apcamargo / genomad

geNomad: Identification of mobile genetic elements
https://portal.nersc.gov/genomad/
Other
168 stars 17 forks source link

Possibility to include NAs in taxonomy csv format for easier parsing? #39

Closed LanderDC closed 2 months ago

LanderDC commented 9 months ago

Hi,

I'm trying to parse the taxonomy column of the _virus_summary.tsv file, but unclassified taxonomic levels are omitted which causes inconsistencies. In the table below for example, for the first entry, Straboviridae would end up in the Order column while it is a viral family.

seq_name length topology coordinates n_genes genetic_code virus_score fdr n_hallmarks marker_enrichment taxonomy
NODE_A75_length_5000_cov_17.505180_BlackFly28 5000 No_terminal_repeats NA 4 11 0.9997 0.0003 1 6.8731 Viruses;Duplodnaviria;Heunggongvirae;Uroviricota;Caudoviricetes;Straboviridae
NODE_A20_length_7615_cov_6.791589_BlackFly6 7615 No_terminal_repeats NA 11 11 0.9997 0.0003 6 15.3910 Viruses;Duplodnaviria;Heunggongvirae;Uroviricota;Caudoviricetes
NODE_A8_length_6639_cov_9.592350_BlackFly34 6639 No_terminal_repeats NA 8 11 0.9997 0.0003 1 13.4767 Viruses;Duplodnaviria;Heunggongvirae;Uroviricota;Caudoviricetes
NODE_A4_length_12404_cov_730.807901_BlackFly44 12404 No_terminal_repeats NA 6 11 0.9996 0.0004 2 3.4366 Viruses;Riboviria;Orthornavirae;Negarnaviricota;Monjiviricetes;Mononegavirales;Rhabdoviridae

Would it be possible to output the taxonomy column as: Viruses;Duplodnaviria;Heunggongvirae;Uroviricota;Caudoviricetes;;Straboviridae;; or Viruses;Duplodnaviria;Heunggongvirae;Uroviricota;Caudoviricetes;unclassified;Straboviridae?

Thanks in advance!

apcamargo commented 9 months ago

Hi @LanderDC,

You make a good point. I'm not sure about adding an "unclassified" taxon to the lineage (your second option) because it might confuse users. They could think that geNomad couldn't assign the sequence to an order but could assign it to a family, when in reality, the family isn't part of any order at all

I like your first option, though.

Another possibility would be adding prefixes to the taxa names, like GTDB does? For instance:

Viruses;r__Duplodnaviria;k__Heunggongvirae;p__Uroviricota;c__Caudoviricetes;f__Straboviridae;

This could make parsing easier. The problem is that "Viruses" is not a taxon at all and doesn't have a named rank.

LanderDC commented 9 months ago

Thanks for your swift reply!

You are right that my second option might cause some confusion. I like your suggestion to add prefixes, because you immediately see which taxonomic rank you're dealing with and don't have to remember which suffix belongs to which rank. However, if possible I would still like empty places for ranks that are not yet classified by ICTV, because then you can just split the taxonomy column based on the semicolon:

Viruses;r__Duplodnaviria;k__Heunggongvirae;p__Uroviricota;c__Caudoviricetes;;f__Straboviridae;;

About the "Viruses" problem, I don't feel that it is really an issue but I understand that you would like to have everything consistent.

apcamargo commented 9 months ago

I like your suggestion. The "Viruses" thing does bother me, though. If I add the additional semicolons, the ranks would be could be inferred by the number of the column, so the prefixes are not strictly required.

LanderDC commented 9 months ago

True, whatever is easier to implement should be fine 🙂

apcamargo commented 9 months ago

I'll will work on that for the next release :)

LanderDC commented 9 months ago

Nice, thanks!

LanderDC commented 6 months ago

Are you ok with a pull request on this issue? I forked your repo and slightly modified taxonomy.py to get these empty fields for unclassified ranks (https://github.com/LanderDC/genomad/commit/14eb85d458ebecdd28fda021765cdbad46e9214e). Incidentally, the "Viruses" rank is also removed by these modifications.

apcamargo commented 6 months ago

Thanks, @LanderDC

If it's easy enough, I'd appreciate that. I'd need to evaluate what could break with this change (the removal of the "Viruses" taxon), but I don't forsee any issues.

LanderDC commented 6 months ago

Great!

apcamargo commented 2 months ago

Fixed in version 1.8.0. Thanks @LanderDC!