#參考博客: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安裝好
#下載數(shù)據(jù)
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
#創(chuàng)建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
#此命令包括從數(shù)據(jù)庫下載數(shù)據(jù),解壓,建立Bowtie index等步驟。
#注意Warning: gzbuffer added in zlib v1.2.3.5. Unable to change buffer size from default of 8192.
#結(jié)果文件為:
#SRS014476-Supragingival_plaque.fasta.gz.bowtie2out.txt? 獨特序列marker的中間比對結(jié)果
#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執(zhí)行過程只處理一個樣本,但是產(chǎn)生的單樣本分析可以很容易地組合成一個包含多個樣本的豐度表。
#讓我們完成輸入文件教程部分的最后四個示例:
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 結(jié)果可視化
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