sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
56ca9dbed3b87ee2dcb8318eff6200d5beb8608d98a88ead6252fb7752c624c4 | Jupyter | 2,531 | 81 | # %% [markdown]
# [](https://colab.research.google.com/github/lucascamillomd/pyaging/blob/main/tutorials/tutorial_histone_mark.ipynb) [](https://nbviewer.jupyter.org/githu... |
889d041b18bb2b9235dc641aadc84e83131bc6cfb301566fe519e80e7c6b3e8a | Jupyter | 2,546 | 121 | # %%
from tensorflow import keras
import cine
import tube2
import numpy as np
from skimage import transform, util, io as skio, morphology as morpho
from matplotlib import pyplot
import glob
model = keras.models.load_model("meniscus_model_unet_sigmoid_out")
def get_batch(video, idx):
zone = []
for i in range(3... |
8bb7ecf8a2c2a4ce5cdf6728bcf0acc45559a0e435729a9595941baa5cbc957c | Jupyter | 2,673 | 86 | # %%
#Imports
import numpy as np
import os
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.gridspec import GridSpec
import matplotlib.backends.backend_pdf
matplotlib.rcParams['lines.linewidth'] = 0.5
matplotlib.rcParams['lines.markersize'] = 1
matplotlib.rcParams['pdf.fonttype']... |
e2521319e6093dc33a1172597873191dba316c6a3602aef6884666d6a84a968d | Jupyter | 2,680 | 91 | # %% [markdown]
# # Experiment Name
# %%
from pathlib import Path
# import fiberphotopy
import fiberphotopy as fp
%matplotlib inline
%load_ext autoreload
%autoreload 2
# %% [markdown]
# Note: The following can be ran as is assuming your project has the following structure:
#
# ```
# project_name/
# ├── data/
# ├─... |
fcf2320d787ad7d22f962138d5139c727569075083dc700a630129548a9c731a | Jupyter | 2,680 | 111 | # %%
import xlrd
import scipy.stats
import math
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.rcParams['pdf.fonttype'] = 42
# %%
sheet = xlrd.open_workbook('220204 BCL.xlsx').sheet_by_index(1)
# %%
species=sheet.col_values(0)[2:][:sheet.col_values(0)[2:].index('')]
subspecies=sheet.col_values(0)[2:][sh... |
ecce36032fca9ae35fad9c49e0d54400214a61243a46ba406379778a8d00bb8a | Jupyter | 2,705 | 92 | # %%
from IPython.display import Image
# qbiome imports
import qbiome
from qbiome.data_formatter import DataFormatter
from qbiome.quantizer import Quantizer
from qbiome.qnet_orchestrator import QnetOrchestrator
from qbiome.mask_checker import MaskChecker
from qbiome.forecaster import Forecaster
from qbiome.hypothesis ... |
acdbe6d1f5cf6378d876c71c2ce7fcd8f6446ac1ab56d5a95b96b1e059175dd5 | Jupyter | 2,706 | 82 | # %%
import h5py
import tensorflow as tf
import os
import numpy as np
from npc.model import Model
from npc.synthesizer import Synthesizer
import npc.losses as losses
import wget
from tqdm import tqdm
import zipfile
import matplotlib.pyplot as plt
%matplotlib inline
npa = np.array
# desired control goal
mode = 'stretc... |
dda741e57c94b55cb94e60da3a746cdb3e29e98e2c5aaf01f62ff2896a9692d6 | Jupyter | 2,715 | 98 | # %%
import os
import sys
sys.path.insert(0, os.path.abspath('../../qbiome'))
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_theme()
plt.style.use('ggplot')
from data_formatter import DataFormatter
from quantizer import Quantizer
from qnet_orchestrator import QnetOrchestrator
from m... |
b9b271970ddd6890c5495c8918a3f073617607b789740573102b10aa8f0d26f1 | Jupyter | 2,726 | 101 | # %%
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import seaborn as sns
from sklearn.preprocessing import StandardScaler
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
import matplotlib.pyplot as plt
from sklearn.utils import resample
from sklearn.metrics i... |
e7a6ed067035ea3f4104e97dab34b689a978dcbf876a732a85e40b77509c6e3c | Jupyter | 2,747 | 78 | # %%
import numpy as np
import pandas as pd
import seaborn as sns
from moseq2_lda.data import load_representations
from moseq2_lda.model import create_lda_pipeline, run_cross_validation, train_lda_pipeline
from moseq2_lda.viz import plot_lda_results, plot_validation_curve, plot_permutation_score
from moseq2_lda.viz.... |
5e8ac7d50b7cf2e4f2da3618932d07b390565864ea4d0bbd61976fe951e61c52 | Jupyter | 2,756 | 95 | # %%
import os.path as op
import pickle
import nibabel as nib
import numpy as np
from nibabel import GiftiImage
from nibabel.gifti import GiftiDataArray
from surfplot.utils import add_fslr_medial_wall
from surfplot.utils import add_fslr_medial_wall
from surfplot import Plot
from neuromaps.datasets import fetch_fslr
fr... |
6aece6641f035191495883824199babed1d694c72ccf9b680a2e943a88403c4d | Jupyter | 2,772 | 62 | # %%
%matplotlib inline
import matplotlib
from matplotlib.backends.backend_pdf import PdfPages
matplotlib.rcParams.update({'font.size': 24, 'font.family':'sans-serif', 'font.sans-serif':'Arial', 'pdf.fonttype':42})
import os, glob
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from scipy.op... |
b7c0fbdf430d1a655edd933e438cd53ad5d0689842cb06ec183f42467f9240f7 | Jupyter | 2,788 | 88 | # %%
#%% Transitive Inference - Human behavioral data analysis #########################
from __future__ import division
import numpy as np
import matplotlib as mpl
import sys
# local #
import task_train_test as tk
import nn_models as nm
import nn_plot_functions as npf
import nn_analyses ... |
270489a8bc5c226f29fe80292ad91b163886c59ce63b6829a46e3f0e49718cc4 | Jupyter | 2,792 | 95 | # %%
%load_ext autoreload
"""
This cell does the initial project setup.
If you start a new script or notebook, make sure to copy & paste this part.
A script with this code uses the location of the `.env` file as the anchor for
the whole project (= PROJECT_ROOT). Afterwards, code inside the `src` directory
are availabl... |
ee71be85fc7871f6e70dc4193ada4d8c005269a9acd9eb4ae2e84346e098664a | Jupyter | 2,794 | 118 | # %% [markdown]
# # Classification — PyCaret 4.0
#
# Predict a binary / multi-class label. This notebook shows the canonical
# 4.0 OOP pattern end-to-end:
#
# 1. Load data
# 2. Construct and fit a `ClassificationExperiment`
# 3. Compare models → get a typed `CompareResult`
# 4. Tune the best
# 5. Predict on test / ne... |
0fcc947ab3aa9263442c1e87426143f367a81149d636254fc8614caf1be3a62c | Jupyter | 2,798 | 75 | # %% [markdown]
# [](https://colab.research.google.com/github/lucascamillomd/pyaging/blob/main/tutorials/tutorial_chromatin_accessibility.ipynb) [](https://nbviewer.jupyte... |
ac1e91033d605af05077ff7efafef11f5bda03d1244d32340a0caf74aec93fc5 | Jupyter | 2,808 | 76 | # %% [markdown]
# **For most part, you may want to call SC Track to batch process some images, and at this point our API will be more suitable than command-line tools.**
#
# here is the document about how to use TC-Track's API to do the tracking.
# %%
# if you don't need to change anything, just do like this:
from S... |
e1cb677d1b0d16cab4e8eba24d6e88dda3e97de87e661a5fa0bcb8e92d8d5000 | Jupyter | 2,808 | 119 | # %%
import numpy as np
import pandas as pd
import time
import matplotlib.pylab as plt
import sys
import numpy
numpy.set_printoptions(threshold=sys.maxsize)
import os
import glob
# Custom imports
from utils import plot_performance_2, load_cotton_data, plot_history_2, save_history, load_history
from cnns_2 import build... |
8cdc5bdc5bf5911d5587b927e6155379be36b01a69e3cabe8f9c39cf5ca23a57 | Jupyter | 2,810 | 85 | # %%
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
import warnings
warnings.filterwarnings('ignore')
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2'}
import keras
print("keras = {}".format(keras.__version__))
import tensorflow as tf
print("tensorflow-gpu = {}".f... |
e9be4ce4f8db1fd49636446db9a13050772bfce2b4d4a2831c15283f0085f1ad | Jupyter | 2,853 | 101 | # %%
from pymodules import sim_functions as sf
from pymodules.sim_functions import b2
import time
import json
import bson
from allensdk.core.swc import read_swc
# %%
def plot_morph(morph):
for n in morph.compartment_list:
for c in morph.children_of(n):
b2.plot([n['x'], c['x']], [n['y'], c['y']]... |
6ccdb7768e6d1f8baa62adf011c338df7487a71add7885982d4394cf156f5b88 | Jupyter | 2,865 | 120 | # %% [markdown]
# ### Check GPU hardware
# %%
!nvidia-smi
# %% [markdown]
# ### Save hardware configuration
# %%
# Create the summary file
!echo "Hardware Summary" > hardware_summary.txt
# Fetch and write CPU Information
!echo "\nCPU Information:" >> hardware_summary.txt
!echo "-----------------" >> hardware_summar... |
bb637953533e9ddda4f7a6d26f06742dc55044c0c5219c4a90a3a0e87d262d86 | Jupyter | 2,865 | 101 | # %%
# Import libraries
import pandas as pd
import numpy as np
# %%
# Original pos pan dataset
pan_orig = pd.read_csv('pan_orig.tsv', sep='\t', header=None)
pan_orig.columns = ['first', 'second', 'label']
pan_orig
# %%
# Create a list of id of pan orig dataframe
list_id_pan_orig = frozenset( list(pan_orig['first']) ... |
ad60c58e77c29e64e039e737127ac68c3ab2bd49b393f70498d9eb142af43757 | Jupyter | 2,870 | 75 | # %% [markdown]
# # Data pipeline quickstart
#
# Runs the `multimodal_ad.data` pipeline end to end on a small, **deterministic synthetic dataset**: no OASIS-3 access needed, no manual paths to edit. Generates fake NIfTI volumes, builds and validates a typed manifest, does a subject-wise train/test split, processes one... |
15e36a61721b3e501bbc7180c99eff9e5578159bb4b7557c62be0c689de03aa6 | Jupyter | 2,900 | 92 | # %%
import pandas as pd
from pathlib import Path
import matplotlib.pyplot as plt
from IPython.display import display
%matplotlib inline
# %%
code_dir=Path.cwd()
project_dir=code_dir.parent
input_dir=project_dir/"input"
output_dir=project_dir/"output/index_comparison"
tmp_dir=project_dir/"tmp"
Path(output_dir).mkdir(e... |
4bee65d57b43df7ba09211a4f08982d13d77c4c376b54487e12563a50e57579d | Jupyter | 2,924 | 113 | # %% [markdown]
# # MuJoCo Gymnasium Training with RL Games
#
# <a href="https://colab.research.google.com/github/Denys88/rl_games/blob/master/notebooks/mujoco_training.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# %%
!apt-get install -y \
... |
3919b97a846ba26ba7ea46945e989b6e7606114a6fd517ce0af7747c7861a94f | Jupyter | 2,927 | 87 | # %% [markdown]
# [](https://colab.research.google.com/github/lucascamillomd/pyaging/blob/main/tutorials/tutorial_proteomics.ipynb) [](https://nbviewer.jupyter.org/github/... |
7da3105ea0b4a323e98f24e29c26f7ca1088592ecd01ec5643a218fbba7285ef | Jupyter | 2,933 | 141 | # %%
import os
import numpy as np
import pandas as pd
import pickle
import lmdb
import matplotlib.pyplot as plt
from tqdm import tqdm
import torch
from torch_geometric.data import Data
# %%
df=pd.read_json('zinc_ev.json')
df.head()
# %%
df.shape
# %%
df_shuffled = df.sample(frac=1)
n_train = 31601
n_val = 3999
# %%... |
45fd823b49861072325934370c82f8291e55ff102af93369f3f1cdb9f4bf26ef | Jupyter | 2,934 | 128 | # %%
import os
from os.path import join
from itertools import chain
import argparse
import yaml
import pandas as pd
import numpy as np
import sklearn
import sklearn.model_selection
import sklearn.preprocessing
import sklearn.ensemble
import sklearn.manifold
import sklearn.linear_model
import sklearn.svm
import torch... |
e9b6f8877165a1436eea8662fd8d548082757e8e54967348741a2fe7bd070f76 | Jupyter | 2,934 | 107 | # %%
%load_ext autoreload
from pathlib import Path
import sys
from dotenv import load_dotenv, find_dotenv
load_dotenv()
PROJECT_ROOT = Path(find_dotenv()).parent
sys.path.append(str(PROJECT_ROOT.joinpath('src')))
print(f"Project root directory: {PROJECT_ROOT}")
# data import & manipulation
import pandas as pd
# %%
%a... |
309e2feecb029e51e3f578726c6b2d6945fc5ab5c9fe12509f0c06e64407bd36 | Jupyter | 2,937 | 53 | # %% [markdown]
# # PCBrainAge
#
# Built from the original authors’ pinned code and coefficients. See `tests/data/pc_extensions/README.md` for source checksums, exact linear composition, and independent R oracle validation.
# %%
from pathlib import Path
import sys
import torch
root = Path.cwd().resolve()
while not (... |
9757827d904d1932149355a65ba5def516661cfd7e64a0d7a48ce5b935f00a1c | Jupyter | 2,949 | 108 | # %% [markdown]
# (moves)=
#
# # Using different moves
#
# One of the most important new features included in the version 3 release of emcee is the interface for using different "moves" (see {ref}`moves-user` for the API docs).
# To demonstrate this interface, we'll set up a slightly contrived example where we're sam... |
14c8386e66c7bee6c8ace81a3898202d2115c28fcbbf7fa920a9355b2a363192 | Jupyter | 2,952 | 77 | # %%
rhumba::set_channels(c("conda-forge", "default")) # Rhumba makes it easier to install packages in conda; set channels for rhumba
if (!require("psych")) rhumba::install("r-psych")
if (!require("dplyr")) rhumba::install("r-dplyr")
if (!require("ggplot2")) rhumba::install("r-ggplot2")
if (!require("car")) rhumba::in... |
096ab169efac29d057e31ad77a4d1fc8a69aaae6fd52b33c1aed1340a81cf921 | Jupyter | 2,955 | 74 | # %% [markdown]
# <h3> Extracting protein sequences' features using ProtBert pretrained-model <h3>
# %% [markdown]
# <b>1. Load necessry libraries including huggingface transformers<b>
# %%
!pip install -q transformers
# %%
import tensorflow as tf
from transformers import TFBertModel, BertTokenizer,BertConfig
import... |
eba9485604c9411301603bb7f0ca7d0f88987246091ab0bcc374f22ba098d30d | Jupyter | 2,960 | 107 | # %%
import scanpy as sc
import pandas as pd
import numpy as np
import sklearn.metrics
import torch
import torch.nn as nn
from torch.optim import Adam
import torch.utils.data as Data
from sklearn.model_selection import train_test_split
from sklearn.metrics import f1_score
from collections import Counter
import copy
# ... |
81b8133d40ecc419e7b3976d960094ea56219a924c108acbcf7ffb98125f3b05 | Jupyter | 3,026 | 75 | # %% [markdown]
# # Cohen's d Value
# ## Definition
# - Cohens's $d$ value of sample populations $X$ and $Y$ can be defined as follows:
#
# $d:=\frac{m_X-m_Y}{\sqrt{\frac{n_Xs_X^2+n_Ys_Y^2}{n_X+n_Y}}}$
#
# where the means are $m_X$ or $m_Y$, sample standard deviations are $s_X$ or $s_Y$, and the samples s... |
3018407ddb10f1ca915a97e8cbc162ead93c3031aaa6d09f2188972ca692a785 | Jupyter | 3,067 | 105 | # %% [markdown]
# # Argument Preferences
# %%
from tools import (
# kwargs for matplotlib.savefig
kwarg_savefig,
# preset arguments for longitudinal comparisons in EDA and StrastifiedGOAnalysis
eda_longitudinal_args, sgoa_longitudinal_args,
# color configurations for venn diagrams in Strasti... |
76c285326c4d9b63e1355e8c70b35b47f8ae9a75c10f0760e10e14b69397c114 | Jupyter | 3,085 | 126 | # %% [markdown]
# ### Check GPU hardware
# %%
!nvidia-smi
# %% [markdown]
# ### Save hardware configuration
# %%
# Create the summary file
!echo "Hardware Summary" > hardware_summary.txt
# Fetch and write CPU Information
!echo "\nCPU Information:" >> hardware_summary.txt
!echo "-----------------" >> hardware_summar... |
2d5f37aa82ad03d5a599d6bc1fe64bfd4914112dcb292938fd216296b117e324 | Jupyter | 3,109 | 101 | # %%
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
import matplotlib
from adjustText import adjust_text
# %... |
cb66ec6a81c308faeeca8f90724c40289bda28b437d51addc77fe661c2cba39b | Jupyter | 3,111 | 113 | # %%
from pathlib import Path
import sys
import pandas as pd
from dotenv import load_dotenv, find_dotenv
load_dotenv()
PROJECT_ROOT = Path(find_dotenv()).parent
sys.path.append(str(PROJECT_ROOT.joinpath('src')))
print(f"Project root directory: {PROJECT_ROOT}")
data_path = Path(PROJECT_ROOT, 'results', 'eyemap')
from... |
08033c0f7ed8f50c9d13e585ff04d2fde2c3b94b65ade9b51d1943f45d0c2b84 | Jupyter | 3,115 | 126 | # %% [markdown]
# <center> Python implementation of Kernel Current Source Density (kCSD) method - TUTORIAL </center>
# ======
# %%
%load_ext autoreload
%autoreload 2
from ipywidgets import interact
import numpy as np
import config
import plotting_helpers as plots
from widget_helpers import dim_select, csd_select, kc... |
73a53e567d259176e6c211e8e4dd5e3cfce31ea55dfe402196deae125a27f748 | Jupyter | 3,133 | 147 | # %%
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, root_validator
# Code cobbled together from various sources:
# https://github.com/samuelcolvin/pydantic/discussions/3091
# https://github.com/samuelcolvin/pydantic/issues/2177
# https://github.com/samuelcolvin/pydantic/discussions/3906
... |
cabc128863fee123840dc4d8e4cb0a9d66e1d031e59e1ad315fcbd30ceb50a45 | Jupyter | 3,156 | 98 | # %% [markdown]
# [](https://colab.research.google.com/github/PTB-MR/mrpro/blob/main/examples/notebooks/b0_correction.ipynb)
# %%
import importlib
if not importlib.util.find_spec('mrpro'):
%pip install mrpro[notebooks]
# %% [markdown]
# # ... |
223d81a19c7254313dec963fe4c4cf693e3dd4438c132f10e2ad19154ce820e6 | Jupyter | 3,168 | 106 | # %%
import pandas as pd
import matplotlib.pyplot as plt
# %%
pd.set_option('display.max_rows', 100)
# %%
tf_class = pd.read_pickle('/home/kvattis/Desktop/tf_classification.pd')
t_class = pd.read_pickle('/home/kvattis/Desktop/t_classification.pd')
mel_class = pd.read_pickle('/home/kvattis/Desktop/mel_classification.... |
68a04ed3e34daaf19099be3d2624df0abb39cc059db446f6e9ccf7ac2663884e | Jupyter | 3,193 | 87 | # %%
import matplotlib
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from helper import *
from tqdm import tqdm_notebook
import brainconn as bc
import pandas as pd
import seaborn as sns
import nilearn.plotting as plotting
import palettable as pal
import matplotlib.colors as mcolors
import matpl... |
a35b5208587a2f0bc58c6bc95ed1a5d54b6f9adc398bf375c54cee0ef85ff554 | Jupyter | 3,198 | 86 | # %% [markdown]
# <a href="https://colab.research.google.com/github/bkkaggle/pytorch-CycleGAN-and-pix2pix/blob/master/pix2pix.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# %% [markdown]
# # Install
# %%
!git clone https://github.com/junyanz/pyt... |
db9c7c5355a1a545477e2c885718deff5d54fbfa084781d261d398ad2d55ab79 | Jupyter | 3,224 | 108 | # %%
import os.path as op
from glob import glob
from neuromaps.datasets import fetch_atlas, fetch_fslr
from netneurotools import stats as nnstats
from surfplot.utils import add_fslr_medial_wall
from joblib import Parallel, delayed
import numpy as np
import nibabel as nib
# %% [markdown]
# # Spin Permutation example
... |
8981dad765bd2eefed91c59acafcf3102fa88f30ad871f27fd7984e6aaae23aa | Jupyter | 3,227 | 77 | # %% [markdown]
# # Inverse estimation
#
# In many cases, one is interested in finding the maximum conductances from a given AP, a problem we refer to as the inverse problem. The package also provides a simple way to achieve this by using the function [`match_Vm`](/docs/match_Vm.html). For further details on the compu... |
4bfc1033b4fe1f01dacff2532e0eaaa8cb5619c8e2a31c29743562bf7af25156 | Jupyter | 3,230 | 113 | # %% [markdown]
# # Compare with R nptest
# %%
import sys
import pandas as pd
import numpy as np
from scipy import stats, io
import seaborn as sns
import matplotlib.pyplot as plt
import statsmodels.api as sm
import statsmodels.formula.api as smf
import pingouin as pg
# %%
sys.path.append('../../scripts')
# %%
import... |
01d411d760b1ec254a8ce4b3ad21d45883f22facfa31c3259d1f99401755a035 | Jupyter | 3,236 | 112 | # %%
from pymodules import sim_functions as sf
from pymodules.sim_functions import b2
import time
import json
from pymodules.ML_params import *
# %%
cell = "NMO_00892";
# %%
morph_d8 = b2.spatialneuron.morphology.Morphology.from_swc_file(f"morphs/{cell}_depth8.swc", spherical_soma=True)
morph_d13 = b2.spatialneuron.... |
8a0ddcc9542277a33e39154ef259a8956c15c64cfd3e3d99926b318d589eaafa | Jupyter | 3,252 | 53 | # %% [markdown]
# # PCGrimAgePAI1
#
# Built from the original authors’ pinned code and coefficients. See `tests/data/pc_extensions/README.md` for source checksums, exact linear composition, and independent R oracle validation.
# %%
from pathlib import Path
import sys
import torch
root = Path.cwd().resolve()
while no... |
1ed83fd502ee6746adc8f839c669d88dac0fb471699ee7b6325f9df203aff7c8 | Jupyter | 3,257 | 53 | # %% [markdown]
# # PCGrimAgeGDF15
#
# Built from the original authors’ pinned code and coefficients. See `tests/data/pc_extensions/README.md` for source checksums, exact linear composition, and independent R oracle validation.
# %%
from pathlib import Path
import sys
import torch
root = Path.cwd().resolve()
while n... |
7b149d7382efc6ecbd8d002f377d16d5383074a52f590d3722b14749c755db10 | Jupyter | 3,265 | 53 | # %% [markdown]
# # PCGrimAgeTIMP1
#
# Built from the original authors’ pinned code and coefficients. See `tests/data/pc_extensions/README.md` for source checksums, exact linear composition, and independent R oracle validation.
# %%
from pathlib import Path
import sys
import torch
root = Path.cwd().resolve()
while n... |
14da22fa65cf74de8e0a2fd93699ba132beb90805d568664722d5cc707fe647c | Jupyter | 3,272 | 53 | # %% [markdown]
# # PCGrimAgeLeptin
#
# Built from the original authors’ pinned code and coefficients. See `tests/data/pc_extensions/README.md` for source checksums, exact linear composition, and independent R oracle validation.
# %%
from pathlib import Path
import sys
import torch
root = Path.cwd().resolve()
while ... |
7ef0d7fb0c4f69757b7c43c1cc1daff9a739e9c6e096afaa9e07335e19cf647b | Jupyter | 3,295 | 89 | # %% [markdown]
# # A sinusoidal weight matrix robust to non sinusoidal inputs
#
# <!-- * If we want a circulant network to have stable activity with no input
# * and the network is operating in the linear regime
# * and the network needs to encode 2 variables (vector direction and magnitude)
# * and the neurons can o... |
59f628e6057ad6b8c2197a3a3beda4158a0a4c094e936f5f2422331cc5a9cde4 | Jupyter | 3,301 | 53 | # %% [markdown]
# # PCGrimAgeCystatinC
#
# Built from the original authors’ pinned code and coefficients. See `tests/data/pc_extensions/README.md` for source checksums, exact linear composition, and independent R oracle validation.
# %%
from pathlib import Path
import sys
import torch
root = Path.cwd().resolve()
whi... |
b9b45221aaff5509dbb9e3fa4318090387552112f779901aa0fc39ab18c61101 | Jupyter | 3,303 | 53 | # %% [markdown]
# # PCGrimAgeADM
#
# Built from the original authors’ pinned code and coefficients. See `tests/data/pc_extensions/README.md` for source checksums, exact linear composition, and independent R oracle validation.
# %%
from pathlib import Path
import sys
import torch
root = Path.cwd().resolve()
while not... |
bb34cc7d56aeb5a9ee8c906ba748bdfa50bc56bdae0a4948fe1f1956245429fb | Jupyter | 3,311 | 69 | # %% [markdown]
# # Use eANN
#
# In this notebook we show how to use the ensemble neural network. As before let's load a spycon test.
# %%
# Basic imports
from matplotlib import pyplot
import spycon
from spycon.spycon_tests import load_test
# %%
spycon_test = load_test(name='ren_simulation_1917_Cell1Block1_long_340_... |
c5938c528a5b82da30b2722f72edbbdde4ea99a35125e1366e89e87dbc7b66c6 | Jupyter | 3,319 | 53 | # %% [markdown]
# # PCGrimAgePackYrs
#
# Built from the original authors’ pinned code and coefficients. See `tests/data/pc_extensions/README.md` for source checksums, exact linear composition, and independent R oracle validation.
# %%
from pathlib import Path
import sys
import torch
root = Path.cwd().resolve()
while... |
8f68d53500ce7ace1255a296106cb26baccab044dbc57148a145e40059785c61 | Jupyter | 3,325 | 53 | # %% [markdown]
# # PCGrimAgeB2M
#
# Built from the original authors’ pinned code and coefficients. See `tests/data/pc_extensions/README.md` for source checksums, exact linear composition, and independent R oracle validation.
# %%
from pathlib import Path
import sys
import torch
root = Path.cwd().resolve()
while not... |
3269b3f954d01338a4a174e709a4e9caf1269b19c85f2e99a0b459cb87bf49b2 | Jupyter | 3,357 | 106 | # %%
%matplotlib inline
import matplotlib
from matplotlib.backends.backend_pdf import PdfPages
matplotlib.rcParams.update({'font.size': 20, 'font.family':'sans-serif', 'font.sans-serif':'Arial', 'pdf.fonttype':42})
import os, glob
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from scipy.op... |
82d464e280f123d85c85ba812bc443da1e1219a07ac8fab0e36d9cd2b26e2fe2 | Jupyter | 3,364 | 142 | # %% [markdown]
# # Library
# %%
# My library
from molgraph.dataset import *
from molgraph.experiment import *
# General library
import argparse
import os as os
import numpy as np
import pickle as pickle
# %% [markdown]
# # Molecular Graph
# %%
reducedgraph = ['atom']
reducedgraph = ['atom', 'pharmacophore', 'juncti... |
c68ac1769b1c98e4852ef6d644e536b74ee77292d9b5b3e962c91c680fc05397 | Jupyter | 3,372 | 124 | # %%
import pandas as pd
import scipy.stats as stats
from scipy.stats import mannwhitneyu
from statistics import stdev
import statsmodels.api as sm
from statsmodels.genmod import families
from scipy.stats import mannwhitneyu, wilcoxon
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from statsmo... |
1b0db1c0aea3f315c23eca225315f6e0258208ca00dc62944ed489e9f04d5fdc | Jupyter | 3,376 | 114 | # %%
%load_ext autoreload
%autoreload 2
import lzma
import dill
import json
import pandas as pd
import shap
from tqdm.auto import tqdm
import numpy as np
import tensorflow as tf
from pathlib import Path
import scienceplots
import matplotlib.pyplot as plt
import matplotlib as mpl
from matal import load_model, load_d... |
bbdd1a1e0e48d7474d5fdf76051ae65d4c3697a40746c61e8c9786c4ddb85e93 | Jupyter | 3,387 | 121 | # %%
# Imports
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from scipy.stats import gaussian_kde
import numpy as np
import os
from pathlib import Path
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
import matplotlib.backends.backend_pdf
plt.style.use('... |
a9c75240b943766f85cc256ff66d3783a9e2846ac4bfac92cbb4c33e2b65b060 | Jupyter | 3,407 | 103 | # %% [markdown]
# # Using Contributed Plugins in Pyxu
#
# In this notebook, we will explore how to use contributed plugins in the Pyxu software framework. We will focus on the `pyxu-gradient-descent` plugin.
#
# ## Step 1: Attempting to Import Before Installation
#
# Before installing the plugin, let's try importin... |
fcc148c91022901dd7db147d8436d3eb6e191dead70aec23451d475abf12a7ff | Jupyter | 3,423 | 136 | # %%
import os
import pandas as pd
import deepchem as dc
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import Draw, PyMol, rdFMCS
from rdkit.Chem.Draw import IPythonConsole
from rdkit import rdBase
from deepchem import metrics
from IPython.display import Image, display
from rd... |
f234ffa081238d099f48d6c5eff4495277c16fb26768b1ef125bb8f6d2c95e29 | Jupyter | 3,424 | 141 | # %%
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib as mpl
from matplotlib.gridspec import GridSpec
plt.rcParams["font.family"] = "Times New Roman"
plt.rcParams['text.usetex'] = True
plt.rc('text.latex', preamble=r'\usepackage{amsmath,dsfont}')
# %%
#loading data for activ... |
cdd31fed3abbe96ecb44bb0153c95ca657e56b430a13509190a096cb9b6a0207 | Jupyter | 3,425 | 128 | # %%
import os
from os.path import join
from itertools import chain
import argparse
import yaml
import pandas as pd
import numpy as np
import sklearn
import sklearn.model_selection
import sklearn.preprocessing
import sklearn.ensemble
import sklearn.manifold
import sklearn.linear_model
import sklearn.svm
import torch... |
57393cd7d000d589c000c407d99c18d2c461a4d6c0fd4822ef0db05ba50be251 | Jupyter | 3,461 | 136 | # %%
import os
import pandas as pd
import deepchem as dc
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import Draw, PyMol, rdFMCS
from rdkit.Chem.Draw import IPythonConsole
from rdkit import rdBase
from deepchem import metrics
from IPython.display import Image, display
from rd... |
626186eda04ab43052c53c81f9b3c6b7fc456e02bf6ed3ddae7452156494d91d | Jupyter | 3,461 | 136 | # %%
import os
import pandas as pd
import deepchem as dc
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import Draw, PyMol, rdFMCS
from rdkit.Chem.Draw import IPythonConsole
from rdkit import rdBase
from deepchem import metrics
from IPython.display import Image, display
from rd... |
b27bd10488540bdacaa1c6e737ee4fe591612e0b79fc1d4bb7ec7113824a9955 | Jupyter | 3,476 | 49 | # %% [markdown]
# # intrinclock370
# Rebuild from the original authors using `clocks/build_author_extensions.py`. Source revisions and checksums are pinned in that script.
# Author-demo IntrinClock at lambda.1se: 370 nonzero CpGs from the original serialized cv.glmnet fit. Predicts chronological age resistant to immune... |
7cbbde49222a23343446fab986b9ba51c922a199b3402120f7de083cb9824bee | Jupyter | 3,478 | 110 | # %%
# Imports
from pathlib import Path
import numpy as np
np.random.default_rng(42)
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from scipy.stats import gaussian_kde
# define your directory here
datapa... |
34133575df67f94772387b334ae5591c18f2961665f1e3a41fe6d4c06faad6d1 | Jupyter | 3,484 | 139 | # %% [markdown]
# ### Check GPU hardware
# %%
!nvidia-smi
# %% [markdown]
# ### Install D-SCRIPT
# %%
!pip install dscript
import os
# Set OMP_NUM_THREADS to "1", limiting OpenMP to single-threaded operation
os.environ["OMP_NUM_THREADS"] = "1"
# %% [markdown]
# ### Download trained models
# %%
# Download Human D-S... |
a9ee8368386624bc44b16e70c5cd173487b253819a41926ff66188a6aca6727f | Jupyter | 3,527 | 117 | # %%
import os
os.environ['QT_QPA_PLATFORM']='offscreen'
import ete3
from ete3 import Tree, TreeStyle, NodeStyle, faces, SeqMotifFace, TextFace, CircleFace
import pandas as pd
import urllib.request
from pathlib import Path
# %%
output_dir = "figs"
# %%
for f,url in (("../data/Round2_pre-test_SOD_results.tsv", "https... |
6f20a5f5689a89ff7df8d27c4ff470709d2327339f85cbe8670cfdfffa5c85ed | Jupyter | 3,547 | 126 | # %%
# hide
%load_ext autoreload
%autoreload 2
# %% [markdown]
# # Evaluation Suzuki Miyaura
#
# > Predicting the yield of Suzuki Miyaura HTE reactions
#
# %%
# data
import logging
import sklearn
import torch
from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_error
import pandas as pd
from rxn... |
c6f579325dfde05c978c9d3a7e9f6f4600bcd0b435fc9158ac9953923b3735ae | Jupyter | 3,561 | 124 | # %%
# # import libraries
import numpy as np
import pandas as pd
from pandas import DataFrame
import itertools
import csv,codecs,nltk,re
from nltk.stem.isri import ISRIStemmer
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
import itertools
import sklearn
from sklearn.feature_extraction.text ... |
d0be35834a2bf4d397dd4770a54de1749462b5df8a9828579ff3f40bd5630480 | Jupyter | 3,569 | 125 | # %% [markdown]
# # GRAB-DA TFC
# %%
import matplotlib.pyplot as plt
%matplotlib inline
import pandas as pd
import numpy as np
import sys
# change pkg_path variable to the directory storing the package
sys.path.insert(0, '../utility_code')
import fp_dat, fp_viz
import fearData as fd
import seaborn as sns
import statsm... |
f926662c45cffbda2a753e3413ea9fe8aaed5dee393f37e9a7bda15419cb2d33 | Jupyter | 3,591 | 136 | # %% [markdown]
# # Getting started with normative modelling
#
# Welcome to this tutorial notebook that will show you the very basics of normative modeling. It's like the "Hello World" of normative modeling.
#
# Let's jump right in.
# %% [markdown]
# ### Imports
# %%
import warnings
import matplotlib.pyplot as plt... |
2422a58b0f2c3f55cac9c7919d93eec139dc8f5d2d2b21d0267b61b394c82321 | Jupyter | 3,593 | 107 | # %% [markdown]
# In this post we will see how to perform Outlier Detection using MiniSom.
# %%
from minisom import MiniSom
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from sklearn.datasets import make_blobs
from sklearn.preprocessing import scale
# %% [markdown]
# First let's create a dat... |
06777f1cd8307f387463a28e4108d279980c402660988e1dcfbe82cb22320376 | Jupyter | 3,621 | 114 | # %%
import cluster4seed
import rsfc
import rsw
import numpy as np
import matplotlib.pyplot as plt
# %%
mask = np.load('demodata/mask.npy')
plt.imshow(mask)
plt.title("Brain mask")
plt.colorbar()
# %%
files = [['demodata/pv_p14_data_1.npy',
'demodata/pv_p14_data_2.npy'],
['demodata/pv_p28_data_1.np... |
8866918093753aa084f0ab2cc58370aa446c8e8573b5d0dc1ab4c4e7c24ef428 | Jupyter | 3,648 | 131 | # %%
import os.path as op
import itertools
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
# %%
result_dir = op.abspath("../results")
data_dir = op.abspath("../data")
figure_dir = op.abspath("./Fig")
# %%
sns.set(style="white")
cotegories = np.array(["Functional", "Clini... |
8a2ffb4b79452bc12c3cb703b7517609718bdebb7b642e4490b9974338e26024 | Jupyter | 3,655 | 88 | # %%
import pandas as pd
import numpy as np
from pathlib import Path
# %%
code_dir=Path.cwd()
project_dir=code_dir.parent
input_dir=project_dir/"input"
output_dir=project_dir/"output"
tmp_dir=project_dir/"tmp"
# %%
variables_ukb = [
"diagnosis_metabolic_syndrome",'base_age', 'base_sex', 'base_isced_aggregated',
... |
a056c913c197f56796192c3be7439fcb62c592078e2c39291346b704ef72a375 | Jupyter | 3,667 | 49 | # %% [markdown]
# # dnamphenoagenonprc
# Rebuild from the original authors using `clocks/build_author_extensions.py`. Source revisions and checksums are pinned in that script.
# Original Levine-lab non-polycomb PhenoAge contribution using 458 CpGs. Coefficients retain their original values; the 60.664 PhenoAge intercep... |
6af930c467bf62c4193287a0c28dbbb4d837d267cba27923a830c7353b28a1b1 | Jupyter | 3,668 | 49 | # %% [markdown]
# # dnamphenoageprc
# Rebuild from the original authors using `clocks/build_author_extensions.py`. Source revisions and checksums are pinned in that script.
# Original Levine-lab polycomb-related PhenoAge contribution using 55 CpGs. Coefficients retain their original values; the 60.664 PhenoAge intercep... |
f8f9b88af6fc87d9ae87394d32d95ee026bf2d5637dd682b15a9f0ee1fe1390b | Jupyter | 3,682 | 125 | # %%
import os
import sys
sys.path.insert(0, os.path.abspath('../../qbiome'))
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_theme()
plt.style.use('ggplot')
from data_formatter import DataFormatter
from quantizer import Quantizer
from qnet_orchestrator import QnetOrchestrator
from f... |
8ca27d3a8108174f2f35b8d6347f7b31ea94716e754065313c9c4fb91f6e9265 | Jupyter | 3,716 | 126 | # %% [markdown]
# ## Get adjacency matrix by type
#
# 1. query all cell types in the optic lobe,
# 2. pick some cell types (eg. >=500 instances)
# 3. query all-to-all connectivity (i.e., adjacency matrix) within a neuropil
# 4. plot the adj matrix and compute some stats
# %% [markdown]
# ### init setup
# %%
"""
Thi... |
6d61bf757e99a067d2cc92ee0b2644a3c9bd3cb41d3013df60ad2f0504f481f7 | Jupyter | 3,718 | 119 | # %%
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib as mpl
from matplotlib.gridspec import GridSpec
plt.rcParams["font.family"] = "Times New Roman"
plt.rcParams['text.usetex'] = True
plt.rc('text.latex', preamble=r'\usepackage{amsmath,dsfont}')
# %%
#loading data for activ... |
1557e5e3794c5f8cd35ab615e6375c1bb1fa627482b89b97b6c60c1a9e98ff85 | Jupyter | 3,726 | 93 | # %%
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import stats
# %%
folder_name = 'sample' #list folder containing images and outputted data directories
date = '051923' #date of analysis
# %%
# import filled matrix
brains = np.load(f'{folder_name} outputted data/{folder_name}_matr... |
b700b3d9bd3928cac42210e310fd84474cc7ac62749c1cab9010840048e22c3e | Jupyter | 3,733 | 113 | # %%
#Imports
import numpy as np
import os
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.gridspec import GridSpec
import matplotlib.backends.backend_pdf
matplotlib.rcParams['lines.linewidth'] = 0.5
matplotlib.rcParams['lines.markersize'] = 1
matplotlib.rcParams['pdf.fonttype']... |
1650d66bdabed44f957f27eeef7778ce875152922f9908f08a87bd4204a9b0dc | Jupyter | 3,740 | 125 | # %%
# hide
%load_ext autoreload
%autoreload 2
# %% [markdown]
# # Evaluation Buchwald Hartwig
#
# > Predicting the yield of Buchwald Hartwig HTE reactions
# %%
# data
import logging
import sklearn
import torch
from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_error
import pandas as pd
from rx... |
06b53737acb942745c78fd513bb9d58521780794bbafa69227086ee8abe3547c | Jupyter | 3,784 | 164 | # %% [markdown]
# ## Multimodal
# %%
import sys
sys.path.append('../')
# %%
import matplotlib.pyplot as plt
import torch
import numpy as np
import cv2
from utils import circle_size, colors, toImg, preprocess
from model import loadMultiModalFan#, predict_landmarks
from torchgeometry.contrib import spatial_soft_argmax2... |
80f2c9bb18d805fe046bf2b8906867a35456aa15fdf466416fdd11501db3fe84 | Jupyter | 3,796 | 164 | # %% [markdown]
# # Multimodal
# %%
import sys
sys.path.append('../')
# %%
import matplotlib.pyplot as plt
import torch
import numpy as np
import cv2
from ELD.utils import circle_size, colors, toImg, preprocess
from ELD.model import loadMultiModalFan#, predict_landmarks
from torchgeometry.contrib import spatial_soft_... |
d746229004d983a205354056a18b3a765112db980cd4181758e86b35b12b4f84 | Jupyter | 3,799 | 132 | # %%
import os
import sys
sys.path.insert(0, os.path.abspath('../'))
import captum
import torch
import torchtext
import torchtext.data
import torch.nn as nn
import torch.nn.functional as F
from torchtext.vocab import Vocab
from captum.attr import LayerIntegratedGradients, TokenReferenceBase, visualization
from tor... |
875de9a3ee9b905898a46ebe3652818519394ac1d1ad12e7c53819a88ce2020d | Jupyter | 3,823 | 113 | # %%
%matplotlib inline
import os, glob
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from scipy.optimize import curve_fit
import scipy.optimize as opt
import matplotlib.lines as mlines
import pandas as pd
import csv
from skimage import io
from matplotlib.gridspec import GridSpec
from mat... |
85dc9009e8ab246b548e1722bb74b0ddfa05d39e9c76d725495977e2369f1b8d | Jupyter | 3,836 | 141 | # %%
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib as mpl
from matplotlib.gridspec import GridSpec
plt.rcParams["font.family"] = "Times New Roman"
plt.rcParams['text.usetex'] = True
plt.rc('text.latex', preamble=r'\usepackage{amsmath,dsfont}')
# %%
#loading data for activ... |
979fe58149b15d02f91f89967d154dfa09131f2ad8ea22917e1b9d9e5e2966ab | Jupyter | 3,853 | 137 | # %% [markdown]
# # Import Modules
# %%
import time
import pianno as po
import scanpy as sc
import squidpy as sq
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import matplotlib.pyplot as plt
import matplotlib as mpl
import json
from os.path import join
# %% [markdown]
# # Preprocessing
# %% [markdown]
# ### Ste... |
066fd91f644dba2aa6b697c24121603c3a9770fc6fbcc9cc4ddb1fdd71662856 | Jupyter | 3,866 | 126 | # %% [markdown]
# # Import Modules
# %%
import scanpy as sc
import squidpy as sq
import sys
sys.path.append(r"/home/yqzhou/JUPYTER/MyPackage/Pianno")
import pianno as po
import json
from os.path import join
import matplotlib.pyplot as plt
import matplotlib as mpl
# %% [markdown]
# # Data input
# %%
# Setting the dat... |
77483f7d82eb4d59cdfe94147a5dabc0bd9aa622e16982c0d87b0d769fde49ae | Jupyter | 3,870 | 126 | # %% [markdown]
# # Import Modules
# %%
import scanpy as sc
import squidpy as sq
import sys
sys.path.append(r"/home/yqzhou/JUPYTER/MyPackage/Pianno")
import pianno as po
import json
from os.path import join
import matplotlib.pyplot as plt
import matplotlib as mpl
# %% [markdown]
# # Data input
# %%
# Setting the dat... |
9dac642e19340807b5eb31baaaacd6b2fe3662d821e4cb763b68f262169e1e6f | Jupyter | 3,893 | 112 | # %%
import xlrd
import numpy as np
import pandas as pd
from scipy import stats
import csv
import matplotlib
from matplotlib import pyplot as plt
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
# %%
textfiles=['./Oct-30-2021-Human-Cytokine .xlsx',
'./Dec-2-2021-Human-Cytoki... |
93fb814f0bd935359fc4e8b2e01437163152aa64b1201febd52b2e246a15f69f | Jupyter | 3,913 | 140 | # %%
# plot code for figureS18
# useful packages:
import matplotlib.gridspec as gridspec
from scipy import stats
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import scipy
import scipy.io as sio
import warnings
warnings.filterwarnings("ignore")
import pickle
from PIL import Image
from scip... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.