美文网首页分析方法基因组共线性分析学习
利用jcvi绘制点图时遇到latex报错

利用jcvi绘制点图时遇到latex报错

作者: 多啦A梦的时光机_648d | 来源:发表于2019-11-04 19:39 被阅读0次

    1. 安装jcvi

    可以直接conda安装,记得在python2的环境下哦,3会报错。

    conda install -c bioconda -y jcvi
    

    2. 准备文件(CDS,pep,gff3)

    准备文件

    3. 我们分析只需要用到每个基因最长的转录本就行,用jcvi就可以可以做到这件事情,先将gff转成bed格式

    python2 -m jcvi.formats.gff bed --type=mRNA --key=ID A.aquatica.EVM.gff3.gz > aquatica.bed
    python2 -m jcvi.formats.gff bed --type=mRNA --key=ID GCA_002102615.1_NepCla1.0_genomic.gff.gz > Nepcla.bed
    python2 -m jcvi.formats.gff bed --type=mRNA --key=ID GCA_000611955.2_Stegodyphus_mimosarum_v1_genomic.gff.gz > Stemim.bed
    这里的--type=mRNA没错,但是后面的--key你要看自己的gff文件长什么样哦。默认=ID
    
    gff转bed

    然后将bed进行去重复

    python2 -m jcvi.formats.bed uniq aquatica.bed
    python2 -m jcvi.formats.bed uniq Nepcla.bed
    python2 -m jcvi.formats.bed uniq Stemim.bed
    
    uniqbed文件

    最后我们得到了aquatica.uniq.bed和Nepcla.uniq.bed, 根据bed文件第4列就可以用于提取cds序列和蛋白序列。

    seqkit grep -f <(cut -f 4 aquatica.uniq.bed ) A.aquatica.EVM.CDS.fasta.gz | seqkit seq -i > aquatica.cds
    seqkit grep -f <(cut -f 4 Nepcla.uniq.bed ) NepCla.CDS.fasta.gz | seqkit seq -i > Nepcla.cds
    seqkit grep -f <(cut -f 4 Stemim.uniq.bed ) Stegodyphus_mimosarum_cds.fa.gz | seqkit seq -i > Stemim.cds
    
    cds文件

    最后就获得了这些文件


    cds+bed

    4.BLAST比对

    makeblastdb -in Nepcla.cds -out db/Nepcla -dbtype nucl
    blastn -num_threads 20  -query Stemim.cds -db db/Nepcla -outfmt 6 -evalue 1e-5 -num_alignments 5 > Ste_Nep.blast
    

    jcvi.compara.blastfilter对结果进行过滤

    python -m jcvi.compara.blastfilter --no_strip_names Ste_Nep.blast --sbed Nepcla.uniq.bed --qbed Stemim.uniq.bed
    
    过滤结果

    最后输出aly_ath.blast.filtered用于做图

    python -m jcvi.graphics.blastplot Ste_Nep.blast.filtered --sbed Nepcla.uniq.bed --qbed Stemim.uniq.bed
    

    报错1:
    由于服务器里没有这种字体

    /.../software/Python-2.7.8/lib/python2.7/site-packages/matplotlib/font_manager.py:1316: UserWarning: findfont: Font family [u'sans-serif'] not found. Falling back to DejaVu Sans
      (prop.get_family(), self.defaultFamily[fontext]))
    
    1. ~/.cache/matplotlib/fontList.json文件存储了matplotlib运行是会调用的字体信息;出现上述错误说明该文件中必然没有Helvetica相关的信息,或者对应的Helvetica.ttf文件;
    2. 在网上下载一个Helvetica.ttf文件,放在matplotlib的font目录(***/matplotlib/mpl-data/fonts/ttf/)或者系统的font目录下都行(/usr/share/fonts/);
    3. 删除/.cache/matplotlib目录,重新运行你的画图脚本;此时程序会自动在/.cache目录下生成matplotlib目录以及fontList.json文件;
      一般来说到这里就应该成功了。

    报错2:

    OSError: [Errno 2] No such file or directory: 'latex'
    
    latex报错

    这是由于服务器里面没有这个排版的软件

    1. 下载 iso 镜像(有root权限哈)
    wget -c https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/texlive2019.iso
    
    1. 挂载镜像到 /mnt/ 并执行安装命令
    su -
    mount -o loop texlive2019.iso /mnt/ 
    cd /mnt 
    ./install-tl
    

    执行最后一条命令之后会出现下面的选项:
    输入 I 然后回车进行安装


    安装结果
    1. 设置环境变量
    export MANPATH=${MANPATH}:/urs/local/texlive/2019/texmf-dist/doc/man
    export INFOPATH=${INFOPATH}:/usr/local/texlive/2019/texmf-dist/doc/info
    export PATH=${PATH}:/usr/local/texlive/2019/bin/x86_64-linux
    
    1. 设置清华源 更新所有宏包
     [CTAN](https://www.ctan.org/) (The Comprehensive TeX Archive Network) 镜像源可以使用 TeX Live 管理器 tlmgr 更改。
    
    在命令行中执行
    
    tlmgr option repository [https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet](https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet)
    
    即可永久更改镜像源。
    
    如果只需要临时切换,可以用如下命令:
    
    tlmgr update --all --repository [https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet](https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet)
    
    其中的 update --all 指令可根据需要修改。
    
    # 如下载时出现问题请将地址中的 https 改为 http。
    
    1. 卸载镜像
    sudo umount /mnt
    

    参考:

    https://www.jianshu.com/p/17aaeaae1ca3
    [https://blog.csdn.net/m0_37952030/article/details/90646388]
    [https://www.cnblogs.com/zhaofeng-shu33/p/texlive_installation.html]
    [https://mirrors.tuna.tsinghua.edu.cn/help/CTAN/](https://mirrors.tuna.tsinghua.edu.cn/help/CTAN/)
    

    相关文章

      网友评论

        本文标题:利用jcvi绘制点图时遇到latex报错

        本文链接:https://www.haomeiwen.com/subject/dwzdbctx.html