Skip to content

Commit 3060c66

Browse files
authored
Merge pull request #21 from jclachance/jc_edit3
Fix model import issue
2 parents b6450d6 + f3c06ff commit 3060c66

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

BOFdat/dna.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ def generate_coefficients(path_to_fasta, path_to_model , DNA_WEIGHT_FRACTION=0.0
9090
genome = _import_genome(path_to_fasta)
9191
base_in_genome = _get_number_of_bases(genome)
9292
ratio_in_genome = _get_ratio(base_in_genome, genome)
93-
biomass_coefficients = _convert_to_coefficient(_import_model(path_to_model), ratio_in_genome, CELL_WEIGHT,
93+
model = _import_model(path_to_model)
94+
biomass_coefficients = _convert_to_coefficient(model, ratio_in_genome, CELL_WEIGHT,
9495
DNA_WEIGHT_FRACTION)
9596
#Add Pyrophosphate synthesis as the sum of the coefficients
9697
ppi_coeff = sum(biomass_coefficients.values())

BOFdat/protein.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ def _get_ratio(normalized_dict, norm_sum, PROTEIN_WEIGHT_FRACTION, CELL_WEIGHT):
151151

152152
return ratio_dict
153153

154-
def _convert_to_coefficient(ratio_dict, path_to_model, CELL_WEIGHT):
154+
def _convert_to_coefficient(ratio_dict, model, CELL_WEIGHT):
155155
WATER_WEIGHT = 18.01528
156-
model = _import_model(path_to_model)
156+
157157
# 3- Convert gram ratios to mmol/g Dry weight
158158
'''
159159
To verify that the normalized to grams to get to the total amount of protein
@@ -218,7 +218,8 @@ def generate_coefficients(path_to_genbank, path_to_model, path_to_proteomic, PRO
218218
# Proteomics data should come in a 2 columns standard format protein_id:abundance
219219
norm_sum = _get_norm_sum(normalized_dict)
220220
ratio_dict = _get_ratio(normalized_dict, norm_sum, PROTEIN_WEIGHT_FRACTION, CELL_WEIGHT)
221-
biomass_coefficients = _convert_to_coefficient(ratio_dict,path_to_model, CELL_WEIGHT)
221+
model = _import_model(path_to_model)
222+
biomass_coefficients = _convert_to_coefficient(ratio_dict,model, CELL_WEIGHT)
222223
h2o_coeff = sum(biomass_coefficients.values())
223224
h2o_dict = {model.metabolites.get_by_id('h2o_c'): h2o_coeff}
224225
biomass_coefficients.update(h2o_dict)

0 commit comments

Comments
 (0)