tzok / rnapolis-py

A Python library containing RNA-related bioinformatics functions and classes.
MIT License
10 stars 3 forks source link

Python exception during annotator run #200

Closed morrgant closed 3 months ago

morrgant commented 3 months ago

Hello,

I utilised RNApolis to obtain the Dot-Bracket annotations of RNA structures (in cif format) and I stumbled on the following errors:

  File "/home/branimir/anaconda3/bin/annotator", line 33, in <module>
    sys.exit(load_entry_point('RNApolis==0.3.15', 'console_scripts', 'annotator')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/branimir/anaconda3/lib/python3.11/site-packages/rnapolis/annotator.py", line 618, in main
    structure2d, dot_brackets = extract_secondary_structure(
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/branimir/anaconda3/lib/python3.11/site-packages/rnapolis/annotator.py", line 490, in extract_secondary_structure
    base_interactions = extract_base_interactions(tertiary_structure, model)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/branimir/anaconda3/lib/python3.11/site-packages/rnapolis/annotator.py", line 479, in extract_base_interactions
    base_pairs, base_phosphate, base_ribose = find_pairs(tertiary_structure, model)
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/branimir/anaconda3/lib/python3.11/site-packages/rnapolis/annotator.py", line 327, in find_pairs
    if residue_i < residue_j:
       ^^^^^^^^^^^^^^^^^^^^^
  File "/home/branimir/anaconda3/lib/python3.11/site-packages/rnapolis/tertiary.py", line 134, in __lt__
    return (self.model, self.chain, self.number, self.icode or " ") < (
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'str' and 'NoneType'

Command line: annotator data/extracted_cif/8btk_B7.cif

The input file is attached in this issue.

Looking forward to your response.

8btk_B7.cif.txt

tzok commented 3 months ago

The mmCIF file is strange because the GTP residue has an empty label_seq_id column. It should not happen according to the mmCIF dictionary: https://mmcif.wwpdb.org/dictionaries/mmcif_pdbx_v50.dic/Items/_atom_site.label_seq_id.html

However, the annotator should not end up in the state as it does now. I will implement a fix that will skip atoms from invalid residues like GTP.

BTW. Can you provide a source for the input file? How was it generated?

morrgant commented 3 months ago

Thank you Tomazs for the swift response!

The file was generated from https://www.ebi.ac.uk/pdbe/entry/pdb/8btk as an "updated mmCIF file".