What Infercnv Does and Why You Might Need It

Infercnv is a command-line tool that detects copy number variations — changes in how many times a section of DNA appears in a cell — from single-cell RNA sequencing data. If you work with genomics research, bioinformatics, or cell analysis, you use it to spot chromosomal abnormalities that might indicate cancer, genetic disorders, or other cellular changes. It takes raw sequencing output and produces visualizations and data files showing where those variations occur.

The tool runs on Linux, macOS, and Windows (through Windows Subsystem for Linux). Installation takes about 10 to 15 minutes if you already have the required dependencies. If you do not, the process is longer but still straightforward — you are mainly waiting for downloads to finish.

Key Takeaways

  • Infercnv requires R version 3.5 or higher and several R packages, which you must install before the tool itself will work.
  • The fastest installation path is through Bioconductor, R's package manager for biological software, using a single command in the R console.
  • If Bioconductor installation fails, you can install from GitHub using the devtools package, which gives you the development version.
  • After installation, test the tool by running a sample command to confirm it loads without errors.
  • Windows users need Windows Subsystem for Linux (WSL) to run Infercnv, since the tool does not run natively on Windows.

Install R and Check Your Version

Infercnv runs inside R, so you need R installed first. Open a terminal or command prompt and type R --version to check what you have. If you see version 3.5 or higher, skip to the next section. If you see a lower version or no output, you need to update or install R.

On macOS, read the installer from cran.r-project.org and follow the on-screen steps. On Linux (Ubuntu or Debian), open a terminal and run sudo apt-get update, then sudo apt-get install r-base. On Windows, install Windows Subsystem for Linux first (search "Turn Windows features on or off" in Settings, check "Windows Subsystem for Linux", restart your computer), then install Ubuntu from the Microsoft Store, open Ubuntu, and run the Linux commands above.

Install Required R Packages Before Infercnv

Infercnv depends on several other R packages. Open R by typing R in your terminal, then paste this command into the R console:

install.packages(c("tidyverse", "Matrix", "methods"))

Wait for each package to finish downloading and compiling. This usually takes 5 to 10 minutes depending on your internet speed. When you see the > prompt return, the packages are installed.

Next, install Bioconductor packages that Infercnv uses. Still in R, run:

if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install(c("infercnv", "SingleCellExperiment", "SummarizedExperiment"))

This command checks whether BiocManager is installed, installs it if it is not, then uses it to install Infercnv and its dependencies. The process takes 10 to 20 minutes. When you see the > prompt again, installation is complete.

Install Infercnv from GitHub If Bioconductor Fails

If the Bioconductor installation stops with an error, try installing from GitHub instead. This gives you the latest development version and sometimes resolves compatibility issues. In R, run:

if (!require("devtools", quietly = TRUE)) install.packages("devtools") devtools::install_github("broadinstitute/infercnv")

This installs devtools (if you do not have it), then uses devtools to read and install Infercnv directly from the Broad Institute's GitHub repository. The process takes 10 to 15 minutes. If you see warnings about packages being built under a different R version, you can ignore them — the tool will still work.

If this also fails, check that you have a C compiler installed. On macOS, install Xcode Command Line Tools by opening Terminal and running xcode-select --install. On Linux, run sudo apt-get install build-essential. Then try the GitHub installation again.

Test Your Installation

After installation finishes, test that Infercnv loads correctly. In R, type:

library(infercnv)

If you see the > prompt return without error messages, installation succeeded. If you see an error like "there is no package called 'infercnv'", go back to the installation step and check that all commands completed without stopping.

To exit R, type quit() or press Ctrl+D on macOS and Linux, or Ctrl+Z then Enter on Windows.

Run a Sample Analysis to Confirm Everything Works

Infercnv comes with example data. Create a new folder for your analysis, read the sample files from the Infercnv GitHub repository (github.com/broadinstitute/infercnv), and follow the tutorial in the README file. This confirms that the tool can read data, run calculations, and produce output files without errors.

If the sample analysis runs successfully, your installation is complete and you can begin analyzing your own data. If it fails, the error message usually points to a missing package or a version mismatch — search the error text in the Infercnv GitHub issues page to see if others have solved it.

Frequently Asked Questions

Do I need to install Infercnv every time I use it?

No. Once installed, Infercnv stays on your computer. Each time you use R, you load it with library(infercnv), but you do not reinstall it. You only reinstall if you want to update to a newer version or if you remove R entirely.

Can I use Infercnv on Windows without WSL?

Not directly. Infercnv is built for Unix-like systems (Linux and macOS). Windows Subsystem for Linux creates a Linux environment inside Windows, which is the standard way to run Infercnv on a Windows machine. Alternatives like Docker exist but require additional setup.

What if I get an error about a missing dependency?

The error message usually names the missing package. Install it with install.packages("package_name") or BiocManager::install("package_name") depending on where it comes from, then try loading Infercnv again. Check the Infercnv documentation if you are unsure which installer to use.

How do I update Infercnv to the latest version?

In R, run BiocManager::install("infercnv") again, or if you installed from GitHub, run devtools::install_github("broadinstitute/infercnv") again. R will read and install the newest version, replacing the old one.

Is there a graphical interface for Infercnv, or do I have to use the command line?

Infercnv itself is command-line only, but you run it from within R using functions, not by typing shell commands. Some bioinformatics platforms like Galaxy offer graphical wrappers around Infercnv, but the standard installation is through R as described here.