Joseph7e / Assign-Taxonomy-with-BLAST

Assign taxonomy with blast, can be used for qiime
21 stars 8 forks source link

using script on custom database #1

Open javiercnav opened 5 years ago

javiercnav commented 5 years ago

Hi Joe, I am trying to use the script to assign taxonomy to some 18S sequences. For this, I have generated my own blast database from a blast search of first 10 hits for each of my sequences and tax file that connects my blast database sequences with their taxonomy. My tax database has been curated to have 7 levels only k,p,c,o,f,g,s...

I tried to run the script and I get this message: Traceback (most recent call last): File "taxonomy_assignment_BLAST_V2.py", line 340, in best_level_taxonomy, blast_percent = Assign_Taxonomy(current_query, current_best_hits) File "taxonomy_assignment_BLAST_V2.py", line 288, in Assign_Taxonomy s.add(j[i]) IndexError: list index out of range

Could it be that the script is not recognizing the categories in my tax file?

blast_output_custom_format.txt log_file.txt

PandengWang commented 4 years ago

Hi, I encountered the same problem. The solution is as follows:

taxonomy_categories = ['superkingdom', 'subkingdom', 'sub_subkingdom', 'kingdom', 'tmp1', 'tmp2', 'phylum', 'class', 'family', 'genus', 'species', 'tmp3', 'tmp4','tmp5', 'tmp6'] uncultured_cutoff_level = len(taxonomy_categories) species_level = 14 family_level = 10 phylum_level = 7 taxonomy_to_grab = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]

Above codes should be changed according to you taxonomy file

taxonomy_categories = ['kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species'] uncultured_cutoff_level = len(taxonomy_categories) species_level = 6 family_level = 5 phylum_level = 1 taxonomy_to_grab = [0,1,2,3,4,5,6]

Long time has passed. Hope this comment is still useful for you.