GDKO / AvP

Automatic evaluation of HGTs
GNU General Public License v3.0
18 stars 2 forks source link

Error running classify, IndexError: list index out of range #7

Closed pyongheng closed 1 year ago

pyongheng commented 1 year ago

Hi, I am getting an error when running downstream analysis, classify. I tried using both sample.classification_ingroup_Metazoa.txt and a custom classification file. Evaluate works fine.

[+] Setting up [+] Classifying Trees Traceback (most recent call last): File "/home/y/yong-phua/AvP/avp", line 6, in main() File "/home/y/yong-phua/AvP/depot/interface.py", line 35, in main classify.main() File "/home/y/yong-phua/AvP/depot/classify.py", line 108, in main final_nodes = classify_tree(tree[gene],gene+"@StudiedOrganism",full_ranks, complex_per_node) File "/home/y/yong-phua/AvP/depot/PetNexus.py", line 212, in classify_tree per_of_most_common_rank = (final_nodes.most_common(1)[0][1]/sum(final_nodes.values()))*100 IndexError: list index out of range

GDKO commented 1 year ago

Hi,

Can you post the command you run?

pyongheng commented 1 year ago

Hi I used this command.

/home/y/yong-phua/AvP/avp classify -i /flash/HusnikU/Phua_2/AI_20/fasttree_nexus/ -t /flash/HusnikU/Phua_2/AI_20/fasttree_tree_results.txt -f /flash/HusnikU/Phua_2/AI_20/sample.classification_ingroup_Metazoa.txt -c config.yaml -o /flash/HusnikU/Phua_2/AI_20

GDKO commented 1 year ago

Thanks, most likely there is a tree file that is producing the error. In order to pinpoint the tree responsible, can you add the following line in the classify.py and rerun as previously. The last tree printed before failing should be the one.

    for gene in tree: #line 94
        print(tree[gene]) # add this line
        if type[gene] == "COMPLEX": #line 95

Then if you want you can send the tree in my personal email to further troubleshoot.

Edit: fixed typo

pyongheng commented 1 year ago

Hi, I am not too sure how to read the output of the file. it seems to be one repeated line. I've attached the log. classify.log

GDKO commented 1 year ago

Sorry I made an error change print(tree) to print(tree[gene])

jmayoral1 commented 1 year ago

Hello GDKO, Any updates on the cause of this IndexError issue? I ran into an identical error with avp classify and found the problematic tree using the print(tree[gene]) code suggested above. I can email you this tree if you would like another example.

GDKO commented 1 year ago

Hi @jmayoral1,

If you can send me the tree via email that would be great!

Thanks

GDKO commented 1 year ago

If the analysis does not use Metazoa as ingroup you need to change the classification file

See updated wiki