-
Notifications
You must be signed in to change notification settings - Fork 24
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
Addition of membrane comp/transport mech #265
base: dev
Are you sure you want to change the base?
Conversation
Added compartment attribute to Component under set_species.
Made lines shorter
Addition of 2 components and 2 mechanism for Membrane Proteins
Addition of direction to material type such that it appears in the name. Rewriting some membrane channel attributes and fix of some if statements.
Small indent edit
Updates for transport mechanism and membrane components. Includes example notebook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks well written, there were some parts I was confused about in terms of how things work and what the model is supposed to do. I think being more careful about choosing variable names and adding some comments will help resolve most of these issues. A few other small changes are listed to make the code slightly more customizable / reusable.
class IntegralMembraneProtein(Component): | ||
"""A class to represent transmembrane proteins or integral membrane proteins. | ||
This membrane class is to classify a membrane channel that will intergrate into the membrane. | ||
Uses a mechanism called "catalysis". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused why membrane proteins are Enzymes by default. Is there an example you have in mind?
if direction is None: | ||
self.product = self.set_species(product, material_type= 'Passive') | ||
else: | ||
self.product = self.set_species(product, material_type= direction) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'passive' and direction
do not seem like materials a molecule is built out of. Maybe I am missing something about what you are doing here though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be an attribute?
else: | ||
self.product = self.set_species(product, material_type= direction) | ||
|
||
if size is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is size being used for?
self.substrate = None | ||
else: | ||
product=substrate | ||
self.substrate = self.set_species(substrate, compartment='Internal',attributes=attributes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually think of catalysis as substrate --> product. Why are you setting substrate = product?
self.substrate = None | ||
else: | ||
product=substrate | ||
self.substrate = self.set_species(substrate, compartment='Internal',attributes=attributes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can internal_compartment
and external_compartment
be variables set in the constructor 'internal' and 'external' are great defaults, but it would be nice to be able to change the compartment names.
else: | ||
complex4 = complex4 | ||
|
||
return [membrane_pump, Sub, Prod, complex1, complex2, complex3, complex4] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Energy and Waste are not returned.
else: | ||
complex2 = complex2 | ||
|
||
nATP=membrane_pump.ATP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be a parameter in a file instead of a variable attached to the membrane_pump? This way, I could use this Mechanism with a different Component.
For example, you might type:
n_E = component.get_parameter(n_E, part_id, self)
k_reverse=ku2) | ||
|
||
# Sub:MT:E --> Prod:MT:W | ||
binding_rxn3 = Reaction.from_massaction(inputs=[complex3], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a binding reaction, so maybe we shouldn't call the parameter "kb"?
class MembraneChannel(Component): | ||
"""A class to represent Membrane Channels. | ||
Assumes the membrane channel transport substrates in a specific direction across the membrane | ||
Uses a mechanism called "catalysis" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better for the mechanism type to be called "transport" - otherwise, if we cannot use your transport Mechanisms at the same time a different catalysis mechanism is used (say for metabolism).
class MembranePump(Component): | ||
"""A class to represent Membrane Channels. | ||
Assumes the membrane channel transport substrates in a specific direction across the membrane | ||
Uses a mechanism called "catalysis" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above comment on mechanism type.
if direction is None: | ||
self.product = self.set_species(product, material_type= 'Passive') | ||
else: | ||
self.product = self.set_species(product, material_type= direction) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be an attribute?
return self.membrane_protein | ||
|
||
def update_species(self): | ||
mech_cat = self.get_mechanism('catalysis') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a different type of mechanism e.g. 'membrane_insertion'
""" | ||
|
||
# PROTEIN | ||
self.membrane_protein = self.set_species(membrane_protein, material_type='protein', attributes=attributes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#Set Internal and Membrane Compartments
self.internal_compartment = ...
self.membrane_compartment = ...
self.membrane_protein_free = self.set_species(membrane_protein, material_type = 'protein', compartment = internal_compartment, attributes = attributes)
self.membrane_protein_integrated = self.set_species(membrane_protein, material_type = 'protein', attributes = attributes, compartment = membrane_compartment)
Assumes the membrane channel transport substrates in a specific direction across the membrane | ||
Uses a mechanism called "catalysis" | ||
""" | ||
def __init__(self, integral_membrane_protein: Union[Species, str, Component], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In all the inits, can you add compartment keywords e.g. internal_compartment = "Internal"
Added membrane components and transport mechanism. A notebook is included for example of transport.