美文网首页微生物
metaphlan2实战案例

metaphlan2实战案例

作者: 寂静的繁华 | 来源:发表于2018-08-01 19:54 被阅读0次

    #参考博客:http://blog.sciencenet.cn/blog-3334560-1110159.html(存在问题,以英文文档为主)

    #参考英文文档:https://bitbucket.org/biobakery/biobakery/wiki/metaphlan2

    ########################################

    #            第一部分 软件安装        #

    ########################################

    #切换目录:/mnt/raid1/jialonghao/MetaPhlAn2

    wget https://bitbucket.org/biobakery/metaphlan2/get/default.zip

    unzip default.zip

    mv biobakery-metaphlan2-4d4992ccea96 metaphlan2_2018.07

    cd metaphlan2_2018.07/

    export PATH=`pwd`:`pwd`/utils:$PATH

    export mpa_dir=`pwd`

    metaphlan2.py -v

    #MetaPhlAn version 2.7.7 (31 May 2018)

    ########################################

    #            第二部分 使用实例        #

    ########################################

    #step1:定量物种谱

    #如果输入文件是fastq,需要依赖bowtie2安装好

    #下载数据

    curl -O https://bitbucket.org/biobakery/biobakery/raw/tip/demos/biobakery_demos/data/metaphlan2/input/SRS014476-Supragingival_plaque.fasta.gz

    curl -O https://bitbucket.org/biobakery/biobakery/raw/tip/demos/biobakery_demos/data/metaphlan2/input/SRS014494-Posterior_fornix.fasta.gz

    curl -O https://bitbucket.org/biobakery/biobakery/raw/tip/demos/biobakery_demos/data/metaphlan2/input/SRS014459-Stool.fasta.gz

    curl -O https://bitbucket.org/biobakery/biobakery/raw/tip/demos/biobakery_demos/data/metaphlan2/input/SRS014464-Anterior_nares.fasta.gz

    curl -O https://bitbucket.org/biobakery/biobakery/raw/tip/demos/biobakery_demos/data/metaphlan2/input/SRS014470-Tongue_dorsum.fasta.gz

    curl -O https://bitbucket.org/biobakery/biobakery/raw/tip/demos/biobakery_demos/data/metaphlan2/input/SRS014472-Buccal_mucosa.fasta.gz

    #创建metaphlan2_analysis目录,将下载的文件移到该目录下

    mkdir metaphlan2_analysis

    mv SRS*.fasta.gz metaphlan2_analysis/

    cd metaphlan2_analysis

    ls

    ################################################################################

    #6个.fasta.gz文件                                                              #

    #SRS014459-Stool.fasta.gz          SRS014472-Buccal_mucosa.fasta.gz          #

    #SRS014464-Anterior_nares.fasta.gz  SRS014476-Supragingival_plaque.fasta.gz    #

    #SRS014470-Tongue_dorsum.fasta.gz  SRS014494-Posterior_fornix.fasta.gz        #

    ################################################################################

    #Run a single sample

    metaphlan2.py SRS014476-Supragingival_plaque.fasta.gz  --input_type fasta > SRS014476-Supragingival_plaque_profile.txt

    #此命令包括从数据库下载数据,解压,建立Bowtie index等步骤。

    #注意Warning: gzbuffer added in zlib v1.2.3.5. Unable to change buffer size from default of 8192.

    #结果文件为:

    #SRS014476-Supragingival_plaque.fasta.gz.bowtie2out.txt  独特序列marker的中间比对结果

    #SRS014476-Supragingival_plaque_profile.txt              最终完成的有机体丰度

    #含有物种分类次序:

    # Kingdom: k__, Phylum: p__, Class: c__, Order: o__, Family: f__, Genus: g__, Species: s__

    #界 ( Kingdom)、门( Phylum)、纲 (Class)、目 (Order)、科( Family)、属( Genus)、种 (Species)

    #Run on multiple cores

    metaphlan2.py SRS014459-Stool.fasta.gz --input_type fasta --nproc 4 > SRS014459-Stool_profile.txt

    #注意Warning: gzbuffer added in zlib v1.2.3.5. Unable to change buffer size from default of 8192.

    #Run multiple samples

    #每个MetaPhlAn2执行过程只处理一个样本,但是产生的单样本分析可以很容易地组合成一个包含多个样本的丰度表。

    #让我们完成输入文件教程部分的最后四个示例:

    metaphlan2.py SRS014464-Anterior_nares.fasta.gz --input_type fasta --nproc 4 > SRS014464-Anterior_nares_profile.txt

    metaphlan2.py SRS014470-Tongue_dorsum.fasta.gz --input_type fasta --nproc 4 > SRS014470-Tongue_dorsum_profile.txt

    metaphlan2.py SRS014472-Buccal_mucosa.fasta.gz --input_type fasta --nproc 4 > SRS014472-Buccal_mucosa_profile.txt

    metaphlan2.py SRS014494-Posterior_fornix.fasta.gz --input_type fasta --nproc 4 > SRS014494-Posterior_fornix_profile.txt

    #如果你熟悉bash shell也可以写脚本

    for f in SRS*.fasta.gz

    do

        metaphlan2.py $f --input_type fasta --nproc 4 > ${f%.fasta.gz}_profile.txt

    done

    #将上述文件合并为以tab键分隔的表格

    merge_metaphlan_tables.py *_profile.txt > merged_abundance_table.txt

    #step2 结果可视化

    cp merged_abundance_table.txt merged_metaphlan2.txt

    metaphlan_hclust_heatmap.py -c bbcry --top 25 --minv 0.1 -s log --in merged_metaphlan2.txt --out abundance_heatmap.pdf

    metaphlan_hclust_heatmap.py -c bbcry --top 25 --minv 0.1 -s log --in merged_metaphlan2.txt --out abundance_heatmap.png

    相关文章

      网友评论

        本文标题:metaphlan2实战案例

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