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

get_network_ids_for_user not returning expected network_ids #78

Closed
ariutta opened this issue Jan 15, 2021 · 4 comments
Closed

get_network_ids_for_user not returning expected network_ids #78

ariutta opened this issue Jan 15, 2021 · 4 comments
Assignees
Labels
Milestone

Comments

@ariutta
Copy link

ariutta commented Jan 15, 2021

The method get_network_ids_for_user appears to be limited to 1000 network_ids.

Test Case for v3.3.1:

Query the test server http://test.ndexbio.org to see how many networks I own:

user_network_ids = my_ndex.get_network_ids_for_user("ariutta")
print(len(user_network_ids))

I'm getting back 1000, but the number should be much larger (over 30k).

@ariutta ariutta changed the title get_network_ids_for_user not returning expected network_ids get_network_ids_for_user not returning expected network_ids Jan 15, 2021
@coleslaw481 coleslaw481 self-assigned this Jan 15, 2021
@coleslaw481
Copy link
Contributor

Oh that is bad. thank you for catching this.

Under the hood get_network_ids_for_user() is simply calling get_user_network_summaries() which by default limits results returned to 1000 networks. I'll fix this, but in the meantime you can call get_user_network_summaries() and set the limit to a giant number like 1000000

Upon success, the result you get back from get_user_network_summaries() is a list of dict objects where each dict is a network. To get the network id simply get the value from the key externalId.

Here is example code that puts all the network ids into the list my_uuids:

res = my_ndex.get_user_network_summaries('ariutta', limit=1000000)

my_uuids = []
for entry in res:
   my_uuids.append(entry['externalId'])

NOTE: get_user_network_summaries() shows not only networks owned by user, but also any networks directly shared with the user.

@coleslaw481 coleslaw481 modified the milestones: 3.3.2, 3.3.3, 3.4.0 Apr 1, 2021
@coleslaw481
Copy link
Contributor

Fixed in branch3.4.0 by updating documentation and adding offset and limit parameters to let caller choose to get more then 1,000 results or to get results via paginations.

coleslaw481 added a commit that referenced this issue May 3, 2021
… switched NiceCXNetwork.upload_to() and NiceCXNetwork.update_to() to named args and added client parameter #80 and #81, Fixed documentation in NiceCXNetwork.update_to() to denote return value #82, Added Ndex2.get_user_by_id(), Added Ndex2.get_id_for_user(), Added Ndex2.get_networksets_for_user_id() #61
@coleslaw481
Copy link
Contributor

Version with offsets and limit parameter Currently available to try as an alpha version by running pip install ndex2==3.4.0a1 For usage see: https://ndex2.readthedocs.io/en/latest/ndex2client.html#ndex2.client.Ndex2.get_network_ids_for_user

@coleslaw481
Copy link
Contributor

ndex2 version 3.4.0 formally released. Can be installed via pip install ndex2

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

No branches or pull requests

2 participants