-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from ExposuresProvider/add-testing
This PR adds a test suite in Python for CAM-KP-API to cam-pipeline. Some of this code has been moved over from https://github.com/ExposuresProvider/cam-kp-api and the rest has been newly written for this. There are three tests here: - test_api.py: test the Automat-CAM-KP API endpoints. - test_examples.py: tests the example files in `examples/`. - test_curies.py: test a set of CURIEs to see if Automat-CAM-KP has information or not about them. This currently includes failing tests from #101 I tried to move over the integration tests from CAM-KP-API, but I couldn't work out the easiest way to figure out how to move them over as a Scala project. I think these Python tests are easier to read and maintain, but I'm happy to be proved wrong. Closes #94
- Loading branch information
Showing
13 changed files
with
3,135 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,4 @@ | ||
# Used only by the Python testing code in `tests/`. | ||
pytest | ||
requests | ||
black |
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,42 @@ | ||
{ | ||
"meta": { | ||
"description": "Chemicals affected by gene Photoreceptor Disc Component (PRCD, NCBIGene:768206)" | ||
}, | ||
"query": { | ||
"message": { | ||
"query_graph": { | ||
"nodes": { | ||
"gene": { | ||
"categories": [ | ||
"biolink:Gene" | ||
], | ||
"ids": [ | ||
"NCBIGene:768206" | ||
] | ||
}, | ||
"chemical": { | ||
"categories": [ | ||
"biolink:ChemicalEntity" | ||
] | ||
} | ||
}, | ||
"edges": { | ||
"t_edge": { | ||
"object": "gene", | ||
"subject": "chemical", | ||
"predicates": [ | ||
"biolink:affects" | ||
], | ||
"knowledge_type": "inferred" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"assertions": [ | ||
{ | ||
"type": "ExpectedResultCounts", | ||
"min": 17 | ||
} | ||
] | ||
} |
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,43 @@ | ||
{ | ||
"meta": { | ||
"description": "Chemicals decreasing the activity of epidermal growth factor receptor (NCBIGene:1956)" | ||
}, | ||
"query": { | ||
"message": { | ||
"query_graph": { | ||
"nodes": { | ||
"n0": { | ||
"name": "Chemical Entity", | ||
"categories": [ | ||
"biolink:ChemicalEntity" | ||
] | ||
}, | ||
"n1": { | ||
"name": "EGFR", | ||
"ids": [ | ||
"NCBIGene:1956" | ||
], | ||
"categories": [ | ||
"biolink:Gene" | ||
] | ||
} | ||
}, | ||
"edges": { | ||
"e0": { | ||
"subject": "n1", | ||
"object": "n0", | ||
"predicates": [ | ||
"biolink:affects" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"assertions": [ | ||
{ | ||
"type": "ExpectedResultCounts", | ||
"min": 35 | ||
} | ||
] | ||
} |
53 changes: 53 additions & 0 deletions
53
tests/examples/genes-affecting-genes-found-in-leukocytes.json
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,53 @@ | ||
{ | ||
"meta": { | ||
"description": "Find genes that affect the activity of ‘GPR35’, specifically occurring within leukocytes (CL:0000738)" | ||
}, | ||
"query": { | ||
"message": { | ||
"query_graph": { | ||
"nodes": { | ||
"n0": { | ||
"categories": [ | ||
"biolink:GeneOrGeneProduct" | ||
] | ||
}, | ||
"n1": { | ||
"categories": [ | ||
"biolink:GeneOrGeneProduct" | ||
] | ||
}, | ||
"n2": { | ||
"categories": [ | ||
"biolink:AnatomicalEntity" | ||
], | ||
"ids": [ | ||
"CL:0000738" | ||
] | ||
} | ||
}, | ||
"edges": { | ||
"e0": { | ||
"subject": "n0", | ||
"object": "n1", | ||
"predicates": [ | ||
"biolink:affects" | ||
] | ||
}, | ||
"e1": { | ||
"subject": "n1", | ||
"object": "n2", | ||
"predicates": [ | ||
"biolink:overlaps" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"assertions": [ | ||
{ | ||
"type": "ExpectedResultCounts", | ||
"min": 5 | ||
} | ||
] | ||
} |
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,35 @@ | ||
{ | ||
"meta": { | ||
"description": "Half the genetic pathway 'positive control' from the June 2022 Relay at https://docs.google.com/presentation/d/1V_K_bgyLWEP2neTdM0TD7Bs-GtJUmqCt8p6BzWTv96s/edit?pli=1#slide=id.p" | ||
}, | ||
"query": { | ||
"message": { | ||
"query_graph": { | ||
"nodes": { | ||
"n0": { | ||
"ids": [ | ||
"NCBIGene:5468" | ||
] | ||
}, | ||
"n1": { | ||
"categories": [ | ||
"biolink:BiologicalProcess" | ||
] | ||
} | ||
}, | ||
"edges": { | ||
"e01": { | ||
"object": "n0", | ||
"subject": "n1" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"assertions": [ | ||
{ | ||
"type": "ExpectedResultCounts", | ||
"min": 8 | ||
} | ||
] | ||
} |
44 changes: 44 additions & 0 deletions
44
tests/examples/molecular-activity-with-valproic-acid-as-input.json
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,44 @@ | ||
{ | ||
"meta": { | ||
"description": "Molecular activity that has valproic acid (PUBCHEM.COMPOUND:3121) as an input" | ||
}, | ||
"query": { | ||
"message": { | ||
"query_graph": { | ||
"nodes": { | ||
"n0": { | ||
"categories": [ | ||
"biolink:MolecularActivity" | ||
] | ||
}, | ||
"n1": { | ||
"ids": [ | ||
"PUBCHEM.COMPOUND:3121" | ||
] | ||
} | ||
}, | ||
"edges": { | ||
"e0": { | ||
"subject": "n0", | ||
"object": "n1", | ||
"predicates": [ | ||
"biolink:has_input" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"assertions": [ | ||
{ | ||
"type": "ExpectedResultCounts", | ||
"min": 1 | ||
}, | ||
{ | ||
"type": "ExpectedNodeResults", | ||
"node": "n0", | ||
"resultEquals": ["GO:0005488"], | ||
"description": "Expected binding (GO:0005488) to have valproic acid (PUBCHEM.COMPOUND:3121) as an input." | ||
} | ||
] | ||
} |
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,44 @@ | ||
{ | ||
"meta": { | ||
"description": "Named things related to pyruvate (PUBCHEM.COMPOUND:107735)" | ||
}, | ||
"query": { | ||
"message": { | ||
"query_graph": { | ||
"nodes": { | ||
"n0": { | ||
"categories": [ | ||
"biolink:Protein" | ||
] | ||
}, | ||
"n1": { | ||
"ids": [ | ||
"PUBCHEM.COMPOUND:107735" | ||
] | ||
} | ||
}, | ||
"edges": { | ||
"e0": { | ||
"subject": "n0", | ||
"object": "n1", | ||
"predicates": [ | ||
"biolink:interacts_with" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"assertions": [ | ||
{ | ||
"type": "ExpectedResultCounts", | ||
"min": 6 | ||
}, | ||
{ | ||
"type": "ExpectedNodeResults", | ||
"node": "n0", | ||
"resultEquals": ["UniProtKB:P21796", "UniProtKB:P26297", "UniProtKB:Q9BYZ2", "UniProtKB:Q1EHB4", | ||
"UniProtKB:P11498", "UniProtKB:Q8N695"] | ||
} | ||
] | ||
} |
41 changes: 41 additions & 0 deletions
41
tests/examples/what-gene-product-is-part-of-the-plasma-membrane.json
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,41 @@ | ||
{ | ||
"meta": { | ||
"description": "What gene or gene product is part of the plasma membrane?" | ||
}, | ||
"query": { | ||
"message": { | ||
"query_graph": { | ||
"nodes": { | ||
"n0": { | ||
"categories": [ | ||
"biolink:GeneOrGeneProduct" | ||
] | ||
}, | ||
"n1": { | ||
"categories": [ | ||
"biolink:AnatomicalEntity" | ||
], | ||
"ids": [ | ||
"GO:0005886" | ||
] | ||
} | ||
}, | ||
"edges": { | ||
"e0": { | ||
"subject": "n0", | ||
"object": "n1", | ||
"predicates": [ | ||
"biolink:part_of" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"assertions": [ | ||
{ | ||
"type": "ExpectedResultCounts", | ||
"min": 10 | ||
} | ||
] | ||
} |
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,44 @@ | ||
{ | ||
"meta": { | ||
"description": "What regulates MAP kinase activity (GO:0004707)?" | ||
}, | ||
"query": { | ||
"message": { | ||
"query_graph": { | ||
"nodes": { | ||
"n0": { | ||
"categories": [ | ||
"biolink:NamedThing" | ||
] | ||
}, | ||
"n1": { | ||
"ids": [ | ||
"GO:0004707" | ||
] | ||
} | ||
}, | ||
"edges": { | ||
"e0": { | ||
"predicates": [ | ||
"biolink:regulates" | ||
], | ||
"subject": "n0", | ||
"object": "n1" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"assertions": [ | ||
{ | ||
"type": "ExpectedResultCounts", | ||
"min": 85 | ||
}, | ||
{ | ||
"type": "ExpectedNodeResults", | ||
"node": "n0", | ||
"resultIncludes": ["GO:0004708", "GO:0004709"], | ||
"description": "MAP kinase activity (GO:0004707) is regulated by MAP kinase kinase activity (GO:0004708) and MAP kinase kinase kinase activity (GO:0004709)" | ||
} | ||
] | ||
} |
Oops, something went wrong.