Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Transmitter type #286

Open
mwatts15 opened this issue Feb 4, 2017 · 3 comments
Open

Add a Transmitter type #286

mwatts15 opened this issue Feb 4, 2017 · 3 comments

Comments

@mwatts15
Copy link
Contributor

mwatts15 commented Feb 4, 2017

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

@clbarnes
Copy link
Contributor

clbarnes commented Feb 7, 2017

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.

@mwatts15
Copy link
Contributor Author

mwatts15 commented Feb 8, 2017

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__

@clbarnes
Copy link
Contributor

clbarnes commented Feb 8, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants