Skip to content

Commit

Permalink
Add print statements to track progress
Browse files Browse the repository at this point in the history
  • Loading branch information
YinHoon committed Aug 22, 2019
1 parent f5d40e9 commit 05d8790
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 12 deletions.
25 changes: 19 additions & 6 deletions wc_model_gen/eukaryote/complexation.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ def gen_reactions(self):
amino_acid_id_conversion = self.options['amino_acid_id_conversion']
codon_table = self.options['codon_table']
cds = self.options['cds']


print('Start generating complexation submodel...')
assembly_rxn_no = 0
disassembly_rxn_no = 0
for compl in cell.species_types.get(__type=wc_kb.core.ComplexSpeciesType):

model_compl_species_type = model.species_types.get_one(id=compl.id)
Expand Down Expand Up @@ -86,6 +89,8 @@ def gen_reactions(self):
model_rxn.participants.add(
model_compl_species.species_coefficients.get_or_create(coefficient=1))

assembly_rxn_no += 1

# Generate reactions that lump complex dissociation and subunit degradation
for compl_subunit in compl.subunits:

Expand All @@ -103,6 +108,8 @@ def gen_reactions(self):
model_compl_species.species_coefficients.get_or_create(
coefficient=-1))

disassembly_rxn_no += 1

for subunit in compl.subunits:

model_subunit_species = model.species_types.get_one(
Expand Down Expand Up @@ -147,11 +154,13 @@ def gen_reactions(self):
model_rxn.participants.add(
model_subunit_species.species_coefficients.get_or_create(
coefficient=subunit_coefficient))

print('{} reactions of complex assembly and {} reactions of complex dissociation have been generated'.format(
assembly_rxn_no, disassembly_rxn_no))

def gen_rate_laws(self):
""" Generate rate laws for the reactions in the submodel """
model = self.model

rate_law_no = 0
for reaction in self.submodel.reactions:

if 'complex_association_' in reaction.id:
Expand Down Expand Up @@ -180,8 +189,10 @@ def gen_rate_laws(self):
expression=rate_law_exp,
reaction=reaction,
)
rate_law.id = rate_law.gen_id()

rate_law.id = rate_law.gen_id()
rate_law_no += 1

print('{} rate laws for complex assembly and dissociation have been generated'.format(rate_law_no))

def calibrate_submodel(self):
""" Calibrate the submodel using data in the KB """
Expand Down Expand Up @@ -239,4 +250,6 @@ def calibrate_submodel(self):
species=degraded_subunit_species).coefficient

diss_k_cat = model.parameters.get_one(id='k_cat_{}'.format(reaction.id))
diss_k_cat.value = - degraded_subunit_stoic / degraded_subunit_hlife
diss_k_cat.value = - degraded_subunit_stoic / degraded_subunit_hlife

print('Complexation submodel has been generated')
6 changes: 5 additions & 1 deletion wc_model_gen/eukaryote/initialize_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def run(self):
self.clean_and_validate_options()
options = self.options

print('Model generator is being initialized')

self.gen_taxon()
self.gen_compartments()
self.gen_parameters()
Expand Down Expand Up @@ -59,7 +61,9 @@ def run(self):
self.gen_kb_rate_laws()

if options['gen_environment']:
self.gen_environment()
self.gen_environment()

print('Model generator has been initialized')

def clean_and_validate_options(self):
options = self.options
Expand Down
15 changes: 13 additions & 2 deletions wc_model_gen/eukaryote/rna_degradation.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ def gen_reactions(self):
'm': met_species_type.species.get_one(compartment=mitochondrion)
}

print('Start generating RNA degradation submodel...')
# Create reaction for each RNA and get exosome
rna_exo_pair = self.options.get('rna_exo_pair')
rna_kbs = cell.species_types.get(__type=wc_kb.eukaryote_schema.TranscriptSpeciesType)
self._degradation_modifier = {}
deg_rxn_no = 0
for rna_kb in rna_kbs:

rna_kb_compartment_id = rna_kb.species[0].compartment.id
Expand Down Expand Up @@ -94,7 +96,10 @@ def gen_reactions(self):

