Skip to content

Commit

Permalink
small updates #8
Browse files Browse the repository at this point in the history
  • Loading branch information
niinina committed Aug 22, 2024
1 parent b0677ac commit 654f425
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
17 changes: 10 additions & 7 deletions src/specimen/cmpb/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from refinegems.analysis import growth
from refinegems.analysis.investigate import plot_rea_sbo_single
from refinegems.classes.reports import ModelInfoReport
from refinegems.utility.entities import test_biomass_presence
from refinegems.utility.util import test_biomass_presence
from refinegems.curation.biomass import check_normalise_biomass
from refinegems.curation.charges import correct_charges_modelseed
from refinegems.curation.curate import resolve_duplicates
Expand Down Expand Up @@ -120,10 +120,6 @@ def between_analysis(model: Model, cfg:dict, step:str):
else:
config = validate_config(configpath, 'cmpb')

if not config['general']['save_all_models']:
only_modelpath = Path(dir,'cmpb_out','model.xml') # @TODO Use model ID here...
# model might not exist here ...

# create directory structure
# --------------------------

Expand All @@ -139,6 +135,12 @@ def between_analysis(model: Model, cfg:dict, step:str):
Path(dir,"cmpb_out",'misc', 'kegg_pathway').mkdir(parents=True, exist_ok=False) # |- kegg_pathways
Path(dir,"cmpb_out",'misc', 'auxotrophy').mkdir(parents=True, exist_ok=False) # |- auxothrophy

# save modelpath
# --------------
if not config['general']['save_all_models']:
only_modelpath = Path(dir,'cmpb_out','models','model.xml') # @TODO Use model ID here...
# model might not exist here ...

# create log
# ----------
today = date.today().strftime("%Y%m%d")
Expand Down Expand Up @@ -314,8 +316,8 @@ def between_analysis(model: Model, cfg:dict, step:str):
current_libmodel = load_model(str(current_modelpath),'libsbml')
if config['general']['save_all_models']:
current_libmodel = run_SBOannotator(current_libmodel)
write_model_to_file(current_libmodel, str(Path(dir,'cmpb_out','models', 'SBOannotated.xml')))
current_modelpath = Path(dir,'cmpb_out','models', 'SBOannotated.xml')
write_model_to_file(current_libmodel, str(Path(dir,'cmpb_out','models', f'{current_libmodel.getId()}_SBOannotated.xml')))
current_modelpath = Path(dir,'cmpb_out','models', f'{current_libmodel.getId()}_SBOannotated.xml')
else:
current_libmodel = run_SBOannotator(current_libmodel)
write_model_to_file(current_libmodel, str(current_modelpath))
Expand Down Expand Up @@ -416,6 +418,7 @@ def between_analysis(model: Model, cfg:dict, step:str):

# MCC
# ---
Path(dir,"cmpb_out",'misc','mcc').mkdir(parents=True, exist_ok=False)
current_model = perform_mcc(current_model, Path(dir,'cmpb_out','misc','mcc'),apply=True)

# save the final model
Expand Down
3 changes: 2 additions & 1 deletion src/specimen/hqtb/core/refinement/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
import urllib.error

# refinegems
from refinegems.utility.io import load_model, kegg_reaction_parser, write_model_to_file
from refinegems.utility.io import load_model, write_model_to_file
from refinegems.utility.connections import run_memote, run_SBOannotator
from refinegems.utility.db_access import kegg_reaction_parser

################################################################################
# functions
Expand Down
3 changes: 2 additions & 1 deletion src/specimen/hqtb/core/refinement/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@
from Bio.KEGG import REST
from Bio.KEGG import Enzyme, Compound

from refinegems.utility.io import kegg_reaction_parser, load_a_table_from_database
from refinegems.utility.io import load_a_table_from_database
from refinegems.utility.entities import create_random_id, get_reaction_annotation_dict, match_id_to_namespace
from refinegems.utility.connections import run_memote
from refinegems.utility.db_access import kegg_reaction_parser

# further required programs:
# - DIAMOND, tested with version 0.9.14 (works only for certain sensitivity mode)
Expand Down

0 comments on commit 654f425

Please sign in to comment.