shuzhao-li-lab / JMS

Json's Metabolite Services
MIT License
1 stars 1 forks source link

EmpCpd lists with Orphans cannot be processed. #22

Closed jmmitc06 closed 1 year ago

jmmitc06 commented 1 year ago

Attempting to annotate the Asari empCpd list emits this error:

File "/Users/mitchjo/Projects/MorPHiC_cyp19a1_prlr_ptn/../PythonCentricPipelineForMetabolomics/src/main.py", line 301, in <module> main(args) File "/Users/mitchjo/Projects/MorPHiC_cyp19a1_prlr_ptn/../PythonCentricPipelineForMetabolomics/src/main.py", line 222, in main EED.build_from_list_empCpds(json.load(open(experiment.empCpds[args['--table']])).values()) File "/opt/homebrew/lib/python3.11/site-packages/jms/dbStructures.py", line 386, in build_from_list_empCpds self.index_empCpds() File "/opt/homebrew/lib/python3.11/site-packages/jms/dbStructures.py", line 409, in index_empCpds self.peak_to_empCpd_ion_relation[P['id_number']] = P['ion_relation'] ~^^^^^^^^^^^^^^^^

The root cause is that the orphans, understandably, do not have an ion_relation field. I have also tried explicitly loading and setting the EED.empCpds field with the decoded JSON dictionary and a similar error will occur.

Setting the 'ion_relation' field to None for peaks lacking this field, allows it to pass this step and annotations are generated.

The questions I have are:

  1. Is this a safe workaround? It appears to be, the singleton search should not care about ion_relation since singletons cannot have ion_relations.

  2. Should this be fixed in JMS or should I update Asari to populate this field with a placeholder so it can work with JMS.

shuzhao-li commented 1 year ago

That's fine. There were a few moving parts. We need to watch out for these inconsistencies btw packages in near future. The 'ion_relation' should be a combined tag of 'isotope' and 'modification' - the latter may be more computable.

jmmitc06 commented 1 year ago

This has been fixed now in asari. The ion_relation and modification field is set to None is Asari.

True solution is to have a unified peak constructor across all projects but that is for the future.

Closing this issue.