注明:我怕我忘了。下次在运行我们的数据的时候,记得要认真核实一下我们的somatic.pl这个文件。我记得上次,我为了测试出和作者一模一样的结果,对参数改了很多次。所以,真正的运行我们的数据的时候,一定要记得认真核实。
现在开始安装sclineager包。上次我在我的PC的R环境中,有安装sclineager,但是我的电脑的内存太小了。有一天,一定会遇到很多的数据的。所以,这个时候,我们要在这个电脑上运行这个数据。而且,我也比较喜欢这个电脑的宽屏和存储空间,我的电脑的存储空间几乎告罄。
好,废话少说,现在开始。
1。安装sclineager包。
setwd("F://Rworkplace//sclineager")
install.packages("devtools")
devtools::install_github("inmybrain/SClineager",subdir = "SClineager")
Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
Error: Failed to install ‘SClineager’ from GitHub:
Could not find tools necessary to compile a package
Callpkgbuild::check_build_tools(debug = TRUE)to diagnose the problem.
显示的是缺少一些工具,来编译这个包。
我们看一下,之前我们的安装记录。
安装了Rtools之后,虽然运行了一阵儿,但是随后又报了错。
*** arch - i386
"c:/rtools40/mingw32/bin/“g++ -std=gnu++11 -I"D:/R/R-4.0.5/include” -DNDEBUG -I’D:/R/R-4.0.5/library/Rcpp/include’ -I’D:/R/R-4.0.5/library/RcppArmadillo/include’ -fopenmp -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c Gibbs.cpp -o Gibbs.o
sh: c:/rtools40/mingw32/bin/g++: No such file or directory
make: *** [D:/R/R-4.0.5/etc/i386/Makeconf:229: Gibbs.o] Error 127
ERROR: compilation failed for package ‘SClineager’
removing ‘D:/R/R-4.0.5/library/SClineager’
重启Rstudio(之前通过快捷键重启好像没啥用)
最终标识我们的Rtools安装成功的是在命令行上敲入:
Sys.which(“make”)
会显示我们安装好的Rtools的路径。而不是,空。
如果安装好Rtools之后,那么sclineager就能够比较顺利的安装下来了(当然,对于两个月前的我而言,这是完全陌生的)又再一次提醒我,经验复盘的重要性。
到这里,R包安装完成。
setwd("F://Rworkplace//sclineager")
install.packages("devtools")
devtools::install_github("inmybrain/SClineager",subdir = "SClineager")
#需要安装Rtools
#writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")
#Sys.which("make")
library(SClineager)
接下来,就是如何使用这个R包的问题。这是上次推进的过程中,遇到巨大问题的。所以,戒骄戒躁,冷静面对。
2。读入数据。
#准备目录
folder<-"cell"
runinfo <- data.frame(
Cell = list.files(paste("./mutations/", folder, sep = "")),
Path = list.files(paste("./mutations/", folder, sep = ""), full = T),
stringsAsFactors = F
)
#runinfo是一个存放数据位置的data.frame
out_folder <- paste("./processed/", folder, sep = "")
#读取数据
coverage_cutoff <- 3 #至于这个阈值的选择应该如何考虑呢?
coverage_percentage <- 0.2
cell_percentage <- 0.2
artefact_percentage <- 0.03
preprocess_genetics <- read_sclineager(runinfo,
coverage_cutoff,
coverage_percentage,
cell_percentage,
out_folder,
artefact_percentage)
#到这一步好像就把数据弄完了
#比我想象的要顺利太多,我前面的脑子是怎么了嘛,为什么会出现蛮多错误的?
#可见还是要一步一步走
[1] “./mutations/cell/1”
[1] “./mutations/cell/10”
[1] “./mutations/cell/11”
[1] “./mutations/cell/12”
[1] “./mutations/cell/13”
[1] “./mutations/cell/14”
[1] “./mutations/cell/15”
[1] “./mutations/cell/16”
[1] “./mutations/cell/17”
[1] “./mutations/cell/18”
[1] “./mutations/cell/19”
[1] “./mutations/cell/2”
[1] “./mutations/cell/20”
[1] “./mutations/cell/3”
[1] “./mutations/cell/4”
[1] “./mutations/cell/5”
[1] “./mutations/cell/6”
[1] “./mutations/cell/7”
[1] “./mutations/cell/8”
[1] “./mutations/cell/9”
[1] 18702 20
Processing coverage data for 1 th cell
Processing coverage data for 2 th cell
Processing coverage data for 3 th cell
Processing coverage data for 4 th cell
Processing coverage data for 5 th cell
Processing coverage data for 6 th cell
Processing coverage data for 7 th cell
Processing coverage data for 8 th cell
Processing coverage data for 9 th cell
Processing coverage data for 10 th cell
Processing coverage data for 11 th cell
Processing coverage data for 12 th cell
Processing coverage data for 13 th cell
Processing coverage data for 14 th cell
Processing coverage data for 15 th cell
Processing coverage data for 16 th cell
Processing coverage data for 17 th cell
Processing coverage data for 18 th cell
Processing coverage data for 19 th cell
Processing coverage data for 20 th cell
[1] 15864 20
keep
FALSE TRUE
14555 1309
keep
FALSE TRUE
1 19
得到了我非常意外的结果,我以为会向上次一样出现挺多的错误。还想去作者的源文档里查查有没有出错,可见上次的主要原因是,我们用的数据太少了。
我用的是前20个数据进行的测试,后来在结果文档中,出现的图挺让我惊喜的(非常的激动,我自己都没有想到会这样的顺利),那我上次尝试着自己画,自己将这些数据整合在一起,实在是太笨拙了。

