-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
699c122
commit 935dfb7
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
while read model;do | ||
media=$(basename $(dirname $model)); | ||
species=$(basename ${model%.*}); | ||
less $model|grep GAP_FILL -B 12|grep "reaction id"|sed 's/ fast.*$//g'|sed 's/^.*<//g'|sed 's/reaction id="//g'|sed 's/ name="//g'|sed 's/ reversible="//g'|sed 's/"$//g'|tr '"' '\t'|sed "s/^/$media\t$species\t/g"; | ||
done< <(find models/ -name "*.xml") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
while read file;do | ||
media=$(basename $(dirname $file)); | ||
model=$(basename $file|sed 's/.xml_summary.txt//g'); | ||
paste $file|grep -v Reactions|grep -v Metabolites|sed 's/ /\t/g'|sed "s/^/${model}\t${media}\t/g"; | ||
done< <(find models/ -name "*summary.txt") > model_summary.tsv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import sys | ||
import glob | ||
import cobra | ||
import reframed | ||
from reframed import load_cbmodel | ||
from reframed import Environment | ||
from reframed import FBA | ||
|
||
# Loop to read in models in hardcoded folder with .xml extension | ||
for file in glob.iglob(r'*.xml'): | ||
|
||
# Use try to handle exceptions with reading SMBL model | ||
try: | ||
|
||
# Load model | ||
model = load_cbmodel(file, flavor='fbc2') | ||
|
||
# open file | ||
sys.stdout = open(file+"_summary.txt", "w") | ||
|
||
# get summary | ||
summary = model.summary() | ||
|
||
|
||
# Catch cobra.io.sbml.CobraSBMLError and continue loop | ||
except cobra.io.sbml.CobraSBMLError: | ||
|
||
# Print message with model ID for log | ||
print("The model",file,"raised an SBML error and could not be read in by COBRA") | ||
pass |