Skip to content
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

G.dump_nodes doesn't respect defaults #224

Open
redst4r opened this issue Aug 27, 2023 · 0 comments
Open

G.dump_nodes doesn't respect defaults #224

redst4r opened this issue Aug 27, 2023 · 0 comments

Comments

@redst4r
Copy link

redst4r commented Aug 27, 2023

Hi,

I just noticed that the default values of Graph.dump_nodes() mentioned in the docs are different than what the code acutally does.
From the python docs:

> G.dump_nodes?
...
verbose: bool = True
    Wether to show a loading bar while writing to file.
separator: str = '\t'
    What separator to use while writing out to file.
header: bool = True
    Wether to write out the header of the file.
nodes_column_number: int = 0
    The column number where to write the nodes.
nodes_column: str = "id"
    The name of the column of the nodes.
node_types_column_number: int = 1
    The column number where to write the node types.
node_type_column: str = "category"
    The name of the column of the node types.

At least I assumed those are defaults specified after the parameter names.

Turns out that if you run

# Just using Hetionet as an example here
from grape.datasets.hetionet import Hetionet
G = Hetionet()
G.dump_nodes('/tmp/node.tsv')

you actually get this:

> head /tmp/nodes.tsv
node_name
Anatomy::UBERON:0000002
Anatomy::UBERON:0000004
...
...

whereas I'd expect (from the defaults):

id    category
Anatomy::UBERON:0000002   Anatomy
...
  • the nodes_column defaults to node_name instead of id
  • the node_type_column is supposed to default to category, but the node type column is missing altogether

Not a big issue, but confusing behavior at first!
Thanks for this great software package!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant