This is a straightforward method written in R to calculate copy numbers from 10X RNAseq data using moving averages of gene expression. Genome cordinates are annotated with hg20 and ensembl 93 through BioMart. Top genes that are expressed in 40% of either testing group of control group are selected to smoothing. The sliding windows are 50 genes. This method is designed to separate aneuploid tumor cells from diploid normal cells within tumor tissues. By default it will not help if you meet a diploid tumor.
install {BioMart} using BiocInstaller::biocLite('grimbough/biomaRt')
source("/volumes/lab/users/ruligao/code/update_MVA_function_version.R")
CNA_result <- cal_CNAs(tumor_mat, normal_mat, ROW.name="ENSEMBLE_id", plot=TRUE)
- tumor_mat, is the UMI count matrix from testing sample, genes in the rows and cells in the columns
- normal_mat, is the UMI count matrix from normal control sample, genes in the rows and cells in the columns
- ROW.name, rownames of the input matrix, default "ENSEMBLE_id" or "GENE_SYMBOL"
- plot=TRUE, default, will generate a heatmap of the copy numbers of all cells
- it outputs a list of two matrix objects
- "MVA_results", the MVA results for all cells
- "defined_celltype", defined tumor or normal cells by clustering
- heatmap plot in PDF in working directory. always double check with the plot to make sure tumor cells have CNAs
source("/volumes/lab/users/ruligao/code/update_MVA_function_version.R")
library(cellrangerRkit)
path1 <- "/Volumes/seq/projects/ATC_thyroid/LAI_p259T" ##path that is one layer above outs/ from the 10x output
tumor_obj <- load_cellranger_matrix(path1)
tumor_mat <- exprs(tumor_obj)
path2 <- "/Volumes/seq/projects/ATC_thyroid/LAI_p259N"
normal_obj <- load_cellranger_matrix(path2)
normal_mat <- exprs(normal_obj)
CNA_result <- cal_CNAs(tumor_mat, normal_mat, ROW.name="ENSEMBLE_id", plot=TRUE)
source("/volumes/lab/users/ruligao/code/update_MVA_function_version.R")
tumor_mat <- as.matrix(tumor_obj@raw.data)
normal_mat <- as.matrix(normal_obj@raw.data)
CNA_result <- cal_CNAs(tumor_mat, normal_mat, ROW.name="GENE_SYMBOL", plot=TRUE)
source("/volumes/lab/users/ruligao/code/update_MVA_function_version.R")
CNA_result <- cal_CNAs(tumor_mat, normal_mat, ROW.name="GENE_SYMBOL", plot=TRUE)
####### Updated by Ruli Gao, August 22nd, 2018