Skip to content

Commit

Permalink
some improvements #7
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-Hades committed Jun 3, 2024
1 parent ca4bbe6 commit c6e2605
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ dependencies = [
'pyyaml',
# 'refinegems >= 2.0',
'requests',
'SBOannotator',
'seaborn',
'tqdm',
'z3-solver',
Expand Down
11 changes: 6 additions & 5 deletions src/specimen/cmpb/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from refinegems.curation.gapfill import gapfill_model, gapfill
from refinegems.curation.pathways import kegg_pathways, kegg_pathway_analysis
from refinegems.curation.polish import polish
from refinegems.utility.connections import run_memote, perform_mcc, adjust_BOF
from refinegems.utility.connections import run_memote, perform_mcc, adjust_BOF, run_SBOannotator
from refinegems.utility.io import load_model, write_model_to_file

# from SBOannotator import *
Expand Down Expand Up @@ -283,11 +283,12 @@ def between_analysis(model: Model, cfg:dict, step:str):
libsbml_doc = readSBML(current_modelpath)
libsbml_model = libsbml_doc.getModel()
if config['general']['save_all_models']:
sbo_annotator(libsbml_doc, libsbml_model, 'constraint-based', True, 'create_dbs',
Path(dir,'cmpb','models', 'SBOannotated.xml'))
libsbml_model = run_SBOannotator(libsbml_model)
write_model_to_file(libsbml_model,Path(dir,'cmpb','models', 'SBOannotated.xml'))
current_modelpath = Path(dir,'cmpb','models', 'SBOannotated.xml')
else:
sbo_annotator(libsbml_doc, libsbml_model, 'constraint-based', True, 'create_dbs',
Path(current_modelpath))
libsbml_model = run_SBOannotator(libsbml_model)
write_model_to_file(Path(current_modelpath))

between_analysis(current_model,config,step='after_annotation')

Expand Down
19 changes: 4 additions & 15 deletions src/specimen/hqtb/core/refinement/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@
import urllib.error

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

# from SBOannotator import *
from SBOannotator import sbo_annotator
from refinegems.utility.io import load_model, kegg_reaction_parser, write_model_to_file
from refinegems.utility.connections import run_memote, run_SBOannotator

################################################################################
# functions
Expand Down Expand Up @@ -176,16 +173,8 @@ def run(model:str, dir:str, kegg_viaEC:bool=False,
libsbml_doc = readSBML(model)
libsbml_model = libsbml_doc.getModel()

# note:
# current implementation needs the script SBOannotator.py
# and the create_dbs.sql files from the SBOannotator github repo
# runs currently only when started from 03-refinement/
# @TODO:
# SBOannotator should be downloadable as a python tool
# if not included download from github

sbo_annotator(libsbml_doc, libsbml_model, 'constraint-based', True, 'create_dbs',
Path(dir,'step3-annotation',libsbml_model.getId()+'_SBOannotated.xml'))
libsbml_model = run_SBOannotator(libsbml_model)
write_model_to_file(libsbml_model, Path(dir,'step3-annotation',libsbml_model.getId()+'_SBOannotated.xml'))

end = time.time()
print(F'\ttime: {end - start}s')
Expand Down

0 comments on commit c6e2605

Please sign in to comment.