进行16S分析时,对样品按照分组进行分类汇总出现问题。


###我想对样品按照分组进行分类汇总,现在使用命令collapse_samples.py,对样本进行组间差异比较,具体的组别为group和type,现在出现的问题是代码无法读取我的 metadata的head line,试过很多方法无法解决。

###代码如下:
mkdir taxa_summary_group

for i in  type group;do   #这里的type group  来自metadata文件
    collapse_samples.py -b feature_table_tax.biom -m $metadata \
        --collapse_fields $i --output_mapping_fp taxa_summary_group/group.$i.txt \
        --output_biom_fp taxa_summary_group/feature_table_$i.biom
    #biom文件转换成表格
    biom convert -i taxa_summary_group/feature_table_$i.biom \
        -o taxa_summary_group/feature_table_$i.txt  --to-tsv --header-key taxonomy
    #分类汇总,相对丰度与绝对丰度
    summarize_taxa.py -i taxa_summary_group/feature_table_$i.biom \
        -o taxa_summary_group/taxa_summary_relative.$i -L 2,3,4,5,6,7
    summarize_taxa.py -i taxa_summary_group/feature_table_$i.biom \
        -o taxa_summary_group/taxa_summary_absolute.$i -a -L 2,3,4,5,6,7
done



##附我的metadata文件
##metadata文件使用谷歌插件keeemei检测过符合qiime2分析要求,文件格式为 .csv ,编码格式为UTF-8。


#SampleID,Group,type,Primer,Age,PH,FlySpecies,data,Des
AWGB16SAA21341083628R,MCon,MCon_1,F36/R28,NA,NA,House fly,2021/10/1,16s
AWGB16SAA21341203728R,MCon,MCon_2,F37/R28,NA,NA,House fly,2021/10/1,16s
AWGB16SAA21341323828R,MCon,MCon_3,F38/R28,NA,NA,House fly,2021/10/1,16s
AWGB16SAA21341453929R,MCon,MCon_4,F39/R29,NA,NA,House fly,2021/10/1,16s
AWGB16SAA21341572829R,MCon,MCon_5,F28/R29,NA,NA,House fly,2021/10/1,16s
AWGB16SAA21341093629R,MP,MP_1,F36/R29,NA,NA,House fly,2021/10/1,16s
AWGB16SAA21341213729R,MP,MP_2,F37/R29,NA,NA,House fly,2021/10/1,16s
AWGB16SAA21341333829R,MP,MP_3,F38/R29,NA,NA,House fly,2021/10/1,16s
AWGB16SAA21341463930R,MP,MP_4,F39/R30,NA,NA,House fly,2021/10/1,16s
AWGB16SAA21341582830R,MP,MP_5,F28/R30,NA,NA,House fly,2021/10/1,16s
AWGB16SAA21341103630R,FP,FP_1,F36/R30,60,NA,NA,2021/10/1,16s
AWGB16SAA21341223730R,FP,FP_2,F37/R30,60,NA,NA,2021/10/1,16s
AWGB16SAA21341343830R,FP,FP_3,F38/R30,60,NA,NA,2021/10/1,16s
AWGB16SAA21341473931R,FP,FP_4,F39/R31,60,NA,NA,2021/10/1,16s
AWGB16SAA21341592831R,FP,FP_5,F28/R31,60,NA,NA,2021/10/1,16s
AWGB16SAA21341113631R,EP,EP_1,F36/R31,NA,NA,NA,2021/10/1,16s
AWGB16SAA21341233731R,EP,EP_2,F37/R31,NA,NA,NA,2021/10/1,16s
AWGB16SAA21341353831R,EP,EP_3,F38/R31,NA,NA,NA,2021/10/1,16s
AWGB16SAA21341483932R,EP,EP_4,F39/R32,NA,NA,NA,2021/10/1,16s
AWGB16SAA21341602832R,EP,EP_5,F28/R32,NA,NA,NA,2021/10/1,16s
AWGB16SAA21341123632R,FWP,FWP_1,F36/R32,NA,7,NA,2021/10/1,16s
AWGB16SAA21341243732R,FWP,FWP_2,F37/R32,NA,7,NA,2021/10/1,16s
AWGB16SAA21341363832R,FWP,FWP_3,F38/R32,NA,7,NA,2021/10/1,16s
AWGB16SAA21341493933R,FWP,FWP_4,F39/R33,NA,7,NA,2021/10/1,16s
AWGB16SAA21341612833R,FWP,FWP_5,F28/R33,NA,7,NA,2021/10/1,16s

