sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 10.7k | content stringlengths 1 200k |
|---|---|---|---|---|
3cbbffac3b2dfe39258104cf019f90d9e5704546ca13e1e2157aa6528b2ce5f2 | Jupyter | 1,870 | 76 | # %% [markdown]
# # Plot Imagesets
#
# Sets of visual stimuli used for training, consisting of simple 2D object
# shapes formed from n sides and p conformations per side.
#
# Imagesets:
# - N3P2
# - N4P2
# %%
import math
import matplotlib.pyplot as plt
from hsnn.utils import io, ImageSet
from hsnn.transforms impor... |
86c1854fae1206cde3e7226dbeadd235487b094dc9f17d03c2fc9a7d4286efaa | Jupyter | 1,912 | 72 | # %%
%matplotlib inline
import matplotlib.pyplot as plt
from PIL import Image
import tensorflow as tf
import numpy as np
import os
from glob import glob
from time import time
from utils import *
from tensorflow.keras.applications import ResNet50
from tensorflow.keras.applications.resnet50 import preprocess_input, decod... |
3b9a56a3dfb9ae293255097bd1ff42227092ec8028ffda9648c9a03efb1adad3 | Jupyter | 1,996 | 45 | # %%
from SPIDER import train_SPIDER, Cal_knn_expression, Cal_Spatial_Net, mclust_R
import os, pickle, pandas as pd
import scanpy as sc, numpy as np
import sklearn
from sklearn.metrics import normalized_mutual_info_score, homogeneity_score
from sklearn.metrics.cluster import adjusted_rand_score
# %% [markdown]
# Down... |
cb91d11d2766a841d61a328ad9c5d0209faf0e2f1d766771422af84007d0606b | Jupyter | 2,041 | 63 | # %%
import pymaid
import navis as nv
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
import matplotlib.axes as axx
import matplotlib.font_manager as fm
fontprops = fm.FontProperties(size=18)
import time
from navis.interfaces import neuprint as nvneu
from neuroboom i... |
2f36fdcb2e3c83c4f087963677125694f3b5112b07cfb687a56c6b1f24ebd19d | Jupyter | 2,057 | 54 | # %%
import pymaid
import navis as nv
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
import matplotlib.axes as axx
import matplotlib.font_manager as fm
fontprops = fm.FontProperties(size=18)
import time
from navis.interfaces import neuprint as nvneu
from neuroboom i... |
da1254247d87bb90d54e609f9630d7914cf0be8055b2758d0d41e2320a22cad4 | Jupyter | 2,108 | 67 | # %% [markdown]
# ### **Tutorial:MTG**
#
# This experiment utilizes the human Middle Temporal Gyrus (MTG) dataset, which includes spatial transcriptomics data from both donors with Alzheimer's Disease (AD) and cognitively normal controls. In this tutorial, we use the normal sample as a representative example to demons... |
2052ae01ad772d59c8a2ca52079af012268f9e50f14b8832d3ff20cfc64f14ca | Jupyter | 2,178 | 90 | # %% [markdown]
# # Convert v1 to v2
# %% [markdown]
# [](https://colab.research.google.com/github/chemprop/chemprop/blob/main/examples/convert_v1_to_v2.ipynb)
# %%
# Install chemprop from GitHub if running in Google Colab
import os
if os.gete... |
a4863851aa6e74f73ced12a4173300f10d20f1b244c61399c21a04b032b963ea | Jupyter | 2,215 | 65 | # %% [markdown]
# ## Aggregation
# %%
import torch
from chemprop.nn.agg import MeanAggregation, SumAggregation, NormAggregation, AttentiveAggregation
# %% [markdown]
# This is example output from [message passing](./message_passing.ipynb) for input to aggregation.
# %%
n_atoms_in_batch = 7
hidden_dim = 3
example_mes... |
c96ca22b10d83a86a0e1d2bbdddeba4e2dab9a8110cce7cb0951a270549a4275 | Jupyter | 2,232 | 63 | # %% [markdown]
# ## Multicomponent models
# %%
from chemprop.nn.message_passing import MulticomponentMessagePassing
from chemprop.models import MulticomponentMPNN
# %% [markdown]
# ### Overview
# %% [markdown]
# The basic Chemprop model is designed for a single molecule or reaction as input. A multicomponent Chempr... |
8773ad3486d4068dde39a13c2f15e87ad4dd93f04793336fda4036a7c935e71b | Jupyter | 2,243 | 67 | # %% [markdown]
# # Local Orientation Calculation
#
# ##### This code calculates the local orientation of each resampled filament point and appends the result to the original file
# %% [markdown]
# ## Initialization
# %%
import numpy as np
import pandas as pd
import os
# %% [markdown]
# ## Helper Functions
# %%
de... |
33deb3d6c2b8eda80e87f18efd314c1ee69c5130ae87f17977b2242e57f72670 | Jupyter | 2,244 | 99 | # %% [markdown]
# # Predicting
# %% [markdown]
# [](https://colab.research.google.com/github/chemprop/chemprop/blob/main/examples/predicting.ipynb)
# %%
# Install chemprop from GitHub if running in Google Colab
import os
if os.getenv("COLAB_RE... |
ce72030485fbdef170c974d920eed18da4909de964b1bab3a5ac7546beb2416f | Jupyter | 2,245 | 80 | # %%
import os
import tifffile
import numpy as np
import matplotlib.pyplot as plt
import glob
# %% [markdown]
# ## Create random crops for training data
#
# Crop positions are drawn with a fixed seed (0) but the draw order follows
# `glob.glob`'s filesystem listing order, which is *not* sorted. The crops
# already i... |
a2e7a19681e07121b3223bff4dab3ed27e81df6813cbeda42425c8a0840c0b3b | Jupyter | 2,247 | 71 | # %%
import pandas as pd
import numpy as np
dataDir = 'C:/Users/15043/'
print(dataDir)
################################################################################
prt1 = 'Table_summary_HF_KS_Lancet.csv'
output_path1 = dataDir + prt1
df = pd.read_csv(output_path1, header = 0);
display(df)
# %%
import math
df['-lo... |
75a5a3c06934b4911b4066310bd3e1ef5ef43a450b10a3396cc8e96ac5e1b577 | Jupyter | 2,265 | 67 | # %% [markdown]
# ## Saving and loading models
# %%
import torch
from chemprop.models.utils import save_model, load_model
from chemprop.models.model import MPNN
from chemprop.models.multi import MulticomponentMPNN
from chemprop import nn
# %% [markdown]
# This is an example buffer to save to and load from, to avoid c... |
502506c0f2c3c76b4464f1d388a1f83a41c235c1ad6587abb855950571e92f76 | Jupyter | 2,282 | 56 | # %%
import seaborn as sns
import pandas as pd
import numpy as np
import shutil
import os
import matplotlib.pyplot as plt
from matplotlib.dates import DateFormatter
from dateutil.relativedelta import relativedelta
# %%
country_list = ['SE', 'DE', 'IT', 'DK', 'FR', 'SP']
clustering_file = 'Covid_cluster.csv'
dfs = {}
... |
387972b348c202e6398969ef1a6548d9ae5de12698d77bf0c176464f4fbba5a3 | Jupyter | 2,293 | 74 | # %%
from pathlib import Path
import scipy.io
from tqdm.notebook import tqdm
import matplotlib.pyplot as plt
# from train_ecg_fm import ECGDataset
# %%
import pandas as pd
class ECGDataset:
def __init__(self, split, base_path='/mnt/sds/sd20i001/malte/data/physionet.org/files/mimic-iv-ecg-preprocessed/'): # '/mn... |
677cfd61eb69e386f381a83163caf2191f8cfcd913a20fdbf80cd3522f1696e7 | Jupyter | 2,329 | 69 | # %% [markdown]
# ## Reaction MolGraph featurizers
# %%
from chemprop.featurizers.molgraph.reaction import CondensedGraphOfReactionFeaturizer
# %% [markdown]
# This is an example reaction to featurize. The sanitizing code is to preserve atom mapped hydrogens in the graph.
# %%
from rdkit import Chem
rct = Chem.MolF... |
4be88d3f538316944deb0df561778a9c67ee1d9dd634ef4794f0e2da0cde0bb3 | Jupyter | 2,370 | 100 | # %% [markdown]
# # Predicting Regression - Reaction
# %% [markdown]
# [](https://colab.research.google.com/github/chemprop/chemprop/blob/main/examples/predicting_regression_reaction.ipynb)
# %%
# Install chemprop from GitHub if running in Goog... |
fb069a57c8722d575fa76e052eb77dad3150886e05d85cdbf4c0a4a9dcadb609 | Jupyter | 2,398 | 70 | # %%
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as ss
import pandas as pd
import seaborn as sns
import os.path
from pathlib import Path
import pingouin as pg
# %%
plt.rcParams["font.family"] = "arial"
plt.rcParams["font.size"] = 7
plt.rcParams['axes.linewidth'] = 0.5
plt.rcParams['xtick.ma... |
ceef1af1e8c837b302d9450a698724425df27f08284ac0f424556a482b60a334 | Jupyter | 2,530 | 95 | # %% [markdown]
# # Multitask model
# %% [markdown]
# [](https://colab.research.google.com/github/chemprop/chemprop/blob/main/examples/multi_task.ipynb)
# %%
# Install chemprop from GitHub if running in Google Colab
import os
if os.getenv("COL... |
a10db61acb9fab7018a8e3521c164721b1226512003ff2e39cc06fc1eb0ccd61 | Jupyter | 2,570 | 86 | # %%
import sys
sys.path.append("..")
from SpaAlign.utils import *
from SpaAlign.model import SpaAlign
import pandas as pd
import numpy as np
import scanpy as sc
import torch
import random
import matplotlib.pyplot as plt
device = 'cuda'
print("CUDA is available. GPU:", torch.cuda.get_device_name(0))
seed = 2022
np.ran... |
efdffac02ee0e3cbd6a7ba7636e546378da1f29043f332da157ad374a4126939 | Jupyter | 2,636 | 114 | # %%
# default_exp utilities
# %% [markdown]
# # utilities
#
# > This contains miscellaneous utility functions.
# %%
#export
from tqdm import tqdm
import numpy
import os
# %%
#export
def text2float(val):
"""A utility function for stably reading strings and return floats if possible,
numpy.nan if not.
... |
c4524c66319d181ab561f087d9dd23628b8e039f7ae47c8e22fc2e8fd8e46f66 | Jupyter | 2,749 | 136 | # %% [markdown]
# # Literature Counts
#
# This notebook uses automated literature searches to collect co-occurence data for the aperiodic-clinical project.
#
# Tools:
# - literature searches and analyses are done with the [lisc](https://lisc-tools.github.io/lisc/) module
# %%
# Import LISC code
from lisc import Cou... |
8d32321dd421ca0dc0e5f01eeb728154f437619d165bb16341c0d13b6e2c8798 | Jupyter | 2,753 | 107 | # %% [markdown]
# # Predicting Regression - Multicomponent
# %% [markdown]
# [](https://colab.research.google.com/github/chemprop/chemprop/blob/main/examples/predicting_regression_multicomponent.ipynb)
# %%
# Install chemprop from GitHub if run... |
a9317c4fb18170ff2a8795c866cc45089c96ed72fd08d74a8e8523c648d67071 | Jupyter | 2,755 | 61 | # %%
import pandas as pd
input_predominant_csv_path = "simulated_predominant_chains.csv"
input_transient_csv_path = "simulated_transient_chains.csv"
columns_to_select_good = ['chain', 'pct_chain_n_1', 'pct_chain_n_2', 'pct_chain_n_3',
'a3', 'b3', 'L3', 'a4', 'b4', 'L4', "a4'", "b4'", "L4'",
'a', 'b', 'L']
pre... |
17b1fd7acd13a1dc6394dec0b0f5cf543004531a3eaaee1188e0d963ebd6f4c5 | Jupyter | 2,757 | 92 | # %%
%matplotlib inline
# %% [markdown]
#
# # Tutorial 1: Building your first gradient
# In this example, we will derive a gradient and do some basic inspections to
# determine which gradients may be of interest and what the multidimensional
# organization of the gradients looks like.
# %% [markdown]
# We’ll first s... |
7a21b764eb308bb1a452a73565a3364a97259cb1f27e7b9f5f54d3e72d169f9d | Jupyter | 2,769 | 74 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as stats
import scipy.integrate as si
import h5py
pd.options.mode.chained_assignment = None # default='warn'
# %%
plt.rcParams["font.family"] = "arial"
plt.rcParams["font.size"] = 7
plt.rcParams['axe... |
81d98600b3ccdf638049ee65d23a3f2513c53480d5d1835800f9e63754b2e21e | Jupyter | 2,974 | 74 | # %%
import pymaid
import navis as nv
import matplotlib.pyplot as plt
import time
from navis.interfaces import neuprint as nvneu
from neuroboom import dendrogram as nbd
import neuroboom as nb
import seaborn as sns
import matplotlib.font_manager as fm
fontprops = fm.FontProperties(size=22)
from mpl_toolkits.axes_grid1.a... |
a668de42b5a95468ce0c2a5fd6138f92af6f18914befe602731f2ab876e3d38d | Jupyter | 2,978 | 74 | # %%
import pymaid
import navis as nv
import matplotlib.pyplot as plt
import time
from navis.interfaces import neuprint as nvneu
from neuroboom import dendrogram as nbd
import neuroboom as nb
import seaborn as sns
import matplotlib.font_manager as fm
fontprops = fm.FontProperties(size=22)
from mpl_toolkits.axes_grid1.a... |
6aa09e05b53cd9ec4c5e08a5a06a221f366d39bdc9ee6b888ba687bba306c7bf | Jupyter | 2,999 | 111 | # %%
from bio_image_unet import unet # pip install bio-image-unet
from bio_image_unet.unet.unet_v0 import Unet_v0
# %% [markdown]
# Trains the two segmentation U-Nets (`Unet_v0`, matching the architecture of
# the shipped `models/model_NF.pth` / `model_VS.pth`) on the crops and hand-drawn
# masks produced by `trainin... |
fe08609fac28698cd1bf210ef8eb88d57c36f71f955253a10a0452c02efedf2c | Jupyter | 2,999 | 88 | # %%
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import scipy.stats as stats
import numpy as np
import pingouin as pg
# %%
plt.rcParams["font.family"] = "arial"
plt.rcParams["font.size"] = 7
plt.rcParams['axes.linewidth'] = 0.5
plt.rcParams['xtick.major.width'] = 0.25
plt.rcParams['xtic... |
59b17d15ab365f75e36d24b0e80f4248e026fe54dd8576eab931ede27f95e8e5 | Jupyter | 3,004 | 82 | # %%
import pymaid
import navis as nv
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
import matplotlib.axes as axx
import matplotlib.font_manager as fm
fontprops = fm.FontProperties(size=22)
import time
from navis.interfaces import neuprint as nvneu
from neuroboom i... |
03adfef7dcad9482459d364a8c107f572c73bd9e68338815b19e369a5dd8b1e6 | Jupyter | 3,021 | 106 | # %%
from pathlib import Path
import pandas as pd
# %%
task = 'inhospital_mortality'
src = Path('results')
# %%
df_ViTiMM = pd.read_csv(src / f'results_ViTiMM_{task}.csv')
df_ViTiMM.rename(columns={'stay_id': 'hadm_id'}, inplace=True)
df_ViTiMM.set_index('hadm_id', inplace=True)
df_ViTiMM.rename(columns={
'swin_l... |
2c8552d1793a5984f45bca2e89f822b1eddcdb572e3a9b1a66d51ffea7171ff4 | Jupyter | 3,027 | 113 | # %%
import numpy as np
import scanpy as sc
import cinemaot as co
import matplotlib.colors as colors
import matplotlib.pyplot as plt
from metrics import calculate_metrics
import random
import torch
import sklearn
import os
def set_seed(seed: int):
# Set Python random seed
random.seed(seed)
# Set NumPy ra... |
aa462b1179ae1fa25727a51bd1be83ccdcfc80099d5c6e7f3c0a86e1daa6327d | Jupyter | 3,045 | 109 | # %%
import numpy as np
from datetime import datetime, timedelta
import glob
import mne
import re
import pandas as pd
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings('ignore') #living on the edge (but i really hate warnings)
# %%
#Gather all resting state recordings
#this takes a while due to... |
68ae96e53864f13ff61f085dad138c9ad3e77a13fe3ac486757e144b35b6b41b | Jupyter | 3,054 | 102 | # %%
# -- coding: utf-8 --
import os
import numpy as np
import pandas as pd
import anndata as ad
import numpy as np
import scanpy as sc
import time
import matplotlib.pyplot as plt
import scvelo as scv
from TSvelo.TSvelo_utils import analyze_g, analyze_GO_KEGG
dataset_name = 'gastrulation_erythroid'
save_folder = 'TSv... |
225312e607ef8fec23aee7a54ae83e06ac81b46217b80f517d8901f63fa7e925 | Jupyter | 3,071 | 94 | # %%
import sys
sys.path.append("..")
from SpaAlign.utils import *
from SpaAlign.model import SpaAlign
import pandas as pd
import numpy as np
import scanpy as sc
import torch
import random
import matplotlib.pyplot as plt
device = 'cuda'
print("CUDA is available. GPU:", torch.cuda.get_device_name(0))
seed = 2022
np.ran... |
f86850ced5ef5bc8f30cfd1ae4bdc2596ac214108ca3f30cb4c5ba10f5bb87f3 | Jupyter | 3,103 | 104 | # %%
from pathlib import Path
import pandas as pd
# %%
task = 'phenotyping'
src = Path('results')
# %%
df_ViTiMM = pd.read_csv(src / f'results_ViTiMM_{task}.csv', index_col=0)
# df_ViTiMM.rename(columns={'stay_id': 'hadm_id'}, inplace=True)
# df_ViTiMM.set_index('hadm_id', inplace=True)
df_ViTiMM.rename(columns={
... |
501d83c389de4c01b17883e38ef34474571a1a2c194979b6fb3e6cf1f1c358f0 | Jupyter | 3,136 | 88 | # %%
import pymaid
import navis as nv
import matplotlib.pyplot as plt
import time
from navis.interfaces import neuprint as nvneu
from neuroboom import dendrogram as nbd
import neuroboom as nb
import seaborn as sns
# %%
#connect your catmaid instance
instance=pymaid.CatmaidInstance('https://radagast.hms.harvard.edu/cat... |
39873859c8d949ce669e07a6d592c8e2b2d20ce2e4d2d8a42bdc924fb49ffc4a | Jupyter | 3,137 | 110 | # %%
# %%
# Data Download from Zenodo (Simplest)
# Downloads and extracts:
# - NF.7z → data/training/NF/ (with image/ and label/ folders)
# - VS.7z → data/training/VS/ (with image/ and label/ folders)
# - test.7z → data/test/ (raw images)
# - publication_data.7z → data/publication_data/ (raw images)
# - models.7z → dat... |
655289c722dec48f09087103327c4490961962549ca2c4854f07c29bd10bf0fd | Jupyter | 3,145 | 90 | # %% [markdown]
# ## 3d brain images
# %%
import nibabel as nb
import numpy as np
import matplotlib.pyplot as plt
from nilearn import image
import k3d
mask = nb.load("ROI_MNI_V7.nii")
atlas = nb.load("ROI_MNI_V4.nii")
atlas = image.resample_to_img(atlas, mask, interpolation='nearest')
atlas = atlas.get_fdata()
mask =... |
ffecd6193d6c1d9bfa3c4462004aa02c4c6099dd51c0f49ad318b5ab9e5d0a28 | Jupyter | 3,147 | 92 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as stats
import scipy.integrate as si
import h5py
pd.options.mode.chained_assignment = None # default='warn'
# %%
plt.rcParams["font.family"] = "arial"
plt.rcParams["font.size"] = 7
plt.rcParams['axe... |
cf7fec695b0f9383c2b35facfe0571a149ff416c9500cdd1f672b89b2c5b4f82 | Jupyter | 3,196 | 95 | # %% [markdown]
# # Local Orientation Calculation
#
# ##### This code calculates the local orientation of each resampled filament point and appends the result to the original file
# %% [markdown]
# ## Initialization
# %%
import numpy as np
import pandas as pd
import os
# %% [markdown]
# ## Helper Functions
# %%
de... |
f0a6f033c565c05118cbdba6c5248cb9e8527dd4eaf0b1a36ea0f9af3a7e41bd | Jupyter | 3,202 | 102 | # %%
import sys
sys.path.append("..")
from SpaAlign.utils import *
from SpaAlign.model import SpaAlign
import pandas as pd
import numpy as np
import scanpy as sc
import torch
import random
import matplotlib.pyplot as plt
device = 'cuda'
print("CUDA is available. GPU:", torch.cuda.get_device_name(0))
seed = 2022
np.ran... |
2fc3f63060d7fad9ff225ccdc45a7da42cf6f25eaae4e208e679e827e6bdac25 | Jupyter | 3,223 | 86 | # %% [markdown]
# # Demographic Prisoner's Dilemma
#
# The Demographic Prisoner's Dilemma is a family of variants on the classic two-player [Prisoner's Dilemma](https://en.wikipedia.org/wiki/Prisoner's_dilemma), first developed by [Joshua Epstein](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.8.8629&rep=rep... |
d4a0e52cef83908ba2ef41ab6cbfb0e715c3cc3b5f3c996c4f125767dffb0674 | Jupyter | 3,244 | 129 | # %%
%load_ext autoreload
%autoreload 2
# %%
from PIL import Image
import torch
import seaborn as sns
sns.set()
from pathlib import Path
import numpy as np
from tqdm.notebook import tqdm
from model import MultiModalTransformer
from data import dataloaders
from utils import plot_attention
device = 'cpu'
root = Path('/... |
b1d33430dd34703ca35a8b50fc16459b16ff415a3f11934acd5ed02b384a6767 | Jupyter | 3,245 | 89 | # %% [markdown]
# ## Chemprop MPNN models
# %%
from chemprop.models.model import MPNN
# %% [markdown]
# ### Composition
# %% [markdown]
# A Chemprop `MPNN` model is made up of several submodules including a [message passing](./message_passing.ipynb) layer, an [aggregation](./aggregation.ipynb) layer, an optional bat... |
33cb78392255f72cb6238b1ab5ab3b3dc8a235366c42ec550706794cd68930d8 | Jupyter | 3,319 | 90 | # %% [markdown]
# ### **Tutorial:Mouse Brain**
#
# This experiment applies SpatialModal to mouse brain Sagittal Anterior, Sagittal Posterior, and Coronal slices, utilizing joint training for the sagittal sections to capture shared biological patterns. While this notebook specifically demonstrates the Coronal slice wor... |
0053384965ee8a3928e6156fee3f1a82e70148d47abb4b03fba6d1deb0104fac | Jupyter | 3,337 | 161 | # %% [markdown]
# # Literature Searches
#
# This notebook uses automated literature searches to find and collect literature for the aperiodic-clinical project.
#
# Tools:
# - literature searches and analyses are done with the [lisc](https://lisc-tools.github.io/lisc/) module
# %%
# Import lisc code
from lisc import ... |
660ff1377900d8c9519fa90cc23986f1ad436bc5d46f012297c9b9b322f8239e | Jupyter | 3,340 | 85 | # %% [markdown]
# ## Message passing
# %%
from chemprop.nn.message_passing.base import BondMessagePassing, AtomMessagePassing
# %% [markdown]
# This is an example [dataloader](../data/dataloaders.ipynb) to make inputs for the message passing layer.
# %%
import numpy as np
from chemprop.data import MoleculeDatapoint,... |
1988de89f63df63ff425287a5ccb74d734dc6cfa3fd0be8f24a578f4419956ca | Jupyter | 3,407 | 127 | # %% [markdown]
# ## Atom featurizers
# %%
from chemprop.featurizers.atom import MultiHotAtomFeaturizer
# %% [markdown]
# This is an example atom to featurize.
# %%
from rdkit import Chem
atom_to_featurize = Chem.MolFromSmiles("CC").GetAtoms()[0]
# %% [markdown]
# ### Atom features
# %% [markdown]
# The following... |
016900567d8b03e041191cc81953569e6ab5eae866779c752c5ee118f16a3135 | Jupyter | 3,527 | 146 | # %% [markdown]
# # Encoding fingerprint latent representation
# %% [markdown]
# [](https://colab.research.google.com/github/chemprop/chemprop/blob/main/examples/mpnn_fingerprints.ipynb)
# %%
# Install chemprop from GitHub if running in Google ... |
a2e3225c40d0a058834255e42ec43817d971b4bd7a1c3311f85253d4ac27811e | Jupyter | 3,646 | 157 | # %%
from os import listdir
import numpy as np
from datetime import datetime, timedelta
import glob
import mne
import re
import pandas as pd
import matplotlib.pyplot as plt
import sys
sys.path.append('/mnt/obob/staff/fschmidt/meeg_preprocessing/utils/')
#from preproc_utils import preproc_data
from psd_utils import co... |
f72a9d8c2150265e7a35700c681f6154f6892ad95f0862004741723bd1cfaba5 | Jupyter | 3,709 | 123 | # %%
import numpy as np
import matplotlib.pyplot as plt
from utils import *
from scipy.cluster.hierarchy import linkage,leaves_list,optimal_leaf_ordering
from scipy.spatial.distance import pdist
from matplotlib import rcParams
rcParams['pdf.fonttype'] = 42
rcParams['ps.fonttype'] = 42
# %% [markdown]
# ### Plot tens... |
79f8e2520bd0cd33b5ad6c69283dd112fce4d498cfa989523305144624fce1fd | Jupyter | 3,739 | 72 | # %% [markdown]
# ## Callbacks
# %%
from pathlib import Path
from lightning.pytorch.callbacks import Callback
import pandas as pd
import torch
from chemprop.callbacks import CallbackRegistry
# %% [markdown]
# ### Available callbacks
# %% [markdown]
# Chemprop uses PyTorch Lightning for training and prediction, whi... |
2e1cc49c17ea16ec5473d368db31d0a1fc1b13b20160c32f2c3ecd39856fb6be | Jupyter | 3,741 | 103 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as stats
import h5py
pd.options.mode.chained_assignment = None
# %%
plt.rcParams["font.family"] = "arial"
plt.rcParams["font.size"] = 6
plt.rcParams['axes.linewidth'] = 0.5
plt.rcParams['xtick.ma... |
f7beb6baeebcdecac76fd9b73fce6c64144de2f58f096f43e384d63e53e7f3b7 | Jupyter | 3,756 | 81 | # %%
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as ss
import pandas as pd
import seaborn as sns
import os.path
from pathlib import Path
import pingouin as pg
# %%
plt.rcParams["font.family"] = "arial"
plt.rcParams["font.size"] = 7
plt.rcParams['axes.linewidth'] = 0.5
plt.rcParams['xtick.ma... |
d1c5804679c7161916acb3177f595b95468add39a48d026d2dc4f8be30487864 | Jupyter | 3,761 | 72 | # %% [markdown]
# # Interpreting Chemprop Predictions with Myerson Values
#
# [Myerson values](https://doi.org/10.1007%2F978-3-540-24790-6_2) are a solution concept similar to the Shapley value from cooperative game theory. By treating a graph neural network (such as chemprop's MPNN) as the payoff function of a game, ... |
43dc10ad57ed3dcbe35aa95c6fc19afa087e65898de60533d785d99838c33155 | Jupyter | 3,763 | 109 | # %%
from pathlib import Path
import pandas as pd
import matplotlib.pyplot as plt
from tqdm.notebook import tqdm
# raw_root = Path('/mnt/sds/sd20i001/mohamad/MeTra2/data/root')
root = Path('/mnt/hdd/data/MMMedViT_data')
labels = pd.read_csv(root / 'data/labels.csv', index_col=0)
labels
# %%
colors = [
'blue', 'or... |
04bdb971d124244da5fd8dfae8808e26dfe626158ce57ebbbcaa5ffb61a41dd1 | Jupyter | 3,783 | 113 | # %%
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import scipy.stats as stats
import numpy as np
import pingouin as pg
# %%
plt.rcParams["font.family"] = "arial"
plt.rcParams["font.size"] = 7
plt.rcParams['axes.linewidth'] = 0.5
plt.rcParams['xtick.major.width'] = 0.25
plt.rcParams['xtick.... |
0ac712ea7e7f8cb3fb9b50b117c102b072267309d1851d7419ecaf559a47f532 | Jupyter | 3,791 | 149 | # %% [markdown]
# # Weight changes due to STDP
#
# Bimodal distribution of synaptic weights in the network after training on N4P2 shapes, shown for modifiable connections between excitatory neurons.
#
# **Plots (labelled by columns):**
#
# A) Feedforward weights: L0 -> L1
#
# B) Lateral L1 <-> L1
#
# C) Feedback L... |
f81af80e58937ffebab2d620a3a0f9ecf34e37bcb6d3c097e0e1edf242799a68 | Jupyter | 3,846 | 77 | # %%
import os
import numpy as np
import mrcfile
import scipy
import utils
import pandas as pd
import matplotlib.pyplot as plt
# %%
data_dir = "/g/scb/mahamid/Dorothy/MCA_Project/Branching_validation/20231016_branch_verficiation_more_actin/"
actin_csv_dir = "/g/scb/mahamid/Dorothy/MCA_Project/Branching_validation/2023... |
d2821f49a60126c1a20c99179dcab1307c927590fd621784d5aee85845033a97 | Jupyter | 3,872 | 141 | # %%
import sys
import matplotlib.pyplot as plt
import seaborn as sns
from tqdm import tqdm
#changes default of autoreloader to continually reload (2) rather than only on restart
#good for debuggin but does slow code as it is continully reloading modules
%load_ext autoreload
%autoreload 2
#can also use dir() to chec... |
8af35f7fe592167a2c0b30eda936d8c9874176272da54ab4fd647d87fb2a2a0f | Jupyter | 3,875 | 104 | # %%
import anndata as ad
import scanpy as sc
import gc
import sys
import cellanova as cnova
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sea
from metrics import calculate_metrics
# %%
def plot_cellanova(adata, cell_type_key, batch_key, condition_key, dataset_name):
ada... |
37b4874a0eebb6229fb55568d27235577c322187fb66e336b82f5ad835d764b9 | Jupyter | 3,890 | 140 | # %% [markdown]
# ## Figure 3
#
# The input files are available at [our repository on Zenodo](https://doi.org/10.5281/zenodo.19499423).
# %%
import os
import numpy as np
import pandas as pd
import SplIsoFind
from matplotlib import pyplot as plt
pd.options.mode.chained_assignment = None
# %% [markdown]
# ### Figure... |
90e5887bdeef01332188f513684b9911acd088a66dc956743b0add5597415292 | Jupyter | 3,893 | 149 | # %% [markdown]
# # Demonstration of using Chemprop featurizer with DGL and PyTorch Geometric
# %% [markdown]
# [](https://colab.research.google.com/github/chemprop/chemprop/blob/main/examples/use_featurizer_with_other_libraries.ipynb)
# %%
# I... |
ab2db9e83b5bce1b51c7a16a55bd2e9d30735e0571a2ce6b46b6de88850a3698 | Jupyter | 3,907 | 177 | # %% [markdown]
# # Literature Analyses - Frequency Ranges
# %%
from pathlib import Path
from collections import Counter
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# %%
# Import local code
from local.utils import replace_multi_str, convert_franges
from local.plts i... |
b598da32e21b9c39af0550f485369d5be6e8c649498d2ddfb5967df1409c82e0 | Jupyter | 3,934 | 125 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as stats
import scipy.integrate as si
import statsmodels.api as sm
from statsmodels.formula.api import ols
pd.options.mode.chained_assignment = None # default='warn'
# %%
plt.rcParams["font.family"]... |
62e7872cf9d6257a92e6ae11d0ccfd987e88a5780638e1a7c48e4931f88d2979 | Jupyter | 3,972 | 100 | # %% [markdown]
# ## Molecule featurizers
# %%
from chemprop.featurizers.molecule import (
MorganBinaryFeaturizer,
MorganCountFeaturizer,
RDKit2DFeaturizer,
V1RDKit2DFeaturizer,
V1RDKit2DNormalizedFeaturizer,
)
# %% [markdown]
# These are example molecules to featurize.
# %%
from chemprop.utils i... |
716c10d0c6917e69e2e897b5b6d9709f0dc4dff93f388826d849943970d497c7 | Jupyter | 4,146 | 158 | # %%
import numpy as np
import pandas as pd
import scanpy as sc
import matplotlib.pyplot as plt
import scanorama
sc.settings.verbosity = 3 # verbosity: errors (0), warnings (1), info (2), hints (3)
#sc.logging.print_versions()
sc.settings.set_figure_params(dpi=80)
%matplotlib inline
# %%
import session_... |
ab821d3e0ba1fd134613e7050cf44410ea465da6e901177a6f03c4f00ca9513a | Jupyter | 4,188 | 130 | # %%
import sys
sys.path.append("..")
from SpaAlign.hist_features import get_features
from SpaAlign.utils import *
from SpaAlign.model import SpaAlign
from PIL import Image
import pandas as pd
import numpy as np
import scanpy as sc
Image.MAX_IMAGE_PIXELS = None
Image.MAX_IMAGE_PIXELS = None
import torch
import random
... |
12cb54887c125912c3021c876ca6192e7d2de39dc9113394313e0e1e5cccccae | Jupyter | 4,216 | 133 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as stats
import scipy.integrate as si
import statsmodels.api as sm
from statsmodels.formula.api import ols
pd.options.mode.chained_assignment = None # default='warn'
import pingouin as pg
# %%
pl... |
ca1df3caf92b6c2232d1ea063e41800a3ebd9923d57f2717e76e204ce2e4a332 | Jupyter | 4,333 | 134 | # %%
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import scipy.stats as stats
import pymaid
import navis
import seaborn as sns
import scikit_posthocs as sp
#connect your catmaid instance
instance=pymaid.CatmaidInstance('https://radagast.hms.harvard.edu/catmaidaedes',"d2a69935210ef282654219ea3... |
072944706d2f2d38405980b8a6583eb8ec81f47e15e08d13b9e0314a25cc7f92 | Jupyter | 4,349 | 117 | # %% [markdown]
# ### Dataloaders
# %%
from chemprop.data.dataloader import build_dataloader
# %% [markdown]
# This is an example [dataset](./datasets.ipynb) to load.
# %%
import numpy as np
from chemprop.data import MoleculeDatapoint, MoleculeDataset
smis = ["C" * i for i in range(1, 4)]
ys = np.random.rand(len(sm... |
1b92949f08b4da5c1d574479de407eaa21670fe182135a9aa744c6066d93b5a6 | Jupyter | 4,364 | 136 | # %%
import os, sys
from pathlib import Path
PROJECT_ROOT = Path("/home/mame_hil")
os.chdir(PROJECT_ROOT)
sys.path.insert(0, str(PROJECT_ROOT))
os.makedirs("output/ana", exist_ok=True)
import pandas as pd
from pathlib import Path
import numpy as np
from abx_app.AttackCNN.utils.condition import Condition
# %%
subj... |
b8427c5ba7e38e2169a798db71e03cc1a2c787e5c1bbca0dd89fc7e6b42f4723 | Jupyter | 4,369 | 148 | # %% [markdown]
# # SlotDeconv Tutorial
#
# This notebook demonstrates how to use SlotDeconv for spatial transcriptomics deconvolution.
#
# **Key features:**
# - Slot-based reference learning from scRNA-seq
# - Spatial dependency modeling via neighborhood consistency
# - Automatic parameter selection based on data ch... |
91f625c09668103b0ce6d829cd2710b1d70dd380483c92b3ed8fe9e902b803bd | Jupyter | 4,407 | 121 | # %%
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as ss
import pandas as pd
import seaborn as sns
import os.path
from pathlib import Path
import pingouin as pg
# %%
plt.rcParams["font.family"] = "arial"
plt.rcParams["font.size"] = 7
plt.rcParams['axes.linewidth'] = 0.5
plt.rcParams['xtick.ma... |
e927059410e0f7303d82697e6053e6194bac26e0838822e4e3bfd8baaf80b6ba | Jupyter | 4,413 | 113 | # %%
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from scipy.signal import butter, lfilter
# %%
plt.rcParams["font.family"] = "arial"
plt.rcParams["font.size"] = 6
plt.rcParams['axes.linewidth'] = 0.5
plt.rcParams['xtick.major.width'] = 0.25
plt.rcParams['xtick.major.... |
e48ec2f2f036e008e64007818fbb8b8590654530a273239a2b8cdc24da6e6c4d | Jupyter | 4,437 | 110 | # %% [markdown]
# # Gene DEA PD vs Ctl
# %% [markdown]
# This markdown runs gene differential expression analysis in each cluster.
#
# - The analysis is not performed in genes located in sex chromosomes.
# - Log fold changes are also calculated as stable log fold changes (mean in PD / mean in Ctl) using `compute_lo... |
8d80a920a7520d506ea3f6e6b7e990e824f0b98f2d28283c1852b45acecced47 | Jupyter | 4,488 | 153 | # %% [markdown]
# %% [markdown]
# ## Normalisation
# %%
import scanpy as sc
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
import anndata2ri
import logging
from scipy.sparse import issparse
import rpy2.rinterface_lib.callbacks as rcb
import rpy2.robjects as ro
sc.settings.verbosity =... |
e7d16811e47672faeafdfeb62f49db90b333f0760822a6b09f4de239c281f917 | Jupyter | 4,489 | 127 | # %%
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import scipy.stats as stats
import seaborn as sns
import scikit_posthocs as sp
from matplotlib.ticker import PercentFormatter
from math import sqrt
from statistics import mean, stdev
from matplotlib.ticker import PercentFormatter
import pymaid
... |
6b8c15aa81d15237bf08d7397e1b23119afb6062157399a66398eac85604c2d4 | Jupyter | 4,505 | 110 | # %% [markdown]
# # mmVelo Tutorial in 10x Multiome Embryonic Mouse Brain Dataset
# %% [markdown]
# mmVelo is a deep generative model designed to estimate cell state-dependent dynamics across multiple modalities. By utilizing splicing kinetics and multimodal representation learning, mmVelo infers cell state dynamics o... |
9cbc094b5943f6480cb6ccf25dfab86face6b8534346989a85ec3670cf6697ea | Jupyter | 4,571 | 129 | # %%
#default_exp datasets
# %% [markdown]
# # datasets
#
# > A submodule containing classes and functions for organizing data resulting from particular kinds of experiments.
# %%
#export
import numpy
import scipy
from matplotlib import pyplot
import seaborn
import pandas as pd
import pyfastx
import pyfaidx
from tqd... |
ef9fb195cfc2e5fff3651e81d42c5609329ede224e51a2684226fbde0273129a | Jupyter | 4,600 | 138 | # %% [markdown]
# ## Predictors
# %%
import torch
from chemprop.nn.predictors import (
RegressionFFN,
BinaryClassificationFFN,
MulticlassClassificationFFN,
)
# %% [markdown]
# This is example output of [aggregation](./aggregation.ipynb) for input to the predictor.
# %%
n_datapoints_in_batch = 2
hidden_di... |
1034779b579d0c16208c2020d59f5096e43ee7154ca3c35fdaba5da80ea8fcec | Jupyter | 4,647 | 192 | # %% [markdown]
# # Training Regression - Reaction
# %% [markdown]
# [](https://colab.research.google.com/github/chemprop/chemprop/blob/main/examples/training_regression_reaction.ipynb)
# %%
# Install chemprop from GitHub if running in Google C... |
f61e5786f8f14dd1fce2b30766f6a19d226b4f1296dcb19c01eb8c5b86f39e2e | Jupyter | 4,699 | 133 | # %% [markdown]
# ## Datapoints
# %%
import numpy as np
from rdkit import Chem
from chemprop.data.datapoints import LazyMoleculeDatapoint, MoleculeDatapoint, ReactionDatapoint
# %% [markdown]
# ### Molecule Datapoints
# %% [markdown]
# `MoleculeDatapoint`s are made from target value(s) and either a `rdkit.Chem.Mol` ... |
71536bc25a01871b65ff46425fd6554deb90992e66270be4e4a16480518e972e | Jupyter | 4,771 | 101 | # %% [markdown]
# ## Molecule MolGraph featurizers
# %%
from chemprop.featurizers.molgraph.molecule import SimpleMoleculeMolGraphFeaturizer
# %% [markdown]
# This is an example molecule to featurize.
# %%
from rdkit import Chem
mol_to_featurize = Chem.MolFromSmiles("CC")
# %% [markdown]
# ### Simple molgraph featu... |
da8f23eb8f91ccffa9821f353b279295f53e3d8bc517db5bee80fd2ebec38417 | Jupyter | 4,801 | 104 | # %%
import scanpy as sc
import pandas as pd
import statistics
import sys
import getopt
import os
import matplotlib.pyplot as mp
import anndata as ad
import time
# %%
sc.settings.figdir = "../results/figures/"
print(sc.__version__)
# %%
#adata.write_h5ad("ASAP_adata_umap_nointegration.h5")
adata = ad.read_h5ad("h5s/A... |
d8ef8514f191d499d048e78fc3bafde7a7dcadd775db784b57eb40762365e703 | Jupyter | 4,813 | 132 | # %%
import pymaid
import navis
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager
import seaborn as sns
import scipy.stats as stats
# connect your catmaid instance
instance=pymaid.CatmaidInstance('https://radagast.hms.harvard.edu/catmaidaedes',"d2a69935210ef282654219ea39... |
93f50972088182b62d6638f1b14b8722c4991fb3d6f0aab9ec4773dcb72358bb | Jupyter | 4,823 | 150 | # %% [markdown]
# ### **Tutorial:Breast Cancer**
#
# This experiment demonstrates the application of SpatialModal to the human breast cancer (BRCA) dataset, highlighting its ability to integrate multi-modal data for precise tissue characterization. We further showcase a variety of downstream analysis workflows, includ... |
1b32aca3b44e19a5dfdd573a12b19a675980fc627766a935778356b1bc04c7a4 | Jupyter | 4,830 | 139 | # %%
import pymaid
import navis
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager
import seaborn as sns
import scipy.stats as stats
# connect your catmaid instance
instance=pymaid.CatmaidInstance('https://radagast.hms.harvard.edu/catmaidaedes',"d2a69935210ef282654219ea39... |
05d590239b5ad6686dbabde2d4b613547c45295243f6cb9a952d7e844347f0a6 | Jupyter | 4,843 | 156 | # %% [markdown]
# # Tutorial 1 - predefined regions
#
# Demo data for the tutorial can be downloaded from [Zenodo](https://doi.org/10.5281/zenodo.16740333).
# %%
import pandas as pd
import SplIsoFind
import warnings
warnings.filterwarnings("ignore", category=FutureWarning)
# %% [markdown]
# ## Process allinfo file... |
e9735ad779edbed5d803d396093d5a9cbd67c5647057d054aa8de2436b205ded | Jupyter | 4,843 | 187 | # %% [markdown]
# # Training Regression - Multicomponent
# %% [markdown]
# [](https://colab.research.google.com/github/chemprop/chemprop/blob/main/examples/training_regression_multicomponent.ipynb)
# %%
# Install chemprop from GitHub if running... |
86d23886a20adb21931f669333cf6928b817201edac19a56a21d91b504abcdd8 | Jupyter | 4,937 | 140 | # %%
import numpy as np
import scanpy as sc
import cinemaot as co
import matplotlib.colors as colors
import matplotlib.pyplot as plt
import random
import torch
import sklearn
import os
def set_seed(seed: int):
# Set Python random seed
random.seed(seed)
# Set NumPy random seed
np.random.seed(seed)
... |
55c83d831417067588458d7e91511d1834e0e6f8b9bd54b55732215ecc95f5c4 | Jupyter | 4,961 | 156 | # %% [markdown]
# # Tutorial 3 - plot examples
#
# Demo data for the tutorial can be downloaded from [Zenodo](https://doi.org/10.5281/zenodo.16740333).
# %%
import numpy as np
from matplotlib import pyplot as plt
import SplIsoFind
# %% [markdown]
# ## Construct isoform matrix with relative expression
#
# The creat... |
381fa88da0bbd2bd8642897ddd6582efaff0bcdb834c0548fd63948745f10f6e | Jupyter | 4,977 | 114 | # %% [markdown]
# ### **Tutorial:DLPFC**
#
# This experiment demonstrates the application of SpatialModal, a multi-modal deep learning framework, to the human Dorsolateral Prefrontal Cortex (DLPFC) dataset. The DLPFC dataset is a widely used benchmark in spatial transcriptomics, consisting of 12 tissue slices sequence... |
319be7322ccb2549d4b40ae1877eb5d5f6214a7e5bc0d004c70c18742ca42809 | Jupyter | 4,982 | 144 | # %%
import numpy as np
import pickle
import matplotlib.pyplot as plt
import glob
# %% [markdown]
# ### Classifying waveforms into putative types
# %%
# Load the list of units used in a certain tensor
mytensorname = 'drifting_gratings_VISp_shiftdirs_p0.0005_32xp_N1261'
datadir = 'data'
AREA = 'VISp'
with open(f'{data... |
8b8448065ca289eecabc3c1f5d6fb0b39be4b991f9ec572bba37989f92048be8 | Jupyter | 5,054 | 120 | # %%
import os
import numpy as np
import mrcfile
import scipy
import utils
import pandas as pd
import matplotlib.pyplot as plt
# %% [markdown]
# ## Helper
# %%
def template_shortest_tip_distance(template, tips, voxel_size = 1.3544):
#generate kd tree
tips_kd_tree = scipy.spatial.KDTree(tips)
#get distance... |
b981c40060775699439b34168d0afadb24edb38e0ebee92dab4bad26b3cbaa4d | Jupyter | 5,075 | 144 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as stats
import scipy.integrate as si
import h5py
pd.options.mode.chained_assignment = None # default='warn'
# %%
plt.rcParams["font.family"] = "arial"
plt.rcParams["font.size"] = 7
plt.rcParams['axe... |
26ac8bb218a903885eed546e74c9e9575c018a55c207ec5f43bcab6daddd1745 | Jupyter | 5,095 | 139 | # %%
import pymaid
import navis as nv
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import scipy.stats as stats
import seaborn as sns
import scikit_posthocs as sp
from matplotlib.ticker import PercentFormatter
#connect your catmaid instance
instance=pymaid.CatmaidInstance('https://radagast.hms... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.