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

TypeError when trying to fetch connectors #217

Closed
bdpedigo opened this issue Apr 4, 2022 · 3 comments
Closed

TypeError when trying to fetch connectors #217

bdpedigo opened this issue Apr 4, 2022 · 3 comments

Comments

@bdpedigo
Copy link

bdpedigo commented Apr 4, 2022

Hi @schlegelp - currently having some trouble with trying to pull some connectivity data from the FANC dataset (which I believe is public and I should not need any credentials for?).

I created a fresh environment and re-installed latest pymaid.

Code I'm trying to run

import pymaid

print("pymaid version:")
print(pymaid.__version__)
print()

pymaid.CatmaidInstance(
    server="https://fanc.catmaid.virtualflybrain.org/", api_token=None
)

skids = pymaid.get_skids_by_annotation("Paper: Phelps, Hildebrand, Graham et al. 2020")
print("# fetched neurons:")
print(len(skids))
print()

connectors = pymaid.get_connectors(skids)

Output

pymaid version:
2.0.6

INFO  : Global CATMAID instance set. Caching is ON. (pymaid)
# fetched neurons:
1198

Traceback (most recent call last):
  File "/Users/bpedigo/JHU_code/maggot_models/maggot_models/notebooks/try_pull_vnc.py", line 17, in <module>
    connectors = pymaid.get_connectors(skids)
  File "/Users/bpedigo/miniconda3/envs/test-pymaid/lib/python3.9/site-packages/pymaid/cache.py", line 316, in wrapper
    res = function(*args, **kwargs)
  File "/Users/bpedigo/miniconda3/envs/test-pymaid/lib/python3.9/site-packages/pymaid/fetch.py", line 1247, in get_connectors
    user_list = get_user_list(remote_instance=remote_instance)
  File "/Users/bpedigo/miniconda3/envs/test-pymaid/lib/python3.9/site-packages/pymaid/cache.py", line 316, in wrapper
    res = function(*args, **kwargs)
  File "/Users/bpedigo/miniconda3/envs/test-pymaid/lib/python3.9/site-packages/pymaid/fetch.py", line 3724, in get_user_list
    df = pd.DataFrame([[e[c] for c in columns] for e in user_list],
  File "/Users/bpedigo/miniconda3/envs/test-pymaid/lib/python3.9/site-packages/pymaid/fetch.py", line 3724, in <listcomp>
    df = pd.DataFrame([[e[c] for c in columns] for e in user_list],
  File "/Users/bpedigo/miniconda3/envs/test-pymaid/lib/python3.9/site-packages/pymaid/fetch.py", line 3724, in <listcomp>
    df = pd.DataFrame([[e[c] for c in columns] for e in user_list],
TypeError: string indices must be integers

Any ideas right away as to what could be causing this, or am I using pymaid incorrectly? If nothing jumps out to you I'm happy to look into it further. Looks like something related to pymaid user so I'm guessing I am just not logged in properly or something?

@bdpedigo
Copy link
Author

bdpedigo commented Apr 4, 2022

Update - this does work:

neurons = pymaid.find_neurons(
    annotations="Paper: Phelps, Hildebrand, Graham et al. 2020"
)
pymaid.adjacency_matrix(neurons)

so maybe specific to the get_connectors function? Individual connectors aren't that important for me right now so I think this will work, but still curious about how to use that properly

@schlegelp
Copy link
Collaborator

Hi Ben! Your minimal example works for me. Best guess is that this is an issue with missing user data (that data is scrubbed for release on public CATMAID instances). I fixed a few bugs there a while ago (see e.g. b7661e4) but haven't pushed a new release since.

With that said: I just released pymaid 2.1.0 which includes this fix. Let me know if that does it for you.

Two side notes:

  1. This new release now supports (and requires) navis >= 1.0.0 which came with a couple renamed functions
  2. With this release the default max_threads for CatmaidInstance went down from 100 to 10 to avoid connection warnings with the sometimes slower public CATMAID servers. If you server/internet connection supports that, you can of course go back up again.

@bdpedigo
Copy link
Author

bdpedigo commented Apr 4, 2022

Awesome, with that release this looks to be working now. Thanks for the help!

@bdpedigo bdpedigo closed this as completed Apr 4, 2022
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

2 participants