-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added ability to include nodes marked as obsolete #15
Changes from 2 commits
11a16d5
94b1c72
a41940f
eccf8b4
bba4310
159001f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,9 @@ def test_read_taxrank_file(): | |
with open(path, 'rt') as read_file: | ||
taxrank = obonet.read_obo(read_file) | ||
assert len(taxrank) == 61 | ||
assert taxrank.node['TAXRANK:0000001']['name'] == 'phylum' | ||
assert 'NCBITaxon:kingdom' in taxrank.node['TAXRANK:0000017']['xref'] | ||
# It looks like networkx has changed the name of the node variable to nodes -- EST 2020-09-25 | ||
assert taxrank.nodes['TAXRANK:0000001']['name'] == 'phylum' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like neworkx 2.4 removed not sure why Travis CI builds are not showing up on GitHub for this pull request, but see the failures at https://travis-ci.org/github/dhimmel/obonet/builds/730420444. We support both networkx 1.x and 2.x. You could add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original (taxrank.node) fails with networkx 2.5:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
yes. we should change to using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. taxrank.node fails for me when using networkx 2.5, but I left the failing test as it was originally. |
||
assert 'NCBITaxon:kingdom' in taxrank.nodes['TAXRANK:0000017']['xref'] | ||
|
||
|
||
@pytest.mark.parametrize('extension', ['', '.gz', '.bz2', '.xz']) | ||
|
@@ -118,3 +119,15 @@ def test_parse_tag_line_backslashed_exclamation(): | |
tag, value, trailing_modifier, comment = parse_tag_line(line) | ||
assert tag == 'synonym' | ||
assert value == r'not a real example \!' | ||
|
||
def test_ignore_obsolete_nodes(): | ||
hpo = obonet.read_obo("http://purl.obolibrary.org/obo/hp.obo") | ||
nodes = hpo.nodes(data=True) | ||
assert "HP:0005549" not in nodes | ||
|
||
def test_presence_of_obsolete_nodes(): | ||
hpo = obonet.read_obo("http://purl.obolibrary.org/obo/hp.obo", ignore_obsolete=False) | ||
nodes = hpo.nodes(data=True) | ||
assert "HP:0005549" in nodes | ||
node = nodes['HP:0005549'] | ||
assert node['is_obsolete'] == 'true' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice tests.
One easy way might be to add the following to
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps keep
is_obsolete = term.get('is_obsolete', 'false') == 'true'
but change the next line to: