Created
August 31, 2022 07:25
-
-
Save russelljjarvis/8657ce17b9752017d23ba25c25a89de2 to your computer and use it in GitHub Desktop.
Get Fly Connectome.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
from tqdm.notebook import tqdm | |
import navis | |
import pickle | |
import os | |
import navis | |
import navis.interfaces.neuprint as neu | |
from neuprint import Client | |
import os | |
NC = neu.NeuronCriteria | |
client = neu.Client('https://neuprint.janelia.org', dataset='hemibrain:v1.1', token='redacted') | |
# First grab all neurons that have either pre- or postsynapses | |
# (we don't really care about neurons without connectivity for this analysis) | |
all_meta1, roi1 = neu.fetch_neurons(NC(min_post=1)) | |
all_meta2, roi2 = neu.fetch_neurons(NC(min_pre=1)) | |
# Combine above dataframes | |
all_roi = pd.concat([roi1, roi2], axis=0).drop_duplicates(['bodyId', 'roi']) | |
meta = pd.concat([all_meta1, all_meta2], axis=0).drop_duplicates('bodyId') | |
meta.tail(2) | |
os.system("mkdir flybrain") | |
export_dir="flybrain" | |
_, edges = neu.fetch_adjacencies(include_nonprimary=True, export_dir=export_dir, batch_size=200) | |
with open("drosophila_connectome.p","wb") as f: | |
pickle.dump(edges,f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment