Single cell CNVs analysis

infercnv

Installation

BiocManager::install("infercnv")

Usage

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
library(infercnv)

# Count matrix
countsMatrix <- GetAssayData(sobj, assay = "RNA", slot = 'counts')
# Cell annotation
cellAnno <- data.frame(Idents(sobj))
# Gene position file
genePos <- "gene_position.txt"

# Create infercnv object
infercnv_obj = CreateInfercnvObject(raw_counts_matrix = countsMatrix,
annotations_file = cellAnno,
gene_order_file = genePos,
delim = "\t",
chr_exclude = c("chrX", "chrY", "chrM"),
ref_group_names = NULL)
# If there are normal cells: ref_group_names = c("T cell")

# Infer CNVs
infercnv_obj = infercnv::run(infercnv_obj,
cutoff = 0.1,
cluster_by_groups = TRUE,
denoise=TRUE,
HMM=TRUE,
out_dir = "cnv",
output_format = "png",
num_threads = 30)
  1. How to get gene position file?

Reference: https://github.com/broadinstitute/infercnv

CONICSmat

Installation

1
2
3
4
5
6
7
8
9
install.packages("beanplot")
install.packages("mixtools")
install.packages("pheatmap")
install.packages("zoo")
install.packages("squash")
install.packages("Rtsne")
BiocManager::install("scran")
BiocManager::install("biomaRt")
devtools::install_github("diazlab/CONICS/CONICSmat", dep = FALSE)

Usage

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
library(CONICSmat)

# expr: A genes X cells matrix of log2(CPM/10+1) normalized expression counts
gene_pos <- getGenePositions(rownames(expr))
expr <- filterMatrix(expr,gene_pos[,"hgnc_symbol"],minCells=5)
normFactor <- calcNormFactors(expr)
regions <- read.table("chromosome_arm_positions_grch38.txt", sep = "\t", row.names = 1, header = T)
l <- plotAll(expr,normFactor,regions,gene_pos,"sample")
hi <- plotHistogram(l,expr,clusters=2,zscoreThreshold=4)
lrbic <- read.table("sample_BIC_LR.txt",sep="\t",header=T,row.names=1,check.names=F)
colnames(lrbic)
candRegions <- rownames(lrbic)[which(lrbic[,"BIC difference"]>200 & lrbic[,"LRT adj. p-val"]<0.01)]
hi <- plotHistogram(l[,candRegions],expr,clusters=4,zscoreThreshold=4)

normal <- which(hi==1)
tumor <- which(hi!=1)
plotChromosomeHeatmap(expr, normal = normal, plotcells = tumor, gene_pos = gene_pos, chr = T, windowsize = 121, expThresh = 0.2, thresh = 1)

Reference: https://github.com/diazlab/CONICS

CaSpER

Reference: https://github.com/akdess/CaSpER

sciCNV

Reference: https://github.com/TiedemannLab/sciCNV

HoneyBADGER

Reference: https://github.com/JEFworks-Lab/HoneyBADGER

RNAseqCNV

Reference: https://github.com/honzee/RNAseqCNV

Author: Giftbear
Link: https://giftbear.github.io/2023/11/29/Single_cell_CNVs_analysis/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.