pantherdb / pthr_db_caller

Convenience wrapper for handling queries to Panther/PAINT postgresql DB
0 stars 0 forks source link

Allow absence of gene_symbol XML element #4

Open dustine32 opened 2 years ago

dustine32 commented 2 years ago

Parsing IBA propagator XML is breaking on <node> elements when a <gene_symbol> child element is completely missing:

File "pthr_db_caller/pthr_db_caller/models/paint.py", line 193, in from_element
    gene_symbol = element.find("gene_symbol").text
AttributeError: 'NoneType' object has no attribute 'text'

This is different than an empty <gene_symbol/> which parses fine.

The code should handle these fields being completely omitted sometimes. Just default to None or "".

Example node is for WHEAT|EnsemblGenome=TraesCS2A02G443900|UniProtKB=A0A3B6B5P8 in 16.0 family PTHR10687.

dustine32 commented 2 years ago

Forgot the cmd:

bin/format_xml_iba_to_gaf.py -f resources/test/PTHR10687.xml -g resources/test/go_aspects.tsv -c resources/test/complex_terms.tsv -s resources/test/paint_iba_files.tsv -d IBA_GAFs -p 15.0 -r 2021-08-18