# Assign modifier
self._degradation_modifier[reaction.name] = model.species_types.get_one(
name=rna_exo_pair[rna_kb.id]).species.get_one(compartment=degradation_compartment)
name=rna_exo_pair[rna_kb.id]).species.get_one(compartment=degradation_compartment)

deg_rxn_no += 1
print('{} RNA degradation reactions have been generated'.format(deg_rxn_no))

def gen_rate_laws(self):
""" Generate rate laws for the reactions in the submodel """
Expand All @@ -104,6 +109,7 @@ def gen_rate_laws(self):
mitochondrion = model.compartments.get_one(id='m')
cytoplasm = model.compartments.get_one(id='c')

rate_law_no = 0
rnas_kb = cell.species_types.get(__type=wc_kb.eukaryote_schema.TranscriptSpeciesType)
for rna_kb, reaction in zip(rnas_kb, self.submodel.reactions):

Expand All @@ -129,6 +135,9 @@ def gen_rate_laws(self):
reaction=reaction,
)
rate_law.id = rate_law.gen_id()
rate_law_no += 1

print('{} rate laws for RNA degradation have been generated')

def calibrate_submodel(self):
""" Calibrate the submodel using data in the KB """
Expand Down Expand Up @@ -187,4 +196,6 @@ def calibrate_submodel(self):
wc_lang.Compartment: {
rna_compartment.id: rna_compartment.init_volume.mean * rna_compartment.init_density.value,
degradation_compartment.id: degradation_compartment.init_volume.mean * degradation_compartment.init_density.value}
})
})

print('RNA degradation submodel has been generated')
21 changes: 18 additions & 3 deletions wc_model_gen/eukaryote/transcription.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ def gen_reactions(self):
volume='14',
pages='796-806'
)
ref_polr_distribution.id = 'ref_'+str(len(model.references))
ref_polr_distribution.id = 'ref_'+str(len(model.references))

print('Start generating transcription submodel...')

# Create for each RNA polymerase a reaction of binding to non-specific site
nuclear_genome_length = 0
Expand Down Expand Up @@ -204,6 +206,7 @@ def gen_reactions(self):
coefficient=1))

# Create initiation and elongation reactions for each RNA
init_el_rxn_no = 0
rna_kbs = cell.species_types.get(__type=wc_kb.eukaryote_schema.TranscriptSpeciesType)
self._initiation_polr_species = {}
self._elongation_modifier = {}
Expand Down Expand Up @@ -361,6 +364,11 @@ def gen_reactions(self):
polr_binding_site_species.species_coefficients.get_or_create(
coefficient=1))

init_el_rxn_no += 1

print('{} reactions each for initiation and elongation have been generated'.format(
init_el_rxn_no))

def gen_rate_laws(self):
""" Generate rate laws for the reactions in the submodel """

Expand Down Expand Up @@ -471,7 +479,8 @@ def gen_rate_laws(self):
units=unit_registry.parse_units('s^-1')
)

# Generate rate laws for initiation and elongation & termination
# Generate rate laws for initiation and elongation & termination
rate_law_no = 0
rnas_kb = cell.species_types.get(__type=wc_kb.eukaryote_schema.TranscriptSpeciesType)
for rna_kb in rnas_kb:

Expand Down Expand Up @@ -596,7 +605,11 @@ def gen_rate_laws(self):
expression=rate_law_exp,
reaction=elongation_reaction,
)
rate_law.id = rate_law.gen_id()
rate_law.id = rate_law.gen_id()

rate_law_no += 1

print('{} rate laws for initiation and elongation have been generated'.format(rate_law_no))

def calibrate_submodel(self):
""" Calibrate the submodel using data in the KB """
Expand Down Expand Up @@ -747,3 +760,5 @@ def calibrate_submodel(self):
wc_lang.Compartment: {
rna_compartment.id: rna_compartment.init_volume.mean * rna_compartment.init_density.value},
})

print('Transcription submodel has been generated')

0 comments on commit 05d8790

Please sign in to comment.