-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinferCNV.Rmd
More file actions
executable file
·77 lines (59 loc) · 2.41 KB
/
inferCNV.Rmd
File metadata and controls
executable file
·77 lines (59 loc) · 2.41 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
title: "inferCNV"
author: "liuc"
date: '2022-04-02'
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## inferCNV
运行inferCNV需要根据单细胞数据制备三个input文件,包括
scRNA-seq表达量的count数据;
表型注释文件,记录肿瘤和正常细胞;
基因或染色体位置文件。
CNV的分析一般还是在肿瘤研究中。
```{r}
library(inferCNV)
```
展现下自带数据集的用法
```{r}
##读取示例数据目录
exprMatrix = system.file("extdata", "oligodendroglioma_expression_downsampled.counts.matrix.gz", package="infercnv")
cellAnnota = system.file("extdata", "oligodendroglioma_annotations_downsampled.txt", package="infercnv")
geneLocate = system.file("extdata", "gencode_downsampled.EXAMPLE_ONLY_DONT_REUSE.txt", package="infercnv")
#创建inferCNV对象,直接给相应的文件路径即可
infercnv_obj = CreateInfercnvObject(delim = '\t',
raw_counts_matrix = exprMatrix,
annotations_file = cellAnnota,
gene_order_file = geneLocate,
ref_group_names = c("Microglia/Macrophage","Oligodendrocytes (non-malignant)"))
##分析细胞CNV
#cutoff阈值,Smart-seq2数据选“1”, 10x Genomics数据选“0.1”
infercnv_obj = infercnv::run(infercnv_obj,
cutoff=1,
out_dir='inferCNV/test',
cluster_by_groups=TRUE,
denoise=TRUE,
HMM=TRUE)
```
Read 10X
```{r}
cellAnnota <- subset(scRNAsclc@meta.data, select='celltype')
exprMatrix <- as.matrix(GetAssayData(scRNAsclc, slot='counts'))
#创建inferCNV对象
#all_celltype: B_cell Monocyte Neurons NK_cell T_cells
infercnv_obj = CreateInfercnvObject(delim = '\t',
raw_counts_matrix = 'inferCNV/exprMatrix.txt',
annotations_file = 'inferCNV/cellAnnota.txt',
gene_order_file = 'inferCNV/geneLocate.txt',
ref_group_names = c("B_cell","Monocyte","NK_cell","T_cells"))
dir.create("inferCNV/gse149180")
#10x数据cutoff推荐使用0.1
infercnv_obj = infercnv::run(infercnv_obj,
cutoff=0.1,
out_dir='inferCNV/gse149180/',
cluster_by_groups=TRUE,
denoise=TRUE,
HMM=TRUE)
```