galaxy-genome-annotation / python-apollo

Python library for talking to Apollo API
MIT License
11 stars 11 forks source link

organism.delete_features does not work: Can not find organism for null to remove features of #4

Closed NeillGibson closed 6 years ago

NeillGibson commented 6 years ago

Hi,

Thank you for the nice Apollo client. Most features work as expected.

I am having trouble to delete all genes/transcript features from an organism from the relational database:

connection.organisms.get_organisms()
{'annotationCount': 22979,
  'blatdb': None,
  'commonName': 'unit_test_organism',
  'currentOrganism': True,
  'directory': '/data/qa/Tools/apollo/2.0.6/unit_test_organism/data',
  'genus': None,
  'id': 40,
  'publicMode': False,
  'sequences': 7,
  'species': None,
  'valid': True}

See my commands to try to delete all genes/transcript features for

>>> connection.organisms.delete_features(40)
{'error': 'problem removing organism features for organism: java.lang.Exception: Can not find organism for null to remove features of'}
>>> connection.organisms.delete_features('40')
{'error': 'problem removing organism features for organism: java.lang.Exception: Can not find organism for null to remove features of'}
>>> connection.organisms.delete_features("unit_test_organism")
{'error': 'problem removing organism features for organism: java.lang.Exception: Can not find organism for null to remove features of'}

The code in the apollo client posts a json where a value is set for the ID field. https://github.com/galaxy-genome-annotation/python-apollo/blob/master/apollo/organisms/__init__.py#L152

The server side code seems to expect the a json where a value is set for the Organism (common name) field. https://github.com/GMOD/Apollo/blob/master/grails-app/controllers/org/bbop/apollo/OrganismController.groovy#L177

I guess this is where it might go wrong. The client and server side code don't use the same field in the json object?

Is it by the way correct that deleting an organism (using the API method deleteOrganism ) includes the deletion of all features from the relational database?

Thank you.

hexylena commented 6 years ago
NeillGibson commented 6 years ago

Ok thank you. I look forward to the patch.

hexylena commented 6 years ago

I don't have a test server running at this minute, I hope this fixes it for you though!

NeillGibson commented 6 years ago

Ok thank you. I will let you know if it works. Might take a few days.

I need to upgrade our pypi installed python-apollo client via github I guess?

hexylena commented 6 years ago

A new tag has been pushed which should appear on pypi shortly.