From f3c06ff6725309b4d17c13580cbd3aec037f28d8 Mon Sep 17 00:00:00 2001 From: jclachance Date: Tue, 8 May 2018 09:55:49 -0700 Subject: [PATCH] Fix model import issue --- BOFdat/dna.py | 3 ++- BOFdat/protein.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/BOFdat/dna.py b/BOFdat/dna.py index 13526bf..1298983 100644 --- a/BOFdat/dna.py +++ b/BOFdat/dna.py @@ -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()) diff --git a/BOFdat/protein.py b/BOFdat/protein.py index 9e00ab4..3849dce 100644 --- a/BOFdat/protein.py +++ b/BOFdat/protein.py @@ -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 @@ -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)