sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f878495067bcc4481b99bbb84f4b500396a821cc93ab64bef9ad62ab2b99a295
Jupyter
293
11
# %% from enigmatoolbox.datasets import load_summary_stats # Load summary statistics for ENIGMA-Autism sum_stats = load_summary_stats('asd') # Get case-control cortical thickness table CT = sum_stats['CortThick_case_vs_controls_meta_analysis'] # Extract Cohen's d values CT_d = CT['d_icv']
e349c5c6ad7c3bc7aa353e8dbd7e5fe57fe2c7ef5880de3ac932d19f5512ccf6
Jupyter
380
23
# %% import yaml # %% with open('test_config.yaml') as file: try: databaseConfig = yaml.safe_load(file) print(databaseConfig) except yaml.YAMLError as exc: print(exc) # %% print(databaseConfig["database"]) print(databaseConfig["author"]) # %% print(databaseConfig["database"]["port"...
68d4fd9b9861b3f42ddc59245117f277298bcfe132bd79531ce5b594a258ad9d
Jupyter
503
28
# %% import pathlib import scanpy as sc import pandas as pd # %% metadata = pd.read_csv("study_overview.csv", index_col=0) # %% metadata # %% metadata["index"] = metadata.index.str.split("_").str[0] + "_" + metadata.index.str.split("_").str[2] metadata = metadata[(metadata["Source"]=="3ca") & (metadata["Include"]=="...
8809c5952c8c138408fb136987cf8894543948e052a0693a0ceff74747f37559
Jupyter
542
25
# %% import os import pandas as pd import numpy as np import requests import json import logging import time from typing import List, Dict, Any, Optional from enum import Enum from dataclasses import dataclass from sklearn.metrics import cohen_kappa_score, confusion_matrix # Define the output directory output_dir =...
4d17d860ee8aab548dcf2a34831e8380b9bb34acf443a87672e860199a356f04
Jupyter
736
27
# %% from sklearn.decomposition import NMF import matplotlib from matplotlib import pyplot as plt from matplotlib.lines import Line2D import cv2 import numpy as np from typing import List, Dict import math from visualizations import show_factorization_on_image import glob from PIL import Image from matplotlib import py...
72a8a793ff02a2ad27919f65b92d75f05e08720c67789dcd1cce5df97363e05d
Jupyter
802
25
# %% [markdown] # # PyLossless Quality Control within a Jupyter Notebook # # This notebook demonstrate how the PyLossless Quality Control interface can be integrated in a Jupyter Notebook. This can even be done on a virtualized platform, like Google Colab! To try it, you can run this notebook from [here!](https://cola...
f2ec788aabfcd7d17d454e18988c55cb8b7da6ade929a526f149b2c797976651
Jupyter
812
33
# %% import sys sys.path.insert(0, "../") import scanpy as sc from model.embedding import embed # %% model_dir = "../model/assets" adata_path = "../data/neftel_ss2.h5ad" # INSERT the path to your anndata object here adata = sc.read_h5ad(adata_path) batch_key = "sample" # The batch identity is used for highly variable...
0b57c489a4e560323d7eb78815e88616a1b7eedb534e05c4e776be302fe3042a
Jupyter
824
26
# %% import os import torch # for determining device from md.Simulator import Simulator # %% # define some constants and identify device kSimulationName = "example-simulation" kPdbInput = os.path.join("structures", "1em7.pdb") kNumMaxIterations = 200 kNumSteps = 20_000 kRestartSimulation = False kFixProtein = False #...
0f23cd7d276d2a70b427c8a9fc529261271f685ac84fa705f394a9517d267e3e
Jupyter
847
35
# %% from enigmatoolbox.datasets import load_summary_stats # Load summary statistics for ENIGMA-Epilepsy sum_stats = load_summary_stats('epilepsy') # Get case-control subcortical volume and cortical thickness tables SV = sum_stats['SubVol_case_vs_controls_ltle'] CT = sum_stats['CortThick_case_vs_controls_ltle'] # Ex...
ace290fa33fdaf361f78062ceb3bb7e93e5f09a26f41824f96dc5754434d6d6e
Jupyter
907
32
# %% import matplotlib.pyplot as plt import numpy as np import scipy.io import os plt.style.use('ggplot') path_root = os.environ.get('DECIDENET_PATH') path_code = os.path.join(path_root, 'code') if path_code not in sys.path: sys.path.append(path_code) from dn_utils.plotting import plot_z_convergence from dn_utils...
13534d23e82cb0c9a0fc026e06e94e639961268922da832c4a645bcabb2689bb
Jupyter
944
53
# %% import sys import os from os.path import dirname, realpath, join base_dir = dirname(dirname(os.getcwd())) base_dir import pandas as pd from os.path import join sys.path.insert(0, base_dir) from config_path import PROSTATE_DATA_PATH, PLOTS_PATH # %% filename=join(PROSTATE_DATA_PATH, 'processed/P1000_final_analysis...
630bb6bb0836c8b8500e5fc1a4de65d2a5e0b2ef897bbae7391f5738465e7ac5
Jupyter
958
32
# %% from os.path import join from pathlib import Path import pandas as pd import numpy as np from dn_utils.path import path_bsc, path_figures from dn_utils.style import ORANGE, BLUE from nilearn.plotting import plot_connectome # %% atlas = "combined_roi_4and5" # %% # Load atlas and filter PE ROIs df_roi = pd.read_c...
e0c146fdfa06047ea13b812e8d89e18baf48aa301c572659d5d46b208523db74
Jupyter
958
32
# %% import networkx as nx import matplotlib.pyplot as plt from faker import Faker import random # Initialize Faker fake = Faker() # Generate fake gene names def generate_gene_names(n): return [fake.unique.word().upper() for _ in range(n)] # Create a random graph num_nodes = 10 num_edges = 30 G = nx.gnm_random_g...
9c611e3c6af708d631fb4c2e0a4343970d45d2a7fe04b0ec335c0749a36ed44b
Jupyter
995
58
# %% import sys import os from os.path import dirname, realpath, join base_dir = dirname(dirname(os.getcwd())) base_dir # %% sys.path.insert(0, base_dir) from config_path import PROSTATE_DATA_PATH # %% import pandas as pd from os.path import join # %% filename = join(PROSTATE_DATA_PATH, 'external_validation/Met500/s...
e6ec2d87bacd360e8197539a8d035c2b5ba9f73a0442fc58e04fd165e1d2836f
Jupyter
1,040
38
# %% [markdown] # # Front page example (XGBoost) # # The code from the front page example using XGBoost. # %% import xgboost import shap # load JS visualization code to notebook shap.initjs() # train XGBoost model X,y = shap.datasets.boston() model = xgboost.train({"learning_rate": 0.01}, xgboost.DMatrix(X, label=y...
a98c6483e94e5739b09b5d48790462ea0045f85407244ce35cf1ad89d6188c32
Jupyter
1,047
35
# %% [markdown] # # Cycles per degree # # Compute the spatial frequency (cycles per degree) of the grating stimuli. # %% import numpy as np # %% def cycles_per_degree(distance_to_screen_cm, spatial_period_cm): """ Calculate cycles per degree given the distance to the screen and the spatial period. Param...
fb16557e03c16cae1079fe78346000353cbdf9ea884cd95e0dc475624a516259
Jupyter
1,092
48
# %% import matplotlib.pyplot as plt import numpy as np from scipy import interpolate # %% pi = -np.array([4.3,4.4,4.2,3.2,2.6,2.2,4.1,3.0,4.2,5.3,5.4,4.1,3.6,2.8,3.4]) s2 = -np.array([5.1,5.0,4.5,4.1,3.1,3.7,4.2,4.8,5.0,6.2,6.4,5.4,5.0,4.7,4.9]) xpos = 10*np.arange(len(pi)) # %% save = True xnew = np.linspace(xpos[0...
da5e389b4aea189760f96cac32f8351003f67f09d96efae781cbadc97ea66fea
Jupyter
1,109
33
# %% [markdown] # ## Convert `.swc` files to `.nr` for `NeuRosetta` # %% T45_df = pd.read_pickle('/home/ndrummond@neuro.mpg.de/Datasets/Optic_lobe_neurons/T45_neurons.pkl') # %% swc_path = '/home/ndrummond@neuro.mpg.de/Datasets/Optic_lobe_neurons/swc/' # %% forest = nr.import_swc(swc_path, parallel = True, max_worke...
e9f526c86b325ee09658f94946111f9901c0f572875fb0da54571b7217341842
Jupyter
1,116
49
# %% [markdown] # ### Get Dendrite Comparrtment # %% import NeuRosetta as nr from tqdm import tqdm # %% fpath = '/home/ndrummond@neuro.mpg.de/Datasets/Optic_lobe_neurons/nr/Female/T4/' forest = nr.load(fpath, parallel = True, progress = True, max_workers=10) # %% trees = [] for f in forest: # if f.metadata['...
1a4d269ebad6727cae0d640ff0fbfa9cfa7cc6b8c9a98fd55767e79352179266
Jupyter
1,140
39
# %% [markdown] # ### Swection angular deviation data for dendrites # # Create a dataframe of section angular mean and variances for each dendrite. # %% import NeuRosetta as nr import pandas as pd # %% path = "/home/ndrummond@neuro.mpg.de/Datasets/Paper_data/nr/Flywire/Dendrites/" forest = nr.load(path, parallel = T...
5240dc2bc8ebb30c3c236d9c8316b37f2c2bcac1791940311a7b0f2dcf4922c8
Jupyter
1,143
40
# %% import scipy from msi_visual.normalization import spatial_total_ion_count, total_ion_count, median_ion import glob import numpy as np import UMAP import matplotlib.pyplot as plt from PIL import Image import cv2 import importlib import msi_visual.nonparametric_umap importlib.reload(msi_visual.nonparametric_umap )...
9cb982cc4e7e107d28239c07e7aa0336f3bf808298cfe41273757c2dd3403706
Jupyter
1,191
43
# %% import numpy as np import matplotlib.pyplot as plt # %% se_ne = np.array([0.627194725, 0.627706144, 0.583127721, 0.493964843, 0.686143704, 0.667042701]) # %% lumen_area = np.array([14810, 14666, 18500, 17482, 15433, 17436])/1.3**2 # %% organoid_area = np.array([40963, 40901, 43631, 43939, 42968, 39899])/1.3**2 ...
ec35d156eff916ff71e9422f9b10600110ee8c497ae2bb8192da85c4ae1281e2
Jupyter
1,227
35
# %% [markdown] # # Explaining the Loss of a Tree Model # # Explaining the loss of a model can be very useful for debugging and model monitoring. This notebook gives a very simple example of how this works. Note that explaining the loss of a model requires passing the labels, and is only supported for the `feature_dep...
15dab3e9431896b84b5fe9386e82a87aaa58e3c7574041132e2679f1a4b787db
Jupyter
1,244
37
# %% import os import numpy as np import tifffile # Set the directory path containing the images directory_path = '' # Output file to store results output_file = 'image_non_black_pixel_counts3.txt' # Open the output file in write mode with open(output_file, 'w') as file: # Write the header file.write("Image ...
2727b3fb67aa4e28491e6737e9ab6866a2e30e2869fa9e9ab0e6a47f548b83f9
Jupyter
1,247
39
# %% library(Seurat) library(SeuratObject) library(Matrix) # %% data_path = 'pancreas_cosmx_rds' seurat_obj <- readRDS(paste0(data_path, "/Seurat_Pancreas_withTranscripts.rds")) # %% spatial_coords <- GetTissueCoordinates(seurat_obj) head(spatial_coords) # %% head(seurat_obj@meta.data) # %% names(seurat_obj@meta.d...
77efb51d5734fc640ecf43177d6771a9e5f022eac1eb27c79e5a3e557677f838
Jupyter
1,253
45
# %% import pandas as pd import numpy as np import scipy as sp from scipy import io from sklearn.metrics import pairwise_distances import sys sys.path.append("../topography/utils_py/mapalign") from mapalign import dist # %% atlases = {'rm': 0, 'lv': 1, 'fv': 3, 'b05': 4, 'bb47': 5, 'pht00': 7} def create_macaque_con...
bed70c3a2e7ab31df8f0bedd73faeed5e909a1982e0380f3e08e59ad37686469
Jupyter
1,279
44
# %% [markdown] # # # # Example 1: Multiple Stat Maps # # This example shows multiple statistical maps on a surface with some extra # stylizing for a clean-looking figure. # %% # Code source: Dan Gale # License: BSD 3 clause from surfplot import Plot from surfplot.datasets import load_example_data from neuromaps....
04abad79e26e8a6824d3762756ad1b7cee89a3aaed5a57de09c733bd75219387
Jupyter
1,285
44
# %% from enigmatoolbox.datasets import load_summary_stats # Load summary statistics for ENIGMA-Epilepsy sum_stats = load_summary_stats('epilepsy') # Get case-control subcortical volume and cortical thickness tables SV = sum_stats['SubVol_case_vs_controls_ltle'] CT = sum_stats['CortThick_case_vs_controls_ltle'] # Ex...
1698f639d9e49c3ce89b3c1bc638801e1500f4f2850bf1daa99eb049e4d7b024
Jupyter
1,289
43
# %% from src.utils import collapse_isoforms_to_proteoforms, read_gtf import polars as pl # %% [markdown] # # Add base_isoform to protein_classification # %% tx_classification = pl.read_parquet("nextflow_results/V47/final_classification.parquet") orfanage_gtf = read_gtf("nextflow_results/V47/orfanage/orfanage.gtf", ...
784b9a382a93f572d7f48a8d16a42bd4061cf873b7b13db5e8982b10033ed598
Jupyter
1,307
39
# %% [markdown] # Code from: # Dear R, Wagstyl K, Seidlitz J, et al. Cortical gene expression architecture links healthy neurodevelopment to the imaging, transcriptomics and genetics of autism and schizophrenia[J]. Nature Neuroscience, 2024, 27(6): 1075-1086. # # More details can be found in paper # ## Setup # %% # ...
5087a22b90f70449f52459bd98233e7dd2792bc6790f94b2f7b6d8d813fb8d64
Jupyter
1,353
51
# %% ! bash demo.sh # %% [markdown] # ## Example 1 # %% from scRNA_workflow import * sc.settings.figdir='./figures_new/' # set figure folder path = './GSM4653863_HC1/' adata = sc.read_10x_mtx(path) # read from 10x file # %% X_df= pd.DataFrame(sparse.csr_matrix.toarray(adata.X),index=adata.obs.index.tolist(),columns...
6df2b2df63f333861d556056ae33e49f0c73c05ef52881fcaf3a6cc83d4ffcd8
Jupyter
1,355
59
# %% import numpy as np import pandas as pd import sys loc = "../../tools/SERGIO/" sys.path.append(loc+"SERGIO") from sergio import sergio # %% sim = sergio(number_genes=1200, number_bins = 9, number_sc = 1000, noise_params = 1, decays=0.8, sampling_state=15, noise_type='dpd') sim.build_graph(input_file_taregts =loc+...
c8e45976ad9090f3b3687382d562e21f49f476e03451ab6752c05f97cd42c212
Jupyter
1,371
44
# %% import numpy as np import glob from matplotlib import pyplot as plt import joblib from visualizations import get_colors from collections import Counter from scipy.signal import find_peaks NUM_COMPONENTS = 5 colors = get_colors(NUM_COMPONENTS) centers = np.load("h.npy") Percentile Ratioint(centers.shape) all_mzs...
9fc0b9a9f28170ce18f6d7d467307f0f900a437c60af7c7ad768353d401dc1c0
Jupyter
1,379
41
# %% import numpy as np from sklearn.metrics import confusion_matrix import seaborn as sns import os from matplotlib import pyplot as plt # %% audiocategory='breathing-deep,breathing-shallow,cough-heavy,cough-shallow,vowel-a,vowel-e,vowel-o,counting-normal,counting-fast' # %% results_folder = 'results' classifier_nam...
41eff91f8d882927d81e4bfd039bd360983a946edd57847f3fd8105ab5548cdb
Jupyter
1,386
43
# %% import pandas as pd import os # %% annot_snps_dir = "/mnt/seagate10/projects/cmm/experiments/hapgen10k11m.utr5_utr3_exon_other" annot_snps_f_dict = {"UTR5":os.path.join(annot_snps_dir,"hapgen11m.utr5.snps.txt"), "UTR3":os.path.join(annot_snps_dir,"hapgen11m.utr3.snps.txt"), ...
e52a7deaa90b1be062f8bf110115dd5e40d7c03e9b33edcdc92773b9a536010d
Jupyter
1,387
29
# %% import re from oneqmc.analysis.energy import HARTREE_TO_KCAL from uncertainties import ufloat_fromstr from uncertainties.unumpy import nominal_values, std_devs import matplotlib.pyplot as plt import pandas as pd # %% results_df = pd.read_csv("../../experiment_results/10_atct_tae/processed_results.csv") results_df...
540092099e6c00e89306bc37ea1ec4ca9bd2815209757e4cd143ae9ce62bbc85
Jupyter
1,391
44
# %% [markdown] # ### Bifurcation geometry data for dendrites # # Create a dataframe of bifurcation geometry metrics for each dendrite # %% import NeuRosetta as nr import pandas as pd # %% red_path = '/home/ndrummond@neuro.mpg.de/Datasets/Paper_data/nr/Flywire/Reduced_dendrites/' full_path = '/home/ndrummond@neuro.m...
7f90fa32212fe07cef368c8a1a83bc562ce672a9fa2063b2e002eae021e34121
Jupyter
1,391
39
# %% from extract import * from extract import _bisect_spectrum input_path = r"D:\\NRL4485-slide-4_lipids\\slide-4_lipids.d" tsf = tsfdata.TsfData(input_path) conn = tsf.conn regions = conn.execute(f"SELECT RegionNumber FROM MaldiFrameInfo").fetchall() regions = [r[0] for r in regions] regions = list(set(regions)) reg...
1a32884c39a951b1ddc702a72628ae09bb89605616a60f54665c8538a6f77265
Jupyter
1,404
51
# %% import pandas as pd import matplotlib.pyplot as plt from oneqmc.analysis import HARTREE_TO_KCAL, colours from oneqmc.analysis.plot import set_defaults set_defaults() # %% df = pd.read_csv("../../experiment_results/06_si_n2_ethene/processed.csv") acpf_df = pd.read_csv("../../experiment_results/06_si_n2_ethene/r1...
866492d3945307a1df4dd66dc68b22f332334b1a03707a87e40458c9a6fe558e
Jupyter
1,412
42
# %% # Download HCP 820 dense connectome: # HCP_S900_820_rfMRI_MSMAll_groupPCA_d4500ROW_zcorr.dconn.nii # %% import numpy as np import nibabel as nib # git clone --branch enh/cifti2 https://github.com/satra/nibabel.git from sklearn.metrics import pairwise_distances # Load data and Fisher's z-to-r transform dcon = np....
93986a1c6f4920edb29a6219745b3cb44be1fbe9df77a957815f80d3d7bd42fc
Jupyter
1,417
32
# %% [markdown] # # Cosine Similarity # %% [markdown] # Prerequisites # # 1. Prepare the relevance matrix file containing the pair of PMIDs and the relevance score for that pair. # 2. Generate the Doc2Vec model, using the [Embeddings Tutorial](https://github.com/zbmed-semtec/doc2vec-doc-relevance/blob/main/Docs/embed...
be3e552aa0bb1123d35e80545e2929c20b9fe6db54f964e269c43a850f5032fb
Jupyter
1,450
57
# %% %load_ext autoreload %autoreload 2 import os from os.path import join as ospj import pickle import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns import pandas as pd from tqdm.notebook import tqdm from einops import rearrange from config import CONFIG from model_v5 im...
c604f77923a4bda06596425cbe05c179fdc8925da1aab62e2b052ec0d782168d
Jupyter
1,453
33
# %% [markdown] # # Example notebook # %% import numpy as np from anndata import AnnData import pandas as pd import nicheformer # %% adata = AnnData(np.random.normal(size=(20, 10))) # %% [markdown] # With myst it is possible to link in the text cell of a notebook such as this one the documentation of a function or a...
d44b6d30aa94cdb494d5614a2dc9e56d81ef1c89ae672b36448afcfde0be0b42
Jupyter
1,457
53
# %% # reading data and working with arrays import zarr import numpy as np from scipy.ndimage import map_coordinates, zoom, gaussian_filter # data paths inv_transform_path = '/nrs/scicompsoft/goinac/multifish/tiny/results/registration/local/t1-t2/inv-deform.n5' inv_transform_subpath = 't2/c1/s2' coords_path = '/nrs/sc...
c093cfbec8dbea63e69d65e9e6b921aff047b60b0f428eab553f533285da05dc
Jupyter
1,479
51
# %% # Script for NB-NC contact length ROC analysis shown in Figure S2 import numpy as np from sklearn.metrics import roc_curve, auc import matplotlib.pyplot as plt import pandas as pd # %% df = pd.read_csv('CombinedMatrixPreWindowFirstSignFrameFINAL0925.csv') df = df.dropna(subset=['area', 'contact_length', 'contact...
5e33bb7b211b7452d21f801e64f9b518cf153d467b08adfd9c3925bf5f1eb6b8
Jupyter
1,484
66
# %% import sys import os from os.path import dirname, realpath, join base_dir = dirname(dirname(os.getcwd())) import pandas as pd from os.path import join sys.path.insert(0, base_dir) # %% from config_path import PROSTATE_DATA_PATH, PLOTS_PATH, DATA_PATH # %% ge_file = join(PROSTATE_DATA_PATH,'processed/outputs_su...
847f149c98ad2e68fb962caa741da4c07a1096c802cb710731dbe0779931e56b
Jupyter
1,487
67
# %% [markdown] # ## Align Dendrite populations globaly # %% # import os # os.environ["JAX_PLATFORMS"] = "cpu" import numpy as np # import vedo as vd import pandas as pd import NeuRosetta as nr # import GeoJax as gj # %% col_df = pd.read_csv('/home/ndrummond@neuro.mpg.de/Desktop/Column_cell_type_ids/column_assignme...
210c367684c52be2b9bed9025221c8432b38dedb6de96369c64f543c34ba3987
Jupyter
1,509
51
# %% # Script for NB-NC contact duration ROC analysis shown in Figure S2 import numpy as np from sklearn.metrics import roc_curve, auc import matplotlib.pyplot as plt import pandas as pd # %% df = pd.read_csv('CombinedMatrixPreWindowFirstSignFrameFINAL0925.csv') df = df.dropna(subset=['area', 'contact_length', 'conta...
f3fbf33712315c7451215ccaf3740c45b8b3b23ca3e5816a07eaba262f4d4daa
Jupyter
1,509
38
# %% [markdown] # # TREC-repurposed Relevance Matrix # %% [markdown] # Prerequisites # # 1. Prepare the TREC relevance pairs file using the instructions given [here](https://github.com/zbmed-semtec/doc2vec-doc-relevance/blob/main/Docs/relevance%20matrix/TREC-simplified.ipynb). # %% import pandas as pd os.chdir('../P...
36ec9d23fa0efe947272f56e2e179f7ee324ea3abc5f2d185771c24bf16a881d
Jupyter
1,520
90
# %% [markdown] # # Load & Parse Data # %% from utils.parse_data import load_dataset_main dataset = load_dataset_main() # %% # %% # %% [markdown] # # Train Model # %% from utils.training_utils import run_loso_cv from models.lstm import alstm_model_generator n_roi, H = 19, 3 model_gen = lambda : alstm_model_ge...
f8b091f300314312993e01277d2abe1d03dc156536a047113a2b529797f86563
Jupyter
1,545
66
# %% import sys import os from os.path import dirname, realpath, join base_dir = dirname(dirname(os.getcwd())) import pandas as pd from os.path import join # %% sys.path.insert(0, base_dir) from config_path import PROSTATE_DATA_PATH, PLOTS_PATH # %% mapping_file = join(PROSTATE_DATA_PATH, 'raw_data/sample_mapping.ts...
bc3985d7bbd57ea1c8bb5e27812fdbb1de524dac1ada4b35465c234b14eb4cb6
Jupyter
1,598
58
# %% import numpy as np a = np.load(r"E:\MSImaging-data\_msi_visual\Extractions\NRL4485-s2-new\5_bins\2.npy") d = np.load(r"E:\MSImaging-data\_msi_visual\Extractions\NRL4485-s2\5_bins\2.npy") print(a.max(), d.max()) print(a[30:40, 30:40].mean(), d[30:40, 30:40].mean()) print(a[:, :, :10].max(), d[:, :, :10].max()) pr...
35499b51ce07d26d98be686952850bbfa8a7f78cf2b1fc0268b642d25ba64fb7
Jupyter
1,602
52
# %% import numpy as np a = np.load(r"E:\MSImaging-data\_msi_visual\Extractions\NRL4485-s2-new\5_bins\2.npy") d = np.load(r"E:\MSImaging-data\_msi_visual\Extractions\NRL4485-s2\5_bins\2.npy") print(a.max(), d.max()) print(a[30:40, 30:40].mean(), d[30:40, 30:40].mean()) print(a[:, :, :10].max(), d[:, :, :10].max()) pri...
0b8e74781365600f251244fdbd458dacfb4a849e6ae7caa694fd47cc08ded959
Jupyter
1,608
59
# %% # Script for NC apical area ROC analysis shown in Figure S2 import numpy as np from sklearn.metrics import roc_curve, auc import matplotlib.pyplot as plt import pandas as pd # %% df = pd.read_csv('CombinedMatrixPreWindowFirstSignFrameFINAL0925.csv') df = df.dropna(subset=['area', 'contact_length', 'contact_durat...
4466fb678bd157899489b187ca2c2d1c9cdfebbc41ce9b70531c1b430e5a7537
Jupyter
1,608
78
# %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import h5py, nrrd import numpy as np # data paths data_path = '/groups/scicompsoft/home/fleishmang/rnr-exm-work/data/zebrafish_pair0.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...] # a...
991749350e345415d5e0f41f326f0ec759392c64b76a6b222a81b1471dbe00ad
Jupyter
1,610
78
# %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import h5py, nrrd import numpy as np # data paths data_path = '/groups/scicompsoft/home/fleishmang/rnr-exm-work/data/sample_pair.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...] # assum...
6ce77cb443702590333f878402e1f55b9cdb1fe9f5a559c0cc239d3497e59a9a
Jupyter
1,615
78
# %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import h5py, nrrd import numpy as np # data paths data_path = '/groups/scicompsoft/home/fleishmang/rnr-exm-work/data/zebrafish_pair1.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...] # a...
f631b1f2a4948446658cf0490b2fec0e7d6000e35cb24230129cf3c81d826167
Jupyter
1,628
63
# %% from binn import BINN, BINNDataLoader, BINNTrainer, BINNExplainer import pandas as pd # Load your data data_matrix = pd.read_csv("../binn/data/sample_datamatrix.csv") design_matrix = pd.read_csv("../binn/data/sample_design_matrix.tsv", sep="\t") # Initialize BINN binn = BINN(data_matrix=data_matrix, network_sour...
f8d3f2d049bfd3d91baa55dc10f02ac003938777c15fe31983a27910c74b2fdd
Jupyter
1,655
49
# %% import numpy as np import matplotlib.pyplot as plt # %% # Load the data data = np.load("Fig5.npz") ActorToPartner = data["ActorToPartner"] PartnerToActor = data["PartnerToActor"] Modulation = data["Modulation"] # %% # Plot the data for Actor to Partner fig, axs = plt.subplots(1,1) # Figure 5A (left) fac = axs.im...
4157be5634b942c5641d65c5938db1ad4ea0398bb8918f12b01cf32264dd84df
Jupyter
1,668
46
# %% library(spacexr) library(Seurat) library(ggplot2) library(cowplot) library(dplyr) library(RColorBrewer) cols = c(brewer.pal(9, "Set1"),brewer.pal(8,"Set2")[1:8],brewer.pal(12,"Paired")[1:12],brewer.pal(8,"Dark2")[1:8],brewer.pal(8,"Accent"),brewer.pal(12, "Set3"),brewer.pal(9,"Pastel1"),brewer.pal(8,"Pastel2")) co...
1ed346faa42193da9c0b37bc3084905bc48ba191d7d07b092704184cf6d3ae99
Jupyter
1,710
57
# %% import scanpy as sc import os from scib_metrics.benchmark import Benchmarker, BioConservation, BatchCorrection import pandas as pd # %% scGPT = sc.read_h5ad("./data/scGPT_neftel_ss2.h5ad") scGPT_cancer = sc.read_h5ad("./data/scGPT_cancer_neftel_ss2.h5ad") CancerGPT = sc.read_h5ad("./data/CancerGPT_neftel_ss2.h5ad...
6bca788d1c3a5a31fef15ad4bb6e621dbca0a7fdcf5247f0828cccf62d674a3a
Jupyter
1,734
71
# %% [markdown] # # Figure S3 # %% import sys import os root_path = os.path.abspath("..") sys.path.append(root_path) os.environ["JAX_PLATFORMS"] = "cpu" import matplotlib.pyplot as plt import matplotlib as mpl import pandas as pd import vedo as vd import pickle # from src import columns from src.columns import Col...
d03c02729c70b95944e702f06a0cf31e83c39bf2e7cbc5e822e556267c257a78
Jupyter
1,822
70
# %% import os from dn_utils.behavioral_models import load_behavioral_data from os.path import join import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from dn_utils.misc import tidy_data from statsmodels.stats.anova import AnovaRM from dn_utils.style import ORANGE, BLUE # %% p...
eaec4936d12f1955ad70dc6bd0eb807ace62964311ce50056d93ec82235f4a31
Jupyter
1,838
59
# %% [markdown] # # Import packages # %% from src.utils import read_gtf from scripts.splice_sites_annotation import add_phyloP, gtf_to_SJ import polars as pl import seaborn as sns import matplotlib.pyplot as plt # %% ORFanage_ss = pl.read_csv("export/ORFanage_splice_sites.csv") # %% intronic_seq = read_gtf("nextflow...
13e96c2422367c8b913a8bed63d5bb449affb5640542a5bac34935757af2a2e4
Jupyter
1,846
49
# %% import numpy as np import matplotlib.pyplot as plt # %% # Load the data data = np.load("Fig4.npz") PartnerToActor = data["PartnerToActor"] PartnerNotToActor = data["PartnerNotToActor"] Modulation = data["Modulation"] # %% # Plot the data for Partner to Actor fig, axs = plt.subplots(1,1) # Figure 4A sub = axs.ims...
2481a99949fc31ccf54b93ff9b7ccfb6246419e203a8426d323d5c7c93ef7dd3
Jupyter
1,858
57
# %% ############## Applicable Environment tereopy-1.5.1 ######### ############################################## import stereo as st import warnings warnings.filterwarnings('ignore') # %% st.__version__ # %% import os import glob # %% ############ Extract all SN chip numbers for looping. # Specify directory path di...
77fdd5dd2a70138d4bee48d5510256823a36b7778d8592e7dca21485f7704e8c
Jupyter
1,859
68
# %% [markdown] # # Inference with MOJO - PyTorch version from HuggingFace # %% [markdown] # # [![Open All Collab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/instadeepai/nucleotide-transformer/blob/main/notebooks/mojo/inference_mojo_pytorch_example.ipynb) # %%...
b9976583e23aa477ab297667af9d2bfc22ab08bc296dc8426d3653b0d6f67fa4
Jupyter
1,870
71
# %% # Script that plots pre-transcription apical areas of presumptive NBs and NCs shown in Figure 3 import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from scipy.stats import ttest_ind # Load dataset df = pd.read_csv("AreasInPreSignallingWindows.csv") # replace with your actual file name # ...
5359b10e65d3b506b021758890fdba5ae64cb1ae84fd1bc1ef3cc54cd3c58093
Jupyter
1,872
73
# %% import pandas as pd import torch import scipy import numpy as np import scanpy as sc import h5py import pickle import pylab as plt import seaborn as sns sns.set_context('paper') plt.rcParams['pdf.fonttype'] = 42 plt.rcParams['ps.fonttype'] = 42 # %% fn_bin_strategy = './data/fig_bin_strategy.csv' df_bin_strateg...
6ab4d40d7ae900f02aa6f56aff9f0cd5b6631e2e92b96ce44749db31fc97f12a
Jupyter
1,872
58
# %% import cv2 import numpy as np import os import tifffile def crop_masked_regions(image_path, mask_path, output_dir, padding=10): # Read the image and mask image = cv2.imread(image_path) mask = tifffile.imread(mask_path) # Use tifffile to read the mask # Convert mask to 32-bit float if it's no...
3561e7afe6e9259408003ac3e7447ea52d90508f446b32307878ddf38c87507a
Jupyter
1,874
59
# %% import cellxgene_census # %% # or, directly open the census (don't forget to close it!) census = cellxgene_census.open_soma() # %% var_df = cellxgene_census.get_var(census, "homo_sapiens") # %% var_df # %% var_df.n_measured_obs.max() # %% var_df.feature_name.str.contains("ENSG").sum() # 40k cannonical genes ...
7c582fe3418b7d99eb6e33cd8e43417b643d94834a6401cae575417bccc3727b
Jupyter
1,875
68
# %% import os import sys sys.path.append("..") import warnings warnings.filterwarnings('ignore') from string import ascii_uppercase, ascii_lowercase alphabet_list = list(ascii_uppercase+ascii_lowercase) from utils.pdb_processing import seq_to_pdb, get_pdb_chains from utils.protein_mpnn import score_complex, protein...
083354eb6d020ddcedf331ca5e3b876f8153b09071a9a33eb638bcf0d334d411
Jupyter
1,891
90
# %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import h5py, nrrd import numpy as np # data paths data_path = '/groups/scicompsoft/home/fleishmang/rnr-exm-work/data/zebrafish_pair3.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...] # a...
a95a14c252a8447c13f1aea45d338bda8bdf3fe23d7b1d426aacf104d30e1792
Jupyter
1,897
90
# %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import h5py, nrrd import numpy as np # data paths data_path = '/groups/scicompsoft/home/fleishmang/rnr-exm-work/data/zebrafish_pair2.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...] # a...
bc6747737ed61adf0e63bc9035b681038824666bc5518b2621bba541a150a4bb
Jupyter
1,904
56
# %% [markdown] # # # # Example 2: Plotting volumetric data # # This example shows how to project data from a NIFTI volume onto a surface, and # then display the result. # # Data is a Left vs Right hand localizer contrast (t-map) for a single subject # of the Midnight Scan Club dataset [1]_. Data is obtained fro...
aabdeb465c1012cec4f6490179733cf865d9d6cf6e59e770b627db2e0cd7a7d0
Jupyter
1,906
87
# %% [markdown] # # Import modules # %% %reset -f %load_ext autoreload %autoreload 2 import sys import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import scipy import seaborn as sns #from figure_functions import plot_trajectory from utils import wrapToPi from PFN_model import PFN, Build...
d628d011a384acb854b53a8c158dbbf1b021422342f66c3a8cfa690a0d5ec067
Jupyter
1,919
81
# %% import os import sys import random import matplotlib.pyplot as plt import numpy as np from prl_task import create_blocks, create_schedule from dn_utils.style import BLUE_TASK, YELLOW_TASK, MPL_STYLES %matplotlib inline # %% path_root = os.environ.get('DECIDENET_PATH') path_code = os.path.join(path_root, 'code'...
601e7499d509e15c15be13faacfb77c73e3f26a3814c057e0f63f58f911e94e2
Jupyter
1,936
55
# %% import os,sys sys.path.append(os.path.realpath(os.path.join(os.getcwd(), '..'))) import warnings warnings.filterwarnings("ignore") # %% import scanpy as sc import pandas as pd import CPS # %% opt = CPS.config() args = opt.parse_args(['--seed', '2026']) args.prep_scale = False args.sigma=0.8 args.dataset_path = '...
9e8d51e6aaaa7552705bfd56b257f97bcb03cd092a6c5265a827174c0e85a251
Jupyter
1,953
59
# %% from scipy.interpolate import interp1d from scipy.special import hyp2f1, beta, gamma, gammaln from numpy.random import uniform import numpy as np import matplotlib.pyplot as plt %matplotlib inline from statsmodels.distributions.empirical_distribution import ECDF # %% def rpdf(n, rs): """ n = number of samples...
2d894cb89fb07556caa2c1216dde5a853fbe9a5a8112076521a93a4fda74d3db
Jupyter
1,972
69
# %% [markdown] # # Node profile dissimilarity visualization # # > **Analysis type**: Multiple γ (visualization) # %% import json from os.path import join import numpy as np import pandas as pd from dn_utils.path import path # %% atlas = "combined_roi" gamma_range = np.arange(0.5, 2.5, 0.5) # %% path_corrmats = jo...
a7f2008b7c8dec0a8b1d10643d64f4eb298299c3054948a4e4d7afe4e6fd2bcf
Jupyter
1,990
69
# %% import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg from matplotlib.offsetbox import OffsetImage, AnnotationBbox from oneqmc.analysis import HARTREE_TO_KCAL from oneqmc.analysis.plot import set_defaults set_defaults() # %% SAVE_FIGURES = False # %% df = pd.re...
cc773ff2d7420d891f7c34430d245f8d8d2cb7bede1ec013c26aaf1e648ba9ee
Jupyter
2,000
71
# %% [markdown] # # Simple Kernel SHAP # # This notebook provides a simple brute force version of Kernel SHAP that enumerates the entire $2^M$ sample space. We also compare to the full KernelExplainer implementation. Note that KernelExplainer does a sampling approximation for large values of $M$, but for small values ...
d41001dfbc30cd56f23d4af2ffc73c75290966c348fadf3a01f73dcc4255c1ce
Jupyter
2,003
78
# %% [markdown] # # Inference with BulkRNABert - Jax version # %% [markdown] # [![Open All Collab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/instadeepai/nucleotide-transformer/blob/main/notebooks/bulk_rna_bert/inference_bulkrnabert_jax_example.ipynb) # %% [mar...
7d39caf386a26923fcecbae3ff246d80632269e339cea70d0cd4c4debb92e955
Jupyter
2,006
26
# %% [markdown] # ## Brachyury expression levels predict lineage potential and axis-forming ability of in vitro derived neuromesodermal progenitors. # # Anahí Binagui-Casas$^{1,*,\#}$, Anna Granés$^{1,*}$, Alberto Ceccarelli$^{2,\$}$, Matthew French$^{3,\$}$, Filip J. Wymeersch$^{4}$, Rosa Portero$^{1}$, Jen Annoh$^{1...
bd9e989f37a52c58db5f5797c57f5f8b71d2f5285bcbe2814813bd8decfb65a4
Jupyter
2,023
88
# %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import h5py, nrrd import numpy as np # data paths data_path = '/groups/scicompsoft/home/fleishmang/rnr-exm-work/test_data/mouse_pair7.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...] # ...
e0f5d3d2d46fdca88ae30e33c804b0b23bffc9f4cacb72bf4d7aec7fe709b744
Jupyter
2,023
88
# %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import h5py, nrrd import numpy as np # data paths data_path = '/groups/scicompsoft/home/fleishmang/rnr-exm-work/test_data/mouse_pair6.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...] # ...
4f457c9c71e7aeb6725650c735d306ee0762b3cad6562036cf65db3276504849
Jupyter
2,028
96
# %% import torch import os import numpy as np import matplotlib.pyplot as plt from libs.codes import * from libs.data import load_mindboggle torch.cuda.memory_allocated('cuda') # %% moving_paths = np.loadtxt('partitions/validation.csv', dtype=str) fixed_paths = np.loadtxt('partitions/fixed.csv', dtype=str) # %% ...
4f5536ed72c577002790df55e3c3ef1e8d38e77c4f9a840f4fd94491ccba1338
Jupyter
2,029
88
# %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import h5py, nrrd import numpy as np # data paths data_path = '/groups/scicompsoft/home/fleishmang/rnr-exm-work/test_data/mouse_pair5.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...] # ...
f63eef5007bee7bb0e61938dfe55ca3344eca06f9ab563e5eadbf71addbee60c
Jupyter
2,033
79
# %% [markdown] # # Inference with MOJO - Jax version # %% [markdown] # [![Open All Collab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/instadeepai/nucleotide-transformer/blob/main/notebooks/mojo/inference_mojo_jax_example.ipynb) # %% [markdown] # ## Installatio...
5aab93e1c61f1134d3ffb7087f45a1f39f1c53293e5d02333f77f8f348e41b09
Jupyter
2,035
92
# %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import h5py, nrrd import numpy as np # data paths data_path = '/groups/scicompsoft/home/fleishmang/rnr-exm-work/test_data/zebrafish_pair5.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...]...
e4f241abb110ae6ccdaaf1514c3ec9aefc3b1324fda2e425051f0fadf83d867f
Jupyter
2,035
92
# %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import h5py, nrrd import numpy as np # data paths data_path = '/groups/scicompsoft/home/fleishmang/rnr-exm-work/test_data/zebrafish_pair6.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...]...
ed545e25d8cc5300527922a8ed4c494019c348f6a29fa3f4158565ac12186ab1
Jupyter
2,035
92
# %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import h5py, nrrd import numpy as np # data paths data_path = '/groups/scicompsoft/home/fleishmang/rnr-exm-work/test_data/zebrafish_pair7.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...]...
da6714343a96f0d3dfe36e2d68b3dfff1c85ae4040a2f7ec64b065e89c04f999
Jupyter
2,044
44
# %% [markdown] # ### Force Plot Colors # # The dependence and summary plots create Python matplotlib plots that can be customized at will. However, the force plots generate plots in Javascript, which are harder to modify inside a notebook. In the case that the colors of the force plot want to be modified, the plot_cm...
910a3bdf2e079e7b985430ce7dfc79451f0d34c1599a95186b6f9c63c552c70d
Jupyter
2,059
73
# %% [markdown] # # Inference with BulkRNABert - PyTorch version from HuggingFace # %% [markdown] # [![Open All Collab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/instadeepai/nucleotide-transformer/blob/main/notebooks/bulk_rna_bert/inference_bulkrnabert_pytorch_...
8911eef43f7f2fe9a61c233cdde94955499fa3f4e101dd1999505ff0a4634666
Jupyter
2,063
66
# %% import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm # --- Parameters --- nPaths = 100 # number of Brownian bridges nPoints = 26 # 0–25 inclusive x = np.arange(nPoints) # --- Simulate Brownian bridges --- dW = np.random.randn(nPaths, nPoints - 1) W = np.cumsum(dW, axis=1) W =...
863a321ffe13341fef339d3d7dcc2275f641aca7c2bc2d71c54f07d0a8954091
Jupyter
2,073
67
# %% import joblib import numpy as np import glob from PIL import Image import msi_visual from importlib import reload from msi_visual import parametric_umap reload(parametric_umap ) from keras.callbacks import Callback class MyCallback(Callback): def on_epoch_end(self, epoch, logs=None): Percentile Ratioi...
1d57677d214752c4815a2a596c177d481d7f430691d956ee537fe8734bb20e57
Jupyter
2,079
62
# %% import sys import os from os.path import dirname, realpath, join base_dir = dirname(dirname(os.getcwd())) base_dir import pandas as pd from os.path import join from matplotlib import pyplot as plt import seaborn as sns from sklearn import metrics # %% sys.path.insert(0, base_dir) from config_path import PROSTATE_...
b09c7edb0ab08614bd87c305e3b3081d1cfb8a26c316fcd824c5bf520dfdf899
Jupyter
2,082
105
# %% import numpy as np from matplotlib import pyplot as plt import matplotlib as mpl import scipy.signal as signal import pandas as pd import glob import seaborn as sns import scipy.ndimage as filters#changed from scipy.ndimage.filters as the namespace was deprecated 05/24/2023 import pickle import scipy.stats as stat...
f1a691871029b421f9eb386c114eb0cb932f28de54f8f9fef34e78b43978ff41
Jupyter
2,102
72
# %% import os import sys sys.path.append("..") import warnings warnings.filterwarnings('ignore') from string import ascii_uppercase, ascii_lowercase alphabet_list = list(ascii_uppercase+ascii_lowercase) from utils.pdb_processing import seq_to_pdb, get_pdb_chains, ld_convert from utils.protein_mpnn import score_comp...
ab554a3e7d53b52b802cde0bbb850790cb5193a21e5db5ba65c52dd95bdfe1a9
Jupyter
2,132
62
# %% [markdown] # ### Vertex (Node) data for dendrites # # Create a dataframe of node level value metrics for each dendrite and save as pickle # %% import NeuRosetta as nr import pandas as pd from NeuRosetta.utils.geometry_utils import euclidean_distance # %% path = "/home/ndrummond@neuro.mpg.de/Datasets/Paper_data...