sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1740dc7388dbabe7ec090cbe8e8424172b3a9b005b9b73fd96abaae65b244195
Jupyter
415
23
# %% import numpy as np import matplotlib.pyplot as plt %matplotlib inline # %% n = np.reshape(np.arange(1,100),(-1,1)) N = np.reshape(np.array([10,50,150,300]),(1,-1)) v = (2*n + 1/n)/(3*(N-n+1)) rel_err = np.sqrt(v) # %% for i, N_ in enumerate(N[0]): plt.plot(n[n[:,0] < N_],rel_err[:,i][n[:,0] < N_],label="$N =...
f0ec67798a768456e3fd870069c065a2214aa9352f7c363a01c4d7ae5e877b7f
Jupyter
417
13
# %% [markdown] # #### This notebook navigates you through the pipeline of VCD-LFM. # # There are three notebooks to go through in total: # 1. [datapre](./datapre/datapre.ipynb) for dataset generation # 2. [train_demo](./vcdnet/train_demo.ipynb) for model training # 3. [predict_demo](./vcdnet/predict_demo.ipynb) for...
ec45529e637bc0d8a03f965536cde0e9e1b4ca77e538799742b86498501c1384
Jupyter
462
17
# %% [markdown] # # Running Models on Graph Datasets # %% import torch from graphxai.datasets import Benzene # %% # Location of benzene.npz file (downloaded from Harvard Dataverse) data_path = '../graphxai/datasets/real_world/benzene/benzene.npz' dataset = Benzene(split_sizes = (0.75, 0.05, 0.2), data_path = data_pat...
55a3ae21f63693e58b2ec17f2a578f077e7b0f0c31419a4923150e8f1bb70cf4
Jupyter
553
21
# %% [markdown] # # GCPDS - visualizations # %% [markdown] # ## Installation # %% pip install -U git+https://github.com/UN-GCPDS/python-gcpds.visualizations.git # %% [markdown] # <div class='gcpds-images0'> # # [![Brain connectivities](_images/conn.png)](notebooks/01-connectivity_circosplot.html) # # [![Accuracy a...
ef6d7d7de6f3ab6fc638f85d79c4980ef81e142c61f3a173c841e0c37285bcc0
Jupyter
565
31
# %% import navis # Load example neurons nl = navis.example_neurons() # %% # Without parallel processing %time res = navis.resample_neuron(nl, resample_to=125) # %% # With parallel processing (by default uses half the available cores) %time res = navis.resample_neuron(nl, resample_to=125, parallel=True) # %% %time ...
922f6f230ba2b2f50a8e755b5eca5398ebffb0f24c87771f7d504b90f7a29f4e
Jupyter
567
35
# %% import numpy as np import pandas as pd # %% mouse = 'ERAB23_1b' file = f'/camp/lab/rancze/working/tranvaa/brainsaw/classification/{mouse}/channel_1_inputs_v5_thr8/analysis/all_points.csv' df = pd.read_csv(file) # %% df.head() # %% df[(df.iloc[:,0:5] < 0).all(1)] # %% df[df['hemisphere'] == 'right'].max() # %...
6f5d868db4f064d46fe78b1d758581f24950287516c5b79bcb55471116bf377a
Jupyter
579
27
# %% %load_ext autoreload %autoreload 2 from palmari.processing import * from palmari import Experiment, ImagePipelineWidget %matplotlib inline %config InlineBackend.figure_format = 'retina' # %% class MyExp(Experiment): @property def custom_fields(self): return {"cell_zone":-2,"exp":-3,"condition":-4...
0284f5269e1d76177c3a4a1df8f7b0e637abeb7e418396244c8bd0851e0f9a8f
Jupyter
585
24
# %% [markdown] # ## Imports # %% from plot_metrics import plot_metrics # %% [markdown] # ## Input your files # %% files = [ "/home/arlapin/DeepCT_outputs/new_sampler_0008/selene_sdk.train_model.validation.txt", "/home/arlapin/DeepCT_outputs/new_sampler_00008/selene_sdk.train_model.validation.txt", "/hom...
6222f6341088a5850576968ed7b348020dae52bb54e3964becceec3d01f69c4b
Jupyter
599
47
# %% import navis n = navis.example_neurons(n=1, kind='skeleton') n # %% n.nodes.head() # %% help(navis.TreeNeuron.root) # %% help(navis.TreeNeuron.downsample) # %% # Downsample and return a copy of the original (default) n_ds = n.downsample(10) # Downsample the original neuron n_ds2 = n.copy() n_ds2.downsample(1...
24b0c27bcc7ba742e082bb4bd2daab1e0a88447ca0c153675194a01f4f1eab81
Jupyter
603
21
# %% from mmdet.apis import init_detector, inference_detector, show_result_pyplot import mmcv # %% config_file = '../configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py' # download the checkpoint from model zoo and put it in `checkpoints/` checkpoint_file = '../checkpoints/faster_rcnn_r50_fpn_1x_20181010-3d1b3351.pth' ...
7cfdcd04f8588048249094f3d5a8205059b5a36625429efc356bcb574779c18e
Jupyter
618
34
# %% %load_ext autoreload %autoreload 2 # %% import os import shutil import sys from tqdm.notebook import tqdm module_path = os.path.abspath(os.path.join('..')) if module_path not in sys.path: sys.path.append(module_path) from scripts import dl_utils # %% # User inputs roi = 'algeria' roi_file = f'../data/b...
fa2d307fde07eb3f69872051855664e7cc73bf756f4e5476d6784f34bca745e0
Jupyter
634
24
# %% import numpy as np import os # %% jer_sweep_name = '/media/thijs/hooghoudt/new_sweep_april20/RBM_sweep_21_04_2020/' thijs_sweep_name = '/media/thijs/hooghoudt/new_sweep_april20/RBM_sweep_Thijs/' # %% jer_files = os.listdir(jer_sweep_name) thijs_files = os.listdir(thijs_sweep_name) jer_ts = [x.split('_')[-1].lst...
ee7a74e913562e3868e7dde914d3b20879aba8e7a1fcf4858980111ef158136a
Jupyter
664
27
# %% import pandas as pd import warnings warnings.filterwarnings('ignore') # %% to_be_clean = pd.read_excel('dockingResults_ROR_gamma_SYBA_selected.xlsx') # %% to_be_clean.head() # %% to_be_clean['7npc'][0][1:5] # %% new_dataframe = pd.DataFrame(to_be_clean['smiles']) # %% new_dataframe['7npc'] = [to_be_clean['7np...
291439fbd049ed488bd7bbbb281d99797ab905abbf7e3379d75de85a1c8374b9
Jupyter
668
26
# %% import geopandas as gpd import pandas as pd # %% fn = 'negative_sites' csv = pd.read_csv(f'../../data/sampling_locations/{fn}.csv', converters={'coords': eval}) gdf = gpd.GeoDataFrame(csv['name'], geometry=gpd.points_from_xy([coord[0] for coord in csv['coords']], [coord[1] for coord in csv['coords']])) for name i...
aa442cbe1ad1a0e5c65a6b1122f18a015b29929c1e9b5261a129df517c655d73
Jupyter
673
18
# %% from scripts import dl_utils from descarteslabs.catalog import Image, properties # %% region = 'australia' product_id = f'earthrise:{region}_v0.0.11_2019-01-01_2021-06-01' search = Image.search().filter(properties.product_id == product_id) image_list = [image.id for image in search] image_keys = [k.split(':')[-1...
dccf47903dcee85cef5239d034d90c707c60f92aa4ff9c9da58f62b9e959d627
Jupyter
674
32
# %% [markdown] # # OAK obsoletes command # # This notebook is intended as a supplement to the [main OAK CLI docs](https://incatools.github.io/ontology-access-kit/cli.html). # # This notebook provides examples for the `obsoletes` command, which shows all obsolete entities in an ontology, # plus associated metadata # ...
6a63b23ff3261b8c4234058c14991df073d75d91e5dfcec9bf2275047819a960
Jupyter
679
33
# %% # Import neuprint wrapper by navis import navis.interfaces.neuprint as neu # %% client = neu.Client('https://neuprint.janelia.org/', dataset='hemibrain:v1.1') # %% mbons, roi_info = neu.fetch_neurons(neu.SegmentCriteria(instance='.*MBON.*', regex=True)) mbons.head(3) # %% mb = neu.fetch_roi('MB(R)') mb # %% mb...
2167ad5454593fa7b4bd80c19ef612ec3a758c3cfad7a8cb52b8989729e78bd2
Jupyter
721
32
# %% [markdown] # ## Loading from obo files using Pronto # %% from oaklib.implementations.ubergraph.ubergraph_implementation import UbergraphImplementation from oaklib.resource import OntologyResource # %% [markdown] # ### Remote (downloading from OBO) # # Next we use pronto's load from obo library feature # %% oi ...
3d90dbd9a6ad875a1093bfdc8481f7c99d583af92a658df40c9754e7b8798e6a
Jupyter
791
28
# %% import sys sys.path.insert(0, '../src') import numpy as np import roboscientist.equation.equation as rs_equation from experiments import run_experiment # %% [markdown] # This notebook shows how to recover equation from Nguyen benchmark using RoboScientist algorithm. # $ Nguyen_1 = x ^ 3 + x ^ 2 + x$ # %% X = ...
e451709f5504d0286c92ff21dc13de72131a748cfb0db9b48a1ac80ac32f8000
Jupyter
799
27
# %% import visualkeras from tensorflow import keras from PIL import ImageFont # %% model_name = 'weak_labels_3.0_batchnorm' model = keras.models.load_model(f'../../models/{model_name}.h5') #model = keras.Model(input_img, encoded) font = ImageFont.truetype("/Users/ckruse/Library/Fonts/Montserrat-SemiBold.ttf", 16) ...
eec5c7eb00f7ea6a80a8df2d342e3519c008fc9ea8caabc4b9d3763aff22675c
Jupyter
811
34
# %% import numpy as np import matplotlib.pyplot as plt # %% lengths_1 = np.random.randint(7,24,size=1000) lengths_2 = np.random.randint(8,18,size=100) # %% def get_target_lengths(L1, L2): sorted_L1 = np.sort(L1) sorted_L2 = np.sort(L2) M = max(L1.shape[0],L2.shape[0]) for i in range(M): ...
226c03391b335fa660264b1160f3acaa59f18929c424c04115f3de98e83e7367
Jupyter
849
42
# %% from polychrom.hdf5_format import list_URIs, load_URI from polychrom.contactmaps import monomerResolutionContactMap, monomerResolutionContactMapSubchains, binnedContactMap from multiprocessing import Pool import glob from polychrom import polymerutils import numpy as np # %% # %% URIs = list_URIs("trajectory...
363bb37a61879c677fef56a4b3ddf2c8fb3e6ba0992dacfec925ef5a3cd222b8
Jupyter
853
27
# %% import pandas as pd home_pth = '/home/thurs/DeepCT/DeepCT_outputs/biox/ct_v2/dnase/multi_ct/masked_train_LR0001_folds_shuffle/fold_00/' validation_metrics = pd.read_csv(home_pth+'src.train.train_kfold.validation_metrics.txt', sep='\t', header=0, # names=['loss', 'average_precision', 'baseline'] )....
7ffc2e8f2baed7aa2c043909d4b85fdbe97be24ffdd8524c91961943367f908e
Jupyter
886
28
# %% import geopandas as gpd import requests import pandas as pd import country_converter # %% endpoint = 'http://api.plastic.watch.earthrise.media/sites?limit=10000' response = requests.get(endpoint, params={'apikey': 'jahsdbvjahsdvaulhsdvoauysdg82973bq'}) data = response.json() data = gpd.GeoDataFrame.from_features(...
4c0a8f21f166ebbd17811533c13dc1853098d22915ee32ac58192b38de5e34e7
Jupyter
907
40
# %% import os import sys import numpy as np from skimage.io import imread import matplotlib.pyplot as plt sys.path.append('..') # %% from keras.applications.imagenet_utils import decode_predictions from efficientnet.keras import EfficientNetB0 from efficientnet.keras import center_crop_and_resize, preprocess_input ...
99367f3ad2ad328add560cac545f5531599e5769e1ca1d2a333b4bc74324c689
Jupyter
907
38
# %% import sys import os if sys.platform == 'darwin': import multiprocessing else: import psutil import numpy as np import pandas as pd import itertools #install as more-itertools from pathlib import Path import networkx as nx from networkx.algorithms import bipartite import pickle #already part of standa...
b88ad3a1cf4f231f7c8fecbe096bac7ba0cf46ad54f37c8b06ec144d3fdce2e1
Jupyter
917
39
# %% import numpy as np import matplotlib from matplotlib import pyplot as plt # %% # import sys # import os # os.environ['WINGHOME'] = '/usr/local/lib/wingpro9' # sys.path.append(os.getenv('WINGHOME]')) # import wingdbstub # wingdbstub.Ensure() # %% [markdown] # # EEG topoplots # %% from gcpds.visualizations.topo...
cdd0708bd179943c27a55935d24d482fad1ca848198163dbed95562a50e28c74
Jupyter
928
41
# %% import pandas as pd # %% generated_smi1 = pd.read_excel('Selected_molecules_from_0_1_tensor_scaling.xlsx') # %% generated_smi2 = pd.read_excel('Selected_molecules_from_0_2_tensor_scaling.xlsx') # %% concate = (generated_smi1, generated_smi2) # %% whole_generated_and_selected_data = pd.concat(concate) # %% who...
e929f01ec57d8b376c56b58d49476c94ce0b73259982ae79db93389d5f265b5e
Jupyter
943
40
# %% import geopandas as gpd import shapely # %% java = gpd.read_file('/Users/ckruse/Downloads/west_java.geojson') java = java['geometry'][0] # %% contours = gpd.read_file('../data/model_outputs/site_contours/v2.1/indonesia_v0_mask_window_8_upsampled_4_contours_model_v0.0.11_ensemble-8-25-21.geojson') # %% contours....
0539af5c1d9cbc385158afcacdf2a1657a1096c55ef00591bcf5e1281cb4eee0
Jupyter
969
48
# %% #Read the relation2id file R = {} with open('relation2id.txt','r') as flr: line=flr.readline() line=flr.readline() while(len(line)>0): (name,idd)=line.strip().split('\t') R[int(idd)]=name line=flr.readline() # %% MRR = {} MR = {} Hit10 = {} Hit3 = {} Hit1 = {} T = {} #read the ...
d651a541577226d958048e5c3cc5e5ba2d11a8fdb3d92928acfa528a30b20ee8
Jupyter
977
61
# %% %matplotlib inline import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib import cm # %% data = ( [1, 10, 10], [1, 10, 10], [1, 9, 9], [1, 7, 7], [2, 3, 3], [1, 3, 2], [5, 1, 1], [3, 1, 1], ) color = cm.get_cmap('Pastel1', len(data)) # %% import mayavi...
2d29ce81d90347f0025390380d24c4c38febb65d7bd96a7780609e1511b33410
Jupyter
1,006
40
# %% ############Training import tensorflow as tf from keras.backend import tensorflow_backend import os from train import train os.environ["CUDA_VISIBLE_DEVICES"]="0" config = tf.ConfigProto(gpu_options=tf.GPUOptions(allow_growth=True)) session = tf.Session(config=config) tensorflow_backend.set_session(session) #e...
334456c8aa2b53fdd58511d5e52ed096addd4df29497f279ef596e8b864b4690
Jupyter
1,006
40
# %% ############Training import tensorflow as tf from keras.backend import tensorflow_backend import os from train import train os.environ["CUDA_VISIBLE_DEVICES"]="0" config = tf.ConfigProto(gpu_options=tf.GPUOptions(allow_growth=True)) session = tf.Session(config=config) tensorflow_backend.set_session(session) #e...
061b39c089b8790e4a621f2e60e60f21d090520260ecee04b454333cfa2cd065
Jupyter
1,008
40
# %% import descarteslabs as dl from descarteslabs.catalog import Image, Search, properties, Product # %% product_id = 'earthrise' search = Search(Product).filter(properties.owners == 'org:earthrise') img_search = Image.search().filter(properties.owners == 'org:earthrise') img_search.summary() # %% product_ids = [p.i...
1590e56ed855a9ca5a337e7cb9212e2e545c41b554894e508e382410146c082b
Jupyter
1,011
54
# %% import numpy as np import pickle # %% example_data = np.load('/media/thijs/hooghoudt/backup_zfrbm_paper_2021-04-15/all_fish_data/spike_only/20190109_Run04_spontaneous7_Tset=22__wb_spikes_only.npy') example_data.shape # %% # %% # %% tmp = np.load('/home/thijs/Documents/matteo_data/Elisa_Latifa__wb_spikes_onl...
f3041a0fc80502b95a09dbebce5df3262c2a2bcc26f0e02531f86394ec4222ea
Jupyter
1,012
40
# %% ############Training import tensorflow as tf from keras.backend import tensorflow_backend import os from train import train os.environ["CUDA_VISIBLE_DEVICES"]="0" config = tf.ConfigProto(gpu_options=tf.GPUOptions(allow_growth=True)) session = tf.Session(config=config) tensorflow_backend.set_session(session) #e...
ecdc9d44123ef718081537062bff250cb59354e34fd2e6b00aff9c7bb2ed258e
Jupyter
1,015
53
# %% import navis navis.set_pbars(hide=True, jupyter=False) from navis.interfaces import r import matplotlib.pyplot as plt from rpy2.robjects.packages import importr import rpy2.robjects as robjects # %% nat = importr('nat') # %% # Get neurons (Drosophila Kenyon cells) shipped with nat kcs20 = robjects.r('kcs20')...
6b06ff41d04861c29641dbaac3591161be9b0d1eea9069dbf07c700793ad6e93
Jupyter
1,018
44
# %% [markdown] # # command: crawl # # This notebook is intended as a supplement to the [main OAK CLI docs](https://incatools.github.io/ontology-access-kit/cli.html). # # This notebook provides examples for the `crawl` command, which is used to walk over multiple ontologies and endpoints. # # ## Help Option # # You...
5239284c62ac631b9fc26c40c08827e6752350937d2af3a1c5ffdc77c65155f0
Jupyter
1,021
53
# %% %load_ext autoreload %autoreload 2 %matplotlib inline # %% from dask_jobqueue import SLURMCluster from distributed import Client # %% use_gpu = True # %% # if we want to fit on cluster # NOTE: if you're using the GPU make sure you spool the scheduler in the same env as your notebook if not use_gpu: extra = ...
83ae0aed49a856289ad6df5557f2dda1feac4e08ae2b474037a4e92e6e9c8269
Jupyter
1,026
33
# %% [markdown] # # Mitochondria visualization # A brief notebook to demonstrate visualizing a cell id and its mitochondria # %% import pandas as pd from nglui import statebuilder as sb from lib import ngl # %% [markdown] # Reading the dataframe that links mitochondria to cell IDs # %% mitodf = pd.read_csv("data/pn...
5fbd8e30eaf56a857061ae54cc21ed84955409ca636a7c3c7f33950775ad72ef
Jupyter
1,069
37
# %% %load_ext autoreload %autoreload 2 import sys from gratin.simulation.diffusion_models import generators, params_sampler from gratin.simulation.traj_tools import get_traj_scale import matplotlib.pyplot as plt import numpy as np # %% # CTRW suit une pente bizarre au début for dim in [1,2,3]: for model in ["sBM"...
76e5a16784ecaf9dc37ee02e7234aed7d11a0dc5d691cf9e0f230a0e020f0a1b
Jupyter
1,076
52
# %% #Read the relation2id file R = {} R[24]='Merged:Treatment' # %% MRR = 0.0 MR = 0.0 Hit10 = 0.0 Hit3 = 0.0 Hit1 = 0.0 T = 0 #read the ranking file with open('TransE,dist_Score.txt','r') as flr: line=flr.readline() while(len(line)>0): (h,r,t,sh,st)=line.strip().split(' ') (h,r,t,sh,st)=(int...
5c576c75d54b33723309959c9fe639ab858be246aedf98caa833a9f914655e23
Jupyter
1,108
53
# %% [markdown] # # OBA tutorial # # * author: Harshad Hegde # * created: 2023-01-25 # # This tutorial walks through OBA. # %% [markdown] # ## Create an alias # # For convenience we will set a bash alias. # # This assumes you have built the sqlite version of oba in the `../../db` folder # # __NOTE__ an alternativ...
c76231b0150b93b93f7434d91b4138512fd61f36b3e7b3e016c723909da4fcd1
Jupyter
1,130
53
# %% from dask_image.imread import imread from dask.distributed import Client from skimage.feature import peak_local_max from dask.array import map_blocks import dask.dataframe as dd from dask import delayed import numpy as np from typing import Any import pandas as pd from dask.diagnostics import ProgressBar # %% c =...
b282b4c90138cf82820e25aedf1618b4ec914fdee8338c3f822932ef7b91dd2f
Jupyter
1,148
47
# %% [markdown] # # OAK rollup command # # This notebook is intended as a supplement to the [main OAK CLI docs](https://incatools.github.io/ontology-access-kit/cli.html). # # This notebook provides examples for the `rollup` command which produces a summarization of ontology associations # between entities and "rolled...
a1a7adcedefdc5082c0fa025aaa1fd87594376e060bd33e0136db8c8ae60c398
Jupyter
1,157
68
# %% import numpy as np import pandas as pd # %% [markdown] # # Load original dataset. # %% data = pd.read_csv('SV_GQ_80.csv') # %% data.head() # %% [markdown] # # Filtering out the missing values. # %% num_of_missings = (data == -1).sum() L = num_of_missings[0].tolist() average = sum(L) / len(L) average # %% x...
eb9b9bce2fdc104b2805d02c4689dac4aeffd3093de92406dda40da506af54dc
Jupyter
1,169
42
# %% !runoak prefixes GO ENVO CL OBI # %% !runoak prefixes dcterms owl EFO hgnc schema # %% !runoak --named-prefix-map obo prefixes dcterms owl EFO HGNC # %% !runoak --named-prefix-map linked_data prefixes dcterms owl EFO HGNC schema # %% !runoak --named-prefix-map bioregistry prefixes dcterms owl EFO hgnc schema ...
63c356cb3ded6fc3e667670ce0210fb03778771c948ff2f249eedf876d54c08c
Jupyter
1,176
67
# %% %pylab inline from numpy import * from numpy.random import rand, randn, randint from dPCA import dPCA # %% # number of neurons, time-points and stimuli N, T, S = 100, 250, 6 # noise-level and number of trials in each condition noise, n_samples = 0.2, 10 # build two latent factors zt = arange(T) / float(T) zs = ...
1afe0cb00479c3258bac33db9f9f72334c7f2c595777a37de817b104c768cade
Jupyter
1,178
83
# %% [markdown] # # Example usage of XTB with XYZ files # %% %load_ext autoreload %autoreload 2 %matplotlib inline # %% import logging import sys # %% from rdkit import Chem # %% try: import ppqm except ModuleNotFoundError: import pathlib cwd = pathlib.Path().resolve().parent sys.path.append(str(cw...
e1211a0914dc2fb3e3cbd062f2679890d81d5c330eaa5fb807a5a744d528ce3a
Jupyter
1,193
27
# %% import requests import geopandas as gpd endpoint = 'http://api.globalplasticwatch.org/sites?limit=10000' auth = requests.auth.HTTPBasicAuth('admin', 'plastics') params = {'apikey': 'jahsdbvjahsdvaulhsdvoauysdg82973bq', 'limit': '10000'} response = requests.get(endpoint, auth=auth, params=params) data = response.j...
ee801a46cc3cbf80f36bc8edb9f0a092c72a4adf49893880f6a0bbd09570c56e
Jupyter
1,193
30
# %% import geopandas as gpd file_name = 'vietnam-1.0' data = gpd.read_file(f'../../data/site_metadata/{file_name}.geojson') data.head() # %% data = data[data['waterway distance'] < 200] data = data.sort_values(by='waterway distance') print(len(data)) data.head() # %% coords = [[point.x, point.y] for point in data['g...
5aee568fa8b6eba73afe02f1db847bfb0a02ddd130ed8807398aabd3569213c1
Jupyter
1,218
56
# %% [markdown] # # Analyzing Text Content of all Ontologies # # %% # %% !mkdir -p output # %% !python -m oaklib.utilities.metrics.text_content_analysis ~/repos/semantic-sql/db/*.db > output/ontologies-tc.tsv # %% import pandas as pd df = pd.read_csv('output/ontologies-tc.tsv', sep='\t') df # %% # replace ontolo...
631233ed21877fd5b89f640b28a7c11888f6a64554bd98ac98bce1a2d9135216
Jupyter
1,221
74
# %% %load_ext autoreload %autoreload 2 from palmari import Acquisition, Experiment, ImagePipeline, ImagePipelineWidget from palmari.processing.steps import * import tifffile # %% exp = Experiment( data_folder="/Users/hverdier/Desktop/exemples_mifobio/short_only/", export_folder="/Users/hverdier/Desktop/exampl...
5110fdb242308df67ddd740300cc455499034b43cd9ef15415fb4ed757dcf0c9
Jupyter
1,257
50
# %% [markdown] # # Extract antibody information # Extract the antibody information provided by Cao et al in an Excel file into a pandas DataFrame and save to a CSV. # # Import Python modules: # %% import pandas as pd # %% [markdown] # Read the data in the Excel file: # %% raw_info = pd.read_excel( "covergent_R...
8a7baefbee1af052f0129ec64578bff96727f598744d82e9406c40f87bf2b8cd
Jupyter
1,260
42
# %% import pandas as pd import json from geojson import Point, Feature, FeatureCollection, dump from shapely.geometry import box, shape, Point, Polygon # %% with open('../../data/sampling_locations/v12_java_bali_validated_positives.geojson', 'r') as f: data = json.load(f) # %% rect_width = 0.006 rect_features = ...
0bebb070de86d2a36a2f11048f45cb47c14a04e3772b390fef79eb475d41030c
Jupyter
1,285
67
# %% %reset -f # %% from sssom.io import parse_sssom_table import pandas as pd fn = "demo.tsv" # %% [markdown] # ### Annotate # %% !runoak -i sqlite:obo:mondo annotate "Marfan syndrome" --matches-whole-text # %% [markdown] # ### Lexmatch # %% %%time !runoak -i sqlite:obo:mondo -a sqlite:obo:doid lexmatch i^MONDO:...
34dde78f365783aa35e8e0514b0355b7b4dd9f609a430beb81ce71d2be73599c
Jupyter
1,294
56
# %% %load_ext autoreload %autoreload 2 from gratin.standard import train_model, load_model, plot_demo, get_predictions import matplotlib.pyplot as plt import socket # %% from scipy.stats import truncexpon, expon import numpy as np # %% if "jbmasson" in socket.gethostname(): export_path = "/home/hverdier/Gaia/hec...
f795a0408e5a7af9560bb1bd168da111e5502bec1bf1074bf8c6f37577c1e392
Jupyter
1,300
56
# %% # load the packages import os import yaml import pandas as pd # load the runner from finetune_transformer import FineTune # %% # load config file config = yaml.load(open("config_ft_transformer.yaml", "r"), Loader=yaml.FullLoader) config['dataloader']['randomSeed'] = 0 print(config) if 'hMOF' in config['dataset...
9f8b8284ec4181f7b631f619e15469a0962d6784eaa194bc9a249aee178190dc
Jupyter
1,307
55
# %% [markdown] # # Mondo Phenotypes Example (IN PROGRESS) # # ## Help Option # # You can get help on any OAK command using `--help` # %% !runoak enrichment --help # %% [markdown] # ## Download example file and setup # # We will use the HPO Association file # %% !mkdir -p input !curl -L -s http://purl.obolibrary....
b37159033d55578009fa2e1c55253bae1de3f180f8a858a42b0e88ac29d73d8a
Jupyter
1,318
63
# %% from oaklib import get_adapter # %% adapter = get_adapter("semsimian:sqlite:obo:hp") adapter2 = get_adapter("sqlite:obo:hp") # %% def labels2curies(labels): return [adapter2.curies_by_label(label)[0] for label in labels] terms1 = labels2curies(["Abnormal liver lobulation", "Focal white matter lesions"]) te...
0f23c82a6caa4e6eaea48303ba39a7754d4cf5781992b64bfa7c67104b5859df
Jupyter
1,326
52
# %% [markdown] # # Accessing data # # The dataset for each topology can be loaded using NumPy in python. After loading (np.load(file)), the following keys can be used: # # - positions; array of shape (N_configs $\times$ N_atoms $\times$ 3) # # - energies; 1-d array of N_configs datapoints # # - forces; array of sh...
d92fc854d6c9e4a6b3c5f0ac8db798c22c7b85ebee543ed377ffc15bb51f0553
Jupyter
1,352
50
# %% [markdown] # ## SOI Localization Estimate # %% from ipywidgets import interactive, fixed import numpy as np import matplotlib.pyplot as plt import pandas as pd from pathlib import Path from PIL import Image from utils.evaluation import evaluate_object_detection, evaluate_soi_localization, get_annotated_sl...
9f23ccf5244f034da4871a3d49989f661a46646df32272326deab8d43ed495a8
Jupyter
1,397
87
# %% import numpy as np import matplotlib from matplotlib import pyplot as plt # %% import sys import os os.environ['WINGHOME'] = '/usr/local/lib/wingpro8' sys.path.append(os.getenv('WINGHOME')) import wingdbstub wingdbstub.Ensure() # %% [markdown] # # EEG plot # %% from gcpds.visualizations.series import plot_eeg...
80173527a33813e98330534534758e251e8474494e079a81e32e300ca48033a8
Jupyter
1,452
51
# %% [markdown] # # Code for trial and error analysis and sanity checks # %% import pandas as pd import os import sys import seaborn as sns import matplotlib.pyplot as plt import numpy as np import statsmodels.api as sm import statsmodels.formula.api as smf import nibabel as nib sys.path.append('../') from lib.stats_...
336487be13d391e39959a234e3d1093d36ba80b16284677ae33f0fa5e5dafa0d
Jupyter
1,491
65
# %% %reset -f # %% # !pip install oaklib==0.5.16-rc1 # %% %%time from oaklib.selector import get_adapter semsim = get_adapter(f"semsimian:sqlite:obo:phenio") # %% %%time semsim.termset_pairwise_similarity( subjects=["MP:0010771","MP:0002169","MP:0005391","MP:0005389","MP:0005367"], objects=[...
98adf2b899b8bcb1e9b3a03a7a2b9f10975a7f2964adfa4923a51f78ad9fe98a
Jupyter
1,491
68
# %% [markdown] # # NCIT tutorial # # * author: Chris Mungall # * created: 2022-11-11 # # This tutorial walks through NCIT-OBO, the goals are: # # - to help understand the structure of ncit # - to show how to do advanced OAK queries (CLI and programmatic) on NCIT # %% [markdown] # ## Create an alias # # For conven...
4f99f0280f4b412fd31caf868daecfd1ad49f7dd9a81707bff9a126e1243f588
Jupyter
1,532
63
# %% [markdown] # # ClassEnrichmentCalculationInterface Examples # # See also [Python docs](https://incatools.github.io/ontology-access-kit/packages/interfaces/class-enrichment.html) # # %% from oaklib.datamodels.input_specification import InputSpecification from oaklib import get_adapter spec = InputSpecification( ...
4a1d9cf1f0653b42097714d4e243c93b00f52544cc852f777b3c6fe6c52e9220
Jupyter
1,536
64
# %% %load_ext autoreload %autoreload 2 # %% import os import descarteslabs as dl import geopandas as gpd from tqdm.notebook import tqdm from scripts import deploy_candidate_detect, candidate_detect # %% roi = 'brazil' model_name = '0.0.11' product_name = f'{roi}_v{model_name}_2019-01-01_2021-06-01' pred_threshold ...
9f68a7a0a9c05b7f15b130bc16b5291d7fc14dc25d44368bfdc73b362fdc5c4b
Jupyter
1,551
71
# %% [markdown] # ## Phenotypic Series queries # # We will walk through # # 1. Finding all MONDOs that correspond to an OMIM Phenotypic Series # 2. Extend these to the leaf MODNO nodes # 3. Query associations between these leaf nodes and genes # %% from oaklib.selector import get_adapter # %% handle = get_adapter("...
02779e99aa3f77804c6e00d2c2debc19418b3671736b6f392fbaafb792b32c17
Jupyter
1,557
65
# %% [markdown] # # Parse the DE genes for pathview # %% # import matplotlib # matplotlib.use('TkAgg') import matplotlib.pyplot as plt import pandas as pd import numpy as np import networkx as nx import seaborn as sns # latex rendering of text in graphs import matplotlib as mpl from matplotlib import rcParams rcPara...
5abce1ba72d7fd2f1aac10193578cf5b09fa43f06033029fc02f8a7341046c4d
Jupyter
1,567
60
# %% %alias go runoak -i sqlite:obo:go # %% go relationships --direction down -p RO:0002211 .desc//p=i 'signal transduction' > output/reg-pathway.tsv # %% import pandas as pd # %% df = pd.read_csv("output/reg-pathway.tsv", sep="\t") df # %% from oaklib import get_adapter from oaklib.datamodels.vocabulary import IS_...
00ac9963823e78372a099ccf0b27f610feede699d50db43f7502e62274a87d90
Jupyter
1,570
61
# %% import numpy as np import pandas as pd import matplotlib.pyplot as plt from pathlib import Path from tqdm.auto import tqdm import torch import torch.nn as nn from torch.utils.data import ConcatDataset import torchvision from torchvision import transforms from dataloading.ouster import OusterCrop, OusterNormalize...
01ce349b1ee712a606f70b1d383bc944e048b6fd318806c07165c9bf93632e27
Jupyter
1,576
45
# %% #import os #os.environ['CUDA_VISIBLE_DEVICES'] = '-1' # Uncomment if you don't want to use GPU. import sys sys.path.append('utilities') sys.path.append('IPA_model') #from GraphBuilder import GraphBuilder from IPA import load_model import numpy as np import tensorflow as tf # %% model_path_d = 'weights/IPA_d' mo...
356fead27e294dc72871ac99ca1f7b314e4e6126417149f50894115a09dc3e7c
Jupyter
1,576
64
# %% import numpy as np import os from pathlib import Path import pandas as pd import seaborn as sns import matplotlib.pyplot as plt sns.set_style("ticks") hfont = {'fontname':'Myriad Pro'} import plotly.express as px # %% path = Path(os.getcwd()).parents[0] datapath = os.path.join(path, 'model_selection') respath = ...
3ba43676681d5edcc7a02a70946ad36e0cf76ce815f37f04db82227581ea2a60
Jupyter
1,577
46
# %% [markdown] # # LLM Tutorial # # This walks through using OAK through an LLM wrapper. # # See also [How-to guide](https://incatools.github.io/ontology-access-kit/howtos/use-llms.html). # # Note for this to work, you must either install OAK with llm extras, or do a separate install # of `pipx install llm`. # # Y...
dd8ce9097e7a8b20608d3544435fc01f1f9775b88fd1162b1c3b3ba1a175fe03
Jupyter
1,593
53
# %% %load_ext autoreload %autoreload 2 # %% import os import sys sys.path.append('../../') from scripts.viz_tools import animate_patch from scripts.dl_utils import download_patch, rect_from_point # %% # This function takes a while to run as it is extracting data from GEE rect_width = 0.02 coords = [95.347998212902...
469a625447745799d90ac1a519eca445350e7674ac349b3ecf4907d50e1a5da3
Jupyter
1,609
52
# %% import numpy as np from keras.applications.inception_v3 import InceptionV3 from keras.preprocessing import image from keras.preprocessing.image import ImageDataGenerator from keras.models import Model from keras.layers import Dense, GlobalAveragePooling2D, Dropout from keras import backend as K from keras.optimize...
33b3b1ccdedc6cebf1eb63fac1e4a19d19080c7231d3ec7328b5deb3415caa44
Jupyter
1,618
63
# %% [markdown] # # OAK validate-mappings command # # This notebook is intended as a supplement to the [main OAK CLI docs](https://incatools.github.io/ontology-access-kit/cli.html). # # This notebook provides examples for the `validate-mappings` command. # This forms part of a suite of *validate* commands. # # #...
2df45ecc95aa80fd01d1753340ade6d38e1f693789f566f3fd163cdc0c7368f7
Jupyter
1,619
79
# %% %load_ext autoreload %autoreload 2 import tifffile import numpy as np import matplotlib.pyplot as plt from skimage.filters import gaussian from dask_image.ndfilters import gaussian_filter from dask_image.imread import imread from palmari.processing.steps import BaseDetector from palmari import ImagePipeline, Acqui...
f066ccbfa98b259af13e3916453a16eb20b12e2369649dd461235fa3c0f44b8b
Jupyter
1,630
58
# %% [markdown] # # Plot cross-correlation between dlight and syllable frequency # %% import toml import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from os.path import join from rl_analysis.plotting import save_factory, bootstrap_lineplot, add_legend, fg, setup_plotting_env, clean_ticks # %% ...
2e03cc5f8df05e9d25f6223a468b8b0ace803bb478d42b3e557b2c8ee122d92d
Jupyter
1,640
48
# %% import numpy as np import matplotlib.pyplot as plt import h5py import scipy.sparse import sys, os from tqdm import tqdm # %% file_path = '/media/thijs/hooghoudt/Zebrafish_data/spontaneous_data_guillaume_T22/' list_files = [x for x in os.listdir(file_path) if x[-3:] == '.h5'] n_ds = len(list_files) list_files #...
433eb13592bdd2d3fd4c2bdc3f0b957691f2fec72a3370cc12aaa347ad726b3a
Jupyter
1,657
72
# %% %load_ext autoreload %autoreload 2 from palm_tools.data_structure.trackset import TrackSet, TrackSets from glob import glob import pandas as pd import logging logging.basicConfig(level=logging.DEBUG) from palm_tools.utils.read_file import check_file_and_read import os # %% def df_is_valid(df: pd.DataFrame, is3D: ...
bb302f6664d83808a2be9ac04bda22ee5a55d090467ed60356378653e96c62a2
Jupyter
1,667
63
# %% [markdown] # * blog post: [Region of interest pooling explained - deepsense.io](https://deepsense.io/region-of-interest-pooling-explained/) # * repository: [deepsense-io/roi-pooling](https://github.com/deepsense-io/roi-pooling) # %% from __future__ import print_function import tensorflow as tf import numpy as np...
644f457e40cd77e7c11312a88998ff2043d3c7177808c52334729318c0f24e4a
Jupyter
1,698
60
# %% [markdown] # # Run Pixel Classifier on a Test Sites # Note: The script `nn_predict.py` also works well for this purpose if evaluating a single site. # # This functionality is also contained within the `train_pixel_classifier` notebook for the purposes of evaluating a trained model. # %% %load_ext autoreload %aut...
79c87e49eb242f47153a533072b2007e150cfd61a28099bbf122c1dd6f6ee18f
Jupyter
1,702
56
# %% [markdown] # ## PDBBind preprocess # %% from data_pipeline.pdbbind_preprocess import PDBBindPreprocess, pdbbind_dataset_generate preprocess = PDBBindPreprocess(core_path='.\data\\raw_files\PDBbind2016\core-set\\', refined_path='.\data\\raw_files\PDBbind2016\\refined-set\\') prepr...
161f2464f464e0431719c687ea6020c4f48127cc27b1803558e5657d8ddc77d8
Jupyter
1,707
75
# %% [markdown] # # OAK paths command # # This notebook is intended as a supplement to the [main OAK CLI docs](https://incatools.github.io/ontology-access-kit/cli.html). # # This notebook provides examples for the `paths` command, which can be used to query for paths between ontology terms # # ## Help Option # # Yo...
dde66dc7a8a4eb04096b6c3d0c0751b1072141465a75d55aae8b0b3422f07edc
Jupyter
1,707
74
# %% [markdown] # ### Plot dF/F response to trains of APs # # * Simultaneous ephys-ophys data were recorded by Marton Rozsa <marton.rozsa@alleninstitute.org> # * Parameter fits were done by Ziqiang Wei <weiz@janelia.hhmi.org> # * Model parameters were reported in Table S8 # * Single-cell statistics were reported in Su...
759214292450e81d5f61c1b5fc9bd746c9c076a9674844d8320876331af3e6da
Jupyter
1,713
48
# %% [markdown] # # OAK termset-similarity command # # This notebook is intended as a supplement to the [main OAK CLI docs](https://incatools.github.io/ontology-access-kit/cli.html). # # This notebook provides examples for the `termset-similarity` command, which can be used to do an aggregate comparisons between # tw...
2e6b6144e09d5549cfe489d80961949637ca2d0991c80b68c247d5e595b08deb
Jupyter
1,723
74
# %% import pandas as pd from sklearn import preprocessing from gnnad.graphanomaly import GNNAD from gnnad.plot import plot_test_anomalies, plot_predictions, plot_sensor_error_scores def normalise(X, scaler_fn): scaler = scaler_fn.fit(X) return pd.DataFrame(scaler.transform(X), index=X.index, columns = X.colu...
3d2540da2049e8f756514c76633b1b1344e229af062936166e5184fbd130e179
Jupyter
1,724
61
# %% import numpy as np import matplotlib.pyplot as plt import h5py import scipy.sparse import sys, os from tqdm import tqdm # %% file_path = '/media/thijs/hooghoudt/Zebrafish_data/spontaneous_data_guillaume_T22/' list_files = [x for x in os.listdir(file_path) if x[-3:] == '.h5'] n_ds = len(list_files) list_files #...
fde8641897a64eb0aef3065492911821f3f09651e73d83086f0c313a44c628d6
Jupyter
1,727
69
# %% import os import pickle import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import NMF # %% with open('../data/pixel_vectors_all.pkl', 'rb') as f: pixel_vectors = pickle.load(f) pixel_vectors = np.array(pixel_vectors) / 3000.0 # %% with open('../data/pixel_vectors_labels_all.p...
278236385d3b7aa2f04504edf29a06990cf6b3fb33dfcc157782014e0f1c1f9b
Jupyter
1,733
61
# %% [markdown] # # Library # %% import pandas as pd import matplotlib.pyplot as plt from sklearn import svm from sklearn.metrics import auc from sklearn.metrics import RocCurveDisplay from sklearn.model_selection import StratifiedKFold from sklearn.linear_model import LogisticRegression # %% # mynewlist contains th...
b26413ee293d20e61e687948390f6c4e25a187255b8b1dca814b78401482fe9d
Jupyter
1,733
62
# %% [markdown] # # Library # %% # install missing libraries if failed to import libraries import torch import torchvision import timm import torch.nn as nn # %% [markdown] # # Model # %% class ImageAndClinicalModel(torch.nn.Module): def __init__(self): super(ImageAndClinicalModel, self).__init__() ...
d085963cfd027937def6af7c926fc3be94723acd2bfd7976519eccb19d3e5d12
Jupyter
1,750
73
# %% [markdown] # # Plot the differentially expressed genes on some significant pathways # %% library(pathview) # %% # load the sample data #data(gse16873.d) # options for comp_name: # LiLRvsNR # CtrlLRvsNR # comp_name = 'LiLRvsNR' # # load the differentially expressed genes # LFC_temp = read.table(paste('DE_',com...
34a9ac07b436189f9f79b966ea4291eadea3c9e962dfd4110c14a524d24013af
Jupyter
1,751
63
# %% import matplotlib.pyplot as plt import numpy as np # %% ls # %% masif_fpr100 = np.load('masif_fpr100.npy') masif_tpr100 = np.load('masif_tpr100.npy') probis_fpr100 = np.load('probis_fpr100.npy') probis_tpr100 = np.load('probis_tpr100.npy') kripo_fpr100 = np.load('kripo_fpr100.npy') kripo_tpr100 = np.load('krip...
621f9d2f1584a165c40991841c2ecc2ee03a304504b734c01112e9b88b12911f
Jupyter
1,757
94
# %% import matplotlib.pyplot as plt import numpy as np import seaborn as sns import pandas as pd import math from scipy import stats # %% # specify the datasets for your plot df = pd.read_csv('/Users/lbreima/Documents/PhD_local/Manuscripts/2021_Sam_zipcodes/database/total_database.csv') # %% df.head() # %% map2 =...
e91f19fc16e43587c54a80357990d45b42a78631ed0f1c3d31f68254a22b7f9e
Jupyter
1,761
85
# %% import cxsystem2.neurodynlib as nd from brian2.units import * import brian2 as b2 import matplotlib.pyplot as plt b2.codegen.target = 'numpy' # %% [markdown] # ## Creating a neuron # %% x = nd.EifNeuron() # try also with: EifNeuron, AdexNeuron, HodgkinHuxleyNeuron # %% x.get_neuron_equations() # %% [markdown...
d627473766115f2349b8baf88c5d34e74c4d463df2f8a96e5301a485f4e73ab2
Jupyter
1,807
102
# %% [markdown] # # Example of handling bad molecules # # If you give a bad conformer, of course xTB will not be able to calculate any properties. # This is an example of how ppqm handles that # %% %load_ext autoreload %autoreload 2 %matplotlib inline # %% import logging import sys # %% from rdkit import Chem # %%...
e14a07b216e5e5bcffc1e149d5586f2c2132c0433cb7d58f911ad594e844ad5e
Jupyter
1,833
94
# %% from oaklib import get_adapter from oaklib.utilities.associations.edge_information_util import associations_to_matrix ont_adapter = get_adapter("sqlite:obo:go") # %% taxa = ["9606", "6239", "7955", "3702", "559292", "4896", "7227", "10090", ] # %% matrix_by_taxon = {} for tax in taxa: assoc_adapter = get_...
6dffbd56f238b1cb933ea5c6f9a8a37b8975a9513914b17e8cc82a7c059775ea
Jupyter
1,842
40
# %% [markdown] # CAVE is the Connectome Annotation Versioning Engine. # It is a collection of services which manage proofreading and data annotation for large scale connectomics dataset. # These services were developed during the IARPA MICrONS program, but now support data from several projects including FlyWire. You...