Skip to content

Commit

Permalink
draft of getSBML
Browse files Browse the repository at this point in the history
  • Loading branch information
juliettepark committed Jan 2, 2024
1 parent e4544a4 commit 1170ac8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
5 changes: 3 additions & 2 deletions activate.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
export PYTHONPATH=`pwd`:$PYTHONPATH
source xsb/bin/activate
source rep/bin/activate
PYTHONPATH=/Users/juliep/Documents/SauroLab/ExplorerSB
export PYTHONPATH
2 changes: 1 addition & 1 deletion scripts/mk_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
stage_dir=cn.STAGE_DIR,
data_dir=cn.DATA_DIR,
is_reset=False)
builder.build()
builder.build()
26 changes: 26 additions & 0 deletions src/ExplorerSB/project_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def buildProject(self):
util.trace("Acquired fields from summary parser", 2)
# Construct and populate the staging directory
_ = self._makeStagingData() # Download the output files
# TODO: Added SBML file here so that not eliminated in makeZipArchive with xml files
self._getSBMLFile()
util.trace("Acquired staging data", 2)
output_dir_path = self._downloadOutput() # Download the output files
if output_dir_path is None:
Expand Down Expand Up @@ -260,6 +262,30 @@ def _getH5FilePath(self)->str:
else:
return None

def _getSBMLFile(self):
# Assumptions: with a path to SBML file, can go to link and download
# See if there is an SBML file
paths = self.getFilePaths(self.stage_dir)
sbml_path = None
for path in paths:
splits = os.path.splitext(path)
if (splits[1] == ".xml") and ("manifest" not in path):
with open(path, "r") as fd:
lines = fd.readlines()
model = "\n".join(lines)
if not "sbml" in model:
continue
sbml_path = path
break
# Now copy the file at the url
if sbml_path is not None:
try:
project_dir = self.getProjectDir(self.stage_dir, is_create=True)
path = self._copyUrlFile(smbl_path, project_dir)
except:
pass


def _makeReadableModel(self, is_write:bool=True, is_replace:bool=False)->str:
"""
Converts a model to human readable text, if possible. Currently only
Expand Down

0 comments on commit 1170ac8

Please sign in to comment.