-
Notifications
You must be signed in to change notification settings - Fork 0
/
6_inferCNV.R
55 lines (45 loc) · 2.01 KB
/
6_inferCNV.R
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
########### R script for running inferCNV for individual patients. ###########
########### Created by Yue Zhao on 2022-11-10. ###########
########### Last modified by Yue Zhao on 2022-11-10. ###########
# Load packages:
library(Seurat)
library(infercnv)
setwd("/mnt/sdc/singlecell/data/pre_infercnv")
# Load the samplesheet:
samplesheet <- read.delim("infercnv_samplesheet.txt", sep="\t", header=T)
# Initial settings:
data_path <- "/mnt/sdc/singlecell/data/pre_infercnv"
out_path <- "/mnt/sdc/singlecell/inferCNV/individual/"
# Run inverCNV:
geneFile="geneFile2.txt"
for (i in 1:nrow(samplesheet)){
expFile <- paste0(samplesheet[i,2],".txt")
groupFiles <- paste0(samplesheet[i,3],".txt")
infercnv_obj = CreateInfercnvObject(raw_counts_matrix=expFile,
annotations_file=groupFiles,
delim="\t",
gene_order_file= geneFile,
ref_group_names=c("Fib","Endo"))
infercnv_obj = infercnv::run(infercnv_obj,
cutoff=0.1,
out_dir=paste0(out_path,samplesheet[i,1]),
cluster_by_groups=TRUE,
denoise=TRUE,
output_format="pdf",
HMM=TRUE)
}
#expFile="expfile_FD2.txt"
#groupFiles="groupfile_FD2.txt"
#geneFile="geneFile2.txt"
#infercnv_obj = CreateInfercnvObject(raw_counts_matrix=expFile,
# annotations_file=groupFiles,
# delim="\t",
# gene_order_file= geneFile,
# ref_group_names=c("Fib","Endo"))
#infercnv_obj = infercnv::run(infercnv_obj,
# cutoff=0.1,
# out_dir=out_path,
# cluster_by_groups=TRUE,
# denoise=TRUE,
# output_format="pdf",
# HMM=TRUE)