实验记录 | 6/5

今天早上(8:57)过来,发现R已经安装完成了,非常棒。
./Rscript

Usage:
/path/to/Rscript [–options] [-e expr [-e expr2 …] | file] [args]
–options accepted are
–help Print usage and exit
–version Print version and exit
–verbose Print information on progress
–default-packages=list
Where ‘list’ is a comma-separated set
of package names, or ‘NULL’
or options to R, in addition to --slave --no-restore, such as
–save Do save workspace at the end of the session
–no-environ Don’t read the site and user environment files
–no-site-file Don’t read the site-wide Rprofile
–no-init-file Don’t read the user R profile
–restore Do restore previously saved objects at startup
–vanilla Combine --no-save, --no-restore, --no-site-file
–no-init-file and --no-environ

接着要做的事情,就是检查一下新安装到的包会存放在哪里?权限是否有?
在目录下找到了lib64的文件夹(就是不知道这个文件夹是否是存放R包的那个文件夹),修改其权限为可读可写可操作。

来重新看一下,Rscript的路径:

/home/xxzhang/miniconda3/bin/Rscript

现在,在这边的准备工作基本完成。接下来,就是去window那边,修改somatic.pl的文件,然后重新运行代码文件。
修改记录:

178行:$annovar_path="/home/xxzhang/workplace/QBRC/annovar/";
Rscript添加路径
samtools的路径更换为bcftools
495行添加strelka的路径

以上,保存后,重新上传。
接下来,重新运行代码,看是否有报错。
切换至Linux系统。

程序正在运行中。不知道会不会报错。(9:28)
现在就是等待,在等待的过程中,自己可以看一下,cnv.pl的代码,看一下,这个文件的作用是什么?
(9:50)运行结束,大概用了20分钟,新产生的文件比之前产生的文件多了更多的内容。
简直太给我面子了,有那么多的错误,这个程序居然还可以如此坚强的运行下去。前进的每一步都是艰难的,但是前进的每一步都是有意义的。


出错1:
/home/xxzhang/miniconda3/bin/bcftools mpileup -d 7000 -I -f ./geneome/hg19/hg19.fa ./output/tumor/tumor.bam > ./output/tumor/tumor.mpileup

[mpileup] 1 samples in 1 input files
Error: mpileup has failed!