##以下是报错信息:

 for i in  type group;do   #这里的type group  来自metadata文件
>     collapse_samples.py -b feature_table_tax.biom -m /work/data/metadata.csv \
>         --collapse_fields $i --output_mapping_fp taxa_summary_group/group.$i.txt\                                                                                                                                                         
>         --output_biom_fp taxa_summary_group/feature_table_$i.biom
>     #biom文件转换成表格
>     biom convert -i taxa_summary_group/feature_table_$i.biom \
>         -o taxa_summary_group/feature_table_$i.txt  --to-tsv --header-key taxonomy                                                                                                                                                            
>     #分类汇总,相对丰度与绝对丰度
>     summarize_taxa.py -i taxa_summary_group/feature_table_$i.biom \
>         -o taxa_summary_group/taxa_summary_relative.$i -L 2,3,4,5,6,7
>     summarize_taxa.py -i taxa_summary_group/feature_table_$i.biom \
>         -o taxa_summary_group/taxa_summary_absolute.$i -a -L 2,3,4,5,6,7
> done
Traceback (most recent call last):
  File "/share/work/biosoft/python/Python2/bin/collapse_samples.py", line 93, in                                                                                                                                                              <module>
    main()
  File "/share/work/biosoft/python/Python2/bin/collapse_samples.py", line 82, in                                                                                                                                                              main
    collapse_mode)
  File "/share/work/biosoft/python/Python-v2.7.18/lib/python2.7/site-packages/qi                                                                                                                                                             ime/group.py", line 380, in collapse_samples
    collapse_fields)
  File "/share/work/biosoft/python/Python-v2.7.18/lib/python2.7/site-packages/qi                                                                                                                                                             ime/group.py", line 462, in _collapse_metadata
    mapping_data, header, _ = parse_mapping_file(mapping_f)
  File "/share/work/biosoft/python/Python-v2.7.18/lib/python2.7/site-packages/qi                                                                                                                                                             ime/parse.py", line 135, in parse_mapping_file
    raise QiimeParseError("No header line was found in mapping file.")
qiime.parse.QiimeParseError: No header line was found in mapping file.
Usage: biom convert [OPTIONS]
Try 'biom convert -h' for help.

Error: Invalid value for '-i' / '--input-fp': File 'taxa_summary_group/feature_t                                                                                                                                                             able_type.biom' does not exist.
Error in summarize_taxa.py: option -i: file does not exist: 'taxa_summary_group/feature_table_type.biom'

If you need help with QIIME, see:
http://help.qiime.org
Error in summarize_taxa.py: option -i: file does not exist: 'taxa_summary_group/feature_table_type.biom'

If you need help with QIIME, see:
http://help.qiime.org
Traceback (most recent call last):
  File "/share/work/biosoft/python/Python2/bin/collapse_samples.py", line 93, in <module>
    main()
  File "/share/work/biosoft/python/Python2/bin/collapse_samples.py", line 82, in main
    collapse_mode)
  File "/share/work/biosoft/python/Python-v2.7.18/lib/python2.7/site-packages/qiime/group.py", line 380, in collapse_samples
    collapse_fields)
  File "/share/work/biosoft/python/Python-v2.7.18/lib/python2.7/site-packages/qiime/group.py", line 462, in _collapse_metadata
    mapping_data, header, _ = parse_mapping_file(mapping_f)
  File "/share/work/biosoft/python/Python-v2.7.18/lib/python2.7/site-packages/qiime/parse.py", line 135, in parse_mapping_file
    raise QiimeParseError("No header line was found in mapping file.")
qiime.parse.QiimeParseError: No header line was found in mapping file.
Usage: biom convert [OPTIONS]
Try 'biom convert -h' for help.

Error: Invalid value for '-i' / '--input-fp': File 'taxa_summary_group/feature_table_group.biom' does not exist.
Error in summarize_taxa.py: option -i: file does not exist: 'taxa_summary_group/feature_table_group.biom'

If you need help with QIIME, see:
http://help.qiime.org
Error in summarize_taxa.py: option -i: file does not exist: 'taxa_summary_group/feature_table_group.biom'

If you need help with QIIME, see:
http://help.qiime.org
请先 登录 后评论

1 个回答

omicsgene - 生物信息
擅长:重测序,遗传进化,转录组,GWAS

请按照课程里面的方法准备metadata文件,qiime1和qiime2 都兼容的格式,视频课程里面有讲解的:https://bdtcd.xetslk.com/s/qZRiF


还有课程里面分组名字是group和type,你的分组名字需要相应更改才行。

请先 登录 后评论