wwood / singlem

Novelty-inclusive microbial community profiling of shotgun metagenomes
http://wwood.github.io/singlem/
GNU General Public License v3.0
133 stars 16 forks source link

problems combining otu tables to one #190

Open camillaln opened 3 months ago

camillaln commented 3 months ago

Hi,

I get an error when trying to combine several OTU tables to one. This command ran successfully: for i in *.profile.tsv do name=$(basename $i profile.tsv) singlem summarise --input-taxonomic-profile $i --output-species-by-site-relative-abundance $name.genus_by_site.csv --output-species-by-site-level genus done

But when I do

singlem summarise --input-otu-tables *.genus_by_site.csv --output-otu-table combined.otu_table.csv I get an error.

(singlem) can002@inter-c-aafc-ubuntu2004:/gpfs/fs3c/aafc/aafc_shp/can0002/deep-metagenomes/SingleM$ singlem summarise --input-otu-tables *.genus_by_site.csv --output-otu-table combined.otu_table.csv 07/17/2024 03:17:12 AM INFO: SingleM v0.18.1 Traceback (most recent call last): File "/gpfs/fs3c/aafc/aafc_shp/can0002/miniconda3/envs/singlem/bin/singlem", line 858, in otus.add_otu_table(open(o)) File "/gpfs/fs3c/aafc/aafc_shp/can0002/miniconda3/envs/singlem/lib/python3.12/site-packages/singlem/otu_table_collection.py", line 32, in add_otu_table self.otu_table_objects.append(OtuTable.read(input_otu_table_io)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/gpfs/fs3c/aafc/aafc_shp/can0002/miniconda3/envs/singlem/lib/python3.12/site-packages/singlem/otu_table.py", line 113, in read for otu in OtuTable.each(input_otu_table_io): File "/gpfs/fs3c/aafc/aafc_shp/can0002/miniconda3/envs/singlem/lib/python3.12/site-packages/singlem/otu_table.py", line 26, in each raise Exception("Parse issue parsing line of OTU table: '%s'" % d) Exception: Parse issue parsing line of OTU table: '['taxonomy', 'S00JY-0887_S190_L001_R1_001']'

Do you have any suggestions as to what I am doing wrong? Thanks Camilla

wwood commented 3 months ago

Hi Camilla,

That does look to me as if there is an issue with the input OTU table file. How was it generated? OTU tables (note, these are not taxonomic profiles - see the glossary in the docs) have 5+ columns, where that line only has 2.

camillaln commented 3 months ago

Thanks for your quick reply! I generated the OTU tables using this command:

for i in *.profile.tsv do name=$(basename $i profile.tsv) singlem summarise --input-taxonomic-profile $i --output-species-by-site-relative-abundance $name.genus_by_site.csv --output-species-by-site-level genus done

wwood commented 3 months ago

Hi @camillaln - did thsi get solved?