Contents

1 Installation

1.1 Required dependencies

inferCNV uses the R packages ape, BiocGenerics, binhf, caTools, coda, coin, dplyr, doparallel, edgeR, fastcluster, fitdistrplus, foreach, futile.logger, future, gplots, ggplot2, HiddenMarkov, leiden, phyclust, RANN, reshape, rjags, RColorBrewer, SingleCellExperiment, SummarizedExperiment, tidyr and imports functions from the archived GMD.

1.2 Installing

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install("infercnv")

1.3 Optional extension

If you want to use the interactive heatmap visualization, please check the add-on packge R inferCNV_NGCHM after installing the packages tibble, tsvio and NGCHMR. To install optional packages, type the following in an R command window:

install.packages("tibble")

install.packages("devtools")
devtools::install_github("bmbroom/tsvio")
devtools::install_github("bmbroom/NGCHMR", ref="stable")
devtools::install_github("broadinstitute/inferCNV_NGCHM")

And download the NGCHM java application by typing the following in a regular shell:

wget http://tcga.ngchm.net/NGCHM/ShaidyMapGen.jar

2 Running InferCNV

2.1 Create the InferCNV Object

Reading in the raw counts matrix and meta data, populating the infercnv object

infercnv_obj = CreateInfercnvObject(
  raw_counts_matrix="../inst/extdata/oligodendroglioma_expression_downsampled.counts.matrix.gz",
  annotations_file="../inst/extdata/oligodendroglioma_annotations_downsampled.txt",
  delim="\t",
  gene_order_file="../inst/extdata/gencode_downsampled.EXAMPLE_ONLY_DONT_REUSE.txt",
  ref_group_names=c("Microglia/Macrophage","Oligodendrocytes (non-malignant)"))
## INFO [2022-04-26 16:45:22] Parsing matrix: ../inst/extdata/oligodendroglioma_expression_downsampled.counts.matrix.gz
## INFO [2022-04-26 16:45:24] Parsing gene order file: ../inst/extdata/gencode_downsampled.EXAMPLE_ONLY_DONT_REUSE.txt
## INFO [2022-04-26 16:45:24] Parsing cell annotations file: ../inst/extdata/oligodendroglioma_annotations_downsampled.txt
## INFO [2022-04-26 16:45:24] ::order_reduce:Start.
## INFO [2022-04-26 16:45:25] .order_reduce(): expr and order match.
## INFO [2022-04-26 16:45:25] ::process_data:order_reduce:Reduction from positional data, new dimensions (r,c) = 10338,184 Total=18322440.6799817 Min=0 Max=34215.
## INFO [2022-04-26 16:45:25] num genes removed taking into account provided gene ordering list: 399 = 3.8595473012188% removed.
## INFO [2022-04-26 16:45:25] -filtering out cells < 100 or > Inf, removing 0 % of cells
## WARN [2022-04-26 16:45:25] Please use "options(scipen = 100)" before running infercnv if you are using the analysis_mode="subclusters" option or you may encounter an error while the hclust is being generated.
## INFO [2022-04-26 16:45:25] validating infercnv_obj

2.2 Running the full default analysis

out_dir = tempfile()
infercnv_obj_default = infercnv::run(
    infercnv_obj,
    cutoff=1, # cutoff=1 works well for Smart-seq2, and cutoff=0.1 works well for 10x Genomics
    out_dir=out_dir,
    cluster_by_groups=TRUE, 
    plot_steps=FALSE,
    denoise=TRUE,
    HMM=FALSE,
    no_prelim_plot=TRUE,
    png_res=60
)

Basic ouput from running inferCNV.

## Warning in knitr::include_graphics(paste(out_dir, "infercnv.png", sep = "/")):
## It is highly recommended to use relative paths for images. You had absolute
## paths: "/tmp/RtmpAd0ez5/file253686760802f0/infercnv.png"

3 Additional Information

3.1 Online Documentation

For additional explanations on files, usage, and a tutorial please visit the wiki.

3.2 TrinityCTAT

This tool is a part of the TrinityCTAT toolkit focused on leveraging the use of RNA-Seq to better understand cancer transcriptomes. To find out more please visit TrinityCTAT

4 Session info

