sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
2b39f6ef52cfe70b85ec38a65bfe73960a2cc9528201a817c8d31d68cf27aeae
Julia
45,109
1,325
############################################################# ####### SIMULATION FUNCTIONS FOR WHOLE DATA SET ############# ############################################################# function create_covariate_dataset(Nid) ## base on distribution from validation dataset d_debutalder = truncated(Norma...
c0532a2c8c93aa18a26e5022d0ec0e6b6d46b37ed6a794d0498d0fd816f1921b
Julia
97,164
2,720
### A Pluto.jl notebook ### # v0.20.17 using Markdown using InteractiveUtils # This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error). macro bind(def, element) #! format: off ...
298d41e651e144862b1799155570d6b5cec74c1bb1a26cb5c34e672ab7dd058e
Jupyter
16
5
# %% pwd # %%
98798b009f1a649a6ad66a43a458e178198aca3f06f860a1ba6c5b068685dd7c
Jupyter
125
17
# %% from joblib import load # %% data = load('./ESOL_attentiveFP.data') # %% len(data) # %% data[0] # %% data[1] # %%
b044052025b0efddde3a563804d253183dbbd27ee09e86d3810dd77710ee8814
Jupyter
174
10
# %% from scipy.stats import binomtest # Active = best binomtest(17, 22, p=0.5, alternative="greater") # %% # Sham = worst binomtest(15, 22, p=0.5, alternative="greater")
bf7f13f97113de1643f297af89e6c91d66241719d14b83736570cc48ea7f5094
Jupyter
193
15
# %% import pandas as pd df = pd.read_pickle("pubmed_abstracts_miRNA.pkl") print(f"Loaded {len(df)} entries") print("Columns:", df.columns.tolist()) df.head() # %% df['abstract'][0] # %%
6286a34cd6c60a5f05d02aa4e6e691cf9ce7628c6a0e0491d1aa4851e9b5ee82
Jupyter
200
19
# %% import pandas as pd # %% #pd.read_pickle('./descriptor_scale.cfg') # %% from __init__ import load_config # %% df = load_config(ftype='fingerprint', metric='correlation') # %% ls -lh # %%
288423b7fc1a5d1d56df48fbc380773e2defa0581c66212f5aa2189de81603a3
Jupyter
243
19
# %% from joblib import load # %% train, valid, test = load('./ESOL_train_valid_test.data') # %% print(len(train), len(valid), len(test)) # %% train.to_csv('./train.csv') valid.to_csv('./valid.csv') test.to_csv('./test.csv') # %% # %%
dd39b52eb5bc926a4d166c019a2a4bbdf005af5c2b96da47716d5fc6d3d5dba4
Jupyter
281
17
# %% import sys sys.path.insert(0, '/home/shenwanxiang/Research/bidd-molmap/') from molmap.feature.sequence.aas.local_feature.aai import load_index, load_all from molmap.feature.sequence.nas.global_feature import nac # %% # %% ls -lh ./result_data/ # %% load_all().data # %%
471061206e2bbee6619d1ab8c05170cd8cc8fa6a293e9b270b5d3ec66775b6ca
Jupyter
400
13
# %% #Fetch ESM2 import torch torch.hub.set_dir("checkpoints/esm2") model, alphabet = torch.hub.load("facebookresearch/esm:main", "esm2_t6_8M_UR50D") # %% #Fetch DR-BERT from transformers import AutoModelForTokenClassification, AutoTokenizer checkpoint = "checkpoints/drbert" tokenizer = AutoTokenizer.from_pretrained(...
62fdd18268e7ac182f8b44b3010f34cc227e7f3020de5a607ba90b33cdb695b9
Jupyter
444
37
# %% import molmap # %% ftypes = ['descriptor', 'fingerprint'] methods = ['umap', 'tsne', 'mds'] metrics = ['cosine', 'correlation'] # %% for ftype in ftypes: for method in methods: for metric in metrics: mp = molmap.MolMap(ftype = ftype, metric= metric) mp.fit(method = method) ...
2382ca00bc8e3baccd1849838810a6aa774745fa7588d18d46fc6b9e7acc91a7
Jupyter
450
7
# %% #Dispatcher code for training. Ensure correct dataset is in "data" folder and named data.json python scripts/dispatcher.py --config configs/protein_localization/full_prot_comp_pred.json --log_dir /home/shd-sun-lab/protgps/logs # %% #Remember to look into: /Synapse Navigation/protgps/datasets/protein_compartments....
0056a2082bfa78ecc23c58dfdaec201af77ccc82b90d5c50dc789f6c834e78d9
Jupyter
517
42
# %% %config Completer.use_jedi = False # %% from molmap import LocalAASeqMolMap # %% lamp = LocalAASeqMolMap() # %% lamp.df_index1 # %% lamp.df_index2 # %% lamp.df_index3 # %% lamp.fit('MLMPKKNRIAIHELLFKEGVMVAKKDVHMPKHPELAD') # %% import seaborn as sns # %% sns.heatmap(lamp.get_matrices_aas_orders()) # %% s...
d2d045b6c4b9f745881aa9402682886a00f074b30de2b806f08c314f1e00f6d6
Jupyter
540
32
# %% import pandas as pd import numpy as np %config Completer.use_jedi = False # %% aas = '''MVADPPRDSKGLAAAEPTANGGLALASIEDQGAAAGGYCGSRDQVRRCLRANLLVLLTVVAVVAGVALGLGVSGAGGALALGPERLSAFVFPGELLLRLLRMIILPLVVCSLI''' import seaborn as sns # %% from molmap import LocalAASeqMolMap # %% lamp = LocalAASeqMolMap() # %% lamp.fi...
10a7ce864f26cbaf76145addbf1ce5756cace96850f5bac241ef05e33cb33d4d
Jupyter
561
29
# %% [markdown] # # Stats for Figure 4 # %% import pandas as pd import numpy as np import statsmodels.api as sm import statsmodels.formula.api as smf # %% [markdown] # ### Load data # %% nmda = pd.read_csv('../data/DendEventTimes/nmda_spk_times.csv') nmda # %% mean_fr = pd.read_csv('../data/Figure4a.csv') mean_fr ...
3024649184632bc6507c9346cdd1c2b7939ef397a9848cc1b161187b2c8c3c19
Jupyter
575
20
# %% [markdown] # ```{currentmodule} optimap # ``` # %% from optimap.utils import jupyter_render_animation as render # %% [markdown] # ```{tip} # Download this tutorial as a {download}`Jupyter notebook <converted/smoothing.ipynb>`, or a {download}`python script <converted/smoothing.py>` with code cells. # ``` # %% [...
3529af8b4aee95b527cb49efadbecd35932487f0e4de857f25bd6b77198cabc3
Jupyter
598
20
# %% [markdown] # ```{currentmodule} optimap # ``` # %% from optimap.utils import jupyter_render_animation as render # %% [markdown] # ```{tip} # Download this tutorial as a {download}`Jupyter notebook <converted/plotting.ipynb>`, or a {download}`python script <converted/plotting.py>` with code cells. We highly recom...
95f64f90eb09279341aa64ce23b24fac747211e218672310f0ba752bee0b941d
Jupyter
667
20
# %% [markdown] # ```{currentmodule} optimap # ``` # %% from optimap.utils import jupyter_render_animation as render # %% [markdown] # ```{tip} # Download this tutorial as a {download}`Jupyter notebook <converted/cv.ipynb>`, or as a {download}`python script <converted/cv.py>` with code cells. We highly recommend usin...
e37ffaa830be957b56a744644cf27356e078ae7f1d4a60b74c6dcf6c3083ecb0
Jupyter
685
20
# %% [markdown] # ```{currentmodule} optimap # ``` # %% from optimap.utils import jupyter_render_animation as render # %% [markdown] # ```{tip} # Download this tutorial as a {download}`Jupyter notebook <converted/plotting.ipynb>`, or a {download}`python script <converted/plotting.py>` with code cells. We highly recom...
af88e3bebbe556da6533a52acd9131967ca372599ff9986af61fe9535d3450cd
Jupyter
745
33
# %% [markdown] # # AttentiveFP has bugs about splitting this dataset # # The 'ToxCast_attentiveFP.data' comes from [AttentiveFP](https://github.com/OpenDrugAI/AttentiveFP/blob/master/code/2_Physiology_or_Toxicity_ToxCast.ipynb) # # at line 14, we saved their train_df, valid_df and test_df # # # ```python # from jo...
311d501e9f04612aa49ff0f573ac15432acf837592d55875af784c488f3b8087
Jupyter
790
72
# %% import pandas as pd # %% df = pd.read_csv('./bace.csv') # %% dfs = pd.read_csv('untitled.txt') dff = df[df.smiles.isin(dfs.smiles)].reset_index(drop=True) dff = dff.sort_values('Class') dff = dff.sort_values('pIC50', ascending=False).reset_index(drop=True) # %% dff # %% # %% dff.to_csv('./debug2.csv') # %% ...
83d56a3eff760383a17d8ed4800c72f3b7e958f8e9595d5548ba4346bc0be77e
Jupyter
791
38
# %% [markdown] # # Stats for Figure 1 # %% import pandas as pd import numpy as np import matplotlib.pyplot as plt # %% [markdown] # ### Load data # %% fr_spon = pd.read_csv('../data/Figure1FR.csv') fr_spon # %% [markdown] # ### Describe the properties of the firing rates # %% fr_spon['firing_rate'].describe() # ...
f6a5d2a12a5f818688daec6d4a1e18454e79e4be64981f847a835fdf481c5738
Jupyter
817
32
# %% [markdown] # # Counting multi-task model parameters in paper of : # ### `Prediction of Human Cytochrome P450 Inhibition Using a Multitask Deep Autoencoder Neural Network` # ### the autoencode part isn't included # %% from tensorflow.keras.utils import plot_model from tensorflow.keras import Model, Input from tens...
fb448dd2103fcce7377ec7b03fa46832927c1377905e0eb60a4681523e528145
Jupyter
828
29
# %% import pandas as pd from collections import defaultdict # Load the DataFrame dir_ids_seq = 'data_ids_seq/mirna_mirna_sequences_WITHIDS.pkl' df = pd.read_pickle(dir_ids_seq) # Dictionary: sequence → list of {"ID": ..., "Category": ...} dict_seq_to_id_type = defaultdict(list) # Iterate over both x and y columns f...
6affe4d7feba1b219d8f782f8373bdd7ea4fc58475501ed6b1871d79dc71fb95
Jupyter
831
40
# %% import molmap import os # %% data_save_folder = '/raid/shenwanxiang/FP_maps' # %% ls -lh /raid/shenwanxiang/FP_maps # %% if not os.path.exists(data_save_folder): os.makedirs(data_save_folder) # %% metric = 'cosine' method = 'umap' n_neighbors = 30 min_dist = 0.1 # %% bitsinfo = molmap.feature.fingerprint....
15e43cdad617546deb0084033872e799411dcbb91b4e471315619f33bf87c5f0
Jupyter
834
28
# %% import numpy as np import scipy.signal as ss import matplotlib.pyplot as plt # %% def minmax(x): """min max normalizes the given array""" return (x - np.min(x))/(np.max(x)-np.min(x)) B_old = [0.049922035, -0.095993537, 0.050612699, -0.004408786] A_old = [1, -2.494956002, 2.017265875, -0.522189400] B_...
131dfffe8f69d62bec803e685bc319a35ded557cdef38065ef06aee3077089d5
Jupyter
837
26
# %% from parse_prt_file import parse_prt_file conditions = parse_prt_file('/Users/alexandresayal/GitHub/phd-main-exp/prt/interhemisphericLocalizer340v.prt') # Print the extracted data for condition, trials in conditions.items(): print(f"Condition: {condition}") for onset, offset in trials: print(f" ...
6fe6d01eee0de22e087910a2ac2b443ff781110c2e55c2d53a9dbf13832b78d0
Jupyter
874
30
# %% [markdown] # # Approve Hits # %% import boto3 # %% aws_access_key_id = "AKIAJ7ODKKKLEQNUJYZA" aws_secret_access_key = "XXXXX" aws_region = "us-east-1" client = boto3.client('mturk', region_name= "us-east-1", aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key) # %% client.approve_as...
1ef24549285ae92fca3312e71b38681e231a20368d539c11b1a92dea0273393e
Jupyter
878
52
# %% from molmap import dataset from molmap import loadmap import molmap import matplotlib.pyplot as plt from joblib import dump, load from tqdm import tqdm import pandas as pd import numpy as np tqdm.pandas(ascii=True) # %% [markdown] # # list of various types of fingerprint # %% bitsinfo = molmap.feature.fingerpri...
4ab3b564149f0ca92c9b8bea9087aca7c93e009e3fc0e6a5dfe9006a408068cd
Jupyter
884
53
# %% [markdown] # ## In case you need to tune the hyperparameter about the feature map object, you can rearrange your feature values X by the rearrangement method, you don't need to extract the feature values again # %% import molmap import numpy as np import pandas as pd import matplotlib.pyplot as plt # %% mp_cosin...
0249c8c90d57958ad8ac42a4cc2df8a3a174e515aba546f20432e6383edb75e1
Jupyter
913
43
# %% %config Completer.use_jedi = False import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from molmap import PDB2Fmap # %% [markdown] # ## transofrm self properties # %% pm = PDB2Fmap(embd_grain='all', fmap_shape=None) pm.fit(pdb_file='./1a1e/1a1e_protein.pdb', embd_chain='...
b85dc2778a44e0ea8e61d559b98a3c805a2e755428b33b601fdb70ca6abf52fd
Jupyter
916
55
# %% from molmap import dataset from molmap import loadmap import molmap import matplotlib.pyplot as plt from joblib import dump, load from tqdm import tqdm import pandas as pd import numpy as np tqdm.pandas(ascii=True) # %% molmap.feature.fingerprint.Extraction({'RDkitFP':{}}).bitsinfo # %% [markdown] # # list of v...
6ad856809339ceefb14d31b15e8f1ca22011121ace541ba66833431b21a1a78c
Jupyter
917
36
# %% pip install brainsmash # %% import numpy as np import time from datetime import datetime, timedelta from brainsmash.mapgen.base import Base from scipy.io import savemat num_genes = 763 num_surrogates = 1000 num_regions = 213 dist_mat_file = "distance_matrix.txt" surrogate_genes = np.zeros((num_surrogates, num_r...
f8e2388c2db7248a79c8f0aee03fecdb1edfe37b91a138dc2fd4825fd686a101
Jupyter
930
54
# %% from molmap import dataset from molmap import loadmap import molmap import matplotlib.pyplot as plt from joblib import dump, load from tqdm import tqdm import pandas as pd import numpy as np tqdm.pandas(ascii=True) # %% [markdown] # # list of various types of fingerprint # %% bitsinfo = molmap.feature.fingerpri...
b72cde0a07888303e1685f8b50fc5b04ce967840350194c5242302cfdf13a0ef
Jupyter
936
41
# %% [markdown] # %% import os from src.my_settings import settings from src.utils import apply_mask sett = settings() # %% task_run_labels = [ "task-loc_run-1", "task-nf_run-1", "task-nf_run-2", "task-sham_run-1", "task-sham_run-2", ] # %% # apply functional mask to each run of a subject for ...
0460781070215b408bde8a536a35fe97a50d84815302bbd7c88683ca61b17883
Jupyter
965
71
# %% %config Completer.use_jedi = False # %% from molmap import GlobAASeqMolMap # %% ps0 = 'MLMPKKNRIAIHELLFKEGVMVAKKDVHMPKHPELAD' ps1 = 'MQSLKSMLMPKKNRIAIHELLFKNVPNLHVMKA' ps2 = 'KEGVMVAKKDVHMPKHPELADKNVPNLHVMKAMQSLK' ps3 = 'MQSLKSMLMPKKNRIAIHVPNLHVMKANLHVMK' ps4 = 'KEKKDVHMPKHPELADKNVPNLHVMKAMQSLK' ps5 = 'MPKHPELAD...
00551127517b701dd381a1c01b8e90d4349e677ff08d701965ad24b1f1185e42
Jupyter
987
47
# %% [markdown] # ## Imports # %% from skimage import io import numpy as np from arcos4py.tools import track_events_image import matplotlib.pyplot as plt # %% [markdown] # ## Use track_events_image to track objects in a binary image # %% img1 = io.imread("sample_data/pix/2_crossing.tif") img2 = io.imread("sample_dat...
a47ebbea598f8d7af34ebe7d94f877ca8afcb6268d4ce1336e9f143e4ee8d499
Jupyter
1,018
38
# %% [markdown] # # Attach PZA PDB to PncA AlphaFold Predicted Structures PDBs # %% from tqdm import tqdm import os # %% def concat_pdb(file1, file2, output_file): with open(file1, "rb") as f1, open(file2, "rb") as f2: lines1 = f1.readlines() lines1 = lines1[:-1] data2 = f2.read() #...
7b8cb5ff8d66df097f0fbcc8d5f0371b7884f128ccdec62ecb48c437600f7638
Jupyter
1,049
33
# %% import pandas as pd import seaborn as sns import matplotlib.pyplot as plt # %% log_file = 'ESOL_Wed_Jan_29_11-02-29_2020.log' df = pd.read_csv(log_file) n_neighbors_list = df.n_neighbors.unique() min_dist_list = df.min_dist.unique() x = df.valid_best_rmse.values.reshape(len(n_neighbors_list), len(min_dist_list)) ...
82bd7b5bdcbdd71407634f9f34de7cb75e961b6f5ef58686da88fb960c9e2cf7
Jupyter
1,066
50
# %% [markdown] # ## Data preprocessing # Let's first load the packages that will be necessary for the analysis and download the data from Nanostring's webiste. # %% import anndata as ad import pandas as pd import scanpy as sc import squidpy as sq import numpy as np import os import matplotlib.pyplot as plt # %% int_...
d6251fc2b4334f36db54b63f8c88a68843e970b62f9673b02c0e776b9ce492bd
Jupyter
1,066
45
# %% import numpy as np import holoviews as hv from numpy.linalg import svd from holoviews import opts hv.extension('matplotlib') # %% ap_na = np.load('apical_na.npy') ap_nmda = np.load('apical_nmda.npy') ba_na = np.load('basal_na.npy') ba_nmda = np.load('basal_nmda.npy') # %% def PlotMat3d(mat): return hv.Imag...
4070395dedf247c287b2811347400e42f94ea214282f7074e5b09ede8f03f444
Jupyter
1,089
35
# %% [markdown] # # Chronological Diagnostic Algorithm for Parkinsonism # # A machine learning-based diagnostic tool that predicts neuropathology in patients with parkinsonism using chronological clinical presentations. # # **Key Features:** # - Achieves 0.83 AUROC for predicting 9 diagnostic categories at 3 years po...
adac53c0fba0a4e46633bbfaa145e5fd2599f05ba5a421caf6638501b0db61fa
Jupyter
1,099
65
# %% import pandas as pd # %% df1 = pd.read_csv('./MolMap-OOB/bace_bbbp_hiv.csv') df1 # %% df2 = pd.read_csv('./MolMap-OOB/sider_toxcast_tox21.csv') df2 # %% df3 = pd.read_csv('./MolMap-OOB/freesolv_esol_malaria.csv') df3 # %% model_name = 'MMNB-OOTB' # %% df1['test_metric'] = 'ROC_AUC' df1['test_performance'] = d...
b369423cf0b066cbe7024d8eeda20295901272aa972e8ff8ee2595c0a6fc6e55
Jupyter
1,101
34
# %% import pandas as pd import seaborn as sns import matplotlib.pyplot as plt # %% log_file = 'Tox21_search_Mon_Feb__3_11-00-12_2020.log' df = pd.read_csv(log_file) n_neighbors_list = df.n_neighbors.unique() min_dist_list = df.min_dist.unique() x = df.valid_best_auc.values.reshape(len(n_neighbors_list), len(min_dist_...
ff559ff3fbe2ff9259a37de80dbfe9a5dd93fecfb082dd1a0eaf621cc6649457
Jupyter
1,110
60
# %% [markdown] # # Counting multi-task model parameters in paper of : # ### `Predictive Multitask Deep Neural Network Models for ADME-Tox Properties: Learning from Large Data Sets` # %% [markdown] # ## Single/multi task # %% from tensorflow.keras.utils import plot_model from tensorflow.keras import Model, Input from...
e8811ccf48fb60e3d73b9cd697b5f529e263e7a661de0c45f0c855cf3edd5e0d
Jupyter
1,113
56
# %% import torch import glob import os import cv2 import matplotlib.pyplot as plt import random from torchvision import transforms # %% from google.colab import drive drive.mount('/content/drive') # %% train_image_path = os.path.join( '..', 'content', 'drive', 'MyDrive', 'ResNetModel', 'inpu...
6a4c49ef001db0889ef36d56cd2ae7c3943a8fb5f927b5d962110a0fd773aa61
Jupyter
1,128
54
# %% from molmap import loadmap import matplotlib.pyplot as plt import seaborn as sns import numpy as np np.random.seed(123) # %% aspirin = 'CC(=O)OC1=CC=CC=C1C(O)=O' #aspirin smiles_list = [aspirin] mp1 = loadmap('./descriptor.mp') mp2 = loadmap('./fingerprint.mp') # %% X1 = mp1.batch_transform(smiles_list) X2 = mp...
1f38fb0c859dc5a6914b10988ebc5c1925cf646d48e871a2f169a48a1b8a1503
Jupyter
1,185
34
# %% [markdown] # # Using a custom masker # # Here we show how to provide a custom Masker to any of the SHAP model agnostic explanation methods. Masking can often be domain dependent and so it often helpful to consider alternative ways to perturb your data beyond the default ones included with SHAP. # %% import xgboo...
6395640dbc0cd0c8dbf270207a08bdbac66ef1d32776d386de424420875fa69f
Jupyter
1,191
58
# %% import pandas as pd import seaborn as sns import matplotlib.pyplot as plt # %% # %% # %% log_file = 'BACE_bace_search_Wed_Sep_16_13-06-16_2020.log' df = pd.read_csv(log_file) n_neighbors_list = df.n_neighbors.unique() min_dist_list = df.min_dist.unique() len(n_neighbors_list), len(min_dist_list) x = df.va...
700e0a64d01afeb4596100233a4f82683bbf7cc3a101a4f3e13e5393ff0fa1ab
Jupyter
1,234
48
# %% [markdown] # # ConvpaintModel Class # %% [markdown] # <img src='../images/CPM_architecture.png' style='width: 800px' /> # %% from bs4 import BeautifulSoup from IPython.display import display, HTML # %% fix_css = """ <style> .doc.doc-object.doc-class { background: transparent !important; border: none !im...
5632f5de265dc43ec85cf1b7c89cc3bae833a1e192b974510726784c55d91f69
Jupyter
1,266
42
# %% import torch import scanpy as sc sn_data = sc.read_h5ad('/cluster/home/sunyk/deeplearning/.sun_algo/test_data/reference.h5ad') st_data = sc.read_h5ad('/cluster/home/sunyk/deeplearning/.sun_algo/test_data/query.h5ad') sn_data.var_names = sn_data.var['features'] st_data.var_names = st_data.var['features'] # %% im...
543e45ad4f5f58ed34b6aa350751ebf5bcc57412a22e1098f0559c4d62d7e494
Jupyter
1,267
48
# %% [markdown] # # 00 settings # %% import numpy as np # %% [markdown] # # 01 find burst periods # %% def func_find_burst(test_signal): BurstOrNot = np.logical_or(test_signal > 1.5*np.sqrt(np.var(test_signal)), test_signal < -1.5*np.sqrt(np.var(test_signal))) smooth_Burst...
58bff0971b4f84b2079ba37b5d776bbf1a03f952c5cd97251d912581fc71cb59
Jupyter
1,286
46
# %% import sys sys.path.insert(0, '/home/shenwanxiang/Research/bidd-molmap/') from molmap.feature.sequence.nas.global_feature.nac import Kmer, RevcKmer, IDkmer # kmer = nac.Kmer(k=5, normalize=True, upto=True) #4**5 + 4**4 + 4**3 + 4**2 + 4**1 # revkmer = nac.RevcKmer(k=5, normalize=True, upto=True) # idkmer = nac.IDk...
2630576356140f6206c41ac9ca241b7e26022effc820bb87a8f85fd89fb96e15
Jupyter
1,296
62
# %% import anndata as ad import squidpy as sq import cellcharter as cc import pandas as pd import scanpy as sc import numpy as np import matplotlib.pyplot as plt # %% [markdown] # ## Load data # %% path = "analysis/adata_obj/" fig_path = 'figures/scatter_plots_k60/' adata = sc.read_h5ad(path + "adata.h5ad") batch_ke...
fba9a26c30440738be485d7b9605626adea3315062d05e1eb472b86841ffbed2
Jupyter
1,296
47
# %% [markdown] # # Run from Database Example # %% from pathlib import Path from sqlalchemy import create_engine from cali.runner import CaliRunner from cali.sqlmodel import AnalysisSettings from cali.sqlmodel._model import Experiment from cali.sqlmodel._visualize_experiment import print_cali_results # %% database_...
a5d60eaa60c52ecc02c61f9cf2254c0d9af32a94e256604dfa6e3f4633c12028
Jupyter
1,325
47
# %% import pandas as pd from glob import glob # %% csvs = glob('./results/*.csv') r = [] for csv in csvs: df = pd.read_csv(csv, index_col = 0) df['model'] = csv.split('results_')[1].split('_')[0] r.append(df) # %% dfres = pd.concat(r) # %% def format_groud(df): res = { 'train_rmse': '%...
3214f2c0ac41f51c99a9dfb20026f60a6d11c6d2f5377f8f982e7536793e26fb
Jupyter
1,366
42
# %% from rlign import Rlign from neurokit2.ecg import ecg_simulate import numpy as np import matplotlib.pyplot as plt # %% X = ecg_simulate(sampling_rate=100, heart_rate=60, noise=0.35, heart_rate_std=15).reshape(1, 1, 1000) # %% X.shape # %% plt.title("Input ECG") plt.plot(X[0, 0], color="black", alpha=.8) plt.xti...
f54cb65dcabea3ce8a05e66d261c5d2be1714d34872ab0c7fbd0d5569945f855
Jupyter
1,369
59
# %% [markdown] # # Second Level GLMs # For the Localizer, NF, and Sham Runs. # %% from src.my_settings import settings from src.glm import secondlevel from nilearn import plotting as nlp from nilearn.glm import threshold_stats_img sett = settings() alpha = 0.05 hc = 'bonferroni' ct = 10 # %% [markdown] # ## NF Run...
3d610a157d594165e2e4219ff0407ab65ff21df78295e78a9715c18410334072
Jupyter
1,393
58
# %% import numpy as np from numpy.linalg import svd import matplotlib.pyplot as plt import h5py # %% temp = h5py.File("Y:\DendCompOsc\\16Hzapical_exc_mod\output_16Hz_dend_inh_0deg_exc_10p\\v_report.h5", "r") # %% print(temp['report']['biophysical']['data']) # %% test1 = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).res...
f0dce5f6cf986d6ae60ea811e35c42a0ec9b53cd6dd4b64716adc6ae5afe4e37
Jupyter
1,403
42
# %% [markdown] # # `image` plot # # This notebook is designed to demonstrate (and so document) how to use the `shap.plots.image` function. # %% import json from tensorflow.keras.applications.resnet50 import ResNet50, preprocess_input import shap # load pre-trained model and choose two images to explain model = Re...
e58280e749ae92a1f55aaaac627548eccc54b9a1c7c4c3bbaa30122a5571b616
Jupyter
1,407
63
# %% import anndata as ad import pandas as pd import scanpy as sc import scvi import numpy as np from lightning.pytorch import seed_everything seed_everything(12345) scvi.settings.seed = 12345 # %% out_dir = "analysis/adata_obj/" adata = sc.read_h5ad(out_dir+"/adata.h5ad") # %% scvi.model.SCVI.setup_anndata( ada...
9bef495e1f1fefc024281a6370f6976beed7dcd9c7e368077e91deeb17c6987c
Jupyter
1,451
61
# %% [markdown] # # Testing out how to extract f/I curves from recordings # %% import os import sys sys.path.append('..') # have to do this for relative imports in jupyter import numpy as np import pandas as pd import matplotlib.pyplot as plt import h5py from src.load_spike_h5 import load_spike_h5 # %% # files to pu...
7c941c5489a1b1b07d0d5b28a403fe4e8fd42e96c5ac3365b50f3abff229d00e
Jupyter
1,476
61
# %% [markdown] # # Training Curves # %% import wandb import pandas as pd import matplotlib.pyplot as plt # %% plt.rcParams['figure.dpi'] = 300 plt.rcParams['axes.labelsize'] = 12 # %% [markdown] # Training data obtained from WandB run. # # CSV saved in data for reproducibility. # %% # wandb.login() # api = wandb....
a5cf5ff234c5fff9a533c5ef41d7921c907cae386cdf5859e8f87c49b8770078
Jupyter
1,476
45
# %% import os import numpy as np import scipy.io from yass.evaluate.visualization import ChristmasPlot from yass.evaluate.util import main_channels # %% [markdown] # # Create Some Fake Entires That demonstrates Plotting # # In the constructor, give a title, number of total datasets that you want to plot side by sid...
bfa54408d01ecaadaba546004156e6a2b7c32d4a3d7743df5b03b9a9988073dc
Jupyter
1,479
43
# %% [markdown] # # Changing feature extractor (DINOv2) to use Convpaint for animal tracking # %% [markdown] # With the pretrained vision transformer DINOv2 as feature extractor, Convpaint is remarkable at detecting animal body parts - or even actions such as closing/opening eyes. # # Here is a sample frame from a mo...
e437902ab206d41cbe9a7a0dde0e79636b5e682e7d057182edfa1f9977c6f10c
Jupyter
1,500
94
# %% import molmap # %% [markdown] # ## Hyper parameters setting # %% metric = 'cosine' method = 'umap' n_neighbors = 30 min_dist = 0.1 # %% [markdown] # # 1.descriptor map # %% mp_name = './descriptor.mp' mp1 = molmap.MolMap(ftype = 'descriptor', metric = metric, flist = []) mp1.fit(method = method, n_neighbors = ...
c701cd6341977f2a22f154223fdf36a5830d541662e463fce9c849aad55fc422
Jupyter
1,506
54
# %% [markdown] # # Text Data Explanation Benchmarking: Abstractive Summarization # %% [markdown] # This notebook demonstrates how to use the benchmark utility to benchmark the performance of an explainer for text data. In this demo, we showcase explanation performance for partition explainer on an Abstractive Summari...
e093de2325323cc2035deff2dfe2412ee4c4ee4f01c85a4c74743dee164f50a1
Jupyter
1,507
62
# %% from tdc.single_pred import ADME from tdc.benchmark_group import admet_group from molmap.model import RegressionEstimator,MultiClassEstimator from molmap import loadmap def fix_seed(seed = 42): import tensorflow as tf import os, random import numpy as np os.environ['PYTHONHASHSEED']=str(seed) ...
6894187166e8d259501598413e37acb2189f46f4674ad3f0da915231020b544d
Jupyter
1,614
49
# %% [markdown] # # Migrating to the new "Explanation" API # # This notebook demonstrates some of the changes to the shap API that were introduced in shap `v0.36.0`. # %% # An example dataset and model import xgboost import shap X, y = shap.datasets.adult(n_points=100) model = xgboost.XGBClassifier().fit(X, y) expl...
7db2d37ec05a9efc6fb112994491be746cec1cc187c7801050cb8c0a4fdce4b5
Jupyter
1,644
64
# %% import os import numpy as np import glob import csv import random test_array = np.repeat(np.arange(6), 12) print(test_array) # %% np.random.shuffle(test_array) flag = np.hstack(([False], test_array[:-1] == test_array[1:])) flag_array = test_array[flag] num_ocurrences = np.sum(test_array[:-1] == test_array[1:]) ...
a0f57427ad18cfba3701e408553443719ee7bcea47ae7e5a7fb08004fca9e730
Jupyter
1,655
52
# %% [markdown] # # 102 Checking the information of dataset, devices # * geting the dataset size. # %% from sklearn.ensemble import RandomForestClassifier,RandomForestRegressor from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split,StratifiedKFold from sklearn.metrics import * impo...
332d323b6ea72dfc814adf0f0361b834f54723a5f450ca23bbf12f807c48e6c1
Jupyter
1,664
55
# %% [markdown] # # Plot from Database Example # %% import matplotlib.pyplot as plt from sqlalchemy import create_engine from sqlmodel import Session, select from cali.sqlmodel import ROI, Traces from cali.sqlmodel._model import CaliResult # %% database_path = "tests/test_data/data_and_db_for_tests/test_db.cali" eng...
6527b1f6041206b051a905b48935094db43303b01653408817583fda6f43ff66
Jupyter
1,675
85
# %% import pandas as pd import numpy as np import seaborn as sns %matplotlib inline # %% res = [] for i in ['ic', 'ki', 'ec', 'kd']: df = pd.read_csv('./%s.csv' % i,sep=';') # drop the compounds that has no pChEMBL Value df = df.iloc[df['pChEMBL Value'].dropna().index] df = df[["Molecule ChEMBL ID",...
7bfe94b535365e7a0e1dc0ad0753738b4526b44892ced1926b2b53f12c6af7df
Jupyter
1,702
55
# %% import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns # %% BAN_UNSAM=pd.read_csv('./BrainAgeNeXt/BAN_UNSAM.csv') BAN_ADNI=pd.read_csv('./BrainAgeNeXt/BAN_ADNI.csv') BAN_RRIB=pd.read_csv('./BrainAgeNeXt/BAN_RRIB.csv') BAN_JUK=pd.read_csv('./BrainAgeNeXt/BAN_JUK.csv') # %% ...
41d9c227249d7facc36f72805e04c743f3af46aaa870be5d46f7028b5542276d
Jupyter
1,709
28
# %% from src.model import initialize_system from src.proposal import do_proposal # %% tokenizer, model_combined_place_backs, models_determiner, models_metadata_place_back = ( initialize_system( path_data="./data/" ) ) # %% SEQUENCE_PROMOTER = "CATCTTGACCTTTTTCAGCGCCGTTAGGAGAAACCGCCTTACTAGCTCATTGCCGCC...
2994185861924ac603fa881f12a193ba6e4f866a0382665ee84adf146c7f1033
Jupyter
1,710
61
# %% import pandas as pd import os import csv # %% ADNI_stats_folder = "/Users/parri/OneDrive/Documentos/Beca PEFI/brainage-models-benchmark/data/recon-all_stats/ADNI" # %% def extract_volumes_aseg(subjects_dir): vols_lista = [] for subj in os.listdir(subjects_dir): subj_path = os.path.join(subjects_...
bb4f048c5eea647f96d09790a5b4865b8ce3148a1264527383bcb637969d0bdc
Jupyter
1,714
50
# %% [markdown] # We show here how to construct time dependant GRNs as shown in the supp movie of NeuroVelo manuscript # %% import scvelo as scv import glob # %% [markdown] # We give a trained NeuroVelo model and list of genes we want to observe # %% adata = scv.datasets.bonemarrow() scv.pp.filter_and_normalize(adat...
ab16f013c51665df10972ebf32985b046be971d17766a9aeb893a83717ac83a4
Jupyter
1,739
66
# %% [markdown] # # Set Up # %% # import necessary packages import pandas as pd import numpy as np import os # %% # flag to save CSVs save_csv = True # set directories base_dir = f'{os.path.dirname(os.getcwd())}/' csv_dir = f'{base_dir}analysis/CSVs/' # %% [markdown] # # Combine group and individual roi PSC # %% #...
10a3ed0ce331088549249d84f81605973467c576796f9baf5b493bb2138c4cd5
Jupyter
1,760
49
# %% %load_ext autoreload %autoreload 2 import sys sys.path.append("../../src/training") from generators.batchgen_generator import * import utils.batchgen_generator_utils as data_utils bed_regions="/oak/stanford/groups/akundaje/projects/atlas/atac/caper_out/25b3429e-5864-4e8d-a475-a92df8938887/call-reproducibility_idr...
66b0b09e3bac3dcac57adf31929c1471ff2de5c5be938ab1e966ece32f94079f
Jupyter
1,764
63
# %% [markdown] # # Text Data Explanation Benchmarking: Machine Translation # %% [markdown] # This notebook demonstrates how to use the benchmark utility to benchmark the performance of an explainer for text data. In this demo, we showcase explanation performance for partition explainer on a Machine Translation model...
45cb658e60ff74121b47d284893491b7daa81c9a47e5a983aa6088ef52ae5ba2
Jupyter
1,766
92
# %% import pandas as pd import numpy as np from Bio import Seq, SeqIO from Bio import pairwise2 # %% # %% js1 = pd.read_json('./01-Pfizer_BNT-162b2.json',orient='index')[0].to_dict() js2 = pd.read_json('./02-Moderna_mRNA-1273.json',orient='index')[0].to_dict() # %% s1 = Seq.Seq(js1['c1']) s2 = Seq.Seq(js2['c2']) ...
a27e1dd469a92cdb85cf634e38d413a311dd8af946f229435a39b493e7a1b034
Jupyter
1,806
61
# %% [markdown] # ## Import the necessary libraries from yass # %% import numpy as np import scipy.io from yass.evaluate import stability, util, visualization, analyzer # %% [markdown] # # Instantiating an analyzer (evaluation) # # Here for demonstration, we use retinal dataset that we have gold standard for. # # T...
2a1b4ddba4e4123205096c566ac38b13de3ca430d1b7bdfbd6198d338cbaf694
Jupyter
1,822
65
# %% from __future__ import print_function import rdkit from rdkit import Chem from rdkit.Chem import AllChem import pandas as pd import numpy as np from matplotlib import pyplot as plt %matplotlib inline print("RDKit: %s"%rdkit.__version__) # %% # %% def chemcepterize_mol(mol, embed=20.0, res=0.5): dims = int(e...
2ea81ee9f7142091729adcaa80f45073ebd1021b4e9d4a2cc1d34f4ef0b8db1e
Jupyter
1,825
77
# %% import numpy as np import matplotlib.pyplot as plt from oasis.functions import deconvolve, estimate_parameters from cali.extraction._util import calculate_dff from cali.analysis._trace_analysis import compute_rising_edges # %% def plot_trace(y, b, c, s, thr: int = 0): plt.figure(figsize=(20, 8)) plt.subpl...
b380d0475e6812062cb24e9cc048e49b613bcc477f821d4864d3af291845fddf
Jupyter
1,838
108
# %% import numpy as np import pandas as pd from tqdm import tqdm from rdkit import Chem import seaborn as sns import tmap, os from molmap import loadmap from molmap.show import imshow_wrap from sklearn.utils import shuffle from joblib import load, dump import numpy as np import pandas as pd import os from sklearn...
4561477b1f7d6cd2f083351778ff4ad852d97aa746041abdb7bacc94f2066e55
Jupyter
1,839
87
# %% [markdown] # Detailed description of run configuration could be found [here](../nablaDFT/README.md). # %% [markdown] # ## Test example # %% # model test example config !cat ../config/gemnet-oc_test.yaml # %% !python ../run.py --config-name gemnet-oc_test.yaml # %% [markdown] # ## Inference on another dataset ...
8e005cfe0dda3633f0a2e86874f9bd46249e2dbf7dc44f27508da59af665bfb8
Jupyter
1,850
77
# %% from molmap import loadmap import matplotlib.pyplot as plt import seaborn as sns import numpy as np np.random.seed(123) # %% aspirin = 'CC(=O)OC1=CC=CC=C1C(O)=O' #aspirin smiles_list = [aspirin] mp1 = loadmap('../paper/descriptor.mp') mp2 = loadmap('../paper/fingerprint.mp') # %% X1 = mp1.batch_transform(smiles...
9ffaaaaa5b5a9c1e4ee6ddc67362cfed1c28dc74ad02215f6d96dcdca74bcbf3
Jupyter
1,853
72
# %% import pandas as pd import numpy as np import matplotlib.pyplot as plt from joblib import load, dump import seaborn as sns from molmap.feature.fingerprint import colormaps,colors sns.set(style = 'white', font_scale = 2) # %% colors = sns.color_palette(palette = 'rainbow',n_colors=12) # %% df = pd.read_csv('./knn...
36b7570af1dd64a65087bf1e213d9287acea928a91eac5566dbee32f36485491
Jupyter
1,870
61
# %% import pickle as pkl import matplotlib.pyplot as plt import os # %% model_25M="/srv/scratch/anusri/chrombpnet_paper/results/chrombpnet/ATAC/K562/4_4_shifted_ATAC_10.04.2021_bias_filters_500_subsample_25M/final_model_step3/unplug/" model_500M="/srv/scratch/anusri/chrombpnet_paper/results/chrombpnet/ATAC/K562/4_4_s...
8213b3abcd2ab3235b914ecd1e50e409f1fe30ffe9be3a29a315a657931ba38e
Jupyter
1,884
88
# %% from molmap import show, loadmap, feature import matplotlib.pyplot as plt import seaborn as sns import os # %% sns.set(style='white', font_scale = 2) size = 20 # %% cms = feature.fingerprint.colormaps # %% data_save_folder = '/raid/shenwanxiang/FP_maps' # %% aspirin = 'CC(=O)OC1=CC=CC=C1C(O)=O' #aspirin NAC =...
f1cf9afdae7ae362f098dd0dcc120ca5086182a56c8d876f23b22f33cc0f6a56
Jupyter
1,917
74
# %% import pandas as pd import numpy as np from matplotlib import pyplot as plt # %% [markdown] # # Import data # %% dane = pd.read_csv('analysis_dataset.csv') # %% [markdown] # Plot lines for each participant and for the average for the whole sample # %% fig, ax = plt.subplots(nrows=7, ncols=5, figsize=(14,10), ...
448a8e896ba76eaf3282bb3cce2dba5ed2331f8fd57cf7dd42c49eeebde7b127
Jupyter
1,960
28
# %% [markdown] # # A note on annotations # %% [markdown] # Since the classifier behind Convpaint is learning specifically from features of the pixels that are annotated by the user, the **quality of the annotations is crucial for the performance of Convpaint**. While this dependence on good annotations is somewhat di...
041ff9c617b83c82ffb8084b4879e165e2495912caec654240e606a59459dab9
Jupyter
1,961
129
# %% from rdkit import Chem from rdkit.Chem.Draw import rdMolDraw2D, MolDraw2DSVG from rdkit.Chem import Draw from IPython import display from base64 import b64decode import io import PIL.Image as Image # %% # %% mol = Chem.MolFromSmiles('CC(=O)OC1=CC=CC=C1C(O)=O') patt = Chem.MolFromSmarts('OC(*)=O') # %% hit_a...
515f791464b86564626592c1cede543fc7ddac7889bbf3c5ebdb77643c6cee1c
Jupyter
1,971
64
# %% [markdown] # # Quick script to incorporate apical nexus electrotonic attenuation into dendritic spike files # %% import pandas as pd import numpy as np # %% [markdown] # ### List the files you want to process # %% # apical nexus attenuation file nex_fpath = 'Z:\\DendOscSub\\Segments.csv' # dend spike files ds_...
5eaafffb8c7b9c03d3784d9a402c0be180c9e067e41905980a3d024a4940c095
Jupyter
1,971
58
# %% [markdown] # # Training on multiple files # %% [markdown] # By default the plugin works on a "layer-level", i.e. annotations and training are done on a single layer (single image, RGB, stack etc.) However sometimes, one has for example a set of separate images that one wishes to segment in the same way. There mig...
75e94a0db99e4419094fac63d2689113f271cb7336cdece967b2285e52db6874
Jupyter
1,982
116
# %% %config Completer.use_jedi = False # %% import numpy as np import matplotlib.pyplot as plt import cv2 %matplotlib inline import pandas as pd #reading the image image = cv2.imread('p1.jpg') #converting image to RGB image = cv2.cvtColor(image,cv2.COLOR_BGR2RGB) #plotting the grayscale image r, g, b = cv2.split(...
78d9a5d7ad027069b1711fb6c623f9dcb8b6e96490f1273ba508accbbeeb25a4
Jupyter
2,001
71
# %% [markdown] # Generating trials dataset using resampling procedure. # # * Number of resampling iterations: 100 (based on bootstrapping stability analysis) # * Number of trials per resampling: N = 40 (based on data in monkey dataset so the number of trials is from experiments) # %% import csv import pickle import ...
8985c13696131d6b11aab714880b89956dc9ac2cc7fd93fe91db787b34f4d2b4
Jupyter
2,009
30
# %% [markdown] # # Supplementary Material # # The paper is accompanied by seven Jupyter tutorial notebooks, included here in rendered form, along with a short Python primer for researchers new to the language. # # The notebooks can be explored interactively on Google Colab via the following links: # # - S0: Python...
a7a34ba3bdc12be71a963001373d44bf7f84803585203ce27ef39f0345006e6b
Jupyter
2,016
67
# %% [markdown] # # Title # %% [markdown] # ## Overview # # [Include a paragraph or two explaining what this example demonstrates, who should be interested in it, and what you need to know before you get started.] # %% [markdown] # ## Background # # [If the topic in this tutorial is involved, a background section ...
502517ec3eefc2d87af396f46367e46cb3fd6970e33f02a8a519172ac55b4ff4
Jupyter
2,027
117
# %% # This scripts creates events.tsv for the main sample of subjects # %% import os from src.utils import seq2tsv # %% [markdown] # # Settings # %% sub_id = "22" # %% bids_path = "/Volumes/T7/BIDS-MUSICNF" subID_string = "sub-" + sub_id sub_bids_path = f"{bids_path}/{subID_string}" feedback_task_list = ["nf", "s...