sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
b6d26bd4228e28e0033e29187bdf715da5745f5b581056052711967aba266f1c
Python
7,677
192
# Copyright (c) 2020 10x Genomics, Inc. All rights reserved. """Basic python interface for creating a websummary. If run as "python summarize.py example" it creates an example HTML websummary using the template in example/summary.html and the data in example/data.json. """ from __future__ import annotations import...
48398083244bddf4c881f30f7a73ea76e13102cf898fcb1f77e17c5f37b85a22
Python
7,689
183
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # All Rights Reserved # See file LICENSE for details. ############################################################################ # Usage: python3 misc/isoseq_quantification.py -o examples --...
ab8d6b97dc608a292ebc962b6c58e4d35f33edadd5388ed6b743299b8a153845
Python
7,689
169
import matplotlib import matplotlib.pyplot as plt import numpy as np import pytest from openfe.analysis.plotting import ( plot_2D_rmsd, plot_lambda_transition_matrix, ) MBAR_HIGH_FLOAT_PREC = np.array([ [4.04963280e-01, 2.64851626e-01, 1.55960834e-01, 8.70071466e-02, 4.65819362e-02, 2.21166590e-02, ...
2f9645ce7532d19fbfd226842370232d9c065f7b47cb35da4865a32b18865515
Python
7,691
207
from dataclasses import InitVar, dataclass, field from typing import Iterable, NamedTuple, Sequence import numpy as np import torch from torch import Tensor from chemprop.data.datasets import CuikBatchedDatum, Datum, MolAtomBondDatum from chemprop.data.molgraph import MolGraph from chemprop.featurizers.molgraph.molec...
14da7db362c338fcd9276ff55358b46c8eb446a1153ab3a438ecc6e4eeafc9f8
Python
7,692
174
from copy import deepcopy from typing import Union, Tuple, List import numpy as np import torch from einops import rearrange from torch.nn import functional as F from nnunetv2.configuration import ANISO_THRESHOLD from nnunetv2.imageio.simpleitk_reader_writer import SimpleITKIO from nnunetv2.preprocessing.resampling.d...
358af186fdbf82c989a72d4d186c2a56a0099446760c59228b6f87888acc39f7
Python
7,701
155
''' Prepares the data necessary for the PRC extraciton the actual PRC extraction goes in prc_extraction/run_prc_extraction.py ''' from rCPGswCPG.Network import firing_rate from rCPGswCPG.utils.sp_utils import * from rCPGswCPG.Network import construct_model from rCPGswCPG.model_params.config_loader import load_model_cfg...
71f9758da572a14cdb6e5107033ac05cdfebac1192cbec1e82ff702e76e681ae
Python
7,705
178
import copy import numpy as np import torch_geometric.nn as gnn import torch from torch import nn from torch.nn import functional as F from sklearn.feature_selection import SelectKBest, f_classif class GraphConvNet(nn.Module): def __init__(self, input_size, output_size, hidden_size, alpha): super().__init...
5bc9201a903c6ecd9ff35872dcd66c6be14bbb1eb23b0f58c662b0262ecc5a9d
Python
7,710
255
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
992bbc4ecf895cadacb220fcadca12de1c94a78e45f9272d39330ea8980416f7
Python
7,710
186
# # Copyright (c) 2025 10X Genomics, Inc. All rights reserved. # """Structify cell annotation outs.""" import os from dataclasses import asdict, dataclass import martian from cellranger.cr_io import hard_link, recursive_hard_link_dict __MRO__ = """ struct CellTypeWebSummaryBundle( string cell_annotati...
58577b375f3ff7f5b9d83c27815439bd6ffce2c4a6ee027caeb6c9213bae4553
Python
7,718
238
# # Copyright (c) 2020 10X Genomics, Inc. All rights reserved. # from __future__ import annotations import functools from collections.abc import Callable, Iterable from html import unescape import h5py import numpy as np from six import ensure_str import cellranger.h5_constants as h5_constants from cellranger.wrap...
e72f38db2fe350f3383d78e28c7a82ea8a27e02a0ecddf2a5f18997d9f16be55
Python
7,722
215
#!/usr/bin/env python # # Copyright (c) 2019 10X Genomics, Inc. All rights reserved. # from __future__ import annotations import json import os import subprocess from typing import TYPE_CHECKING import martian import numpy as np import cellranger.cr_io as cr_io import tenkit.log_subprocess as tk_subproc if TYPE_CH...
3fb8b76f3a556fb1faed954f34921872cc37cfd422e0f329c781dbd3a3f72550
Python
7,725
200
# Garnet tests from garnetff import garnet, get_equivalent_atom_types from openff.toolkit.topology import Molecule, Topology from openff.pablo import topology_from_pdb from openmm import HarmonicBondForce, LangevinMiddleIntegrator from openmm.app import PME, HBonds, Simulation, PDBFile, PDBxFile, ForceField from openm...
0da49334733dfc0657f7eb7ecf64fde7b216648b06085e16b4851465ea91ec8b
Python
7,731
221
import numpy as np import pandas as pd import seaborn as sns import os import matplotlib.pyplot as plt from scipy.stats import mannwhitneyu import mimic_iii_sql.psql_wrapper as psql_mimic import aumc_sql.psql_wrapper as psql_aumc import yaml """ To extract demographic and patient characteristic of MIMIC-III and Ams...
02d6fab8082181c7729c7fc8b56348387433162423025001551ed3f71851005f
Python
7,740
253
"""XGBoost model wrapper for molecular property prediction. Provides a thin wrapper around ``xgboost.XGBClassifier`` and ``xgboost.XGBRegressor`` that exposes ``model_family = "xgboost"`` for dispatch compatibility with the existing training and inference pipeline. """ import logging from contextlib import contextman...
0b89f0708da10db61efccea6a684655c9bb2542047fb9ac873306e57c0252dd0
Python
7,741
214
""" Vox2Cortex """ __author__ = "Fabi Bongratz" __email__ = "fabi.bongratz@gmail.com" from itertools import chain from typing import Union, Tuple, Sequence from deprecated import deprecated import torch import torch.nn as nn from pytorch3d.structures import MeshesXD import logger from utils.mesh import vff_to_Meshe...
be5e884a7078c7ead8e7c12283a0cd5c69601a5d5c64dacae0dd5c713a4b7d5d
Python
7,747
203
# Copyright (c) 2019 10X Genomics, Inc. All rights reserved. """Code to make the web summary for AGGR runs of (Space|Cell) Ranger.""" from __future__ import annotations from typing import TYPE_CHECKING import numpy as np import cellranger.rna.library as rna_library import cellranger.websummary.sample_properties as ...
8630ae3b6f9b1a4413182e4b73d80fe0fab8723b721baebb8b3e4b03a9655947
Python
7,751
233
from composer import Trainer from composer.models import ComposerModel from composer.utils import dist, reproducibility from glob import glob import numpy as np import os import pandas as pd from pathlib import Path from transformers import AutoTokenizer import torch from tqdm import tqdm from train_modules import Tra...
024db93ab96bf9577b8fcf3b4bfeb44987ffadbd16678ee756f5a1e36117356d
Python
7,762
241
from pathlib import Path from typing import List, Dict from dataclasses import dataclass import argparse import matplotlib.pyplot as plt import numpy as np import torch import torchvision.transforms as transforms from tqdm import tqdm from . import config from .utils.activation_manager import ActivationManager from ....
45d7b7ea3e66fc2100b387c49f239c5b7a289fdd97658ca0f13fa1f74d942255
Python
7,766
210
# Copyright (c) Facebook, Inc. and its affiliates. import numpy as np import unittest from copy import copy import cv2 import torch from fvcore.common.benchmark import benchmark from torch.nn import functional as F from detectron2.layers.roi_align import ROIAlign, roi_align class ROIAlignTest(unittest.TestCase): ...
d915511bfdbe101bf09f5ef0a347e7905d2cbdad782a5b4ea17dffcfcbf3dbea
Python
7,783
158
import os, re import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import functools from smma.src.utilities import closest_node, find_pairs from smma.src.visualise import plot_colocalisation from loguru import logger logger.info('Import OK') input_path = 'results/spot_detecti...
f8983edc0f990967ecfa6ccd7afdefacc07eab270bca713f9020b61402d1e984
Python
7,792
199
import networkx as nx import numpy as np import mesa from mesa.examples.advanced.alliance_formation.agents import AllianceAgent from mesa.experimental.scenarios import Scenario from mesa.meta_agents import MetaAgents class AllianceScenario(Scenario): """Scenario for the Alliance model.""" n: int = 50 me...
0495729278fbb6fd55e9e68323d8fec676872830a7e84bc6e6be357e312a998e
Python
7,814
197
import argparse import pandas as pd import numpy as np from scipy.stats import ttest_rel as _ttest_rel, wilcoxon as _wilcoxon from datetime import datetime from tqdm import tqdm import sys import os import warnings warnings.filterwarnings("ignore", category=RuntimeWarning) # One-sided wrappers: scipy >= 1.7.0 suppor...
9df12559b9bfc8181a7fe96ad84fd004c0efea375ba19c90fde3961976247a79
Python
7,814
188
""" loaders/axion_loader.py ----------------------- Loader for Axion BioSystems Maestro MEA recordings. Axion AxIS exports spike data as a CSV with an interleaved layout: - Columns 0-1: metadata key-value pairs (left side) - Columns 2-4: Time (s), Electrode, Amplitude (mV) (right side) Both sides share the same ...
8548f445890643e85d8c7aec83ea2c83d53a7a513e198c3f4fb2479a70061902
Python
7,820
162
import sys from pathlib import Path if len(sys.argv)!=2: sys.exit("USAGE: python evidenceScoreProtMap.py <path to tab-sep-peptide-hits>, \n e.g.,\npython evidenceScoreProtMap.py L:\promec\TIMSTOF\LARS\2021\Oktober\211031FinnFinal\") pathFiles = Path(sys.argv[1]) #pathFiles = Path("L:/promec/TIMSTOF/LARS/2021/Oktober...
507982156403829ceaf13e285e1a1c87088ed14c17b3a55d4ae17a6171729ddc
Python
7,821
187
# Copyright (c) Facebook, Inc. and its affiliates. import json import logging import os from detectron2.data import DatasetCatalog, MetadataCatalog from detectron2.data.datasets.builtin_meta import CITYSCAPES_CATEGORIES from detectron2.utils.file_io import PathManager """ This file contains functions to register the ...
61cd8fb88ddb7fb2f1ef72cb9c9b9ec7ebcffbbde629bf59f9557c4f907877f9
Python
7,821
191
''' pre-processing script for Vox2Cortex This script is adapted from DeepCSR https://bitbucket.csiro.au/projects/CRCPMAX/repos/deepcsr/browse/preprop.py This script registers an image (orig.mgz file from FreeSurfer outputs) to MNI space (using niftyreg), the corresponding affine transformation matrix is then used to w...
dce967a0cf7c3d2b73f9dbda4ba39b3e6de151cf98c865d8f5fd2f8cbedadb62
Python
7,833
204
#!/usr/bin/env python # # Copyright (c) 2020 10X Genomics, Inc. All rights reserved. # """A helper stage to pipe through map called stages to sidestep martian issue.""" from __future__ import annotations from typing import TYPE_CHECKING, Any import martian import cellranger.cr_io as cr_io from cellranger.fast_utils...
34e7e8bd2aeb8fd09f3811f8d2ea84d1ff08fd4cd562b74847bbf119f0b45fdf
Python
7,835
204
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
7d5a1938aefc192f673111b4da6fb7dab0266f04b47fdf11d7485de731aeaf1a
Python
7,835
296
# noqa: D100 import gc import weakref import pytest from mesa.examples import ( BoidFlockers, BoltzmannWealth, ConwaysGameOfLife, EpsteinCivilViolence, MultiLevelAllianceModel, PdGrid, Schelling, SugarscapeG1mt, TransitSystem, VirusOnNetwork, WolfSheep, ) from mesa.examples...
6aa223eb5e7edbf13efad5838f9fea392d69cf019292fc4602ec731b007883e6
Python
7,836
220
# Copyright (c) Facebook, Inc. and its affiliates. import atexit import bisect import multiprocessing as mp from collections import deque import cv2 import torch from detectron2.data import MetadataCatalog from detectron2.engine.defaults import DefaultPredictor from detectron2.utils.video_visualizer import VideoVisual...
84fe93fa8979e07d4a7e14817d50c3a51342a918693c9c8540782a7f80dd3753
Python
7,844
183
import utils import numpy as np import pandas as pd import scipy import math import os import sys #Helper functions # separate actin point into cells based on their distances to the two membranes def separate(actin, memb1, memb2, cutoff, voxel_size = 1.34808): #generate kd tree memb_1_kd_tree = scipy.spatial.K...
253dcd43ffa9a7cc7b8ffa85236db0e8a721a2f4274726c86dc6fe30f802f6ce
Python
7,846
220
# Copyright (c) Facebook, Inc. and its affiliates. import fvcore.nn.weight_init as weight_init import torch import torch.nn.functional as F from detectron2.layers import Conv2d, FrozenBatchNorm2d, get_norm from detectron2.modeling import BACKBONE_REGISTRY, ResNet, ResNetBlockBase from detectron2.modeling.backbone.resn...
790d7a663f7e6898f99ec7ccf38ac63e69719688aa527f775bc77e58bce0a04c
Python
7,846
220
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from typing import List import click from openfecli import OFECommandPlugin from openfecli.parameters import ( MAPPER, MOL_DIR, N_PROTOCOL_REPEATS, NCORES, OUTPUT_DIR,...
18a9f204003830aa3a2cb7617628859db559034fbef327bf872f1f9836869f6b
Python
7,850
211
import sys import argparse import os import shutil import time import numpy as np import sys import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.optim import torch.utils.data import torch.utils.data.distributed import torchvision...
5216036aa0ba32de7d546dfb82382c8aa547d86633d15ea49fa0da60d455c4e9
Python
7,858
226
""" Skeletons ========= <!-- difficulty: beginner --> Load and save skeletons from SWC and other formats, or build them from scratch. Skeletons are probably the most common representation of neurons and are stored as a series of connected nodes (the "skeleton"). In {{ navis }}, skeletons are represented by the [`navi...
7495e0659063127ffe17e01aed8e9f59f42e5cd69fed72c3cf3b639c7e8f3597
Python
7,862
280
import json import pickle import sys from pathlib import Path import torch import stoic.predict_stoichiometry as ps class DummyStoicModel: def __init__(self): self.device = None self.eval_called = False self.enabled_full_length = None self.predict_calls = [] def to(self, dev...
77f7064ddc89cb61231e45a7f375f7b0c417f618040b06b463b0b611a08ad4bc
Python
7,863
172
from qcportal import PortalClient from collections import defaultdict from rdkit import Chem import argparse import numpy as np import h5py import yaml # Units for a variety of fields that can be downloaded. units = {'dft_total_energy': 'hartree', 'dft_total_gradient': 'hartree/bohr', 'mbis_charges'...
498ae143dd3efb449ae9760e41dbc0c14b568e1632f07eab911178de11817a38
Python
7,867
217
#code https://towardsdatascience.com/creating-an-email-parser-with-python-and-sql-c79cb8771dac #data outlooks mail copied to folder #check https://sqlite.org/cli.html #pip install sqlalchemy db = sqlite3.connect("emails.db") # Create empty tables db.execute(""" CREATE TABLE IF NOT EXISTS "articles" ( "id" INTEGER, "tit...
ca0fe5c9a4ca7b4c5c8202d33f820568c30dd533000cbdc6c5812e37b201c058
Python
7,889
208
import pandas as pd import pytest import torch import stoic_train.dataset as dataset_module from stoic_train.dataset import StoichiometryDataModule class DummyGraph: def __init__(self, quantity_value: int, interact_value: int): self.quantity = torch.tensor([quantity_value], dtype=torch.long) self...
d7bce845c7cd3827f22687d4b035fd830490f960dce4423484570192d573e9f2
Python
7,890
229
# Copyright (c) Facebook, Inc. and its affiliates. """ Backward compatibility of configs. Instructions to bump version: + It's not needed to bump version if new keys are added. It's only needed when backward-incompatible changes happen (i.e., some existing keys disappear, or the meaning of a key changes) + To bump...
2913c110b142c54081700530ff8b70fa1f2083ddab60bb1e89a50efb99dccc50
Python
7,893
200
#!/usr/bin/env python # # Copyright (c) 2018 10x Genomics, Inc. All rights reserved. # """Aggr preflight check + convert legacy molecule info h5 to current version.""" from __future__ import annotations import os import shutil from typing import TYPE_CHECKING import martian import cellranger.constants as cr_constan...
9b53ff271b32dece05914bc9cec0174e57acd67e522a746846650b1731ceba63
Python
7,898
129
''' Created on Feb 7, 2025 @author: voodoocode ''' import scrubber.database4 import scrubber.database6 import scipy.signal import matplotlib matplotlib.use("Qtagg") import matplotlib.pyplot as plt import numpy as np minF = 1 maxF1 = 500 maxF2 = 5000 def db4(): path = "/mnt/data/Professional/LMU/data/Beta-prev...
31e18573cba93395b6ed4d5802ed5c75f5609e7f763b74695b347833746bf710
Python
7,921
280
""" Evaluation metrics. Those metrics are typically computed directly from the model prediction, i.e., in normalized coordinate space unless specified otherwise.""" __author__ = "Fabi Bongratz" __email__ = "fabi.bongratz@gmail.com" from abc import ABC, abstractmethod import numpy as np import torch import pandas as...
43e992e99ae9197c3874f279237bfe4800f69bb22e6b16a1a42343d88f0ea0d4
Python
7,927
201
# -*- coding: utf-8 -*- """ Created on Tue Jul 19 11:52:35 2022 @author: Joseph Vermeil GraphicStyles.py - state the graphic styles elements of CortExplore programs, to be imported with "import GraphicStyles as gs" and call content with "gs.my_graphic_style_thingy". Joseph Vermeil, 2022 This program is free softwar...
069b1bb87e5f940cfc5672ebd56b0fb93d0dfa619163b553c343ff4a9680add7
Python
7,941
210
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
9905d89ea41bc366f5e451e2f835a0c0d49bed79e3d3e2c6edc83837320de093
Python
7,941
167
import torch from torch import nn import torch.nn.functional as F from einops import repeat from taming.modules.discriminator.model import NLayerDiscriminator, weights_init from taming.modules.losses.lpips import LPIPS from taming.modules.losses.vqperceptual import hinge_d_loss, vanilla_d_loss def hinge_d_loss_with_...
bb3ebd9643a85d8d3d35b251579f336d8f0872a30e406c2a5a491d28cf2210df
Python
7,942
216
""" Run the v3 response pipeline on ICMS83 sessions. ICMS83 uses a different data layout than experimental animals: - Data on E:/ICMS83/ instead of C:/data/ - trial_df from CSV instead of DataLoader - Analyzer at batch_sort/stage3/analyzer_final.zarr instead of merge/hmerge_analyzer.zarr Usage: python -m batch_pr...
93614d6fc635811c794ab2ee364430f1046a93322283ffd58eb0667a3d934249
Python
7,946
231
"""Copyright 2013 Michael Kane and Bryan Lewis. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writ...
272077647aa88a3df8aa5f2a765f8e92c3077527873cf278c6bd965538efa43d
Python
7,950
207
#!/usr/bin/env python3 """Create RAVEN-compatible 3D HDF5 patch datasets from NIfTI volumes.""" from __future__ import annotations import argparse import csv import json from pathlib import Path import sys import h5py import nibabel as nib import numpy as np SCHEMA = ( "orig_dataset_imgs", "orig_zooms_x", ...
f711f2caaff760a4c4fbe12bdd32787a9cd9f22539ccf8943d5484dee76b9fce
Python
7,958
241
"""Tests for the Brain Image Library interface. These are deliberately network-free: we only exercise the pure helpers (the autoindex parser, the URL mapping, the record flattening and the field validation). Anything that talks to BIL is left to manual testing, in line with how the other interfaces are handled. Note ...
3e2b420ef56ec055a9ce2a6e5e713b0d4c715cb48214dfd8cc00543f30043607
Python
7,961
221
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. """ Detectron2 training script with a plain training loop. This script reads a given config file and runs the training or evaluation. It is an entry point that is able to train standard models in detectron2. In order to let one script support tr...
d8f9b685b52e2bde1663ca30cee7da3a561f8f09face80c0ed1688f466f1517c
Python
7,964
277
""" @Article{li2014multiplicative, author = {Li, Chunming and Gore, John C and Davatzikos, Christos}, title = {Multiplicative intrinsic component optimization (MICO) for MRI bias field estimation and tissue segmentation}, journal = {Magnetic resonance imaging}, year = {2014}, volume = {32}, ...
67733215fa138ead79cbfde7301eabf57adf7a926615b18b0ae8d045a04101ba
Python
7,979
158
#%% import sys sys.path.append('/mnt/obob/staff/fschmidt/cardiac_1_f') from utils.pymc_utils import coefficients2pcorrs from os import listdir from os.path import join import pandas as pd import bambi as bmb import pymc as pm import joblib from scipy.stats import zscore import arviz as az from plus_slurm import Job...
b341eff116027dc57b204561fe359e1dd465a95dcbf6136279ad6f0fbafa7760
Python
7,980
182
from tristan_pipeline.utils.analysis_utils import * from tristan_pipeline.io.params import * from tristan_pipeline.utils.loading_utils import * from tristan_pipeline.utils.preproc_utils import * from tristan_pipeline.utils.glm_utils import * from nilearn.glm import threshold_stats_img from nilearn import image import n...
50e8d967d72f358fa276c9a4f6c5dd7c970788be7b5858dcad26778802f35076
Python
8,000
252
import nibabel as nib import numpy as np import naturalneighbor from scipy.stats import zscore logfile = open(snakemake.log[0], "w") print(f"Start", file=logfile, flush=True) def convert_warp_to_itk(warp): """Convert warp to ITK convention by negating X and Y""" warp_itk = warp.copy() warp_itk[:, :, :, 0...
b2fe61b940048ce8abe1240c89ff2e41f18b991c14078db5d7df1d2b8dc1a942
Python
8,005
167
import sys from pathlib import Path if len(sys.argv)!=2: sys.exit("USAGE: python pepXscoreProtMap.py <path to tab-sep-peptide-hits>, \n e.g.,\npython pepXscoreProtMap.py L:\promec\TIMSTOF\LARS\2021\Oktober\211031FinnFinal\gluCtryP") pathFiles = Path(sys.argv[1]) #pathFiles = Path("L:/promec/TIMSTOF/LARS/2021/Novembe...
8f205f2434e3f46f82388b77a57fb75d6648f65526e5ea9d47c97e96df37541a
Python
8,008
213
############################################################################ # Copyright (c) 2023 University of Helsinki # # All Rights Reserved # See file LICENSE for details. ############################################################################ import math import os import sys import argparse from Bio import S...
925e0f9e230a184517467a6e73255754aca77ed0293094671b43553c177f0d10
Python
8,011
186
# Copyright (c) 2021 10X Genomics, Inc. All rights reserved. from __future__ import annotations from typing import TYPE_CHECKING import numpy as np import cellranger.rna.library as rna_library from cellranger.feature.utils import get_feature_counts_as_df if TYPE_CHECKING: import pandas as pd from cellrang...
509b478f473e1ff13717e310aeddc57b2680cd7feb3c085fe8db1fccd546930d
Python
8,016
197
import warnings import numpy as np import pandas as pd import nibabel as nib import pytest from neuroHarmonize import harmonizationLearn, harmonizationApply from neuroHarmonize.harmonizationApply import applyModelOne from neuroHarmonize.harmonizationNIFTI import applyModelNIFTIs, flattenNIFTIs, createMaskNIFTI @pytes...
8898c259b9f227d9643c4c125e3f9b7efac3770834ae94d30bc3c491e787d8ae
Python
8,036
223
import numpy as np import matplotlib.pyplot as plt import warnings def fitSmoothingKernelBandwidth(full_traindict, total_trial_len): """Fits a spike smoothing kernel to spike train data using the improved Sheather-Jones (ISJ) algorithm: Z. I. Botev, J. F. Grotowski, and D. P. Kroese. “Kernel dens...
2a32b61948c77de1557c3a12f22218be8a14c7141b9acbb9f2018412c1d5cf1b
Python
8,042
221
import torch import torch.nn as nn import torch.optim as optim import numpy as np from torch.utils.data import DataLoader, TensorDataset, Subset import pandas as pd from sklearn.metrics import mean_absolute_error,mean_squared_error,r2_score NCGCN_embedding_train = np.load('../AMP_dataset/embedding/NCGCN_embedding_trai...
46d31a10b4e2dc9522c7ebff03714e9a411264226fbe1a48d5a2d9b91716f7d5
Python
8,044
301
# -*- coding: utf-8 -*- import os import numpy as np import pandas as pd import matplotlib.pyplot as plt def plot_cluster_stability(cluster_stab_df, out_fn=None, title=None): """ Barplot of within-cluster vs between-cluster consensus. Input: cluster_stab_df = output of cluster_stability_table() ...
cd3446c99489aa05943c3ce27ff1d28772431054bd7cc0ca5d52c0974fa7a60d
Python
8,060
278
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """Pydantic models for the definition of advanced CLI options""" import warnings from collections import namedtuple from typing import Any, Optional import click import yaml from plugcli.pa...
7ea81b08e7197ab4e4be853b1f64ce7684ee9e0da0716f8dc9179684c58b0e5c
Python
8,062
227
"""Tests for conformer disk caching and parallel generation.""" import tempfile from pathlib import Path from unittest.mock import patch import numpy as np import pytest from rdkit import Chem from nfml.data.fingerprints import ( _ConformerCache, _generate_conformers, _generate_single_conformer, compu...
a5094cef4fed29b6327d2e0fc8a23b6ef2a7a6cb633aec160f7a0f183a03583a
Python
8,066
228
""" Stratified Tile-Level Evaluation Metrics Accumulates patch-level predictions across batches, groups them by tile ID, and computes segmentation metrics per tile. Supports aggregation to WSI level. Components: StratifiedMetricsCalculator — main accumulator class compute_wsi_level_metrics — aggregate tile ...
232326df52baecf4e5d72c911bab5514c1c2ce86087429a584d55f4ccf3b82a0
Python
8,069
206
import os import numpy as np import pandas as pd import umap import matplotlib.pyplot as plt import anndata as ad import scanpy as sc import scvelo as scv import cellrank as cr import scanpy.external as sce from scipy.io import mmwrite, mmread import statsmodels.api as sm from sklearn.cluster import AgglomerativeCluste...
74013029de7e82bc071d7739be46a13e0a47941f698996401cd51339b8689808
Python
8,069
251
""" Test procedure """ __author__ = "Fabi Bongratz" __email__ = "fabi.bongratz@gmail.com" import re import os import sys import logging import json from copy import deepcopy import wandb import torch import numpy as np import logger from data.dataset_split_handler import dataset_split_handler from models.model_han...
2da6c843ffa493728a17ed7bbf4fec2cf3cab2319c65bc060269f17d1de36c84
Python
8,070
177
import os import numpy as np import pandas as pd import umap import matplotlib.pyplot as plt import seaborn as sns import anndata as ad import scanpy as sc import scvelo as scv import scanpy.external as sce from scipy.io import mmwrite, mmread import statsmodels.api as sm np.random.seed(42) # peak-gene linkage matrix...
124641f80c389c24f6e7edc3c76288073c20b1b672ae82982b88b33698a0cf68
Python
8,071
198
#!/usr/bin/env python # Copyright 2016-2025 Biomedical Imaging Group Rotterdam, Department of # Radiology and Nuclear Medicine, Erasmus MC, Rotterdam, The Netherlands # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain ...
45cba821150be0d1e2cc57d85339c8713a00391a5c803e05e51f77dff59ef715
Python
8,072
223
"""Tests for `navis.graph.geodesic_clusters`. Runs on `navis_fastcore.geodesic_clusters`. The greedy carve-out is deterministic, so these pin what the partition must *be* - every node within `max_dist` of its cluster's seed, every cluster connected - rather than comparing against a second implementation. """ import n...
e54a0e0af3788847c3f112cd835ba4ba5202ffb770d82ce8c86b13ec46850b22
Python
8,072
216
#!/usr/bin/env python3 """ Bulk runner for map_active_sites_to_pdb.py over a CSV, including pdb_resseq in the master summary. Usage : python run_bulk_mapping_from_csv_with_resseq.py \ --csv mapping_ready.csv \ --pdb-dir ./pdbs \ --outdir ./mapped_results \ --mapper-path ./map_active_sites_to_pdb.py \...
9b497f02b3836725cc7d2fc4913ab2923fb075f31d1cbb58523f185a75a710ce
Python
8,074
237
import pandas as pd import numpy as np def _compute_bounds(totals, target=0.2, low=0.18, high=0.22): """ Compute integer lower/upper bounds for each semantic. """ lb = np.floor(totals * low).astype(int) ub = np.ceil(totals * high).astype(int) tgt = np.round(totals * target).astype(int) # E...
84dcc67a948ec3f17f1908638f01e52e91b0e3599833bc86c13b164d42edb9ee
Python
8,078
222
"""Agent related classes. Core Objects: Agent. """ # Postpone annotation evaluation to avoid NameError from forward references (PEP 563). Remove once Python 3.14+ is required. from __future__ import annotations import contextlib import itertools from random import Random from typing import TYPE_CHECKING, ClassVar i...
3d83e862ec52fbdda732845131e82c4f079630ff38afdd63d0d359e6736e06ee
Python
8,088
195
#cluster https://nbviewer.jupyter.org/github/KrishnaswamyLab/PHATE/blob/master/Python/tutorial/EmbryoidBody.ipynb #!pip install --user phate matplotlib==3.1 scprep #demo https://www.krishnaswamylab.org/projects/phate/eb-web-tool import sys base_path = os.path.expanduser("~") print(base_path) from pathlib import Path pa...
ca3ebe09d428ff638b2930e4f13003239e069aa592afe132e7113b45464c8c6c
Python
8,093
172
import glob import os from typing import Union import torch import torch.optim as optim from torch.utils.data import DataLoader, random_split from tqdm import tqdm from bio_image_unet.siam_unet import BCEDiceLoss from . import logcoshTverskyLoss, TverskyLoss, weightedBCELoss from .predict import Predict from .siam_un...
ec119d6ad79e9db3eace880775325b77b22e8897518ff5017031355a8c827ebe
Python
8,096
274
#%% import pandas as pd import mne import scipy.signal as dsp import joblib from pathlib import Path from os.path import join import scipy.stats as stats import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pingouin as pg from fooof import FOOOFGroup from fooof.utils.params import compute_kne...
5c43b89727bb4423387666de2d3c830d98663f3ed220f0a0d8fec95c1a7b3ea1
Python
8,121
227
#%% import os import re import argparse import numpy as np import pickle as pk import MDAnalysis as mda from os import path from src.hbonds import karplus_dict, backbone_torsions, karplus_J, karplus_hbonds, backbone_amide_hbond_between, karplus_extrema if __name__ == "__main__": parser = argp...
85865bb0fbfa777c39fa45d7f870a88f962fd81107d13afeb9fc29542235c442
Python
8,121
176
import os import json import albumentations import numpy as np from PIL import Image from tqdm import tqdm from torch.utils.data import Dataset from taming.data.sflckr import SegmentationBase # for examples included in repo class Examples(SegmentationBase): def __init__(self, size=256, random_crop=False, interpo...
59e8218ffbdb1021ede0ca01b78c7ea0948f6d6edca294bf12e5423fbba2491c
Python
8,123
153
# This file contains the main code for extracting resampled center line coordinates out of a binary filament segmentation # It is to be used with the sample config file import numpy as np import pandas as pd import mrcfile from skimage.morphology import skeletonize_3d, medial_axis, remove_small_objects from skimage.co...
67ed6e6e75a5a8e059584cd2521944e311bd5592e6fdc9f7509fe2ceb51898b7
Python
8,124
192
# Read molecules and record elements, formal charges, aromatic atoms, # n bonded atoms, bonds, angles, propers, impropers and molecule indices # Output uses one-based indexing # See also https://github.com/openmm/spice-models/blob/main/five-et/createSpiceDataset.py # This is for the GEMS data and uses MDAnalysis to d...
ac6a0bb279ada57c96ce06640acf10198e4822427701842a965c78b2599af407
Python
8,126
250
""" Wrappers for VTK classes needed for rendering. """ # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause from .base import BSVTKObjectWrapper, wrap_vtk from .actor import BSActor, BSActor2D, BSScalarBarActor, BSTextActor ############################################################### # ...
b98ea9f27b1b644711c917c908ff66385cd92bf30ce04b45175d3517409d7734
Python
8,127
207
#c:\Users\animeshs\scripts>python boltz2JSON.py from pathlib import Path import sys import json import csv import glob import re import os in_arg = sys.argv[1] if len(sys.argv) > 1 else "" out_path = Path(sys.argv[2]) if len(sys.argv) > 2 else Path("boltz2.combined.csv") def load_file(p: Path): with p.open("r", ...
bce2d079a32630bed889c5763e5d9d0d7d389f24095af97324f4324d550e0535
Python
8,128
205
# Copyright (c) Facebook, Inc. and its affiliates. import logging import math from typing import List, Tuple, Union import torch from detectron2.layers import batched_nms, cat, move_device_like from detectron2.structures import Boxes, Instances logger = logging.getLogger(__name__) def _is_tracing(): # (fixed in...
3cad832a0e096edadbac067bfcd26cf47e1d2df4964925112cda58cf736cdd68
Python
8,129
205
from __future__ import annotations from copy import copy from typing import Any, Hashable, Iterable, Optional import numpy as np import numpy.typing as npt import pandas as pd import xarray as xr from pandas.core.groupby.generic import DataFrameGroupBy from .base import attach_labels, get_midx, get_proj_layer_mappin...
3b6765b4a5deeae6454d117a477587f1c5f6c8e3ecb71ea914ba56f263968a7f
Python
8,136
224
# ruff: noqa: PLR2004 from __future__ import annotations import re from math import inf import pyparsing as pp from hypothesis import assume, given from hypothesis import strategies as st import tests.strategies as sb_st from snakebids import bids from snakebids.core.datasets import BidsComponent, BidsDataset from s...
4bcaac738591419fa0b01862424562bd37bc30648dc0ec3599b0676f0d5c015c
Python
8,152
185
# type: ignore import pandas as pd from ..base import get_proj_layer_mapping, get_midx from . import _utils pidx = pd.IndexSlice def get_structural_indices(nrn: int, layer: int, syn_params: pd.DataFrame, w_min: float = 0.5, tol: float = 3.0) -> pd.MultiIndex: """Gets network (layer, n...
e89cf5242941aebdafe26fcfa2b587c8d89fce95f04b88d379d69a06d663bbc2
Python
8,158
292
""" Created on Wed Oct 16 11:36:39 2024 @author: dcupolillo """ import numpy as np import torch from torch.utils.data import ( DataLoader, SubsetRandomSampler, WeightedRandomSampler) from sklearn.model_selection import train_test_split import random def set_device(): return "cuda" if torch.cuda.is_availa...
825d814339645f7ddf5c3375ed1d29f9d5861a0cd0af6ab71ea03bb6817a31fa
Python
8,161
221
import pandas as pd import numpy as np import nibabel as nib from scipy.ndimage import binary_dilation from nilearn import image from scipy.stats import mannwhitneyu, ttest_ind, ttest_rel from statsmodels.stats.multitest import multipletests from scipy.stats import permutation_test def consecutive_blocks_(task_vector...
b60ac5b3346f8692c1eee66be88b536e94656b691e6b4b71e4c07a035a975cc1
Python
8,165
168
import math import random import warnings from itertools import cycle from typing import List, Optional, Tuple, Callable from PIL import Image as pil_image, ImageDraw as pil_img_draw, ImageFont from more_itertools.recipes import grouper from taming.data.conditional_builder.utils import COLOR_PALETTE, WHITE, GRAY_75, B...
9bf8999668937bfdf3a14394d443fb8fe94f007e30d35db466f5deb090d0b109
Python
8,168
170
import sys #export import os, argparse, sys, datetime os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import seaborn from matplotlib import pyplot import numpy, scipy from katmap.mikesmaps import GroupedKatmapModels, AnalysisSpecification, FeatureTable from katmap.parsers import FastaReader from katmap.rnamap import RNAm...
d7db732f0c52c18044f61a45af8b90f450ee055f09d4010bcb1f62a8aa35ed20
Python
8,169
191
# Copyright (c) Facebook, Inc. and its affiliates. import copy import logging import numpy as np from typing import List, Optional, Union import torch from detectron2.config import configurable from . import detection_utils as utils from . import transforms as T """ This file contains the default mapping that's appl...
4eb41fc5acd0d852f4375d0a6ff74fbdadc38d6bc0b8bf4b63ea193efb60a24f
Python
8,174
226
# -*- coding: utf-8 -*- """ Figure 4: Dynamics """ import numpy as np import matplotlib.pyplot as plt from netneurotools import stats from scipy.stats import zscore, pearsonr, ttest_ind import seaborn as sns from matplotlib.colors import ListedColormap from scipy.spatial.distance import squareform, pdist from sklearn....
8a3598417d25cf537119127cbbdd880d0d46256d50c417ee2aea216488f43686
Python
8,186
181
"""Postprocessing for general analysis of detected PNGs. """ import numpy as np import numpy.typing as npt import xarray as xr from hsnn.core.record import SpikeRecord from hsnn.core.types import SpikeTrains from hsnn import ops from .base import PNG __all__ = [ "get_spike_trains", "get_polygrp_trains", ...
265c9ecf94fae75f53d036f000785f7e359057c21e4d5a32a01c90b6e23889d8
Python
8,191
201
#%% from plus_slurm import Job #%% import os from os import listdir from os.path import join from mne_bids import BIDSPath, read_raw_bids import mne import pandas as pd import numpy as np from autoreject import Ransac # noqa import pyriemann import joblib from scipy.signal import welch import h5py from fooof import...
460344571795f33ad6080caaa3f31832e9c2fcfcbeabfb1168f01e1833181ba4
Python
8,193
236
from typing import Iterable, Optional, NamedTuple from ..core import Skeleton import networkx as nx import pandas as pd import numpy as np from ..config import get_logger logger = get_logger(__name__) OTHER = "__OTHER__" class Edge(NamedTuple): connector_id: int source_name: str target_name: str sou...
734f02b49731f3abd168de79a38c68fbce7c32191a81e0221a0dc7b2f417e9b0
Python
8,200
204
""" Axon-Dendrite Splits ==================== <!-- difficulty: intermediate --> Split a neuron into axon and dendrite from synapse flow centrality. ## Background Neurons, generally, have two main compartments: axon and dendrites. In textbooks, the axon is the part of the neuron that sends signals to other neurons, w...
ac09c0112ee2eb7e12e5f41d4bd8a18502024c3a89b52d7a06aefc8df3cc6dc5
Python
8,208
161
"""Compare held-out XGBoost TreeSHAP and GA-BPNN DeepSHAP summaries.""" from __future__ import annotations import argparse import json from itertools import product from pathlib import Path from typing import Sequence import numpy as np import pandas as pd DEFAULT_COUNTRIES = ("AUS", "BEL", "CZE", "FIN", "GBR", "I...
b37df4710dd48850da1fa3756768b7560de77333a0b996c783c4a178744c8652
Python
8,212
241
#!/usr/bin/env python # # Copyright (c) 2014 10X Genomics, Inc. All rights reserved. # # Code for estimating tile-extents on a lane # from __future__ import annotations import re import xml.etree.ElementTree as etree from collections.abc import Iterable from typing import ClassVar, Literal, NamedTuple import tenkit.s...
ba0c616efd175eca7b67d559785096307286c9ae761c1019749e73bd59e178fc
Python
8,212
288
# Copyright (c) 2022 10X Genomics, Inc. All rights reserved. """Utility functions for working with aligned segments.""" from __future__ import annotations from typing import TYPE_CHECKING import numpy as np from six import ensure_binary import cellranger.bam_constants as bam_constants import cellranger.constants a...
b2e29d168fb6acd431a0db62ac803bf9c34e041da782dd043975519e9e78956d
Python
8,214
298
import torch import torch.nn as nn import torch.nn.functional as F class BCELoss(nn.Module): """ Binary Cross-Entropy Loss. Parameters ---------- weight : torch.Tensor, optional A manual rescaling weight given to the loss of each batch element. size_average : bool, optional By...