Skip to content

Commit

Permalink
Merge pull request #21 from jclachance/jc_edit3
Browse files Browse the repository at this point in the history
Fix model import issue
  • Loading branch information
jclachance authored May 8, 2018
2 parents b6450d6 + f3c06ff commit 3060c66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion BOFdat/dna.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ def generate_coefficients(path_to_fasta, path_to_model , DNA_WEIGHT_FRACTION=0.0
genome = _import_genome(path_to_fasta)
base_in_genome = _get_number_of_bases(genome)
ratio_in_genome = _get_ratio(base_in_genome, genome)
biomass_coefficients = _convert_to_coefficient(_import_model(path_to_model), ratio_in_genome, CELL_WEIGHT,
model = _import_model(path_to_model)
biomass_coefficients = _convert_to_coefficient(model, ratio_in_genome, CELL_WEIGHT,
DNA_WEIGHT_FRACTION)
#Add Pyrophosphate synthesis as the sum of the coefficients
ppi_coeff = sum(biomass_coefficients.values())
Expand Down
7 changes: 4 additions & 3 deletions BOFdat/protein.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ def _get_ratio(normalized_dict, norm_sum, PROTEIN_WEIGHT_FRACTION, CELL_WEIGHT):

return ratio_dict

def _convert_to_coefficient(ratio_dict, path_to_model, CELL_WEIGHT):
def _convert_to_coefficient(ratio_dict, model, CELL_WEIGHT):
WATER_WEIGHT = 18.01528
model = _import_model(path_to_model)

# 3- Convert gram ratios to mmol/g Dry weight
'''
To verify that the normalized to grams to get to the total amount of protein
Expand Down Expand Up @@ -218,7 +218,8 @@ def generate_coefficients(path_to_genbank, path_to_model, path_to_proteomic, PRO
# Proteomics data should come in a 2 columns standard format protein_id:abundance
norm_sum = _get_norm_sum(normalized_dict)
ratio_dict = _get_ratio(normalized_dict, norm_sum, PROTEIN_WEIGHT_FRACTION, CELL_WEIGHT)
biomass_coefficients = _convert_to_coefficient(ratio_dict,path_to_model, CELL_WEIGHT)
model = _import_model(path_to_model)
biomass_coefficients = _convert_to_coefficient(ratio_dict,model, CELL_WEIGHT)
h2o_coeff = sum(biomass_coefficients.values())
h2o_dict = {model.metabolites.get_by_id('h2o_c'): h2o_coeff}
biomass_coefficients.update(h2o_dict)
Expand Down

0 comments on commit 3060c66

Please sign in to comment.