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

Witvilet Connectome linking #115

Open
wrgr opened this issue Mar 29, 2024 · 1 comment
Open

Witvilet Connectome linking #115

wrgr opened this issue Mar 29, 2024 · 1 comment
Assignees

Comments

@wrgr
Copy link

wrgr commented Mar 29, 2024

Would it be possible to add links to connectomes hosted externally to boss or to mirror them in a standardized format? I think it would be a great asset for reusability. We are running into challenges in doing secondary data analysis in an academic class. Thanks!!

For example: Witvilet 2020 has graph data, but is hosted externally. Would be nice to have it more accessible and clearly linked. (E.g., a connectome block with a pointer to the paper supplementary files. Thanks!!!

https://www.nature.com/articles/s41586-021-03778-8

@j6k4m8
Copy link
Member

j6k4m8 commented Mar 29, 2024

@wrgr Definitely! This is on our roadmap as the metadata service converges on complete; in the meantime we host these data (immutably) in a standardized form in Motif Studio. Exhaustive API docs here, but here's a short Python script to download the latest:

import requests
hosts = requests.get("https://api.motifstudio.bossdb.org/providers/hostlist").json()['hosts']

Each graph has a name and an ID:

>>> hosts[0]
{'name': 'Witvliet et al. 2020, Dataset 1', 'id': 'Witvliet_1'}

You can request graphs in a few different formats like graphml or gexf:

graph_raw = requests.post(
    "https://api.motifstudio.bossdb.org/queries/graph/download", 
    json={"host_id": hosts[0]['id'], "format": "graphml"}
)

This can be written to a file,

with open(f"{hosts[0]['id']}.graphml", "wb") as f:
    f.write(graph_raw.content)

...or materialized in, say, a graph library like NetworkX:

import io
import networkx as nx

G = nx.read_graphml(io.BytesIO(graph.content))

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

3 participants