Skip to content

Commit

Permalink
feat: example on how to integrate some tests from Memote #3
Browse files Browse the repository at this point in the history
  • Loading branch information
famosab authored and mihai-sysbio committed Mar 6, 2023
1 parent 312867d commit 85302bc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from os import environ
import tests.cobra
import tests.yaml
import tests.memote

API_ENDPOINT = 'https://api.github.com/graphql'
API_TOKEN = environ['GH_TOKEN']
Expand Down Expand Up @@ -91,9 +92,10 @@ def validate(nameWithOwner):
test_results.update(tests.yaml.validate(model))
test_results.update(tests.cobra.load(model))
test_results.update(tests.cobra.validateSBML(model))
test_results.update(tests.memote.get_consistency(model))
else:
print('is not following standard')
release_data = { 'standard-GEM' : [ { standard_version : gem_is_standard }, { 'test_results' : test_results} ] }
data[nameWithOwner].append({ model_release: release_data })
with open('results/{}_{}.json'.format(owner, model), 'w') as output:
output.write(json.dumps(data, indent=2, sort_keys=True))
output.write(json.dumps(data, indent=2, sort_keys=True))
17 changes: 17 additions & 0 deletions tests/memote.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import memote
import cobra
import json
from memote.support import consistency
# needed by memote.support.consitency
from memote.support import consistency_helpers as con_helpers

def get_consistency(model_filename):
try:
model = cobra.io.read_sbml_model(model_filename + '.xml')
except Exception as e:
errors = json.dumps(str(e))
print(e)

is_consistent = consistency.check_stoichiometric_consistency(model)

return {'memote-tests': { memote.__version__ : is_consistent, 'errors': errors } }

0 comments on commit 85302bc

Please sign in to comment.