## R version 4.2.0 RC (2022-04-21 r82226)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.4 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.16-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.16-bioc/R/lib/libRlapack.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] infercnv_1.13.0  BiocStyle_2.25.0
## 
## loaded via a namespace (and not attached):
##   [1] TH.data_1.1-1               colorspace_2.0-3           
##   [3] ellipsis_0.3.2              modeltools_0.2-23          
##   [5] futile.logger_1.4.3         XVector_0.37.0             
##   [7] GenomicRanges_1.49.0        leiden_0.3.9               
##   [9] listenv_0.8.0               fansi_1.0.3                
##  [11] mvtnorm_1.1-3               coin_1.4-2                 
##  [13] codetools_0.2-18            splines_4.2.0              
##  [15] doParallel_1.0.17           libcoin_1.0-9              
##  [17] knitr_1.38                  jsonlite_1.8.0             
##  [19] argparse_2.1.5              rjags_4-13                 
##  [21] png_0.1-7                   BiocManager_1.30.17        
##  [23] compiler_4.2.0              assertthat_0.2.1           
##  [25] Matrix_1.4-1                fastmap_1.1.0              
##  [27] limma_3.53.0                cli_3.3.0                  
##  [29] formatR_1.12                htmltools_0.5.2            
##  [31] tools_4.2.0                 igraph_1.3.1               
##  [33] coda_0.19-4                 gtable_0.3.0               
##  [35] glue_1.6.2                  GenomeInfoDbData_1.2.8     
##  [37] RANN_2.6.1                  dplyr_1.0.8                
##  [39] Rcpp_1.0.8.3                Biobase_2.57.0             
##  [41] jquerylib_0.1.4             vctrs_0.4.1                
##  [43] ape_5.6-2                   nlme_3.1-157               
##  [45] iterators_1.0.14            xfun_0.30                  
##  [47] fastcluster_1.2.3           stringr_1.4.0              
##  [49] globals_0.14.0              lifecycle_1.0.1            
##  [51] gtools_3.9.2                future_1.25.0              
##  [53] edgeR_3.39.0                zlibbioc_1.43.0            
##  [55] MASS_7.3-57                 zoo_1.8-10                 
##  [57] scales_1.2.0                MatrixGenerics_1.9.0       
##  [59] parallel_4.2.0              SummarizedExperiment_1.27.0
##  [61] sandwich_3.0-1              lambda.r_1.2.4             
##  [63] RColorBrewer_1.1-3          SingleCellExperiment_1.19.0
##  [65] yaml_2.3.5                  reticulate_1.24            
##  [67] gridExtra_2.3               ggplot2_3.3.5              
##  [69] sass_0.4.1                  reshape_0.8.9              
##  [71] stringi_1.7.6               highr_0.9                  
##  [73] S4Vectors_0.35.0            foreach_1.5.2              
##  [75] caTools_1.18.2              BiocGenerics_0.43.0        
##  [77] GenomeInfoDb_1.33.0         rlang_1.0.2                
##  [79] pkgconfig_2.0.3             matrixStats_0.62.0         
##  [81] bitops_1.0-7                parallelDist_0.2.6         
##  [83] evaluate_0.15               lattice_0.20-45            
##  [85] purrr_0.3.4                 tidyselect_1.1.2           
##  [87] parallelly_1.31.1           plyr_1.8.7                 
##  [89] magrittr_2.0.3              bookdown_0.26              
##  [91] R6_2.5.1                    IRanges_2.31.0             
##  [93] gplots_3.1.3                generics_0.1.2             
##  [95] multcomp_1.4-19             DelayedArray_0.23.0        
##  [97] DBI_1.1.2                   pillar_1.7.0               
##  [99] fitdistrplus_1.1-8          survival_3.3-1             
## [101] RCurl_1.98-1.6              tibble_3.1.6               
## [103] crayon_1.5.1                futile.options_1.0.1       
## [105] phyclust_0.1-30             KernSmooth_2.23-20         
## [107] utf8_1.2.2                  rmarkdown_2.14             
## [109] locfit_1.5-9.5              grid_4.2.0                 
## [111] digest_0.6.29               tidyr_1.2.0                
## [113] RcppParallel_5.1.5          stats4_4.2.0               
## [115] munsell_0.5.0               bslib_0.3.1