sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
92f0daef47a9fdae1391cd6963400f59722be76340df3294f8ca6374078483ca
Jupyter
3,544
147
# %% [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/c_elegan_pair2.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...] # as...
60e7b292516965d06a6dae0effad02dd7ce7aba8e12567ebf19b3a9567d97c5b
Jupyter
3,593
135
# %% import sys import os from os.path import dirname, realpath, join base_dir = dirname(dirname(os.getcwd())) import itertools import pandas as pd from os.path import join base_dir sys.path.insert(0, base_dir) from config_path import PROSTATE_DATA_PATH, PLOTS_PATH, GENE_PATH, PROSTATE_LOG_PATH, BASE_PATH from data.da...
15514df8ef9d41cc59fc9fbc9f968546643e0b6720d935b958beaf96c6806972
Jupyter
3,594
117
# %% import torch from utils import * import matplotlib.pyplot as plt import numpy as np # Set the device to GPU if available, otherwise use CPU device = torch.device("cuda" if torch.cuda.is_available() else "cpu") print(f"Using device: {device}") # %% [markdown] # ### Identifying the slice above the lateral ventricl...
a4c7284469796fa1e26aa2afd96d0cfdb95d60ba293ab87d9dc6509fbc1fe7a6
Jupyter
3,595
98
# %% [markdown] # ## Predicting exons with Evo 2 Embeddings # # As a result of extensive pretraining, we expect Evo 2 embeddings to capture details of eukaryotic gene architecture. By training a lightweight model on top of Evo 2 embeddings, we can build classifiers to predict genomic annotations. Annotation prediction...
5aa132e019b2346879be38abec83d216807c355c58bcda740f22be580b7221e2
Jupyter
3,613
86
# %% ### Annotating Different Clusters # %% library(dplyr) library(Matrix) library(data.table) library(Seurat) library(ggplot2) library(RColorBrewer) library(cowplot) library(future) library(viridis) library(SeuratObject) library(tidyr) # %% seuobj = readRDS("/data/Bin200.merge.debatch.rds") # %% ### read anno info ...
3897b3081caf3c7ac33ef11d6985a7b05fa0c9dbbb0a95a56edbcfb3422ba9e8
Jupyter
3,620
111
# %% [markdown] # ## Using scMulan to annotate cell types in Heart, Lung, Liver, Bone marrow, Blood, Brain, and Thymus # %% [markdown] # #### we provide a liver dataset sampled (percentage of 20%) from Suo C, 2022 (doi/10.1126/science.abo0510) # you can download the sampled dataset for this tutorial from: https://clou...
87bb4ce7e6626d1caf44a1acf4aac8b044cf8c88182f9cfd81c7b16959345aa6
Jupyter
3,651
123
# %% [markdown] # # Plot benchmark results # This notebook reads metrics from `baseline_metrics` and produces barplot akin to those in the paper. **Note** that these results are based on the retrained checkpoints and **MatterSim** relaxation & energy (**not DFT**), so results may vary from those in the paper. # %% imp...
cbabff2f329b2b5499cdf210d084e72c4589ac16516e400f8d1d17eb41eeb731
Jupyter
3,661
94
# %% [markdown] # # Keras LSTM for IMDB Sentiment Classification # # This is simple example of how to explain a Keras LSTM model using DeepExplainer. # %% # This model training code is directly from: # https://github.com/keras-team/keras/blob/master/examples/imdb_lstm.py '''Trains an LSTM model on the IMDB sentiment...
dd965db19cc8041fb6c49dfb2969cc2c9056760d1ab0b7646539e0bcd2e2dacd
Jupyter
3,669
138
# %% # This notebook loads in the data from the marmoset and computes a histogram of the spatial frequency selectivity import numpy as np import pandas as pd import matplotlib.pyplot as plt # %% marm_data = pd.read_hdf('../data/parker/marm.h5') # %% def get_group_h5_keys(savepath): """ Get the keys of a group h5...
05e57f0d4de3fc15cf4dc8d19e930ffc4ee91e4c195ac4daaee33eec0b7c91c6
Jupyter
3,693
112
# %% ### Merge single-slice RDS objects and perform batch-corrected clustering using BayesSpace. # %% ### library suppressMessages({ library(Seurat) library(data.table) library(ggplot2) library("stringr") library("dplyr") library(ggrepel) library(SingleCellExperiment) library(BayesSpace...
4f9862d4e1b733c66aed53c71763c7bdadcd76c06e035e88b5db52908e51fac6
Jupyter
3,702
113
# %% # running geneformer and deepSem import anndata as ad import torch import scanpy as sc from bengrn import BenGRN, get_perturb_gt from grnndata import utils as grnutils %load_ext autoreload %autoreload 2 FOLDER = "../../../Geneformer/" NUM_GENES=5000 # %% import os import requests # Create a directory to sto...
6dd835afe28b0fc8999ab8ae82ad1185353027984a64b055cf39680801f4522d
Jupyter
3,708
115
# %% [markdown] # # # # Tutorial 1: Quick Start # # This tutorial gives a quick overview of ``surfplot`` before diving into more # detail in subsequent tutorials. The aim here is to get a flavour of how # ``surfplot`` works and what can be plotted. # # ## Getting surfaces # # First, we need to get some brain sur...
8f3dda423938a554c8553b89939d3cece7a4e4b35bf67b53a7a5db7bb00ab2be
Jupyter
3,722
95
# %% ### library(dplyr) library(Matrix) library(data.table) library(Seurat) library(ggplot2) 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...
62c07eb6e286ce53d2408e1ad392a8d1d30b86d0686e30987f367953d24cc255
Jupyter
3,728
100
# %% % matplotlib inline import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pylab as plt import seaborn as sns from mpl_toolkits.axes_grid1 import make_axes_locatable from scipy.io import loadmat mpl.rcParams['svg.fonttype'] = 'none' SpecificTasks = loadmat('gradient_data/brainmap/Spec...
42b3a768d31dc4164119c9e67079644d7ba6248cf6fe52b8e903ae1dfb16cf4d
Jupyter
3,740
167
# %% from pylab import * import seaborn as sns # cmap = cm.get_cmap('seismic', 5) # PiYG cmap = sns.color_palette(None, 10) for c in cmap: # print (c) # for i in range(cmap.N): # rgba = cmap(i) # # rgb2hex accepts rgb or rgba print(matplotlib.colors.rgb2hex(c)) # %% import pandas as pd import numpy...
07ce3ea4b95e27fb373d34e7e0a36bda1946ab765c2e03379d2491df88061f4c
Jupyter
3,781
108
# %% [markdown] # # Usage on proteins # # Although Novae was mainly designed for spatial transcriptomics, it can also be used for spatial proteomics. # # The main difference with the [normal tutorial](../main_usage) is that we will not be able to use the pretrained model, so we'll re-train a Novae model from scratch....
676b128b0e29030e6d97499e49fa6f811da5781fbf1a20ce8c1ec2034cf722ce
Jupyter
3,781
96
# %% [markdown] # # Inference in Discrete Bayesian Network # %% [markdown] # In this notebook, we show a simple example for doing Exact inference in Bayesian Networks using pgmpy. We will be using the Asia network (http://www.bnlearn.com/bnrepository/#asia) for this example. # %% [markdown] # ### Step 1: Define the m...
5945623dd9e87bc06f1f02ea46986678097c5553bb47773a7aedafa51eca08a5
Jupyter
3,811
118
# %% [markdown] # # PyTorch Deep Explainer MNIST example # # A simple example showing how to explain an MNIST CNN trained using PyTorch with Deep Explainer. # %% import torch, torchvision from torchvision import datasets, transforms from torch import nn, optim from torch.nn import functional as F import numpy as np ...
a9236f4af2365bb8efc964917039d74c979588df18a8b31e60e589b5a22baa20
Jupyter
3,821
137
# %% import os import json from os.path import join import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np import pandas as pd import seaborn as sns from statsmodels.stats.anova import AnovaRM from dn_utils.misc import tidy_data from dn_utils.plotting import plot_matrix from dn_utils.style impor...
b33f338a0431008ce81467cebae256de50caa849269194c1db1611c9c53bf049
Jupyter
3,824
117
# %% #!/usr/bin/env python # coding: utf-8 # In[1]: # import matplotlib.pyplot as plt # import pytorch_lightning.callbacks # get_ipython().run_line_magic('load_ext', 'autoreload') # get_ipython().run_line_magic('autoreload', '2') # get_ipython().run_line_magic('matplotlib', 'widget') # In[2]: print('=========Loadin...
de40c8397cd8ba9ccf90aa7c47e47ba21ca7a07a22578ceb783f305e386aa0a5
Jupyter
3,844
80
# %% library(dplyr) library(Matrix) library(data.table) library(Seurat) library(ggplot2) 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")) ...
f65622bcdd644609ba5dc87d0bb6403c10beacefebc7ae40fa1f5edb8d8a1744
Jupyter
3,941
150
# %% # Script that analyses area fold changes in transcribing and non-transcribing NCs shown in Figure 5 # Imports import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from scipy.stats import ttest_rel # Load dataset df = pd.read_csv('AreasInWindowsNaNMean.csv') # Identify window columns windows...
d394eac14f8282a0e4105dec256672c92c6380221bfab4ecbd92f4f3d0a28586
Jupyter
3,951
145
# %% [markdown] # # Figure S4 # %% import sys import os # GeoJax should use the CPU os.environ["JAX_PLATFORMS"] = "cpu" # Get the absolute path to the project root (one directory up from notebooks/) root_path = os.path.abspath("..") sys.path.append(root_path) import pandas as pd import numpy as np import matplotl...
78dedb2f9a5a2934f87a5b68e1686ea69c2769857e3490f556b44457bca054f3
Jupyter
3,977
139
# %% %pylab inline import numpy as np # %% [markdown] # # Enhancement # %% tgtres5 = np.load('../enhancement/baron_human_samp_19264_fromsaver_50M-0.1B-res_tgthighres5_embedding.npy') # %% demoa5 = np.load('./examples/enhancement/Baron_01B-resolution_singlecell_cell_embedding_a5_resolution.npy') # %% tgtres5,demoa5 ...
e6e83efce5178dcf7647628614746d356b0af1c58131be0d540f8d1bbb7af4c1
Jupyter
4,006
108
# %% [markdown] # # Combine parcellations # # Here, two parcellations are combined into one. These parcellations are: # - base parcellation: whole-brain network functional parcellation from [Power et al., 2011](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3222858/) # - meta-analytic parcellation: only regions involved...
1ef34b1bdbb2ac884f4c89bef19a64cb2946a10e51e0ee61fe87f91796965e40
Jupyter
4,018
104
# %% [markdown] # # Census income classification with scikit-learn # # This example uses the standard <a href="https://archive.ics.uci.edu/ml/datasets/Adult">adult census income dataset</a> from the UCI machine learning data repository. We train a k-nearest neighbors classifier using sci-kit learn and then explain the...
32b80c182c629ad9fab621115f97afef0e4e0e43c0882a93303088e9ee20a8bc
Jupyter
4,041
165
# %% %matplotlib inline %reset import matplotlib.pyplot as plt import numpy as np import pandas as pd import pickle import skfda import sys from scipy.integrate import simpson from skfda.preprocessing.dim_reduction import FPCA from skfda.representation.basis import BSplineBasis sys.path.append("[insert root path]/f...
5f758313a64a56c537fb9ec54c6b501766a9f205fc6047efb677937c2a6a22de
Jupyter
4,042
152
# %% [markdown] # # Creating Linear Gaussian Bayesian Networks # %% [markdown] # Similar to defining a Discrete Bayesian Network (BN), defining a Linear Gaussian BN also involves specifying the network structure and its parameterization. # # There are a few ways to define a Linear Gaussian BN in pgmpy: # 1. Load an e...
3ccfe8be514a647e9081a5f3f8c0c569a9eee54f0664b2896d8bff1d50f2f01d
Jupyter
4,047
96
# %% [markdown] # # Consensus partitions calculation # # Here representative module partitions are calculated for entire task and condition classes. First, agreement matrix $D$ between all partitions of interest is calculated. An element of agreement matrix $D_{ij}$ represents the number of times that nodes $i$ and $j...
095288a7124cedfe897225bf91afabd2c835bcc50783cfdd6404dc52975f32cb
Jupyter
4,063
132
# %% [markdown] # ### Tutorial of spatial imputation on slice #151673 of DLPFC using CPS # %% 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.p...
cdc23473615dea07d3b2b66656338e2732f2e77509627d132d21e89adf3c05e3
Jupyter
4,066
124
# %% [markdown] # # CaLM # ## The Codon adaptation Language Model # # Implementation of the [Codon adaptation Language Model (CaLM)](https://www.biorxiv.org/content/10.1101/2022.12.15.519894v1.abstract), a large protein language model has been trained on coding DNA, instead of amino acids. Embeddings from CaLM can be ...
3209e98c56a37a3059ee2bd6830004447ec44b2084ebaef828786a0f1df85c5c
Jupyter
4,121
157
# %% [markdown] # # Using FISSA with SIMA # # [SIMA](http://www.losonczylab.org/sima/) is a toolbox for motion correction and cell detection. # Here we illustrate how to create a workflow which uses SIMA to detect cells and FISSA to extract decontaminated signals from those cells. # # **Reference:** # Kaifosh, P., Za...
bc32f8da3242ff738c888280f31116fad6c4688b9adfc1672fe97f366b8cab62
Jupyter
4,122
101
# %% [markdown] # # Monty Hall Problem # %% [markdown] # ### Problem Description: # The Monty Hall Problem is a very famous problem in Probability Theory. The question goes like: # # # Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You p...
74cec748492e00d0dbc935c0f80c091f36daea0a42ae408c34c4fce262f161a0
Jupyter
4,129
140
# %% library(fasthplus) library(SpatialExperiment) library(here) library("sessioninfo") library(spatialLIBD) library(Seurat) # %% seuobj = readRDS(paste0("/data/Bin200.merge.seuobj.rds")) # %% ###read all BayesSpace outcome meta= readRDS(paste0("/data/work/00.human.brain.atlas/06.Layer.identify.method/00.data/06.Baye...
1914913452636ce3486b1dd274d9bc209ca3456e8d5615fd7149355dd4b70ffc
Jupyter
4,135
125
# %% [markdown] # # GPN demo # # Load the published Brassicales GPN with explicit Transformers AutoClass # registration, inspect its embeddings, and score a masked start-codon nucleotide. # The committed outputs are rendered statically in the documentation. # %% [markdown] # ## Setup # %% !pip install --quiet "gpn[i...
50f8cb8d13542f82df8532af7588f24894731c634dea21c78650c4a37de67e57
Jupyter
4,138
113
# %% cd .. # %% import torch import json import os from importlib.machinery import SourceFileLoader from matplotlib import pyplot as plt from utils.utils import * # %% import skimage def visualize(tensor, cmap='hsv', vmin=None, vmax=None, figsize=None, axis=True, title=None, psnr=None, ssim=None, l1=None): plt.f...
61439da2bc9855b07b56fbf5fba4936a358a235d85ea17f3825ac053cbb842e6
Jupyter
4,151
112
# %% import numpy as np import pickle import matplotlib.pyplot as plt from statsmodels import robust def plot_curve(bundled_data, title, curve, statistics, save_path=None): plt.figure(figsize=(6, 6)) lw = 2 handles = [] for auc_mean, auc_sd, mean_curve_x, all_curve_y, wts, sample, color in bundled_dat...
07676d8bf4e88d8b456a81faf6913aef7acf0180393c9fd25d974ceb7b408503
Jupyter
4,171
129
# %% [markdown] # # Modularity # # This analysis answers the question: **"Does modularity differ between task conditions?"**. Individual modularity values are imported for the threshold range of interest. Modularity values for excluded subjects are discarded. Values are subjected into repeated measures ANOVA with two ...
78c321f4445b017cd2e5c0c02cad3c420d159d7dd3b62c78326084fd3d6b4265
Jupyter
4,203
153
# %% [markdown] # # Creating Discrete Bayesian Networks # %% [markdown] # Defining a Discrete Bayesian Network (BN) involves specifying the network structure and its parameterization in terms of Tabular Conditional Probability Distributions(CPDs), also known as Conditional Probability Tables (CPTs). # # There are few...
a4cd605c408b6b25ba988919f82694f06022d0a4688031cce77c6a97d1c0f91a
Jupyter
4,213
134
# %% [markdown] # # Deep Learning Segmentation (pixel wise classification) # # First Percentile Ratioepare the training dataset. # For all the categories except white matter, we do some spatial smoothing. # For white matter we don't since it's very thin. # %% import numpy as np import cv2 import torch from PIL import...
94a9f6a26662fef82ecf6fac86a68d3bdfefcdfca5157522d667f1fe3267ee04
Jupyter
4,230
142
# %% [markdown] # # [Numba](https://numba.pydata.org/numba-doc/latest/user/5minguide.html) # # Numba is a just-in-time compiler for Python that works best on code that uses NumPy arrays and functions, and loops. # # This jupyter notebook gives a short tutorial on how to use Numba to speed up a function. For instance,...
fa9cdf440719340cfdf4fc5db7c37a6a34e1544c9d2dcaa78a6851484cc90fd5
Jupyter
4,259
187
# %% [markdown] # # Import Libraries # %% #torch.cuda.is_available() # %% [markdown] # # Import Libraries # %% data_dir = "D:/Shahid Sir/Gastrointestinal Tract Kvasir Dataset"# Datasets path data_dir = pathlib.Path(data_dir) data_dir # %% path = "D:/Shahid Sir/Gastrointestinal Tract Kvasir Dataset" dir_list = [os.p...
2f05c54cba4ac42e70e455872e4167f100fd76841406299f7bf3b6af058c1fb2
Jupyter
4,266
158
# %% ##### Fig. 2 - Workflow of time-resolved representational similarity analysis (RSA) # # written by S-C. Baek # updated date: 16.12.2024 # # %% # import packages import os import pickle import numpy as np import pandas as pd from scipy import stats as stats from scipy.spatial.distance import squareform import m...
71e444e8510e998704c6c594fa026749c7f56952827cc09165283f5f0fe3aaf4
Jupyter
4,295
125
# %% ### Visualize the Bayesian results and analyze each cluster. # %% library(dplyr) library(Matrix) library(data.table) library(Seurat) library(ggplot2) library(RColorBrewer) library(cowplot) library(future) library(viridis) library(SeuratObject) library(tidyr) plan("multicore", workers = 16) options(future.globals....
2d63c3fa219b16e9ad0d19326da9a6325de12b69fc3b701210ad1703225fb6cf
Jupyter
4,317
141
# %% [markdown] # ### Tutorial of gene imputation on slice #151673 of DLPFC using CPS # %% 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 numpy as np import CPS # %% opt = CPS.confi...
d8acf461c9fb1fb80faaa58ad7516642d19c96645f75f6e33d7391c9d92beacf
Jupyter
4,333
143
# %% [markdown] # # Basic Operations on Bayesian Networks # %% [markdown] # This notebook shows examples of some basic operations that can be performed on a Bayesian Network. We use the Protein Signalling network from the bnlearn repository as the example model: https://www.bnlearn.com/bnrepository/discrete-medium.htm...
b27af3c076a5c70b9a75ddf8c757d4127e703e0fabf413364b63f66305d6986a
Jupyter
4,358
155
# %% [markdown] # # Compare analytical method with simulation (SI, fig. 14): # # Here we show that our analytical method to compute the STDDs (see section 4.2.1 and the `stddc`-package) is consistent with the results of numerical simulations (computed by the `neuralsampling`-package based on eq. 8ff) # %% import os ...
8cbdd33a591dfd6a909517d82db7ef44e2134989a02c4180efa2cbef6d1102de
Jupyter
4,440
147
# %% [markdown] # # # # Tutorial 4: Layouts and Views # # This tutorial covers the layout and view options provided by ``surfplot``. # # For variety, let's import the left and right Conte69 midthickness surface # directly using :func:`~brainspace.datasets.load_conte69`. Then, we'll make a # blank surface plot usin...
cc7cb7dd7d1292449ce188a52f83a2d3135528061aa7774b5699104686559f8f
Jupyter
4,449
182
# %% [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/c_elegan_pair0.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...] # as...
9edb25b754aa954c8f25dc8b4ec8c28ba7360be1b57f794e6343dd5a9a220869
Jupyter
4,453
159
# %% [markdown] # # Permuation based Mutual Exclusive and Co-occurrence for group of items # %% import numpy as np import pandas as pd import scipy.sparse as sparse import random # %% [markdown] # This is the python implementation of the MutEx algorithm described in the PhD Thesis "Analysis and visualization of multi...
641fbda6cc788634838a930cf7922fed45530ac4f214bbe896952e5d9394e4f9
Jupyter
4,517
183
# %% [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/c_elegan_pair1.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...] # as...
f99e19bcef0d78bfab58861c2777b1d7e8470b067a51a517136d05d299eb84fb
Jupyter
4,522
138
# %% [markdown] # # Transferring Labels Using UCE # # This notebook walks through the example from Figure 4d,4e of transferring labels from mouse kidney norn cells to a human lung disease dataset. # # To transfer labels, we use a basic default implementation of sklearn's logistic classifier. # %% ## Imports import s...
f74a06ecb4988378cf105731dff4bb2b99efe0f4ba029a9eca514f6facb2363b
Jupyter
4,528
207
# %% [markdown] # # Create the plots used in the stability proof (section 4.2.2, fig. 12) # %% from pathlib import Path import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from scipy.integrate import trapezoid from stddc import STDDMaker, alpha_PSP, rect_PSP, exp_PSP # %% # define the style ...
e1c1d22ab11bcd71d8510027a296293800e8b1dcf26d7cc45f3efde5a917c7e9
Jupyter
4,544
200
# %% [markdown] # # Import packages # %% import polars as pl import polars.selectors as cs import numpy as np import src.plotting_functions as plotting from importlib import reload from src.utils import read_gtf, collapse_isoforms_to_proteoforms, read_SJ, gtf_to_SJ from src.ryp import to_r, r from pathlib import Path ...
ee7dad118e7703571c66ca4c1cbd070eb514f36ccca227c792530d579f722e59
Jupyter
4,545
122
# %% import matplotlib.pyplot as plt from math import sqrt from collections import namedtuple # %% Trait = namedtuple("Trait", ["name","n_genes","n_intergenic","s_genes","s_intergenic","h2_genes","h2_intergenic"]) n_genes_total = 135207 n_intergenic_total = 9410173 # %% intelligence = Trait(name = "Intelligence", ...
8b9d015e15f771400786ddd5fb017270d1709094bafa12307d3e098fa4bb74df
Jupyter
4,586
113
# %% import uniport as up import scanpy as sc import torch import scanpy as sc import pandas as pd import numpy as np device = torch.device("cuda" if torch.cuda.is_available() else "cpu") import scanpy as sc key = 'subclass.v4' # %% T_names = [ "T996", "T928", "T906", "T758", "T996", "T756", "T993", "T989"] # 单细胞数据文件...
1c6f5f9bc72de44f0e2b33b3a771eeb86c8b5852f1b48f413d5b9919e6f82308
Jupyter
4,588
131
# %% [markdown] # ## Parameter estimation # %% import matplotlib.pyplot as plt import seaborn as sns import numpy as np import scipy.io import os from sklearn.neighbors import KernelDensity path_root = os.environ.get('DECIDENET_PATH') path_code = os.path.join(path_root, 'code') if path_code not in sys.path: sys....
d24629b87978c52bfe78563b9dc35b7a5e750769df17885ac2d3d1ba86a5551f
Jupyter
4,610
177
# %% # Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors from rdkit import Chem from rdkit.Chem import Draw import json methyl_capped_side_chains = [ "CC", "CCS", "CCC(O)=O", "CCCC(O)=O", "CCC1=CC=CC=C1", "C", "CCC1=CNC=N1", "CC(C)CC", "CCCCCN", "CSCC...
2f050d969c34ffb6635720fe640185c3182a4c13f296ccb0101b569d94f2ee1f
Jupyter
4,618
174
# %% [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/validation_data/mouse_pair4.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][.....
ef8844dcab8d1e9dbe90924fe374c2ba87355ff810d7817ab586d53f2641b752
Jupyter
4,620
167
# %% [markdown] # # Dependencies # %% suppressPackageStartupMessages({ library(tidyverse) library(ggbeeswarm) }) source("./utils.R") # %% limits_ari <- c(-0.05, 1) # %% [markdown] # # Fig1D # %% ari_tech <- read_tsv("./data/ari.tsv", show_col_types = FALSE, col_select = 2:5) head(ari_tech) # %% options(r...
69207ce84d45aa7043903e8c0fd3ab98dcfcbb402bbd2ab3987c215ffb731788
Jupyter
4,622
100
# %% [markdown] # # EASI-FISH pipeline tutorial # --- # # This tutorial shows the basic requirements for running the pre-packaged easi-fish registration pipeline. Although we will only be running a few functions in this tutorial, a lot of complex things are happening behind the scenes. At the end of the tutorial I wil...
7c7383d49bfb10469df596624f07791e5b0c260ae4640a21b0ace99988e19b37
Jupyter
4,635
152
# %% # %% import sys import os from os.path import dirname, realpath, join base_dir = dirname(dirname(os.getcwd())) import itertools import pandas as pd from os.path import join base_dir sys.path.insert(0, base_dir) from config_path import PROSTATE_DATA_PATH, PLOTS_PATH, GENE_PATH, PROSTATE_LOG_PATH from data.data_a...
66ff1af386d34b4d106b51531761dafbe1224d9474f2adf2554979147d7a519a
Jupyter
4,645
168
# %% [markdown] # # Batch effect correction (multiple batches) # %% [markdown] # Here we will use human pancreas datasets (scRNA-seq data) of different studies as an example to illustrate how Garfield performs scRNA-seq batch correction for multiple batches. # %% import os import pandas as pd import numpy as np os.c...
4d77462ac4ee28d95ec508e213dda795607b22328302dfa0ca3e50bbb4ede968
Jupyter
4,652
234
# %% # Script that analyses area log2 fold changes in transcribing and non-transcribing NCs shown in Figure 5 # Imports import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from scipy.stats import ttest_1samp # Load dataset df = pd.read_csv('AreasInWindowsNaNMean.csv') # Ide...
611e253e197974820e17ecb80d7afc6cddcd61b4fbe4ac847c4884cb51147990
Jupyter
4,652
159
# %% [markdown] # # Hypothesis testing on LSNs agreemnent values # # > **Analysis type**: Single γ (results) # %% import json from os.path import join import numpy as np import pandas as pd from dn_utils.networks import fdrcorrection_matrix from dn_utils.path import path from dn_utils.plotting import plot_matrix %m...
5278ce51f310ed2313e1d31d4f3007e8416a9537242c9ad5736c9b87eb4d294d
Jupyter
4,659
184
# %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import h5py, nrrd import numpy as np from bigstream.transform import apply_transform # data paths data_path = '/groups/scicompsoft/home/fleishmang/rnr-exm-work/data/mouse_pair1.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fix...
675e78297c45a2606c8ee0db69f4ba020c7c156d5a42007c9e6cafeb124c6202
Jupyter
4,676
187
# %% import sys import os from os.path import dirname, realpath, join base_dir = dirname(dirname(dirname(os.getcwd()))) import itertools import pandas as pd from os.path import join base_dir # %% sys.path.insert(0, base_dir) from config_path import PROSTATE_DATA_PATH, PLOTS_PATH from data.data_access import Data # %%...
6f3e55d04726f99af2fc432af04ceae50519e8133c2fc6fb438ef5a73a5e137e
Jupyter
4,678
184
# %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import h5py, nrrd import numpy as np from bigstream.transform import apply_transform # data paths data_path = '/groups/scicompsoft/home/fleishmang/rnr-exm-work/data/mouse_pair2.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fix...
bfb79da983475c91181112b5617bdeeeaac6bae65d89c82dbabeab506a649bff
Jupyter
4,678
184
# %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import h5py, nrrd import numpy as np from bigstream.transform import apply_transform # data paths data_path = '/groups/scicompsoft/home/fleishmang/rnr-exm-work/data/mouse_pair0.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fix...
96e7db49e88cde5ced274e154a8e2e70e83f01ebe2e81df7e970d418c4de597c
Jupyter
4,691
111
# %% [markdown] # # Documentation by example for `shap.dependence_plot` # # This notebook is designed to demonstrate (and so document) how to use the `shap.dependence_plot` function. It uses an XGBoost model trained on the classic UCI adult income dataset (which is classification task to predict if people made over 50...
4d29d38611017ca5278c205a23fcc7a7aeffb6733ba681d1b5f5ad0d357e7669
Jupyter
4,693
190
# %% %pylab inline import scanpy as sc import pandas as pd import pickle # %% seg_label = np.load('./data/Segerstolpe-test-label.npy') seg_name = np.load('./data/Segerstolpe-str_label.npy') # %% emb_path="./data/seg-emb.pkl" emb=None label=None f=open(emb_path, 'rb') while 1: try: sub_pkl = pickle.load(f)...
55833befe060e474efe07637b1200581499e6b4e479f75dd8e742b1e4bd7540a
Jupyter
4,695
152
# %% [markdown] # # F01_A: NSD ROI Mega-Matrix MDS # # Minimal reproduction notebook for manuscript Fig. 1A. This starts from the saved whole-brain `mega_matrix` pickle copied into `streamlined/data/processed/mega_mega_matrix.data`, runs MDS on `1 - mega_matrix`, and exports the plotted coordinates. # (see https://git...
5236b63f72a5077cc36d9e21e89506e5b23d0f7242e23cd31da7523e41349b4c
Jupyter
4,700
126
# %% [markdown] # A script which creates a nested dictionary in which the final value at every nested key is a vector containing the processed timeseries for a specific trial, for channel, chromophore and participant, using 'fNIRSData.storeChannelData' <br> # # Stored in the current working directory. # # Inputs:<br...
0e20dd8343b7718b8363cb1f9e6d508a3853e3809c6a897c48c6f5670fdd4356
Jupyter
4,703
178
# %% [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/validation_data/c_elegan_pair4.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move']...
c1ce0984d332d4e6030ede113d9928e8b20e9d14b8e601071256a599a2500722
Jupyter
4,713
154
# %% [markdown] # # # # Tutorial 3: Types of Input Data # # This tutorial covers what types of data can be passed to the `data` parameter # of the :func:`~brainspace.plotting.Plot.add_layer` method of # :class:`~brainspace.plotting.Plot`. # # `data` accepts four different types of data: # # 1. A numpy array of ve...
9221808572a5ebe0cc33ae1972493cd37e6c058074529b5cf134e976d86fd8fa
Jupyter
4,714
184
# %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import h5py, nrrd import numpy as np from bigstream.transform import apply_transform # data paths data_path = '/groups/scicompsoft/home/fleishmang/rnr-exm-work/data/mouse_pair3.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fix...
2e7f484ddc69193ac7ccff470be6a4ffcdd9bccb983e39565e21d5ec06593a34
Jupyter
4,742
124
# %% from tasks.scfoundation import load import scipy.sparse as sp import anndata as ad import hdf5plugin import pandas as pd import numpy as np import scanpy as sc from scipy.spatial.distance import cdist import matplotlib.pyplot as plt # %% def prepare_data(adata, need_normalization=True): gene_list_df = pd.read...
1ca4b2aec1c87b33a256d5703777e13af4855983b831e3bab4e028b04be126ca
Jupyter
4,746
131
# %% [markdown] # ## Data Quality Assurance (QA) # # This script identify bad quality data (e.g. with motion artifacts) and returns vectors specifying which subject can be included in second-level analysis. Script features: # - identifies high motion subjects # - returns DataFrame specifying final sample with high qua...
4472f70c403fa0f296d757422bccb09962ba2133eb40606ba16d4bee7a597d7f
Jupyter
4,762
132
# %% [markdown] # # Iris classification with scikit-learn # # Here we use the well-known Iris species dataset to illustrate how SHAP can explain the output of many different model types, from k-nearest neighbors, to neural networks. This dataset is very small, with only a 150 samples. We use a random set of 130 for tr...
7c6f52c4c84b017c13682d961953b849559acde7379d3c8b3e320be295ba5627
Jupyter
4,764
188
# %% [markdown] # # Thigmotaxis # # Thigmotaxis (wall-following) analysis and figures. # %% import os import dataframe_image as dfi import matplotlib.pyplot as plt import numpy as np import pandas as pd import pingouin as pg from cichlid_omr.config import data_dir, load_config, output_dir # %matplotlib widget # pd....
ef4a80619629ce1f0f19e81460cb8a04cde40859a2df5533367dabbb8b323290
Jupyter
4,779
149
# %% [markdown] # ### In this tutorial we will see the faster way to loop over a pandas dataframe # %% import pandas as pd import numpy as np import time # %% [markdown] # ### Generate sample data for the example # # Lets create a dataframe with two columns: 'pmid' and 'embedding'. The 'pmid' column will contain the...
f63ac1de1e2d831e169613be5ff148fc3736ef8ecfbca1c410b46325a07c330b
Jupyter
4,799
146
# %% [markdown] # # Large Scale Embedding benchmarks # # This notebook includes an example showing how to run large scale embedding benchmarks using scIB [(single-cell integration benchmark)](https://www.nature.com/articles/s41592-021-01336-8) # # We use the GPU accelerated version implemented here: https://github.co...
53fb956dad82fa263d1f5ade8b47081de28fc1ed5383fc55c66911727c87ea5a
Jupyter
4,805
148
# %% [markdown] # # Using FISSA with CNMF from MATLAB # # CNMF is blind source separation toolbox for cell detection and signal extraction. # # Here we illustrate how one can use the ROIs detected by CNMF, and use FISSA to extract and decontaminate the traces. # # In this tutorial, we assume the user is using the [...
4ce49c8166edc205cde28689d627c4d41915bdc86ef3464ff33f395ddbdb81df
Jupyter
4,816
188
# %% [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/c_elegan_pair6.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...] ...
ba11fb6de49555f768dc61b7a057a6f77b1f899e751b4c0876388d02c00d8d55
Jupyter
4,820
125
# %% [markdown] # # # # Tutorial 5: Colors and colorbars # # This tutorial demonstrates how to configure the colorbar(s) with ``surfplot``. # # ## Layer color maps and colorbars # # The color map can be specified for each added plotting layer using the `cmap` # parameter of :func:`~surfplot.plotting.Plot.add_lay...
228b0394cc87061eff0b83a951e3bce5a190b54d7663a4753013f7e083a3d617
Jupyter
4,829
191
# %% %load_ext blackcellmagic # %% [markdown] # #### Imports, setup and helper functions # %% import numpy as np import pandas as pd import deepdish as dd import h5py import nibabel.freesurfer.mghformat as mgh import matplotlib.pyplot as plt import seaborn as sns from scipy.stats import ttest_rel # %% from spacestr...
79074d2aba15e07b733e807a95bcd49f6ef5cd68dc8ddfd093db52a46aa6bd33
Jupyter
4,837
127
# %% [markdown] # # 1_SynAnalyzer_ConvertImarisStatsFile.ipynb # This notebook reads in Imaris statistics files and generates Python-friendly CSV files # with the relevent surface statistics and image metadata added. The exact parameters used for the # conversion process were determined empirically and may need adjust...
c00b47b2aa6b236962122c1d7e4f425f05bd7872943325d1aedebf7b7b318b3d
Jupyter
4,844
187
# %% [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/c_elegan_pair5.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...] ...
91e9a11eea263bac55f9749a7f90b7a1e6f6faf3cb7b8b723f5cfb1ab775a657
Jupyter
4,856
180
# %% [markdown] # ### Geneating data needed fo contour plots # # Fig. 2a, Fig. S1 # %% import NeuRosetta as nr import numpy as np # %% fpath = '/home/ndrummond@neuro.mpg.de/Datasets/Paper_data/nr/Flywire/Reduced_dendrites/' forest = nr.load(fpath, parallel = True, show_progress = True, max_workers = 10, set_units = ...
3fe38496cbd74536048531958fddbf0092b700d1722363c0a36da10d9197d9e5
Jupyter
4,865
179
# %% [markdown] # # Sequence Generation and Alignment Analysis with Evo2 # This notebook demonstrates how to generate biological sequences using the Evo2 model and analyze them using Biopython alignments. # # ## Setup and Dependencies # # First, let's import our required libraries and set up our environment. Note you...
f47326564803561766adcec3d97f7805f0df12a1fef3a83b4477ec790d44e20c
Jupyter
4,869
121
# %% [markdown] # # Structure Learning in Bayesian Networks # %% [markdown] # In this notebook, we show a few examples of Causal Discovery or Structure Learning in pgmpy. pgmpy currently has the following algorithm for causal discovery: # # 1. **PC**: Has $3$ variants original, stable, and parallel. PC is a constrain...
f2d8efa98d9888358b6e7711cba87ad6d21811f443920da61562156e2b216e3c
Jupyter
4,873
185
# %% [markdown] # ## Logging Configuration # %% from bigstream.configure_logging import configure_logging configure_logging(None, True) # %% [markdown] # ## Inputs # --- # %% # reading data and working with arrays import os import zarr, nrrd import numpy as np import os # data paths base_path = '/Users/goinac/Work...
4952c68d224a830694ae5b18e7e54f74dba480c183d2dfc3fb84a9a54877cdb9
Jupyter
4,881
147
# %% %matplotlib inline import matplotlib.pyplot as plt from mapalign.embed import DiffusionMapEmbedding import numpy as np from sklearn.manifold import SpectralEmbedding, TSNE from sklearn.cluster import KMeans # %% def compare_methods(X, title, cluster=None): f, axarr = plt.subplots(2, 7, sharex=True, sharey=Tru...
8b4e797f981c6d27b3fa484b423220aa819e56a056f40eb22227010521991c10
Jupyter
4,893
153
# %% [markdown] # ## AESTETIK with simulated spatial transcritpomics data # # In this notebook we apply AESTETIK on simulated spatial transcriptomics data. # # You can find the code for generating spatial transcriptomics data [here](https://github.com/ratschlab/simulate_spatial_transcriptomics_tool). https://github.c...
68334b15908d05d2d49669220034432d39e3f06b70b1b890e745ef2dd7b7721a
Jupyter
4,894
202
# %% [markdown] # # Speed and size comparision # # # > This tutorial aims to find out the efficient way to save pandas dataframe in terms of read/write speeds and size of the file. # %% import os import time import pandas as pd import numpy as np import matplotlib.pyplot as plt # %% [markdown] # Lets create a samp...
d969aaba396a40aa9b0c597a747446a56bba9a65b7fdb8ed026d0eb9616bdb20
Jupyter
4,912
190
# %% [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/c_elegan_pair7.h5' hdf5_file = h5py.File(data_path, 'r') fix = hdf5_file['/fixed'][...] mov = hdf5_file['/move'][...] ...
07b84726d53871872ede182e139afcf89051f86cda8654e27226973b6648fee5
Jupyter
4,965
114
# %% [markdown] # # Zero-shot Multi-modal Integration with Pre-trained scGPT-spatial # %% [markdown] # #### Dataset: Multi-modal Developing Fetal Lung (Visium/Xenium) ([Quach et al.](https://www.nature.com/articles/s41467-024-50281-5)) # %% [markdown] # In this demo, we will explore the integration of two different ...
eebef9e637127d31cbf24f9a8a5edd7ccbb3c0e14123bb11e8a2d99918d29fb8
Jupyter
4,965
172
# %% [markdown] # # Paired single-cell multi-omics analysis # %% [markdown] # Here we will use 10X PBMCs multiome dataset from scanpy as an example to illustrate how Garfield performs multi-omics integration analysis # %% import os os.chdir('/data2/zhouwg_data/project/Garfield') os.getcwd() # %% # load packages impo...
6f013a9b8590179e802b1c512b00ca3fe5f1ee372645ef6430e876e7641c40db
Jupyter
4,998
88
# %% import matplotlib.pyplot as plt import numpy as np # %% p_coding_005 = [5.79E-03, 5.86E-03, 5.66E-03, 5.91E-03, 5.47E-03, 7.18E-03, 6.68E-03, 6.61E-03, 6.28E-03, 6.97E-03] p_noncoding_005 = [3.19E-04, 3.67E-04, 4.07E-04, 3.81E-04, 3.56E-04, 3.88E-04, 3.59E-04, 4.51E-04, 4.54E-04, 5.47E-04] s_coding_005 = [6.12E-0...
6d3e3a6e7ef521234c044aeaf19f308e52af294ded80d61df29a5a21f260ca44
Jupyter
5,016
179
# %% [markdown] # # Extract Embeddings from Pre-trained Nicheformer Model # # This notebook extracts embeddings from a pre-trained Nicheformer model and stores them in an AnnData object. # %% import os import numpy as np import pytorch_lightning as pl import torch from torch.utils.data import DataLoader import anndat...