sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
dece06ab0a2e2f73d74c0d5c7f7dc468d9a046a6ff343dcf559d96f5b6e67f7c
Python
3,850
126
import argparse import os import pandas as pd def get_args(): parser = argparse.ArgumentParser(description="Generate sample sheet to convert bcl files to fastq files") parser.add_argument( "-b", "--barcodes", required=True, help="Tab separated file with a header of columns Sam...
a25da3d651bd07d14b1c9cf7a866def33c90a532c6776102f8d3ce6c0885a0ba
Python
3,851
118
"""alignments methods.""" import functools import parasail import pysam import medaka.common from medaka.tandem.record_name import RecordName def align_chunk_to_ref( chunk: pysam.FastxRecord, ref_fasta: pysam.FastaFile, aln_header=None ) -> pysam.AlignedSegment: """Align consensus chunk to reference using ...
b478a1b3d3ecb10c6af990086ed6facd66da2b5d3990831f1aacee1528cf6e94
Python
3,854
91
"""Explicit demonstration of the KAN's advantages (Paper #2): a capability scorecard across all six models and a parsimony/efficiency analysis (accuracy vs trainable parameters). These crystallise why the KAN is the preferred model — competitive accuracy, fewest parameters, and the only learner that is both intrinsical...
960f2b79003f2095a93c934253cca1248ef7813b2806606654ae633307ac3e13
Python
3,855
127
#!/usr/bin/env python # Made by Paul Kiessling pakiessling@ukaachen.de import urllib.request from urllib.parse import urlparse import os import anndata import argparse import shutil import pandas as pd import scipy import json import tempfile LINKS = [ "https://linnarssonlab.org/osmFISH/osmFISH_SScortex_mouse_all...
2cbab51c597a90100f6351b61dc505590f9f0d998893dbd82b20180506af1a46
Python
3,856
92
import torch import torch.nn as nn import torch.nn.functional as F import config.cfg_lodet as cfg from ..layers.convolutions import Convolutional, Deformable_Convolutional from ..layers.msr_blocks import MSR_Convset_L, MSR_Convset_M, MSR_Convset_S, MSR_Convset_L_R, MSR_Convset_M_R, MSR_Convset_S_R from ..head.mtr_head ...
4d558ea36adcc6d5a3d8a214566b4f7130966b39aff2e5a1a8676a81ba6d76e4
Python
3,856
113
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Optional import torch from . import FairseqDataset class TransformEosLangPairDataset(FairseqDataset): """A :class:...
755105045322ee73902f3c75db8dbec921bb9929925179017b863ce580fe7f9b
Python
3,856
110
import numpy as np import pandas as pd from scipy import stats from ._base import BaseCITest, _CITestResult class Pearsonr(BaseCITest): r""" Partial Correlation test for conditional independence. If :math:`Z = \emptyset`, compute Pearson's correlation coefficient :math:`r_{XY}` and its two-sided p-value...
87528406b1a63e1a5c1d0dd55b47ea8cff7fe31210ed2aa6963fff5ff4d4eef0
Python
3,859
103
import torch from librosa.filters import mel as librosa_mel_fn from .audio_processing import dynamic_range_compression from .audio_processing import dynamic_range_decompression from .stft import STFT from .utils import get_mask_from_lengths class LinearNorm(torch.nn.Module): def __init__(self, in_dim, out_dim, bi...
1a01387e7d33bce9086627248e62a3162b5ef0307b99539033fa650d3c6092fe
Python
3,860
102
import pickle as pkl import scipy.sparse import numpy as np import pandas as pd from scipy import sparse as sp import networkx as nx from collections import defaultdict from scipy.stats import uniform from data import * def load_data(datadir): input_data(datadir) PIK = "{}/datasets.dat".format(datadir) wit...
3716b9c415666a44cf55e1ee0a904c87fcc6b0fffaf5ec8d64442b1daafad56b
Python
3,860
87
import anndata import os import sys import pandas as pd import scanpy as sc from tqdm import tqdm from nicheformer.data.constants import DefaultPaths, ObsConstants, UnsConstants, VarConstants, AssayOntologyTermId, SexOntologyTermId, OrganismOntologyTermId, TissueOntologyTermId, SuspensionTypeId from nicheformer.data....
5e601c5a074166930f6fe19010af19fcfe856d1df3e01349af068e9ca32285ae
Python
3,861
128
#!/usr/bin/env python3 """Generate a jobs.sh file for SLURM array job submission. This is step 1 of the SLURM workflow for reproducing the SymmNet paper figure. Each line of the output file contains one `python salnet_symm.py ...` command, one per learning_rate × seed combination. Already-completed runs (those with a...
372300303a0058064537c8192dc343a4728287944a5576e97d7c70bfdac241aa
Python
3,865
79
import traceback from typing import Type from batchgenerators.utilities.file_and_folder_operations import join import nnunetv2 from nnunetv2.imageio.natural_image_reager_writer import NaturalImage2DIO from nnunetv2.imageio.nibabel_reader_writer import NibabelIO, NibabelIOWithReorient from nnunetv2.imageio.simpleitk_r...
3b21e1aa5d20d73a92691f4ef111fca3dc5b0d95bc8f651ee91d6254ffdeb682
Python
3,865
79
import traceback from typing import Type from batchgenerators.utilities.file_and_folder_operations import join import nnunetv2 from nnunetv2.imageio.natural_image_reader_writer import NaturalImage2DIO from nnunetv2.imageio.nibabel_reader_writer import NibabelIO, NibabelIOWithReorient from nnunetv2.imageio.simpleitk_r...
1823c734aa425536fc0c18f6b636581cdcb988c8e5208f9bcff47c640d4282e3
Python
3,866
79
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ScheduleUI/ValveMapUI.ui' # # Created by: PyQt5 UI code generator 5.9.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.se...
0b3fae81f845813308687f534af41f9e0c853d396962996165cad4753d283161
Python
3,868
108
"""Culture-collection accessions: the strain identifiers running text spells. A strain deposited in a public collection is named by the collection's acronym and a deposit number — `ATCC 6538`, `DSM 22228` — and BRENDA's `cultures` table records that string verbatim, so a span carrying one reaches a strain with no name...
31209ba56a336112e3858310ccceafd2b8d530a0170ec4a2d1681a22bf9487bb
Python
3,868
109
"""The release script refuses rather than half-releasing. Every check here guards a step that cannot be undone once it is published: a tag is immutable the moment anyone fetches it, and a changelog commit with no tag beside it is a release that does not exist. The classification of a commit subject is pinned too, beca...
ef73aeba84f2d377eccc046f7be2f71e11672809a24b846b9cd0fa287cde33f7
Python
3,871
108
"""The package `__init__` must not make a leaf import pay for the model stack. `d3text.models.__init__` used to re-export the three model classes eagerly, so importing any submodule of the package ran `base` and everything behind it — transformers, lmdb, sklearn, `d3text.utils` — whatever the importer actually wanted....
b739266618a479ebe5fab4ff2b384470fe9e1196b5aed95bec9a0c243c4c9f5a
Python
3,873
111
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from collections import OrderedDict from torch.utils.data import Dataset from torch.utils.data.dataloader import default_collat...
eab81e3421469b9d96f18fb1c35f798206eba75936b5eb7d6e810f3619134505
Python
3,873
104
"""Class representing the model table of a toml configuration file.""" from __future__ import annotations from attrs import asdict, define, field from attrs.validators import instance_of from .. import models MODEL_TABLES = [ "network", "optimizer", "loss", "metrics", ] @define class ModelConfig: ...
773787e5dfed95097de76904e5dbb586bfd30686d8ec98a2a08fd3af3a190b66
Python
3,877
114
"""Explicit registration of GPN model families with Transformers AutoClasses.""" from threading import Lock from typing import Literal ModelFamily = Literal["ss", "msa", "phylo", "star"] _FAMILIES: tuple[ModelFamily, ...] = ("ss", "msa", "phylo", "star") _registered_families: set[ModelFamily] = set() _registration_l...
d1a227880c95e8c195eac4f5a16e47b875d2ae00cf761894ebf6b8cc19a91072
Python
3,878
160
#!/usr/bin/env python # -*- coding: utf-8 -*- """decorators for functions""" from matplotlib.colors import LinearSegmentedColormap transparent_binary_cmap = LinearSegmentedColormap( name="transparent_binary", segmentdata={ "red": [ (0, 0, 0), (1, 1, 1), ], "gr...
0c855f48fc78f4e6d55f2683311d8c83874b2f6cb233250497888aff56015790
Python
3,882
107
""" Positional Encoding Modules for Spatial Coordinates Various positional encoding schemes for 2D and 3D spatial data, including sinusoidal encodings and learnable Fourier features. """ # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license foun...
c24529204f0c4b83a53f3bbd404f3d5e8a7facb48391d7d104959a3957113c51
Python
3,883
139
"""fixtures relating to annotation files""" import crowsetta import pytest import tomlkit from .config import GENERATED_TEST_CONFIGS_ROOT from .test_data import SOURCE_TEST_DATA_ROOT ANNOT_FILE_YARDEN = SOURCE_TEST_DATA_ROOT.joinpath( "spect_mat_annot_yarden", "llb3", "llb3_annot_subset.mat" ) @pytes...
c4c76f0c99b13e04fcde55393647f9ca90fc5bcbc3bd00f1f292d30fcbfee68f
Python
3,883
132
#!/usr/bin/env python # ENCODE DCC pseudo replicator wrapper # Author: Jin Lee (leepc12@gmail.com) import sys import os import argparse import multiprocessing from encode_common import * def parse_arguments(): parser = argparse.ArgumentParser(prog='ENCODE DCC pseudo replicator.', ...
08931ac67d76145a78a2cb2699e0ecb62ba2e85244f076c730806a4b7927c657
Python
3,884
109
#!/usr/bin/env python # ENCODE annot_enrich (fraction of reads in annotated regions) wrapper # Author: Daniel Kim, Jin Lee (leepc12@gmail.com) import sys import os import argparse from encode_lib_common import ( run_shell_cmd, strip_ext_ta, ls_l, get_num_lines, log) import warnings warnings.filterwarnings("ig...
49e4da6ecdf286b5c1562cc745240360cca9e2c55079715b6c5acd5399f3dd28
Python
3,885
103
from __future__ import annotations from collections import defaultdict from functools import cached_property from html import unescape from typing import TYPE_CHECKING from poetry.core.packages.utils.link import Link from poetry.repositories.link_sources.base import LinkSource from poetry.repositories.link_sources.b...
baf84042fd7be982b351bd523f0a44af21529ccc12673694cf5e19a3fcca1159
Python
3,885
103
#!/usr/bin/env python import unittest import sys import shutil import os import io import re import gzip import numpy if "DEBUG" in sys.argv: sys.path.insert(0, "..") sys.path.insert(0, "../../") sys.path.insert(0, ".") sys.argv.remove("DEBUG") import metax.Formats as Formats from M00_prerequisites i...
32e21b912b9684a28bdc343886252ea20b76185eede138b987ee5d082322e0db
Python
3,886
126
"""Utility functions for brenda_references""" import string from collections.abc import Iterable import nltk import pandas as pd from aiotinydb.middleware import AIOMiddlewareMixin from rapidfuzz import fuzz from tinydb.middlewares import CachingMiddleware as SyncCachingMiddleware class CachingMiddleware(SyncCachin...
f5f568fe5957e48bd56247dea0f9cc942bf8883573a12acd9dc3506fa9156c56
Python
3,886
91
#!/usr/bin/env python import polars as pl from src.utils import gtf_to_SJ, read_gtf import argparse def get_CSSs(predicted_cds_gtf, annotation_gtf, out, novel=True, feature="exon"): """ Get novel canonical splice sites present in the predicted GTF but not the GENCODE GTF. A splice site is considered novel ...
4790cd1e397d0d10efd95925316c702fd30e24a91ac33032e90751d3ea69add4
Python
3,889
119
from __future__ import annotations import pandas as pd import pytest from src.processing.cluster_detection import ( find_longest_cluster_times, group_clusters_by_time_period, identify_clusters, process_cluster_window, select_peak_clusters, select_stim_clusters, ) def test_identify_clusters_m...
8c4a24c5d67ffe276be48819dcfd34c457532f6596ec50ddb53e842beac66aad
Python
3,889
111
import glob import os import subprocess import sys import time import matplotlib import numpy as np import pandas as pd import torch from Bio.PDB.Polypeptide import index_to_one, one_to_index from torch.utils.data import DataLoader, Dataset from rasp_model import ( CavityModel, DownstreamModel, Residue...
9c09873fb7023cd1e6f02a4ed23137a3e4cd495e3edcda6ddefefd82d2ae1e6b
Python
3,890
71
#!/usr/bin/env python3 """TOC graphic -- exigencia 4 do escritorio da ACS (e-mail de 11/09/2026). Quadro do achemso = 3.25 x 1.75 in. Gerado em 3.05 x 1.62 in SEM bbox_inches='tight' (o tight distorce o aspecto; armadilha registrada no JPCL), incluido com width=3.05in e centralizado com \\vspace*{\\fill} dentro do toc...
24e424c7f9123e6ff3239297def62a67441518702ec01e7d902d1a3e01234302
Python
3,891
107
""" This module inference sequences embeddings. Author: wangning(wangning.roci@gmail.com) Date : 2022/12/7 7:41 PM """ from Bio import SeqIO import paddle from paddlenlp.utils.log import logger from paddlenlp.data import Stack from paddlenlp.transformers import ErnieModel from dataset_utils import seq2input_ids fr...
54dba78707e510b73a1488fdfcc4f69f3a3806d31f9ef35a6d4ffcb8ba470180
Python
3,894
73
from dynamic_network_architectures.architectures.unet import ResidualEncoderUNet, PlainConvUNet from dynamic_network_architectures.building_blocks.helper import convert_dim_to_conv_op, get_matching_batchnorm from dynamic_network_architectures.initialization.weight_init import init_last_bn_before_add_to_0, InitWeights_H...
a166464360c119202c78edaccfe3b4e23f912553863ef865f9ccc91fa909a70c
Python
3,894
88
#!/usr/bin/env python3 from collections.abc import Callable from typing import Any from bpreveal.internal import interpretUtils from bpreveal import logUtils from bpreveal import utils from bpreveal.internal import interpreter from bpreveal.internal.constants import ONEHOT_AR_T import numpy as np def minmaxMetric(hea...
b2615655b9e938d60c1fbfbeb11f63790dc9062803a3857220407ffd6ea50dd7
Python
3,895
70
import os opdir='/Volumes/My_Passport/150423_journal_44/' #noiselist = ['0.00' ,'0.02' ,'0.04' ,'0.06' ,'0.08' ,'0.10' ,'0.12' ,'0.14' ,'0.16' ,'0.18' ,'0.20' ,'0.22' ,'0.24' ,'0.26' ,'0.28' ,'0.30'] #noiselist = ['0.26' ,'0.28' ,'0.30'] #noiselist = ['0.00' ,'0.02' ,'0.04' ,'0.06' ,'0.08' ,'0.10','0.12' ,'0.14'] nois...
953cfb4d33adec309f8c71c5c6290978f95d78d205c3ecebc5528dd9d21b4df5
Python
3,896
115
import os import mne print('Starting now with preprocessing') base_dir = './derivatives/' directory_path = "./data/" # Initialize a set to store unique participant identifiers unique_participants = set() # Iterate over the files in the directory for filename in os.listdir(directory_path): # Check...
1d96d334412e704c8ebcb18f4db7a22e763952d99b39736f5dbe5ea5ea817ddf
Python
3,897
122
from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING from typing import ClassVar from cleo.helpers import option from poetry.console.commands.command import Command if TYPE_CHECKING: from cleo.io.inputs.option import Option class PublishCommand(Command): name = "pu...
524fb9816a7d5dc944da3e2708d2088affbe55c2f4718517f1239af51fe512b1
Python
3,898
97
import ast import sys import tempfile import unittest from pathlib import Path import numpy as np import trimesh MODULE_DIR = Path(__file__).resolve().parents[1] if str(MODULE_DIR) not in sys.path: sys.path.insert(0, str(MODULE_DIR)) from stl_mesh_pipeline import ( # noqa: E402 build_stl_meshes, export...
fcd7e3d67edb1e9ec3f9d90d66b8f788300892ea3f035a90f8c0f22e86729fa0
Python
3,900
105
#!/usr/bin/env python3 """Make a PISA plot or graph (depending on the input json). BNF --- .. highlight:: none .. literalinclude:: ../../doc/bnf/makePisaFigure.bnf Parameter notes --------------- ``graph-configs``, ``plot-configs`` A list of configurations appropriate for the functions in :py:mod:`plotting...
21c42416a770727c6c9b0154c0945a040de18e2304d7101cc31f56f90c591ef8
Python
3,905
121
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import torch.nn as nn from fairseq.model_parallel.modules import ( ModelParallelTransformerDecoderLayer, ModelParalle...
b97a94bf1fd7db25b828a50d61efce5312a1d6ab083bf6c55f9cc01ffd6ff452
Python
3,905
148
import argparse import random import numpy as np def cut_no_overlap(length, kmer=1, max_prob=0.5): cuts = [] while length: if length <= 509+kmer: cuts.append(length) break else: if random.random() > max_prob: cut = max(int(random.random(...
8ed05b3145f817f882c1287249b8a7652141fe4498d5d034496b2cda9a776630
Python
3,906
98
"""Implementation of a bucketed data sampler from PyTorch-NLP. Modified by Roshan Rao. See https://github.com/PetrochukM/PyTorch-NLP/ """ import typing import math import operator from torch.utils.data.sampler import Sampler from torch.utils.data.sampler import BatchSampler from torch.utils.data.sampler import SubsetR...
50d8aea510d76ceb74c6c14f32dfe5de5f485b853d2966c70a09fb3231246e32
Python
3,907
73
import os opdir='/Volumes/My_Passport/140423_journal_4/' #noiselist = ['0.00' ,'0.02' ,'0.04' ,'0.06' ,'0.08' ,'0.10' ,'0.12' ,'0.14' ,'0.16' ,'0.18' ,'0.20' ,'0.22' ,'0.24' ,'0.26' ,'0.28' ,'0.30'] #noiselist = ['0.26' ,'0.28' ,'0.30'] #noiselist = ['0.00' ,'0.02' ,'0.04' ,'0.06' ,'0.08' ,'0.10','0.12' ,'0.14'] noise...
c8184fd623a6bb89e08fa3a2905cf53ba36015526628b81a8c81421f670f9f3e
Python
3,907
106
#!/usr/bin/env python3 import os import sys import pickle import argparse import numpy as np import pandas as pd from tqdm import tqdm from sklearn.metrics import roc_auc_score, f1_score, average_precision_score import torch import torch.nn.functional as F from torch.utils.data import DataLoader sys.path.append("../sc...
6a94e8b62393af986fcc408e159aca88d2b0720a221ccc7c8b24d67031c43213
Python
3,909
121
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging import os import subprocess from pathlib import Path from typing import Any, List, Sequence from hydra.core.singleton import Singleton from hydra.core.utils import JobReturn, filter_overrides from omegaconf import OmegaConf log = lo...
078acc29cb26ef58d178a5d0111bb67fff210bc280f8c48c0ea43674881d2b53
Python
3,912
113
""" Simple check list from AllenNLP repo: https://github.com/allenai/allennlp/blob/master/setup.py To create the package for pypi. 1. Change the version in __init__.py, setup.py as well as docs/source/conf.py. 2. Commit these changes with the message: "Release: VERSION" 3. Add a tag in git to mark the release: "git...
30d6ae143e81b6e0b411786c5d718db1e81896c93463baad6c030065df5e7dc5
Python
3,912
106
import numpy as np import pandas as pd import pytest from pgmpy.ci_tests import ChiSquare @pytest.fixture def test_chi_square(): df_adult = pd.read_csv("pgmpy/tests/test_estimators/testdata/adult.csv") test = ChiSquare(data=df_adult) return test def test_chisquare_adult_dataset(test_chi_square): #...
85d515bb26ae5efc00c5e14fd42d1b5b0181caaaa070567f8db9ee433a7cd82c
Python
3,912
72
import numpy as np import torch import torchvision.transforms as transforms from utils.PerlinBlob import * def circle_grad(img_res_y, img_res_x): center_x, center_y = img_res_x // 2, img_res_y // 2 circle_grad = np.zeros([img_res_y, img_res_x]) for y in range(img_res_y): for x in range(img_res_x):...
e7aed7afa27a33cb35258e06c8d92a93ba5743bb41948d7da520db98938d803b
Python
3,912
93
#!/usr/bin/env python3 """Build and inspect wheel/sdist artifacts from an external checkout copy.""" from __future__ import annotations import argparse import json import shutil import subprocess import tempfile from pathlib import Path def validate(source: Path, python: Path, results_root: Path) -> dict: root ...
ea695120874fdbb658e2b8849e433f8021a3ee775e61db2906b5cdc2ffa9ee48
Python
3,912
100
from typing import Tuple import jax import jax.numpy as jnp import jax_dataclasses as jdc from ...utils import factorial2, zero_embed def get_cartesian_angulars(l): r"""List x, y and z angular momenta for a given total angular momentum.""" return [(lx, ly, l - lx - ly) for lx in range(l, -1, -1) for ly in r...
16ce8644dbdff9d139fbd75a0e514b8e24489e6df437f20f75af312e2a3d807f
Python
3,913
96
import numpy as np import matplotlib.pyplot as plt import matplotlib matplotlib.use("TkAgg") import pandas as pd from cal_KL_div import calculate_kl_divergence min_n = 100 max_n = 0 def get_model_bit_scores(model_name, min_n, max_n): all_seq_score_list = [] f = open("./outputs/" + model_name, 'r')...
e06baf5c14a2984cee6fa6076cd71e92b0755ca0fee5767780afd3b46495bf4f
Python
3,914
124
import os import pickle from typing import Any import pandas as pd import torch from lightning.pytorch.loggers.logger import Logger, rank_zero_experiment from lightning.pytorch.utilities import rank_zero_only class SimpleExperiment: """Simple experiment class.""" def __init__(self): self.data = {} ...
fc5f8654c79d2378da9e47225631bb4fa6861163ceeeca4726f663a08b274374
Python
3,915
114
""" This script is a modified version of the code in the following link to support the current requirements of this repository. source: https://github.com/zbmed-semtec/medline-preprocessing/tree/main/code/Cosine_Similarity author: Vishnu Vardhan Dadi credits: [Rohitha Ravinder, Leyla Jael Castro, Dietrich Rebholz-Schu...
49142594578a543ccef349d44d320dca4ca8a4a051c39019e6bb31fccd3c5144
Python
3,916
96
"""Fixture-based GB energy parse golden (kcal/mol component means). This is not a full AmberTools end-to-end regression. It locks the mdout → EnergyVector → BindingStatistics path so GB totals cannot drift silently. See scripts/validation/README.md for adding Amber binaries goldens. """ import tempfile import unittes...
a1cbdaf11a9e885bb2515bfc46921bc940c8796dd0318e0fde2da89bde1da77e
Python
3,918
94
def validate_split_durations(train_dur, val_dur, test_dur, dataset_dur): """helper function to validate durations specified for splits, so other functions can do the actual splitting. First the functions checks for invalid conditions: + If train_dur, val_dur, and test_dur are all None, a ValueError...
c3629ec79c428bb458498d0386c564acd6c6c606bbc8645e40824b4fed569e3d
Python
3,919
89
# scSGL - a python package for fene regulatory network inference using graph signal processing based # signed graph learning # Copyright (C) 2021 Abdullah Karaaslanli <evdilak@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as pu...
a0ceb34319994f9fdb57f85907adfdddbe3abaf784cf4de58d5b7d5ffd9d035d
Python
3,921
98
import pandas as pd import gc from preprocessor.utils.preprocess_intrinsic import preprocess_intrinsic from preprocessor.utils.preprocess_synaptic import preprocess_synaptic class MembraneCurrentPreprocessor: """ Preprocesses intrinsic and synaptic currents and combines them into membrane currents. """ ...
cdd9ddbab7128a6d48b2fa4da906622665a93dc43d182bbcf48e837e85e5583b
Python
3,923
116
import pandas as pd import logging import gzip import shutil import requests from pathlib import Path from typing import List from src.data.manager import DatasetManager log = logging.getLogger(__name__) class ECODManager(DatasetManager): def __init__(self, filepath_dir: str="data/", version=292): """ ...
8c073b1adeac21b71b572db7cba7f20fc97c8d7308c9698fe1f5934934e195ec
Python
3,924
109
# Copyright 2015 Google Inc. All Rights Reserved. # # 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 a...
2ef62f02c3027e95370f81dd1c0a0b0b4515b51efb05f0d1a68b6eeb367e91ff
Python
3,925
74
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
46bf84258fdb9f094fbc694dd77a43a75c3f7629f0a80c4b97cebd5c961003d4
Python
3,925
108
#!/usr/bin/env python """Neural pattern similarity across participants — single-condition (R4) and triple / across-condition (R5). Per parcel: mean the BOLD over each excerpt's 60 s window -> spatial pattern; correlate each participant's pattern with the leave-one-out group mean (single), or take the sign-consistent a...
928cb60e76c940be697d1760e09eb60260e5e437d3ef1e78b2a9c0fe93b4dbc6
Python
3,925
121
from math import isclose from skbase.utils.dependencies import _safe_import from sklearn.exceptions import ConvergenceWarning from pgmpy import logger from pgmpy.utils._warnings import _warn_external torch = _safe_import("torch") optim = _safe_import("torch.optim") def pinverse(t): """ Computes the pseudo-...
6729d0a1924a2547b6c9af610b087a43c0d45a599c4ac26b23719d8e715eb2f6
Python
3,926
99
from typing import List import numpy as np import pandas as pd from harmony import harmonize from scipy.stats import ks_2samp from sklearn.decomposition import IncrementalPCA import loompy from cytograph.preprocessing import Normalizer import logging class PCA: """ Project a dataset into a reduced feature space u...
62f94c578cff83f0dc81af983665da9d6722f12085181fd833cddb5f40147937
Python
3,927
83
from pathlib import Path import re import unittest ROOT = Path(__file__).resolve().parents[1] class BuildEditionTests(unittest.TestCase): def test_version_is_single_source_for_both_builds(self): source = (ROOT / "SegRef3D.py").read_text(encoding="utf-8") version = re.search(r'^__version__\s*=\s*...
ec8d3ea793ba11500db04d3b84673880400ececc40a48503305bf090e0c3c902
Python
3,927
94
import torch import torch.nn as nn import torch.nn.functional as F # source: https://github.com/kaijieshi7/Dynamic-convolution-Pytorch/blob/master/dynamic_conv.py # zhihu: https://zhuanlan.zhihu.com/p/142381725 # zhihu: https://zhuanlan.zhihu.com/p/208519425 class attention2d(nn.Module): def __init__(self, in_plan...
6db82c1aa1d8cd745f2557dec7eb864bbe6d1c9f70936962af5a0365cbc7bb3f
Python
3,928
108
""" 03_celltype_deconvolution.py NNLS cell-type deconvolution and adjusted enrichment analysis. Estimates cell-type proportions, then recomputes PCDH coordination scores using partial correlations controlling for cell-type fractions. Harbert D. (2026) BMC Genomics """ import sys, os sys.path.insert(0, os.path.dirnam...
fd675534fc54b761c9d6a7735b9f4bac0f33e51a2121206218aa69fb85a2f6c9
Python
3,929
121
#!/usr/bin/env python3 """ Author: Ken Chen Email: chenkenbio@gmail.com Date: 2022-11-24 """ import os import sys import pickle from tqdm import tqdm import argparse import numpy as np import matplotlib.pyplot as plt new_rc_params = {'text.usetex': False, 'svg.fonttype': 'none' } plt.rcParams.update(new_rc_params) im...
2f3a24121915b9223b0d5ac4c8018cc9b3fc5b58877ff37ff88e976024744502
Python
3,932
98
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import torch from mattergen.common.diffusion import corruption as sde_lib from mattergen.common.utils.data_utils import compute_lattice_polar_decomposition from mattergen.diffusion.corruption.corruption import Corruption, maybe_expand from matte...
34f4be7963b44aa9b8a58408e4c40e4fe087e99bb81e5977427cb4e1034c6d6b
Python
3,936
153
# # Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with # Sandia Corporation, the U.S. Government retains certain rights in this software. # # See LICENSE for full license details # import numpy as np from ...backend import ComputeBackend xp = ComputeBackend() STYLES = ( "S...
7e8ead3ccac38b8d1f818b7b6d19e43548c3cb8f196e70104f13792a32d01512
Python
3,936
133
import pytest from apiadapters.ncbi import AsyncNCBIAdapter from apiadapters.straininfo import StrainInfoAdapter from brenda_references import expand_doc from d3types import Bacteria, Document, Organism, Strain from lpsn_interface import get_lpsn, lpsn_id, lpsn_synonyms, name_parts get_lpsn() straininfo = StrainInfoAd...
291243717b999671db6fd2e11e9661a87f18bdd1f0eef061f2e3eed95d4091e4
Python
3,937
113
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import glob import argparse import pprint import omegaconf from omegaconf import OmegaConf from torch.utils.data import DataLoader ...
849b6703ad14112a7df5a167ecf4a7cad25025d33367cc4b372c7f0f74147496
Python
3,937
96
"""Orchestrate ``summary.log`` for dynamic segmentation (aligned with DLBase ``tasks/classification/run.py``).""" from __future__ import annotations import os from datetime import datetime from typing import Any import torch from omegaconf import DictConfig from pytorch_lightning.utilities.rank_zero import...
4c0e8509bcca1055dc16396676900c6d4a019cda71815f87be36e7846dc715d8
Python
3,940
115
""" Model class """ import warnings warnings.filterwarnings("ignore") import math from torch import nn, Tensor from torch.nn import TransformerEncoder, TransformerEncoderLayer import sys sys.path.append('../') from typing import Any import torch def full_block(in_features, out_features, p_drop=0.1): return nn....
548554bdb1f9958cd3d272397d1d2202a66c26ce1a11bd52cda1255dd5733715
Python
3,940
103
"""Pure unit tests for the vocabulary-independent helpers in data/data.py. None of these touch HDF5 or the BRENDA files (see tests/data/test_dataset.py for the fixture-backed dataset tests). """ import numpy import pandas as pd import pytest import torch from d3text.data.data import BrendaDataset, compute_frequencie...
e3c6f136d5e1801c5067f7e02dd8d0f3cf532fb7bcd0223500189c8149785ef3
Python
3,940
104
# encoding: utf-8 """ @author: Jiayang Chen @contact: yjcmydkzgj@gmail.com CATH 20201021 database """ import os import pandas as pd from redevelop.data.datasets.utils import * from redevelop.data.datasets.bio_seq import BIO_SEQ from Bio import SeqIO class Custom(BIO_SEQ): def __init__(self, root, data_type="se...
ef1aafda7c337c1567a442dad1a0a7a142228062042b2d312b776ed36403b54c
Python
3,940
133
import pytest from apiadapters.ncbi import AsyncNCBIAdapter from apiadapters.straininfo import StrainInfoAdapter from brenda_references import expand_doc from d3types import Bacteria, Document, Organism, Strain from lpsn_interface import lpsn_id, lpsn_synonyms, name_parts straininfo = StrainInfoAdapter() caldanaerobac...
044bff7f04bb21570da24e92d5728131dc54c3b15d4ed4c97d036f8b33c2d523
Python
3,941
103
import numpy as np from pgmpy.base import DAG, PDAG from pgmpy.metrics import BaseSupervisedMetric class SHD(BaseSupervisedMetric): r""" Computes the Structural Hamming Distance (SHD) between two graphs. Given two graphs (DAGs or PDAGs) :math:`G_1` and :math:`G_2` over the same vertex set, let :math:`S(...
57fea405991a43a677a3d0bb87219394437a09d3197092fbd291350df9d663eb
Python
3,941
99
#!/usr/bin/env python # -*- coding: utf-8 -*- """The setup script.""" from setuptools import find_packages, setup def get_extra_requires(path, add_all=True): """Parse an optional-dependencies file into a setuptools ``extras_require`` mapping. ``path`` is a *standard* pip requirements file: one requirement ...
9f856c8f38471deb16ea543bd51eadbb54f7a221d76f421d5d55817d0e1fd866
Python
3,941
110
""" Some sanity checking of polarisation/phasing options for different processors """ import numpy as np import sys import os import pytest sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "workflow", "scripts")) import ts_simulators import ts_processors def test_genotypes_and_distances(): one_po...
f39261d6e16eab48ebdd7eb7d1b68a4cfef84e496f2f40cd8bc07c77cfbcca3b
Python
3,941
88
# Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors import json import os import numpy as np from pathlib import Path def write_qm_mm_json(path:str): parameters = {} parameters["qm_zone_resnames"] = ["UNL"] parameters["mm_zone_resnames"] = ["HOH"] with open(path, "w") as ...
a893ae8c3f6e0f6feab6ac3365ba1009580de49f80578b6c65c4ce9a6862f33e
Python
3,943
93
#!/usr/bin/env python3 # Florian Bénitière 16/03/2025 # Script to generate a .parquet file by merging all TSV gVCF files from a directory import os import shutil import sys import pandas as pd import subprocess import psutil # System and process utilities from math import floor # For rounding down numbers from col...
dfa7a07afda12c5aa896b1b0b538b2f79709dca5d8b2a3b9db279723bae69a17
Python
3,943
99
import os import pandas as pd import numpy as np from neuron import h # Dictionary mapping current types to their corresponding NEURON attributes # current_types = { # 'nax': '_ref_ina_nax', # 'nad': '_ref_ina_nad', # 'car': '_ref_ica_car', # 'kdr': '_ref_ik_kdr', # 'kap': '_ref...
7ede8a62a11758835a5a06adf4dd4f73284051716af0746fa23d4a7559bc6b9e
Python
3,944
112
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from scipy.stats import shapiro, ttest_rel, ttest_ind, wilcoxon, mannwhitneyu # Set font to Times New Roman plt.rcParams["font.family"] = "Times New Roman" # Load the Excel file file_path = "path_to/Database_comparison.xlsx" df = pd.r...
ee7b25dcf7d61d5f8b07e2371549ec19f080115137a285f6e220b7af4a19a29e
Python
3,945
127
"""Build Wave-1.5 feature matrix for perovskite candidate pool (n=1784). Mirrors data/mofs_qmof/build_wave15.py: adaptive CT2F + Madelung-CT2F + CT3F on each perovskite supercell, with charges taken from `formal_charges` (ionic Cs+/K+, Pb+2/Sn+2/Ge+2, I-/Br-/Cl-/F-). """ from __future__ import annotations import json...
fedae29612be4d8436ff449b5aab8fe38836f6cbc1e6360f0d4d5d0925135c1b
Python
3,946
124
import typing import os import logging from abc import ABC, abstractmethod from pathlib import Path import torch.nn as nn from tensorboardX import SummaryWriter try: import wandb WANDB_FOUND = True except ImportError: WANDB_FOUND = False logger = logging.getLogger(__name__) class TAPEVisualizer(ABC): ...
48ee7cd04bba1593f6158b677c588f1064d87e2c5f6fdd83f0bad1306d50616d
Python
3,949
137
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import ast import argparse import json import logging from pathlib import Path import soundfile as sf import torch from tqdm import tqdm fro...
944bae494e9abc9d76f9dc79628fab86a525abcb0ae55773088ecf8a21f1664d
Python
3,950
107
"""What an evaluation logs when sklearn cannot score the class head. A diverged head scores NaN, which `average_precision_score` refuses outright. `evaluate_model` hands its dict to tracking in a single call at the end, so a raise there cost the whole pass — every count already measured included — rather than one numb...
c20013d5cbad134f3df88b82fc905eb939f38f9d6500af8ce7a9004abffd7f56
Python
3,950
114
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import numpy as np import torch import CBIG_pMFM_basic_functions as fc import warnings def CBIG_mfm_test_desikan_main(gpu_index=0): ''' This function is to im...
8895b62e97190adcd9feeb46cbc20eb7079d9377db4da2209eceb875ed0bf23d
Python
3,952
76
#!/usr/bin/env python3 # MIT License # # Copyright 2024 Broad Institute # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to u...
adbeba6fe3f9fbef2baf096cc0582a3528bbbd8c26d72124865735d7cb8c1da9
Python
3,952
114
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import numpy as np import torch import scipy.io as sio import CBIG_pMFM_basic_functions as fc import warnings def CBIG_pMFM_generate_simualted_fc_fcd(gpu_index=0): ...
fbc8b385b227f70fa2a74d3952ab88336bd6d9af5a7cc72981f4ce3068c36522
Python
3,953
107
import torch import numpy as np from typing import List, Callable from pytorch_grad_cam.base_cam import BaseCAM from pytorch_grad_cam.metrics.road import ROADCombined def batch_pearson_coherency(A: np.ndarray, B: np.ndarray) -> np.ndarray: """ Computes Pearson correlation for a batch of matrices. """ ...
87d8a1325d39ec288155179847691567b68b49c0e15c873c8f6537f9cc939658
Python
3,954
77
#04 3 "old DET" import sys sys.path.append("..") from modelR.backbones.mobilenetv3 import MobileNetV3 from modelR.backbones.mobilenetv2 import MobilenetV2 # from modelR.necks.conv_csa_drf_fpn_hbb import Conv_CSA_DRF_FPN,FC2_CSA_DRF_FPN,Cat_Conv_CSA_DRF_FPN,M_CSA_DRF_FPN from modelR.necks.Three_Head import FC2_CS...
ba23e883d5b04bab18bad3599c67e4d501ea6555d4e7f0ff5f27069fa2238583
Python
3,954
149
import numpy as np def affine_transform( coords: np.ndarray, matrix: np.ndarray, inverse: bool = False ) -> np.ndarray: """Perform an affine transform of coordinates. Args: coords: array of points with shape (3, ...) matrix: the transformation matrix inverse: do an inverse transfo...
5440264a60dcffe8dea07dd3e2dde399888ca7a2b154832f52071962eb3e7e30
Python
3,955
98
#!/usr/bin/env python3 """SUPERSEDED by build_rna_sex_persample.py, which is what produced the reported numbers. This earlier implementation uses a 1.0-SD gap threshold and a single inference route; the shipped analysis uses 0.85 SD and three per-series routes. Retained for provenance only. Its output paths pointed at ...
812bccb8e66fee814967a54f18622ab8be5ee98d17075fb49be0fc0fcef098fa
Python
3,955
100
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from typing import Callable import torch from mattergen.diffusion.sampling.pc_sampler import Diffusable, PredictorCorrector from mattergen.common.data.collate import collate BatchTransform = Callable[[Diffusable], Diffusable] def identity(x:...
a8bc7653c76def4293726858a7cd223bec91a550356b275f4b6bbaf6d6a7eeb7
Python
3,955
122
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import numpy as np from fairseq.data import FairseqDataset from . import data_utils from .collaters import Seq2SeqCollater class...
b9ab4747c983c2d373dccc02f551b498877d70c8a215d0736e9fc23b6bcfda32
Python
3,955
113
#!/usr/bin/env python3 ######################################### # Author: [DonFreed](https://github.com/DonFreed) # File: license_message.py # Source: https://github.com/DonFreed/docker-actions-test/blob/main/.github/scripts/license_message.py # Source+commit: https://github.com/DonFreed/docker-actions-test/blob/aa10...
0168ab050cab05a9db7bb41ce7c171f04317234769bd15a932ef1b11695f596c
Python
3,956
99
import os import numpy as np import matplotlib.pyplot as plt def scatterPlot(X_f,figHeight,figWidth,filename): Yaxis = np.zeros((X_f.shape[0],1),dtype = np.float64) plt.figure(figsize=(figWidth,figHeight)) plt.scatter(X_f[:,0:1], Yaxis[:,0:1], marker='o', color='black', s= 0.15) plt.tight_layout() ...
4da03dfe6063e574ed1a67d7e3ecc7866f263355b54dd9e6894866f246069cd2
Python
3,956
119
import argparse import torch import torch.nn.functional as F import numpy as np import cv2 def gaussian_blur(x, k=31, sigma=7): """Simplified separable Gaussian kernel.""" coords = torch.arange(k, device=x.device, dtype=x.dtype) - (k // 2) g1 = torch.exp(-(coords ** 2) / (2 * sigma ** 2)) g1 /= g1.sum...