-
Notifications
You must be signed in to change notification settings - Fork 210
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 #32 from dvklopfenstein/master
Create test prior to modifying any code
- Loading branch information
Showing
3 changed files
with
24 additions
and
11 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,23 @@ | ||
|
||
from goatools.obo_parser import GODag | ||
import sys | ||
|
||
def chk_results(actual_paths, expected_paths): | ||
for actual_path in actual_paths: | ||
# GOTerm -> list of Strings | ||
actual = [GO.id for GO in actual_path] | ||
if actual not in expected_paths: | ||
raise Exception('ACTUAL {} NOT FOUND IN EXPECTED RESULTS\n'.format(actual)) | ||
|
||
def test_paths_to_top(): | ||
dag = GODag("./data/mini_obo.obo") | ||
expected_paths = [ | ||
['GO:0000001', 'GO:0000002', 'GO:0000005', 'GO:0000010'], | ||
['GO:0000001', 'GO:0000003', 'GO:0000005', 'GO:0000010'], | ||
['GO:0000001', 'GO:0000003', 'GO:0000006', 'GO:0000008', 'GO:0000010'] ] | ||
actual_paths = dag.paths_to_top("GO:0000010") | ||
chk_results(actual_paths, expected_paths) | ||
|
||
|
||
if __name__ == '__main__': | ||
test_paths_to_top() |