owmeta icon indicating copy to clipboard operation
owmeta copied to clipboard

Add a Transmitter type

Open mwatts15 opened this issue 8 years ago • 3 comments

Add a DataObject subclass for representing transmitters. Must include a property for receptor mappings. It is not necessary to add any additional properties beyond the name of the receptor to close this issue, but properties which can apply equally to all neurotransmitters may be added.

Addition of a Receptor type (#291) is not necessarily a prerequisite to this, but if #291 is completed, then the receptor property should have Receptor-type values.

Child of #281 blocks #287 blocks #288

mwatts15 avatar Feb 04 '17 16:02 mwatts15

We'll have to deal with is naming inconsistency. Capitalisation and dashes/spaces can be dealt with fairly easily (although it requires overriding __eq__ and __hash__ ), but abbreviations (acetylcholine -> ACh, gamma-amino butyric acid -> GABA, Dopamine -> DOP, Serotonin -> 5-HT) are more tricky. Furthermore, many neuropeptides have alternative names due to being renamed once the sequence was discovered, or reclassified due to ligand binding or whatever. It looks like Cell has a 'synonyms' property which will likely do the job.

I'm looking at using __new__ to check to see if any of the synonyms match with any of the alternative names on record, and return the canonically-named neurotransmitter if it's there. That would require us to have another set of triples mapping synonyms to canonical names (which may be subjective - probably best to use WormBase's names), and I don't know what assumptions POW makes about that sort of thing already. See #297.

clbarnes avatar Feb 07 '17 16:02 clbarnes

Assuming the comment above is in reference to methods of the Transmitter class.

__eq__ and __hash__ must not be overridden for DataObject subtypes -- both depend only on the identifier of the object. I'm not sure why you would use __new__ on a mutable type. Storing the alternatives in the database rather than hard-coding is a good idea.

Edit: s/__str__/__eq__

mwatts15 avatar Feb 08 '17 04:02 mwatts15

If we already have in the database a Neurotransmitter('acetylcholine'), with a bunch of metadata about it, and a user creates Neurotransmitter('ACh'), I was thinking of using __new__ to intercept the instantiation, catch that we already have that molecule, and return that instance instead of a new one - that way all the metadata ends up on the same item. We could throw a warning so that the user knows that the returned object won't have the exact name they gave it, and which name to use in future.

I guess this is a method which could go into DataObject - given that a lot of different data objects have synonyms and as you say, their identity is based solely on their identifier.

clbarnes avatar Feb 08 '17 15:02 clbarnes