Skip to content

Commit

Permalink
Merge pull request #17 from MetabolicAtlas/chore/refactor-output
Browse files Browse the repository at this point in the history
chore: refactor output
  • Loading branch information
mihai-sysbio authored Nov 28, 2023
2 parents ef3cd8b + 7a93eca commit 29483b2
Show file tree
Hide file tree
Showing 10 changed files with 285 additions and 83 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
python -c 'import runner; runner.matrix()'
- name: Commit index of standard-GEMs
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_user_name: validation-bot
commit_message: update index of standard-GEMs
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

Expand All @@ -74,7 +74,7 @@ jobs:
run: git pull --ff

- name: Auto-commit results
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_user_name: validation-bot
commit_message: update validation results for ${{ matrix.gem }}
Expand Down
2 changes: 1 addition & 1 deletion index.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["SysBioChalmers/yeast-GEM", "SysBioChalmers/Human-GEM", "SysBioChalmers/Mouse-GEM", "SysBioChalmers/Fruitfly-GEM", "SysBioChalmers/Zebrafish-GEM", "SysBioChalmers/Sco-GEM", "iAMB-RWTH-Aachen/Opol-GSMM", "SysBioChalmers/Worm-GEM", "tibbdc/vna-GEM", "SysBioChalmers/Rat-GEM", "AlmaasLab/T66-GEM"]
["SysBioChalmers/yeast-GEM", "SysBioChalmers/Human-GEM", "SysBioChalmers/Mouse-GEM", "SysBioChalmers/Fruitfly-GEM", "SysBioChalmers/Zebrafish-GEM", "SysBioChalmers/Sco-GEM", "iAMB-RWTH-Aachen/Opol-GSMM", "SysBioChalmers/Worm-GEM", "SysBioChalmers/Rat-GEM", "tibbdc/vna-GEM", "AlmaasLab/T66-GEM"]
97 changes: 83 additions & 14 deletions results/AlmaasLab_T66-GEM.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,60 @@
{
"AlmaasLab/T66-GEM": [
{
"main": {
"standard-GEM": [
{
"0.4": true
},
{
"test_results": {
"cobrapy-load-json": {
"description": "Check if the model in JSON format can be loaded with cobrapy.",
"errors": "File missing",
"status": false,
"version": "0.26.2"
},
"cobrapy-load-matlab": {
"description": "Check if the model in Matlab format can be loaded with cobrapy.",
"errors": "File missing",
"status": false,
"version": "0.26.2"
},
"cobrapy-load-sbml": {
"description": "Check if the model in SBML format can be loaded with cobrapy.",
"errors": "",
"status": true,
"version": "0.26.2"
},
"cobrapy-load-yaml": {
"description": "Check if the model in YAML can be loaded with cobrapy.",
"errors": "\"while parsing a block mapping\\n in \\\"T66-GEM.yml\\\", line 51085, column 9\\nexpected <block end>, but found '<scalar>'\\n in \\\"T66-GEM.yml\\\", line 51085, column 18\"",
"status": false,
"version": "0.26.2"
},
"cobrapy-validate-sbml": {
"description": "Check with cobrapy if the model in SBML format is valid.",
"errors": "",
"status": true,
"version": "0.26.2"
},
"memote-score": {
"description": "Check the score of the model in SBML format with Memote.",
"errors": "",
"status": 0.48120642579796324,
"version": "0.13.0"
},
"yamllint": {
"description": "Check if the model in YAML format is formatted correctly.",
"errors": "[\"51085:18: syntax error: expected <block end>, but found '<scalar>' (syntax)\"]",
"status": false,
"version": "1.29.0"
}
}
}
]
}
},
{
"v0.1.0-alpha": {
"standard-GEM": [
Expand All @@ -9,32 +64,46 @@
{
"test_results": {
"cobrapy-load-json": {
"0.26.2": false,
"errors": "\"[Errno 2] No such file or directory: 'T66-GEM.json'\""
"description": "Check if the model in JSON format can be loaded with cobrapy.",
"errors": "File missing",
"status": false,
"version": "0.26.2"
},
"cobrapy-load-matlab": {
"0.26.2": false,
"errors": "\"[Errno 2] No such file or directory: 'T66-GEM.mat'\""
"description": "Check if the model in Matlab format can be loaded with cobrapy.",
"errors": "File missing",
"status": false,
"version": "0.26.2"
},
"cobrapy-load-sbml": {
"0.26.2": false,
"errors": "\"The file with 'T66-GEM.xml' does not exist, or is not an SBML string. Provide the path to an existing SBML file or a valid SBML string representation:\\n\""
"description": "Check if the model in SBML format can be loaded with cobrapy.",
"errors": "",
"status": true,
"version": "0.26.2"
},
"cobrapy-load-yaml": {
"0.26.2": false,
"errors": "\"[Errno 2] No such file or directory: 'T66-GEM.yml'\""
"description": "Check if the model in YAML can be loaded with cobrapy.",
"errors": "\"while parsing a block mapping\\n in \\\"T66-GEM.yml\\\", line 51085, column 9\\nexpected <block end>, but found '<scalar>'\\n in \\\"T66-GEM.yml\\\", line 51085, column 18\"",
"status": false,
"version": "0.26.2"
},
"cobrapy-validate-sbml": {
"0.26.2": false,
"errors": "\"The file with 'T66-GEM.xml' does not exist, or is not an SBML string. Provide the path to an existing SBML file or a valid SBML string representation:\\n\""
"description": "Check with cobrapy if the model in SBML format is valid.",
"errors": "",
"status": true,
"version": "0.26.2"
},
"memote-score": {
"0.13.0": false,
"errors": "\"The file with 'T66-GEM.xml' does not exist, or is not an SBML string. Provide the path to an existing SBML file or a valid SBML string representation:\\n\""
"description": "Check the score of the model in SBML format with Memote.",
"errors": "",
"status": 0.48120642579796324,
"version": "0.13.0"
},
"yamllint": {
"1.29.0": false,
"errors": "\"[Errno 2] No such file or directory: 'T66-GEM.yml'\""
"description": "Check if the model in YAML format is formatted correctly.",
"errors": "[\"51085:18: syntax error: expected <block end>, but found '<scalar>' (syntax)\"]",
"status": false,
"version": "1.29.0"
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions results/SysBioChalmers_Sco-GEM.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
"SysBioChalmers/Sco-GEM": [
{
"main": {
"standard-GEM": [
{
"0.4": false
},
{
"test_results": {}
}
]
}
},
{
"v1.3.1": {
"standard-GEM": [
Expand Down
97 changes: 83 additions & 14 deletions results/SysBioChalmers_yeast-GEM.json

Large diffs are not rendered by default.

54 changes: 40 additions & 14 deletions results/tibbdc_vna-GEM.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
"tibbdc/vna-GEM": [
{
"main": {
"standard-GEM": [
{
"0.4": false
},
{
"test_results": {}
}
]
}
},
{
"0.1": {
"standard-GEM": [
Expand All @@ -9,32 +21,46 @@
{
"test_results": {
"cobrapy-load-json": {
"0.26.2": false,
"errors": "\"[Errno 2] No such file or directory: 'vna-GEM.json'\""
"description": "Check if the model in JSON format can be loaded with cobrapy.",
"errors": "File missing",
"status": false,
"version": "0.26.2"
},
"cobrapy-load-matlab": {
"0.26.2": false,
"errors": "\"[Errno 2] No such file or directory: 'vna-GEM.mat'\""
"description": "Check if the model in Matlab format can be loaded with cobrapy.",
"errors": "File missing",
"status": false,
"version": "0.26.2"
},
"cobrapy-load-sbml": {
"0.26.2": false,
"errors": "\"The file with 'vna-GEM.xml' does not exist, or is not an SBML string. Provide the path to an existing SBML file or a valid SBML string representation:\\n\""
"description": "Check if the model in SBML format can be loaded with cobrapy.",
"errors": "\"The file with 'vna-GEM.xml' does not exist, or is not an SBML string. Provide the path to an existing SBML file or a valid SBML string representation:\\n\"",
"status": false,
"version": "0.26.2"
},
"cobrapy-load-yaml": {
"0.26.2": false,
"errors": "\"[Errno 2] No such file or directory: 'vna-GEM.yml'\""
"description": "Check if the model in YAML can be loaded with cobrapy.",
"errors": "File missing",
"status": false,
"version": "0.26.2"
},
"cobrapy-validate-sbml": {
"0.26.2": false,
"errors": "\"The file with 'vna-GEM.xml' does not exist, or is not an SBML string. Provide the path to an existing SBML file or a valid SBML string representation:\\n\""
"description": "Check with cobrapy if the model in SBML format is valid.",
"errors": "\"The file with 'vna-GEM.xml' does not exist, or is not an SBML string. Provide the path to an existing SBML file or a valid SBML string representation:\\n\"",
"status": false,
"version": "0.26.2"
},
"memote-score": {
"0.13.0": false,
"errors": "\"The file with 'vna-GEM.xml' does not exist, or is not an SBML string. Provide the path to an existing SBML file or a valid SBML string representation:\\n\""
"description": "Check the score of the model in SBML format with Memote.",
"errors": "\"The file with 'vna-GEM.xml' does not exist, or is not an SBML string. Provide the path to an existing SBML file or a valid SBML string representation:\\n\"",
"status": false,
"version": "0.13.0"
},
"yamllint": {
"1.29.0": false,
"errors": "\"[Errno 2] No such file or directory: 'vna-GEM.yml'\""
"description": "Check if the model in YAML format is formatted correctly.",
"errors": "\"[Errno 2] No such file or directory: 'vna-GEM.yml'\"",
"status": false,
"version": "1.29.0"
}
}
}
Expand Down
28 changes: 16 additions & 12 deletions runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
RELEASES = 5

header_auth = {'Authorization': 'token %s' % API_TOKEN}
additional_branch_tags = []
# additional_branch_tags = ['develop']
# additional_branch_tags = []
additional_branch_tags = ['main']

def gem_repositories():
json_request = {"query" : """
Expand Down Expand Up @@ -55,7 +55,7 @@ def releases(nameWithOwner):
release_tags = list(map(lambda x: x['node']['tagName'], json_data))
if not release_tags:
return []
return release_tags + additional_branch_tags
return additional_branch_tags + release_tags

def matrix():
m = json.dumps(list(gem_repositories()))
Expand All @@ -81,7 +81,7 @@ def validate(nameWithOwner):
standard_gem_releases = releases('MetabolicAtlas/standard-GEM')
last_standard = standard_gem_releases[len(standard_gem_releases)-1:]
for standard_version in last_standard:
print("{}: {} | Standard-GEM: {}".format(nameWithOwner, model_release, standard_version))
print("{}: {} | standard-GEM version: {}".format(nameWithOwner, model_release, standard_version))
gem_is_standard = gem_follows_standard(nameWithOwner, model_release, standard_version)
test_results = {}
if gem_is_standard:
Expand All @@ -91,16 +91,20 @@ def validate(nameWithOwner):
if response.ok:
with open(my_model, 'w') as file:
file.write(response.text)
test_results.update(tests.yaml.validate(model))
test_results.update(tests.cobra.loadYaml(model))
test_results.update(tests.cobra.loadSbml(model))
test_results.update(tests.cobra.loadMatlab(model))
test_results.update(tests.cobra.loadJson(model))
test_results.update(tests.cobra.validateSbml(model))
test_results.update(tests.memote.scoreAnnotationAndConsistency(model))
test_results.update(resultJSONString(tests.cobra.loadYaml, model))
test_results.update(resultJSONString(tests.cobra.loadSbml, model))
test_results.update(resultJSONString(tests.cobra.loadMatlab, model))
test_results.update(resultJSONString(tests.cobra.loadJson, model))
test_results.update(resultJSONString(tests.cobra.validateSbml, model))
test_results.update(resultJSONString(tests.yaml.validate, model))
test_results.update(resultJSONString(tests.memote.scoreAnnotationAndConsistency, 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))

def resultJSONString(testToRun, model):
testModule, description, moduleVersion, status, errors = testToRun(model)
return {testModule: { 'description': description, 'version': moduleVersion, 'status': status, 'errors': errors[:300] } }
Loading

0 comments on commit 29483b2

Please sign in to comment.