Conversation
185af82 to
d5f94c2
Compare
|
Hi Pierre,
Cheer, EDIT (by Pierre): formatting |
etfl/core/genes.py
Outdated
| from cobra import Gene | ||
| from Bio.Seq import Seq | ||
| from Bio.Alphabet import DNAAlphabet, RNAAlphabet, ProteinAlphabet | ||
| from etfl.optim.constraints import SynthesisConstraint |
There was a problem hiding this comment.
change to
from ..optim.constraints import SynthesisConstraint
etfl/core/genes.py
Outdated
| else: | ||
| # We need to make the model change the corresponding cstr | ||
| mod_id = self.id + '_transcription' | ||
| Cstr = self.model.get_constraints_of_type(SynthesisConstraint) |
There was a problem hiding this comment.
please respect the conventions and use Uppercas names only for classes. variables are lowercase most of the time.
etfl/core/genes.py
Outdated
| try: | ||
| Cstr.get_by_id(mod_id) | ||
| except KeyError: | ||
| cstr_exist = 0 |
There was a problem hiding this comment.
Please use True and False instead of 1 and 0
There was a problem hiding this comment.
Also please add comments as to why you are doing this: checking that the genes are not transcribed yet.
| self._transcribed_by = value | ||
| else: | ||
| # We need to make the model change the corresponding cstr | ||
| mod_id = self.id + '_transcription' |
There was a problem hiding this comment.
Please replace by get_transcription_reaction_name
There was a problem hiding this comment.
You mean I should write a new function to do this?
| cstr_exist = 0 | ||
| if cstr_exist: | ||
| # trancription constraint already exists | ||
| raise NotImplementedError() |
There was a problem hiding this comment.
Please add #TODO with instructions
| def translated_by(self,value): | ||
| # TODO: Make this a setter that rewrites the adequate constraints | ||
| raise NotImplementedError() | ||
| if value != self._translated_by: |
etfl/core/memodel.py
Outdated
| :return: | ||
| """ | ||
|
|
||
There was a problem hiding this comment.
can you please remove these empty lines containing only spaces
etfl/core/memodel.py
Outdated
|
|
||
| def add_transcription_by(self, transcription_dict): | ||
|
|
||
| for gene_id, transcripted_by in transcription_dict.items(): |
There was a problem hiding this comment.
Please rename transcripted_by into transcribed_by
| # transcripted_by is a list of rnap(s) | ||
| try: | ||
| self.genes.get_by_id(gene_id).transcribed_by = transcripted_by | ||
| except KeyError: |
There was a problem hiding this comment.
Please add a comment explaining in which case this error would happen
| free_pep._model = self | ||
| self.peptides += [free_pep] | ||
|
|
||
| def add_peptide_sequences(self, aa_sequences): |
There was a problem hiding this comment.
Can you remind me for which case you had to add this ?
There was a problem hiding this comment.
This is a function that I have to add my peptide sequences. It's not related to mitochondrial expression. You can neglect it.
etfl/core/memodel.py
Outdated
| for x in self.rnap] | ||
| # only for genes trascribed by this rnap | ||
| sum_RMs = symbol_sum([x.unscaled for x in all_rnap_usage \ | ||
| if x.hook.transcribed_by is None \ |
There was a problem hiding this comment.
Add a comment explaining why we include the None as well
etfl/core/memodel.py
Outdated
| - sum([x.concentration for x in self.rnap.values()]) | ||
| usage /= min([x.scaling_factor for x in self.rnap.values()]) | ||
| - sum([self.rnap[rnap_id].concentration]) | ||
| usage /= min([self.rnap[rnap_id].scaling_factor]) |
There was a problem hiding this comment.
You can remove the min here, we do not have an iterable anymore
etfl/core/memodel.py
Outdated
| + sum([x.unscaled for x in free_rnap]) \ | ||
| - sum([x.concentration for x in self.rnap.values()]) | ||
| usage /= min([x.scaling_factor for x in self.rnap.values()]) | ||
| - sum([self.rnap[rnap_id].concentration]) |
There was a problem hiding this comment.
You can remove the sum here, we do not have a list anymore
etfl/core/memodel.py
Outdated
| sum_RPs = symbol_sum([x.unscaled for x in all_ribosome_usage]) | ||
| # only for genes traslated by this ribosome | ||
| sum_RPs = symbol_sum([x.unscaled for x in all_ribosome_usage \ | ||
| if x.hook.translated_by is None \ |
| if gene.translated_by is not None else None | ||
| except AttributeError: | ||
| obj['translated_by'] = [x for x in gene.translated_by] \ | ||
| if gene.translated_by is not None else None |
There was a problem hiding this comment.
I see no method to read that back from the dictionary ?
There was a problem hiding this comment.
I will do this later ;)
etfl/io/dict.py
Outdated
| g._peptide = Seq(gene_dict['peptide'], alphabet=ProteinAlphabet()) | ||
| g._copy_number = int(gene_dict['copy_number']) | ||
|
|
||
8717f82 to
605c00b
Compare
80dcb00 to
2cd0619
Compare
Mitochondrial expression system