其实,上一步骤就出现了一些问题,产生的index.out几个文件都是0,tumor.bam确实是有内容的。为什么使用gatk做这一步呢?这个过程,对于我们的体系而言是有意义的吗?必须要有结果才“正确”吗?

 # indel realignment
    if ($pdx=~/mouse/) {$known=" -known ".$resource_dbsnp." ";} else {$known=" -known ".$resource_mills." -known ".$resource_1000g." ";}
    system_call("java -Djava.io.tmpdir=".$type_output."/tmp -jar ".$gatk." -T RealignerTargetCreator -R ".$index." --num_threads ".$thread.
      $known." -o ".$type_output."/".$type."_intervals.list -I ".$type_output."/dupmark.bam > ".$type_output."/index.out");

    system_call("java -Djava.io.tmpdir=".$type_output."/tmp -jar ".$gatk." -T IndelRealigner ".
      " --filter_bases_not_stored --disable_auto_index_creation_and_locking_when_reading_rods -R ".$index.$known.
      " -targetIntervals ".$type_output."/".$type."_intervals.list -I ".
      $type_output."/dupmark.bam -o ".$type_output."/realigned.bam >".$type_output."/".$type."_realign.out");

    unlink_file($type_output."/dupmark.bam");
    unlink_file($type_output."/dupmark.bam.bai");

    # base recalibration
    if ($skip_recal==0)
    {
      if ($pdx=~/mouse/) {$known=" ";} else {$known=" -knownSites ".$resource_mills." ";}
      system_call("java -Djava.io.tmpdir=".$type_output."/tmp -jar ".$gatk." -T BaseRecalibrator -R ".$index." ".
        " -knownSites ".$resource_dbsnp.$known." -I ".$type_output."/realigned.bam -o ".$type_output."/".
        $type."_bqsr > ".$type_output."/table.out");
      system_call("java -Djava.io.tmpdir=".$type_output."/tmp -jar ".$gatk." -T PrintReads -rf NotPrimaryAlignment -R ".
        $index." -I ".$type_output."/realigned.bam -BQSR ".$type_output."/".$type."_bqsr -o ".
        $type_output."/".$type.".bam > ".$type_output."/".$type."_recal.out");

      unlink_file($type_output."/realigned.bam");
      unlink_file($type_output."/realigned.bai");
      unlink_file($type_output."/".$type."_bqsr");
      unlink_file($type_output."/".$type."_intervals.list");

这个出错,我其实有些没有办法理解,是因为只有一个文件吗?

这个错误是我最不知道怎么办的了。

继续回到查看运行指令,发现这个流程,光会跑通是远远不够的,我希望自己能够理解他每一步为什么会这样做?
就有点像孔子学琴的故事:

孔子学古琴师襄子,十日不进。师襄子曰:“可以益矣。”孔子曰:“丘已习其曲矣,未得其数也。”有间,曰:“已习其数,可以益矣。”孔子曰:“丘未得其志也。”有间,曰:“已习其志,可以益矣。”孔子曰:“丘未得其为人也。”有间,有所穆然深思焉,有所怡然高望而远志焉。曰:“丘得其为人,黯然而黑,几然而长,眼如望羊,如王四国,非文王其谁能为此也!”师襄子辟席再拜,曰:“师盖云《文王操》也。”

学习,有一个逐渐深化的过程,我现在的理解还远远不够。
看到昨天的使用指南,我想,或许我可以去掉原始文件中的-I指令,因为在源文件中,根本就没有说有这个option。
不对,又确认了一下,是有的。

-I, --skip-indels do not perform indel calling

意思就是说,跳过indel,不进行indel calling
通过解释,这行代码的意思是:
/home/xxzhang/miniconda3/bin/bcftools mpileup -d 7000 -I -f ./geneome/hg19/hg19.fa ./output/tumor/tumor.bam > ./output/tumor/tumor.mpileup

-d的参数是7000,即为了避免对内存的过度使用,规定每一个文件的最大的深度(depth)为7000。对于我们这个没有多大的意义吧。

单独的运行一行代码,查看运行结果是否顺利。
/home/xxzhang/miniconda3/bin/bcftools mpileup -f ./geneome/hg19/hg19.fa /home/xxzhang/workplace/output/dupmark.bam > /home/xxzhang/workplace/output/tumor.mpileup

运行成功,生成了结果文档,那就说明是我们的指令本身出现了问题,所以,程序才运行不起来。我先让他转起来,至于具体的生物学意义,我们再进行调整参数。

另外,加不加-I这个参数,对于结果文件还是有一定的差异的。前后,进行两次的实验操作。生成的结果文件如下所示:

tumor.mpileup 131,804,995
tumor_2.mpileup 131,702,722

所以,还是加上去这个参数更好(起码会有影响)。

最终修改代码为:
/home/xxzhang/miniconda3/bin/bcftools mpileup -I -f ./geneome/hg19/hg19.fa ./output/tumor/tumor.bam > ./output/tumor/tumor.mpileup

出错2:
/home/xxzhang/workplace/software/strelka/bin/configureStrelkaGermlineWorkflow.py --bam /home/xxzhang/workplace/QBRC/output/tumor/tumor.bam --referenceFasta ./geneome/hg19/hg19.fa --runDir ./output/strelka/ --exome

Can’t exec “/home/xxzhang/workplace/software/strelka/bin/configureStrelkaGermlineWorkflow.py”: Permission denied at somatic.pl line 523.

出错原因是:拒绝访问。接下来,就是修改这个文件夹的使用权限。这个并不难。

解决方案:

chmod -R 777 bin/
ll

total 2
drwxrwxrwx. 2 xxzhang Zhu_lab 6 6月 3 12:13 bin
drwxr-xr-x. 3 xxzhang Zhu_lab 1 6月 3 12:13 lib
drwxr-xr-x. 2 xxzhang Zhu_lab 29 6月 3 12:14 libexec
drwxr-xr-x. 5 xxzhang Zhu_lab 6 6月 3 12:14 share

cd bin
ll

total 26
-rwxrwxrwx. 1 xxzhang Zhu_lab 8537 6月 2 21:18 configureStrelkaGermlineWorkflow.py
-rwxrwxrwx. 1 xxzhang Zhu_lab 606 6月 2 21:18 configureStrelkaGermlineWorkflow.py.ini
-rwxrwxrwx. 1 xxzhang Zhu_lab 6085 6月 2 21:18 configureStrelkaSomaticWorkflow.py
-rwxrwxrwx. 1 xxzhang Zhu_lab 2580 6月 2 21:18 configureStrelkaSomaticWorkflow.py.ini
-rwxrwxrwx. 1 xxzhang Zhu_lab 3465 6月 2 21:18 runStrelkaGermlineWorkflowDemo.bash
-rwxrwxrwx. 1 xxzhang Zhu_lab 3384 6月 2 21:18 runStrelkaSomaticWorkflowDemo.bash

修改完成。

出错3:

  • installing source package ‘statmod’ …
    ** package ‘statmod’ successfully unpacked and MD5 sums checked
    ** libs
    x86_64-conda_cos6-linux-gnu-gfortran -fpic -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -I/home/xxzhang/miniconda3/include -fdebug-prefix-map==/usr/local/src/conda/- -fdebug-prefix-map==/usr/local/src/conda-prefix -c gaussq2.f -o gaussq2.o
    make: x86_64-conda_cos6-linux-gnu-gfortran: Command not found
    make: *** [gaussq2.o] Error 127
    ERROR: compilation failed for package ‘statmod’
  • removing ‘/home/xxzhang/miniconda3/lib/R/library/statmod’

安装包出错,主要原因是在运行x86_64-conda_cos6-linux-gnu-gfortran这行指令的过程中,显示没有这个指令,导致这个包的编译过程出了问题。

解决方案:

查了一下,系统中确实有这个指令的存在,但是,链接不到这里,估计并没有存放绝对路径。
whereis x86_64-conda_cos6-linux-gnu-gfortran

x86_64-conda_cos6-linux-gnu-gfortran: /opt/anaconda3/bin/x86_64-conda_cos6-linux-gnu-gfortran /opt/anaconda3/bin/x86_64-conda_cos6-linux-gnu-gfortran.bin

那么,我们只需要按照老办法,将其放在我们原始代码文件中的绝对路径即可(这种方法的平台依赖很大,甚至只适用于我们的系统,但是能用就行,以后能够跑起来的话,就可以尝试扩大它的平台的灵活性)。

/opt/anaconda3/bin/x86_64-conda_cos6-linux-gnu-gfortran

这个好像暂时还不行。
我找不到这个程序运行,调用的是哪里的?系统自身的吗?
明明系统中是有这个插件的,为什么检测不到呢?我们可以先把包安装完成,然后到时候已经存在,是不是就可以不用它自己安装了?

出错4:
/home/xxzhang/workplace/QBRC/annovar/table_annovar.pl ./output/germline_mutations.txt /home/xxzhang/workplace/QBRC/annovar//humandb/ -buildver hg19 -out ./output/germline_mutations -remove -protocol refGene,ljb26_all,cosmic70,esp6500siv2_all,exac03,1000g2015aug_all -operation g,f,f,f,f,f -nastring

NOTICE: the --polish argument is set ON automatically (use --nopolish to change this behavior)
Error: the required database file /home/xxzhang/workplace/QBRC/annovar/humandb/hg19_ljb26_all.txt does not exist.

是什么问题呢?这里,我检查了一下我的数据库,发现就是hg19_ljb26_all.txt这个文件没有下载完全,显示的是filepart,还是我可以重新将其命名为txt.
因为查看实验记录:

(base) zxx@zxx-Lenovo-Yoga710-14ISK:/media/zxx/TOSHIBA/QBRC/annovar$ perl annotate_variation.pl -buildver hg19 -downdb -webfrom annovar ljb26_all humandb/
NOTICE: Web-based checking to see whether ANNOVAR new version is available … Done
NOTICE: Downloading annotation database http://www.openbioinformatics.org/annovar/download/hg19_ljb26_all.txt.gz … OK
NOTICE: Downloading annotation database http://www.openbioinformatics.org/annovar/download/hg19_ljb26_all.txt.idx.gz … OK
NOTICE: Uncompressing downloaded files
NOTICE: Finished downloading annotation files for hg19 build version, with files saved at the ‘humandb’ directory

我明白了,并不是我没有下载完全,是我将我的这个文件,上传到服务器的时候,并没有上传完全。实际上,这个文件有11GB,而我这边只有8GB,我实在是太蠢笨了,计算机要比我严谨,敏锐的多。我知道怎么处理了。

最后,将本次操作运行产生的结果文件,转移到备份文件夹中,好有一个结果的跟踪记录。


转移到window界面下,继续编辑指令,上传缺失的文件。

  • 上传缺失文件。
    上传完成。
  • 修改bcftools指令。
  • 添加指令的位置。
  • 选择手动安装R包。
    install.packages("statmod")

回到Linux平台下。重新运行指令,又是一堆的错误。

/home/xxzhang/workplace/software/strelka/bin/configureStrelkaGermlineWorkflow.py --bam /home/xxzhang/workplace/QBRC/output/tumor/tumor.bam --referenceFasta ./geneome/hg19/hg19.fa --runDir ./output/strelka/ --exome

bin/sh: /home/xxzhang/workplace/software/strelka/libexec/htsfile: Permission denied

修改权限:chmod -R 777 strelka/
权限修改完成。

还有的那个,就是老问题。

x86_64-conda_cos6-linux-gnu-gfortran -fpic -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -I/home/xxzhang/miniconda3/include -fdebug-prefix-map==/usr/local/src/conda/- -fdebug-prefix-map==/usr/local/src/conda-prefix -c gaussq2.f -o gaussq2.o
make: x86_64-conda_cos6-linux-gnu-gfortran: Command not found
make: *** [gaussq2.o] Error 127
ERROR: compilation failed for package ‘statmod’

  • removing ‘/home/xxzhang/miniconda3/lib/R/library/statmod
    The downloaded source packages are in
    ‘/tmp/RtmpQAtxv3/downloaded_packages’
    Updating HTML index of packages in ‘.Library’
    Making ‘packages.html’ … done
    Warning message:
    In install.packages(name_pkg[bool_nopkg]) :
    installation of package ‘statmod’ had non-zero exit status
    Error in FUN(X[[i]], …) : there is no package called ‘statmod’
    Calls: lapply -> FUN
    Execution halted

我来修改指令,重新运行。

遇到了一个问题,挺严重的,一时不知道该如何解决。
我来简单的描述一下这个问题:
(1)安装某个非常重要的R包的时候,显示编译不成功。主要原因是缺少“依赖”——

make: x86_64-conda_cos6-linux-gnu-gfortran: Command not found

在编译的过程中,出现错误。显示缺乏这个指令。我不知道R环境中,R包一般编译的位置是在哪里?我去网上提问:R的编译器放在什么位置?不是自己的电脑实在是太麻烦了。
所以,我选择在外面安装并编译好R包,然后移动到文件夹中,必要的话,可以修改原始代码。
刚开始的时候,选择的是同济的安装镜像,安装不了。很困惑。后来,选择清华的镜像,就安装成功了。
options("repos" = c(CRAN="http://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
install.packages("statmod")

trying URL ‘http://mirrors.tuna.tsinghua.edu.cn/CRAN/src/contrib/statmod_1.4.36.tar.gz’
Content type ‘application/x-gzip’ length 93897 bytes (91 KB)
==================================================
downloaded 91 KB

  • installing source package ‘statmod’ …
    ** package ‘statmod’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    x86_64-conda_cos6-linux-gnu-gfortran -fno-optimize-sibling-calls -fpic -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/zxx/miniconda3/include -fdebug-prefix-map=/tmp/build/80754af9/r-base_1589917437985/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/home/zxx/miniconda3=/usr/local/src/conda-prefix -c gaussq2.f -o gaussq2.o
    x86_64-conda_cos6-linux-gnu-cc -I"/home/zxx/miniconda3/lib/R/include" -DNDEBUG -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/zxx/miniconda3/include -I/home/zxx/miniconda3/include -Wl,-rpath-link,/home/zxx/miniconda3/lib -fpic -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/zxx/miniconda3/include -fdebug-prefix-map=/tmp/build/80754af9/r-base_1589917437985/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/home/zxx/miniconda3=/usr/local/src/conda-prefix -c init.c -o init.o
    x86_64-conda_cos6-linux-gnu-cc -shared -L/home/zxx/miniconda3/lib/R/lib -Wl,-O2 -Wl,–sort-common -Wl,–as-needed -Wl,-z,relro -Wl,-z,now -Wl,–disable-new-dtags -Wl,–gc-sections -Wl,-rpath,/home/zxx/miniconda3/lib -Wl,-rpath-link,/home/zxx/miniconda3/lib -L/home/zxx/miniconda3/lib -L/home/zxx/miniconda3/lib -Wl,-rpath-link,/home/zxx/miniconda3/lib -o statmod.so gaussq2.o init.o -lgfortran -lm -lgomp -lquadmath -lpthread -L/home/zxx/miniconda3/lib/R/lib -lR
    installing to /home/zxx/miniconda3/lib/R/library/00LOCK-statmod/00new/statmod/libs
    ** R
    ** data
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded from temporary location
    ** checking absolute paths in shared objects and dynamic libraries
    ** testing if installed package can be loaded from final location
    ** testing if installed package keeps a record of temporary installation path
  • DONE (statmod)
    The downloaded source packages are in
    ‘/tmp/Rtmp2nx94T/downloaded_packages’
    Updating HTML index of packages in ‘.Library’
    Making ‘packages.html’ … done

安装好了之后,我将其移到服务器中指定的文件夹中。

虽然能够加载,但是出现了新的问题:
library(statmod)

Error: package or namespace load failed for ‘statmod’ in rbind(info, getNamespaceInfo(env, “S3methods”)):
number of columns of matrices must match (see arg 2)
In addition: Warning message:
package ‘statmod’ was built under R version 3.6.1

所以,这件事情,最核心的问题应该是什么?就是筛选的这个指令无法运行对吧?影响大吗?

perl somatic.pl NA NA ./example/example_dataset/sequencing/SRR7246238_1.fastq.gz ./example/example_dataset/sequencing/SRR7246238_2.fastq.gz 32 hg19 ./geneome/hg19/hg19.fa /home/xxzhang/workplace/software/java/jdk1.7.0_80/bin/java ./output human 1 ./disambiguate_pipeline

环境的问题,很难搭建好。


重新运行之后,到strelka这一步都是没有问题的。接下来,就是加载R包的问题。
/home/xxzhang/miniconda3/bin/Rscript /home/xxzhang/workplace/QBRC//somatic_script/filter_vcf.R ./output NA

Error: package or namespace load failed for ‘statmod’ in rbind(info, getNamespaceInfo(env, “S3methods”)):
number of columns of matrices must match (see arg 2)
In addition: Warning message:
package ‘statmod’ was built under R version 3.6.1
Execution halted

下面的报错,都是源于,缺少这一步产生的结果文件。所以,问题的根源还是在于:
(1)如何更新R版本?
(2)错误加载的原因是什么?

参考链接:https://www.it1352.com/1721382.html
出现这个错误,是不是说明,这个包是损坏的?(或者我这样“武力”的移植,本身就是不契合其实际的操作环境的?)
最本质的方法,还是跟R有关。

还是要想办法说,怎样更新我的R版本到(3.6.1),以及怎样解决编译的过程中,依赖库缺失的问题(明明系统上是存在的,但是自动编译的时候,却显示缺失,我一直想不明白,大概是没有把这个放在绝对的根目录中)。

如果,我能够在九点之前解决这个问题,今天就是成功的。
(19:06)


 ./conda create -n R3.6
 ./conda activate R3.6

但是,当我想要更新R环境的时候,系统说这个shell版本太老了。需要更新。

CommandNotFoundError: Your shell has not been properly configured to use ‘conda activate’.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:

  • bash
  • fish
  • tcsh
  • xonsh
  • zsh
  • powershell
    See ‘conda init --help’ for more information and options.
    IMPORTANT: You may need to close and restart your shell after running ‘conda init’.

那我就更新吧。
./conda init bash

-bash-4.2$ ./conda init bash
no change /home/xxzhang/miniconda3/condabin/conda
no change /home/xxzhang/miniconda3/bin/conda
no change /home/xxzhang/miniconda3/bin/conda-env
no change /home/xxzhang/miniconda3/bin/activate
no change /home/xxzhang/miniconda3/bin/deactivate
no change /home/xxzhang/miniconda3/etc/profile.d/conda.sh
no change /home/xxzhang/miniconda3/etc/fish/conf.d/conda.fish
no change /home/xxzhang/miniconda3/shell/condabin/Conda.psm1
no change /home/xxzhang/miniconda3/shell/condabin/conda-hook.ps1
no change /home/xxzhang/miniconda3/lib/python3.6/site-packages/xontrib/conda.xsh
no change /home/xxzhang/miniconda3/etc/profile.d/conda.csh
modified /home/xxzhang/.bashrc
> For changes to take effect, close and re-open your current shell. <

接下来,就是重启shell,但是我不知道如何重启shell。

1 hour later ……
尝试了好多方法都不行。

20:32
决定下载R。重新安装全新的R版本,不用那么麻烦了,要有壮士断腕的决心。
./conda uninstall R
因为之前的那个R版本是3.5,不再适用于我们的这个statmod这个包。

出现了新的问题:

Found conflicts! Looking for incompatible packages.

我好像最近尝试这个那个变得一团糟,难道还有从新的安装conda吗?心累。

20:50

我需要休息了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值