现在,想要将65号数据重新跑起来,最后将这91个样本一起来分析,看看会不会画出和作者文献中相似的图,想到这一点我就非常的激动,甚至VAF值都不需要我们自己来计算。
现在,需要解决的问题,就是解决perl环境,使之运转稳定。
Can't locate local/lib.pm in @INC (you may need to install the local::lib module ) (@INC contains: //opt/ActivePerl-5.26/lib/perl5/lib/perl5 /opt/ActivePerl-5.26 /lib/perl5/site_perl/5.26.3/x86_64-linux-thread-multi /opt/ActivePerl-5.26/lib/p erl5/site_perl/5.26.3 /opt/ActivePerl-5.26/lib/perl5/5.26.3/x86_64-linux-thread- multi /opt/ActivePerl-5.26/lib/perl5/5.26.3 /opt/ActivePerl-5.26/lib/perl5/site_ perl).
也就是说在perl环境中找不到模块local::lib,这个其实不是一个大问题。因为可能我们程序(somatic.pl)的运行本身并不需要这个文件。另一方面,我现在最需要解决的问题是,somatic.pl之前有修改,现在要重新调整过来。
我好像还调整了不止一个文件,我一点点的来看看。
Can’t locate Parallel/ForkManager.pm in @INC (you may need to install the Parallel::ForkManager module) (@INC contains: /home/xxzhang/miniconda3/lib/site_perl/5.26.2/x86_64-linux-thread-multi /home/xxzhang/miniconda3/lib/site_perl/5.26.2 /home/xxzhang/miniconda3/lib/5.26.2/x86_64-linux-thread-multi /home/xxzhang/miniconda3/lib/5.26.2 .) at /home/xxzhang/workplace/QBRC//somatic.pl line 42.
BEGIN failed–compilation aborted at /home/xxzhang/workplace/QBRC//somatic.pl line 42.
按照上次的方法暂时性的解决了这个问题,明天要彻底的解决这个问题(真的是太烦人了!),最讨厌配置perl环境。明天,要彻底的解决这个问题。
第65个细胞的数据也跑完了。
(12:55)现在考虑,用91个细胞来跑这个流程。
现在遇到的一个问题就是:
Error: cannot allocate vector of size 109.7 Mb
解决方法的链接:https://www.programmingr.com/r-error-messages/cannot-allocate-vector-of-size/
我现在决定重新打开Rstudio。
我一点点尝试,这个另外开一篇博客吧。我觉得这个问题还是挺重要的。
[1] “./mutations/cell/1”
[1] “./mutations/cell/2”
[1] “./mutations/cell/3”
[1] “./mutations/cell/4”
[1] “./mutations/cell/5”
[1] “./mutations/cell/6”
[1] “./mutations/cell/7”
[1] “./mutations/cell/8”
[1] “./mutations/cell/9”
[1] “./mutations/cell/10”
[1] “./mutations/cell/11”
[1] “./mutations/cell/12”
[1] “./mutations/cell/13”
[1] “./mutations/cell/14”
[1] “./mutations/cell/15”
[1] “./mutations/cell/16”
[1] “./mutations/cell/17”
[1] “./mutations/cell/18”
[1] “./mutations/cell/19”
[1] “./mutations/cell/20”
[1] “./mutations/cell/21”
[1] “./mutations/cell/22”
[1] “./mutations/cell/23”
[1] “./mutations/cell/24”
[1] “./mutations/cell/25”
[1] “./mutations/cell/26”
[1] “./mutations/cell/27”
[1] “./mutations/cell/28”
[1] “./mutations/cell/29”
[1] “./mutations/cell/30”
[1] “./mutations/cell/31”
[1] “./mutations/cell/32”
[1] “./mutations/cell/33”
[1] “./mutations/cell/34”
[1] “./mutations/cell/35”
[1] “./mutations/cell/36”
[1] “./mutations/cell/37”
[1] “./mutations/cell/38”
[1] “./mutations/cell/39”
[1] “./mutations/cell/40”
[1] “./mutations/cell/41”
[1] “./mutations/cell/42”
[1] “./mutations/cell/43”
[1] “./mutations/cell/44”
[1] “./mutations/cell/45”
[1] “./mutations/cell/46”
[1] “./mutations/cell/47”
[1] “./mutations/cell/48”
[1] “./mutations/cell/49”
[1] “./mutations/cell/50”
[1] “./mutations/cell/51”
[1] “./mutations/cell/52”
[1] “./mutations/cell/53”
[1] “./mutations/cell/54”
[1] “./mutations/cell/55”
[1] “./mutations/cell/56”
[1] “./mutations/cell/57”
[1] “./mutations/cell/58”
[1] “./mutations/cell/59”
[1] “./mutations/cell/60”
[1] “./mutations/cell/61”
[1] “./mutations/cell/62”
[1] “./mutations/cell/63”
[1] “./mutations/cell/64”
[1] “./mutations/cell/65”
[1] “./mutations/cell/66”
[1] “./mutations/cell/67”
[1] “./mutations/cell/68”
[1] “./mutations/cell/69”
[1] “./mutations/cell/70”
[1] “./mutations/cell/71”
[1] “./mutations/cell/72”
[1] “./mutations/cell/73”
[1] “./mutations/cell/74”
[1] “./mutations/cell/75”
[1] “./mutations/cell/76”
[1] “./mutations/cell/77”
[1] “./mutations/cell/78”
[1] “./mutations/cell/79”
[1] “./mutations/cell/80”
[1] “./mutations/cell/81”
[1] “./mutations/cell/82”
[1] “./mutations/cell/83”
[1] “./mutations/cell/84”
[1] “./mutations/cell/85”
[1] “./mutations/cell/86”
[1] “./mutations/cell/87”
[1] “./mutations/cell/88”
[1] “./mutations/cell/89”
[1] “./mutations/cell/90”
[1] “./mutations/cell/91”
[1] 87581 86
Processing coverage data for 1 th cell
Processing coverage data for 2 th cell
Processing coverage data for 3 th cell
Processing coverage data for 4 th cell
Processing coverage data for 5 th cell
Processing coverage data for 6 th cell
Processing coverage data for 7 th cell
Processing coverage data for 8 th cell
Processing coverage data for 9 th cell
Processing coverage data for 10 th cell
Processing coverage data for 11 th cell
Processing coverage data for 12 th cell
Processing coverage data for 13 th cell
Processing coverage data for 14 th cell
Processing coverage data for 15 th cell
Processing coverage data for 16 th cell
Processing coverage data for 17 th cell
Processing coverage data for 18 th cell
Processing coverage data for 19 th cell
Processing coverage data for 20 th cell
Processing coverage data for 21 th cell
Processing coverage data for 22 th cell
Processing coverage data for 23 th cell
Processing coverage data for 24 th cell
Processing coverage data for 25 th cell
Processing coverage data for 26 th cell
Processing coverage data for 27 th cell
Processing coverage data for 28 th cell
Processing coverage data for 29 th cell
Processing coverage data for 30 th cell
Processing coverage data for 31 th cell
Processing coverage data for 32 th cell
Processing coverage data for 33 th cell
Processing coverage data for 34 th cell
Processing coverage data for 35 th cell
Processing coverage data for 36 th cell
Processing coverage data for 37 th cell
Processing coverage data for 38 th cell
Processing coverage data for 39 th cell
Processing coverage data for 40 th cell
Processing coverage data for 41 th cell
Processing coverage data for 42 th cell
Processing coverage data for 43 th cell
Processing coverage data for 44 th cell
Processing coverage data for 45 th cell
Processing coverage data for 46 th cell
Processing coverage data for 47 th cell
Processing coverage data for 48 th cell
Processing coverage data for 49 th cell
Processing coverage data for 50 th cell
Processing coverage data for 51 th cell
Processing coverage data for 52 th cell
Processing coverage data for 53 th cell
Processing coverage data for 54 th cell
Processing coverage data for 55 th cell
Processing coverage data for 56 th cell
Processing coverage data for 57 th cell
Processing coverage data for 58 th cell
Processing coverage data for 59 th cell
Processing coverage data for 60 th cell
Processing coverage data for 61 th cell
Processing coverage data for 62 th cell
Processing coverage data for 63 th cell
Processing coverage data for 64 th cell
Processing coverage data for 65 th cell
Processing coverage data for 66 th cell
Processing coverage data for 67 th cell
Processing coverage data for 68 th cell
Processing coverage data for 69 th cell
Processing coverage data for 70 th cell
Processing coverage data for 71 th cell
Processing coverage data for 72 th cell
Processing coverage data for 73 th cell
Processing coverage data for 74 th cell
Processing coverage data for 75 th cell
Processing coverage data for 76 th cell
Processing coverage data for 77 th cell
Processing coverage data for 78 th cell
Processing coverage data for 79 th cell
Processing coverage data for 80 th cell
Processing coverage data for 81 th cell
Processing coverage data for 82 th cell
Processing coverage data for 83 th cell
Processing coverage data for 84 th cell
Processing coverage data for 85 th cell
Processing coverage data for 86 th cell
[1] 50880 86
keep
FALSE TRUE
50351 529
keep
FALSE TRUE
9 77
3。进一步画图。
4。使用sclineager模型进行预测。
file_out <- paste("./processed/", folder, sep = "") # a folder to hold temporary results
categories <- c("chrM",
"synonymous SNV",
"nonsynonymous SNV",
"UTR5",
"UTR3",
"nonframeshift substitution",
"frameshift substitution")
max_iter <- 100
file_in0 <- paste("./processed/", folder, "/cleaned.RData", sep = "")
mask_genes <- c("HLA-A", "HLA-B", "HLA-C") #这个mask_genes参数是什么鬼?
vaf_offset <- 0.01
dfreedom <- 100
skip_common <- T
control <- list(a = 0.5,
b = 0.5,
c = 1,
d = 20,
e = 0.4)
sclineager_results <- run_sclineager(
file_in = file_in0,
folder = file_out,
categories = categories,
max_iter = max_iter,
keep_genes = "all",
mask_genes = mask_genes,
vaf_offset = vaf_offset,
dfreedom = dfreedom,
skip_common = skip_common,
psi = NULL,
control = control,
save = FALSE
)
得到的是一个矫正后的矩阵。
这个程序到这里,就能够比较顺利的运行了。
over!
3285



被折叠的 条评论
为什么被折叠?



