Open wrgr opened 5 months ago
@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))
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