sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
ed75cd13bed4ff38d68b383f5ba0b279bc1c9271d702a7750a63d4f3b30b18b4
Python
3,381
97
# 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 numpy as np import torch from typing import Dict from fairseq.data.monolingual_dataset import MonolingualDataset from . import Fairse...
02df8f93be911ac2a948a7890e026af8089801f63f153a93f125b4554a2d5a8c
Python
3,385
70
import torch from torch._dynamo import OptimizedModule from torch.nn.parallel import DistributedDataParallel as DDP import torch.distributed as dist def load_pretrained_weights(network, fname, verbose=False): """ Transfers all weights between matching keys in state_dicts. matching is done by name and we only ...
1c625c6e9ef2993d5c6bfa73ef7317efc8fd2b60d5f6bb4d06318003bb74d76a
Python
3,386
103
#!/usr/bin/env python # ENCODE DCC spp call peak wrapper # Author: Jin Lee (leepc12@gmail.com) import sys import os import argparse from encode_lib_common import ( assert_file_not_empty, human_readable_number, log, ls_l, mkdir_p, rm_f, run_shell_cmd, strip_ext_ta) def parse_arguments(): parser = argpars...
62b03ea317bfe63f33812a3cfed44f9cc3271a233022e6549055437fa8f9caa9
Python
3,387
104
# Copyright 2021 DeepMind Technologies Limited # # 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 agr...
e7f721b1b607fb37f2511bf7e233c9b6df6329d23e05a7b1f1861410bea22967
Python
3,387
107
# 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 subprocess import threading from pathlib import Path import numpy as np import torch def fasta_file_path(prefix_path): ...
36059dd05453ca9f5e3a61a0bb828609c73ae7f90a5c746d5348d8e8a3e0e3df
Python
3,388
64
# ############################################################################## # GPLv3 LICENSE INFO # # # # Copyright (C) 2020 Mario S. Valdés-Tresanco and Mario E. Valdés-Tresanco ...
babc5234099e47334172c3ff3664acb7426e7b2d88b25306a91b36ea1317fa9e
Python
3,388
115
import pytest import torch from gpn.scoring import ( log_likelihood_ratio, nucleotide_probabilities, require_reference_matches, validate_centered_window_size, validate_snv_batch, ) def test_nucleotide_probabilities_normalize_final_axis(): logits = torch.tensor( [ [0.0, 0.0...
6322745bc100c60c0cb8e9b8a2c096027d7fe5a6a1a0ed7105a07c211d4481a9
Python
3,391
62
import numpy as np import torch from torch import distributed as dist from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer class nnUNetTrainer_probabilisticOversampling(nnUNetTrainer): """ sampling of foreground happens randomly and not for the last 33% of samples in a batch since most...
bcdf0fe0032b149adaaa22e418817d114b4b3ff08089eee8a6497bd0b8fdd278
Python
3,391
71
import numpy as np import pandas as pd import copy from Net import omics_net from SparseCoding import dropout_mask, fixed_s_mask, sparse_func from Survival_CostFunc_CIndex import R_set, neg_par_log_likelihood, c_index import torch import torch.nn as nn import torch.optim as optim def eval_omics_net(x_tr, a...
8721b4b2cfa6b8c88b1bf38ed8755e044fc84a1b4a1333305c080b4aa4bd7455
Python
3,394
93
"""Schema validation tests against the toy dataset. These tests exercise the canonical CSV layout HIPPIE consumes: waveforms.csv (N x T) -- trough-centered spike templates isi_dist.csv (N x ~100) -- 1 ms bins, 0..100 ms acg.csv (N x ~201) -- 1 ms bins, -100..+100 ms (optional) labels.csv (N ...
8e4caf109626e57507e717646dff2d26330d0b2ff62f172776a552e8a9d7e3db
Python
3,395
100
# coding=utf-8 # Copyright 2020 The Fairseq Authors and The HuggingFace Inc. team. # # 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 # # Unles...
9f15b2c0b0da35a5d16213f8bdea234ad3a01553867df6714f9742ed80f54bb8
Python
3,395
77
#!/usr/bin/env python3 """Exercise expected CLI failures and diagnostic-bundle policy.""" from __future__ import annotations import argparse import json import subprocess from pathlib import Path try: from .common import DEFAULT_EXAMPLES, DEFAULT_RESULTS_ROOT, copy_examples, entrypoint_command, environment_for, ...
3b089086fa258d8db08a56580bb702c95269dd10eb72018b32379e8b87fb2ae5
Python
3,396
101
# coding=utf-8 # Copyright 2020 The Fairseq Authors and The HuggingFace Inc. team. # # 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 # # Unles...
e8ccd4a7a4eb4d41ca79bfc2f3c059404c67565a3b180f1ffab23b26b76036b7
Python
3,396
75
#!/usr/bin/env python # PYTHON_ARGCOMPLETE_OK """Estimate the noise standard deviation of the Gaussian noise in the original complex image domain. The result is a single floating point number with the noise std. for every voxel. It uses the estimation routines from the components folders for the estimation. The estima...
0c3aee4114d11f6752166783f0e006e24e71fc808b28aa36b5d6d94ee7c2bb1a
Python
3,399
63
import unittest from pathlib import Path from tangle_tracer.annot_conversion.WSIAnnotation import WSIAnnotation, load_annot from tangle_tracer.annot_conversion.ROIAnnotation import ROIAnnotation # from tangle_tracer.annot_conversion import point_to_mask as p2m import zarr class WSIAnnotationTestCase(unittest.TestCase...
b44f25a08aa510b98d521462fa30da016eac89ff2cd5ada9f4c6cde36c3291be
Python
3,400
70
import numpy as np import pandas as pd import copy from Net import omics_net from SparseCoding import dropout_mask, fixed_s_mask, sparse_func from Survival_CostFunc_CIndex import R_set, neg_par_log_likelihood, c_index import torch import torch.nn as nn import torch.optim as optim def train_omics_net(x_tr, ...
122ca57b85b28ab714e2f3d86b0fde3ca01879f728ad53f8f4f445b9279149e9
Python
3,401
95
''' Functions for computing correcting fluorescence signals for changes in baseline activity. Authors: - Scott C Lowe ''' import numpy as np import scipy.signal def findBaselineF0(rawF, fs, axis=0, keepdims=False): """Find the baseline for a fluorescence imaging trace line. The baseline, F0, is the 5th...
a5247ee10131823ff9ad9e679a5c96fb14e60ed091aa770b391cdc47cc20d599
Python
3,402
124
#### ::: DNABERT-viz SNP analysis ::: #### import os import sys sys.path.append('../motif') import pandas as pd import numpy as np import argparse #import motif_utils as utils def kmer2seq(kmers): """ Convert kmers to original sequence Arguments: kmers -- str, kmers separated by space. R...
23a6b56efad4b9c32c4a13eb1d042c3b8664ec16ba32a6c696329f64888c1d2d
Python
3,403
97
# 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 math from dataclasses import dataclass, field import torch import torch.nn.functional as F from fairseq import utils from fairseq.log...
d2e1ab166beaced8fcd8e5c40ab99c216067fa158cfbabd524573f6fdcdbed28
Python
3,404
107
#!/usr/bin/env python # ENCODE DCC FRiP wrapper # Author: Jin Lee (leepc12@gmail.com) import sys import os import argparse from encode_common import * def parse_arguments(): parser = argparse.ArgumentParser(prog='ENCODE DCC FRiP.', description='') parser.add_argument('...
e6e8e9119ff4cd70d3a30552c739016843613b37502ecd815edc869efd492a62
Python
3,404
115
import re from ..datasets import EXTRA, FILENAMES class JsCode: def __init__(self, js_code: str): self.js_code = "--x_x--0_0--" + js_code + "--x_x--0_0--" def replace(self, pattern: str, repl: str): self.js_code = re.sub(pattern, repl, self.js_code) return self class OrderedSet: ...
0fb272a074559849f5cb5f548bdec3366738b036972d54cdc27e39087c8b964c
Python
3,405
111
#!/usr/bin/env python import argparse import pathlib import h5py import hdf5plugin import numpy as np import transformers from d3text import corpus, utils from jaxtyping import Float from torch import Tensor from tqdm import tqdm def read_args() -> argparse.Namespace: parser = argparse.ArgumentParser( p...
8f7fad27f9e2018f530f8493589c088ec81aed3b27b6cf123f8936672a4c6e0e
Python
3,405
78
#!/usr/bin/env python # PYTHON_ARGCOMPLETE_OK """Create a single slice mask that only includes the voxels in the selected slice.""" import argparse import os import mdt from argcomplete.completers import FilesCompleter import textwrap from mdt.lib.nifti import load_nifti import mdt.utils from mdt.lib.shell_utils import...
15fcd76d9beda9530dacf0bcb21b7c4894cbb5f1e8aa0b716b6652b5032c9b66
Python
3,408
78
"""Common checks in test data.""" __copyright__ = "Copyright (C) 2010-2019, DV Klopfenstein, H Tang, All rights reserved." __author__ = "DV Klopfenstein" from goatools.gosubdag.gosubdag import GoSubDag from goatools.gosubdag.plot.gosubdag_plot import GoSubDagPlot class CheckGOs: """Check that the dicts of GO ID...
50a34beb8b6cea5f1a54a325c281a9185d6734ca21985ac0b8c606e012fd928b
Python
3,408
101
from __future__ import annotations from typing import TYPE_CHECKING from typing import ClassVar from cleo.helpers import argument from poetry.console.commands.env_command import EnvCommand from poetry.utils._compat import WINDOWS if TYPE_CHECKING: from cleo.io.inputs.argument import Argument from poetry.co...
8c2b58b3562ab0e7ea384e35668987bae342279940a755c6cc6846a9410ccaa2
Python
3,408
104
#!/usr/bin/env python # ENCODE DCC fastq merger wrapper # Author: Jin Lee (leepc12@gmail.com) import sys import os import argparse from encode_lib_common import ( copy_f_to_f, log, ls_l, mkdir_p, read_tsv, run_shell_cmd, strip_ext_fastq) def parse_arguments(debug=False): parser = argparse.ArgumentParser...
a070878a313788cb129e8f60bd1668b72ad4aef6c6bf6e9ef73a1e9e1a987f23
Python
3,408
106
# 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 pickle import os import argparse import numpy as np from torch.utils.data import Dataset, DataLoader from mmpt.processors import PKLJS...
d2d7a5fe264ea63f8582cdace95b497ceff3e94b3a6586576205d9875bcc0d83
Python
3,409
93
# /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 def CBIG_mfm_validation_desikan_main(gpu_index=0, subject=1): ''' This function is to va...
e1cfcf5a4298e2e57daf57496f27445e7bf009d2b7da836d89fb2c61a06e1dce
Python
3,409
73
# Copyright 2021 HIP Applied Computer Vision Lab, 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...
4c3c28dbd99c05ac1c7a6b954c1ca09edf927f482ded076111a0d6c84e896852
Python
3,410
89
# 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 urllib.parse import json import pandas as pd from tqdm import tqdm # TODO: extending to other datasets. supported_formats =...
75d49273b3b984d9cd4cc3ab0f9ce29bab30ae8a3ae891bfade2f62fc33142bf
Python
3,410
96
import gzip import logging import io import numpy from .Genotype import GF from .. import Utilities from . import Helpers def parse_gtex_variant(variant): comps = variant.split("_") return comps[0:4] def gtex_geno_header(gtex_file): with io.TextIOWrapper(gzip.open(gtex_file, "r"), newline="") as file:...
cd459ccb9efa9414020d3582062b08383d63b8b37bf80dd1d3c9898abcc7f979
Python
3,412
130
"""fixture used to test DAS model""" from __future__ import annotations import numpy as np import pytest import torch from .test_data import NETS_TEST_DATA_ROOT DAS_TEST_DATA_ROOT = NETS_TEST_DATA_ROOT / "das" DAS_BATCH_DATA_ROOT = DAS_TEST_DATA_ROOT / "batches" AMP_TO_DB_IN_BATCHES = [ batch for batch in...
2087d5e3786ded8eeffc7020a4cffcf46e5c0b16080002c6c1c52c3b2b8fc6c4
Python
3,413
89
import torch from tqdm import tqdm from transformers import EsmConfig, EsmForMaskedLM, EsmTokenizer from torch.nn.functional import normalize class StructureEncoder(torch.nn.Module): def __init__(self, config_path: str, out_dim: int, gradient_checkpointing: bool = False): """ Args: co...
d261d5584e7da33d7fc65f4d4d3aa6d8a68103904bbfbc8cd99b22f1b5005de8
Python
3,413
98
import numpy as np from mdt import CompartmentTemplate, FreeParameterTemplate from mdt.lib.post_processing import DTIMeasures from mdt.model_building.parameter_functions.transformations import ScaleTransform __author__ = 'Robbert Harms' __date__ = "2015-06-21" __maintainer__ = "Robbert Harms" __email__ = "robbert@xkls...
a9241dcb6a81b25ec7a47b1ce78dbaac70374f83e64496129c2880a0bb237695
Python
3,414
83
from model.builders.prostate_models import build_pnet2_account_for task = 'classification_binary' # selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes_and_memebr_of_reactome.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', ...
0585f64dfdfe445b48229f233df60bf57e88366fcaf1d4ef8bf400688c7568fb
Python
3,416
105
import pandas as pd from sklearn.gaussian_process import GaussianProcessClassifier def _gaussian_process_classifier( lfc_g1_g2: pd.Series, lfc_n1_g2: pd.Series, fdr_g1_n1: pd.Series, lenght_scale_init: float = 10, lenght_scale_bounds: tuple = (1e1, 1e2), alpha_init: float = 0.1, alpha_boun...
554340359d85c0959215e0e7cd166b60a00114dcbba6016ea6563945274b8fa7
Python
3,416
88
import torch import torch.nn as nn import torchvision.models as models from . import DA_network class Deeplabv3plusMobilenetFeatureExtractor(nn.Module): def __init__(self, layers_to_extract): super(Deeplabv3plusMobilenetFeatureExtractor, self).__init__() self.deeplabv3plus_mobilenet = DA_network.mo...
fa3b9f6cc6bae3baa48851b32dc2074a7632fc2c7758faa9fa1af2bfdfea48e4
Python
3,416
100
import random import numpy as np import pandas as pd import nibabel as nb from scipy.stats import ttest_ind import statsmodels.stats.multitest as multi from matplotlib_surface_plotting import plot_surf from meld_classifier.meld_cohort import MeldCohort, MeldSubject # Load demographics df = pd.read_csv('/home/meldstude...
67180d30e70122827d7fd0d8d5571cf5a65b4ad9aafade87e35d083eb8297c3c
Python
3,418
114
from __future__ import annotations import fnmatch import pathlib import re def find_fname(fname: str, ext: str) -> str | None: """given a file extension, finds a filename with that extension within another filename. Useful to find e.g. names of audio files in names of spectrogram files. Parameters ...
b9043f8316b777a4c08a02c0a53da612e91f76cc0714cc01c427de1ac73d4a4e
Python
3,419
87
"""Deprecated compatibility shims for :class:`pgmpy.causal_discovery.ChowLiu` / :class:`pgmpy.causal_discovery.TAN`.""" from pgmpy.causal_discovery import TAN as _TAN from pgmpy.causal_discovery import ChowLiu as _ChowLiu from pgmpy.estimators import StructureEstimator from pgmpy.utils._warnings import _warn_external ...
bb60316d016fc943bd79b3fae65d65e42000fc534cb6b04ff0f6383116a06554
Python
3,421
83
from model.builders.prostate_models import build_pnet2_account_for task = 'classification_binary' # selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes_and_memebr_of_reactome.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', ...
31514b5bbe7baf765dbcbae530e785af84854a82f53f6a32b685775b561c15d2
Python
3,424
83
from model.builders.prostate_models import build_pnet2_account_for task = 'classification_binary' # selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes_and_memebr_of_reactome.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', ...
ee8ba260b31eb9493fcc2934f161fbd85cd24ebb90f1e3a64df8d4e2dc742636
Python
3,425
93
"""Checkpoint loading for HIPPIE models.""" from __future__ import annotations import torch def infer_model_dims(state_dict: dict) -> tuple[int, int]: """Infer num_sources and num_classes from a checkpoint state dict.""" src_key = next(k for k in state_dict if "source_embed" in k and "weight" in k) num_...
4aa191f99b32518f4f51ad478c4f6c5393ef9e8193e26c28241347964950d384
Python
3,427
139
""" 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 numpy as np import torch from torch import nn from .base_layers import Dense from crystalgrw.gnn.embeddings import MAX_ATOMIC_NUM ...
dea8f8f302a19c59577621237caebb8fa05f4172ba42ff26b4dd688b025b999a
Python
3,427
105
"""Unit tests for delaf.py.""" from __future__ import division import unittest import numpy as np from .base_test import BaseTestCase from .. import deltaf class TestFindBaseline(BaseTestCase): """Test baseline functions.""" @unittest.expectedFailure def test_trivial(self): """Test trivial inp...
567d2b6b03fc91fe411b6985539c3295f8eb3aca22c37974058662c1cbd0922b
Python
3,428
83
from model.builders.prostate_models import build_pnet2_account_for task = 'classification_binary' # selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes_and_memebr_of_reactome.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', ...
dcae261dbd98023b7b7a4a78b4d27056f59c2f6339acf3aa7215f60220a362aa
Python
3,429
100
# 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 def calc_mean_invstddev(feature): if len(feature.size()) != 2: raise ValueError("We expect the input feature to be ...
dfcbceab2206244779bd80b53501be0713a2979e45682d78617791c3bcf82d8e
Python
3,429
102
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import argparse import json import os import re class InputExample: def __init__(self, paragrap...
7df77db5f7b31b1aeffd4ca39c09c6fb54efd0b8ce5df3129617bf5ac7317778
Python
3,430
87
import multiprocessing import shutil from multiprocessing import Pool from batchgenerators.utilities.file_and_folder_operations import * from nnunetv2.dataset_conversion.generate_dataset_json import generate_dataset_json from nnunetv2.paths import nnUNet_raw from skimage import io from acvl_utils.morphology.morpholog...
a369cdbe6cdcb95c35064b85c446c1cd5ddc7e6891b096548d2cb5525fc35d07
Python
3,430
87
import multiprocessing import shutil from multiprocessing import Pool from batchgenerators.utilities.file_and_folder_operations import * from nnunetv2.dataset_conversion.generate_dataset_json import generate_dataset_json from nnunetv2.paths import nnUNet_raw from skimage import io from acvl_utils.morphology.morpholog...
7b14699b73cac8b212a8a8dddd1ce14ae117283fc66ed6b9bb723639135937a2
Python
3,432
119
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function, unicode_literals import argparse i...
b39babe3ea833f8df35010fae8361f2405c4f0b3582e190a8a22970b4bf6ac88
Python
3,436
94
from __future__ import annotations from typing import TYPE_CHECKING from poetry.core.packages.package import Package from poetry.installation.chooser import Chooser if TYPE_CHECKING: from poetry.repositories.repository_pool import RepositoryPool from poetry.utils.env import MockEnv def test_chooser_no_li...
239f869c1db274cbd2233ba2c3c49967d5a908c734e681b7035db7e3901fbac0
Python
3,439
96
from collections.abc import Mapping from typing import NamedTuple, TypedDict from jaxtyping import Float, Integer from torch import Tensor type BatchedLogits = Float[Tensor, "sequence logits"] class BatchItem(TypedDict, total=False): """One document's inputs as consumed by the model methods. Every field is...
c0fcfbb8dc74721e8fc972762cb347493923f8adc53147f49564020c8758df0e
Python
3,439
106
#!/usr/bin/env python3 """ Basic usage example for RAG-GNN. This example demonstrates how to: 1. Create a simple network 2. Generate RAG-GNN embeddings 3. Evaluate embedding quality """ import numpy as np import networkx as nx from rag_gnn import RAGGNN, GNNEncoder from rag_gnn.utils import compute_silhouette, evalua...
0e08b73d5d6b244b408bd4143e36351af746f569b458e25443d5ae8b5bcbe23b
Python
3,441
96
# 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 unittest from tempfile import TemporaryDirectory from fairseq import options from fairseq.binarizer import FileBinarizer, Vo...
8898b45dd75ba3d7f2254aef92c9de4fc99c692f73a1fad00b5326723ecff36a
Python
3,441
103
import logging import os from anndata import AnnData, read_h5ad from scvi.data._download import _pooch_retrieve_with_retries from scvi.utils import dependencies logger = logging.getLogger(__name__) @dependencies("pooch") def _load_retina(save_path: str = "data/") -> AnnData: """Loads retina dataset. The d...
7591cfc7fb26d3d9a8947f463e39ff0ff687800803c4150e3e6e009167784c8f
Python
3,442
131
import math import torch import torch.nn as nn from torch.nn import init class Input(nn.Module): def __init__(self): super(Input, self).__init__() def forward(self, x): return x class ConvHole2D(nn.Conv2d): def __init__( self, in_channels, out_channels, k...
928bf4db43e7eabaab91236680f6d506b5daa67267995230596bf2fde051064c
Python
3,443
85
from src.utils import read_gtf import polars as pl from tqdm import tqdm import numpy as np import multiprocessing as mp from src.utils import read_CAGE_peaks, read_polyA_peaks #--------Read in datasets-------- cage_peak_obj = read_CAGE_peaks("data/refTSS_v3.3_human_coordinate.hg38.sorted.bed") polya_peak_obj = read_p...
51bd004c6fe768069c401757a55f2472834df2d7cbb0f6f947e4c58016df953e
Python
3,444
77
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from pymatgen.core.structure import Structure from pymatgen.entries.compatibility import Compatibility, MaterialsProject2020Compatibility from mattergen.common.utils.globals import get_device from mattergen.evaluation.metrics.evaluator import Me...
1bbe7835f91f915888fdda5d9524d686494c47df6a51e78d5decaa1d4c2fd987
Python
3,445
118
import anndata import numpy as np import pytest from anndata import AnnData from fast_array_utils import stats from fast_array_utils.conv import to_dense from scipy.sparse import csr_matrix import novae x_np = np.array([ [1, 0, 0, 3], [0, 5, 6, 0], [7, 0, -1, 0], ]) x_sparse = csr_matrix(x_np) adata = A...
ce0fdd9d5746996d5996837acffa36c4bfc680e1e5d150dfb8e41b026a4c4889
Python
3,445
69
#!/usr/bin/env python3 """A super simple program that displays a summary of your model and optionally saves an image. .. warning:: This module is deprecated and will be removed in BPReveal 6.0.0. To see a text description of your model, just do:: model = utils.loadModel(modelFname) print(model...
ebe52fb9de22db4a5cb4d6ca6f5fb2056f9fee61b31b37ca59ca7f7eda32de76
Python
3,445
126
from typing import Optional, Dict from torch import Tensor import torch def waitk_p_choose( tgt_len: int, src_len: int, bsz: int, waitk_lagging: int, key_padding_mask: Optional[Tensor] = None, incremental_state: Optional[Dict[str, Dict[str, Optional[Tensor]]]] = None ): max_src_len = src_...
30112490112299d65b0f566f789a16e3d3cf6ea649e97e7d29c78409521dbc3c
Python
3,446
110
from __future__ import annotations import shutil from typing import TYPE_CHECKING from typing import ClassVar from cleo.helpers import argument from cleo.helpers import option from poetry.core.constraints.version.version import Version from poetry.core.version.exceptions import InvalidVersionError from poetry.conso...
a2d8180975b36ae6788230dae05b04a5ea2cdbad9f059f978637757fd49b310f
Python
3,446
123
""" 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 import torch.nn as nn from torch_geometric.nn import radius_graph from ..common.utils import ( compute_neig...
37c341dc41c11ebc5d8b0c3d3ab203ed80ca040861cf735d27c97c28f68a9c8f
Python
3,451
94
from __future__ import annotations from functools import cache from typing import TYPE_CHECKING import torch if TYPE_CHECKING: from collections.abc import Callable @cache def _mps_supports(op: Callable[[torch.Tensor], torch.Tensor]) -> bool: """Whether ``op`` has an MPS kernel in the torch build in use. ...
784ab4147d374b7f18f75a0aebb7ab1663ee08231c40e2b8d2ae3e529e5ed163
Python
3,451
103
import os import h5py import numpy as np from types import SimpleNamespace from typing import Tuple from voluseg._tools.constants import hdf from voluseg._tools.evenly_parallelize import evenly_parallelize def collect_blocks( color_i: int, parameters: dict, ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.n...
ed0a3d8f6cd787c3aba3d6e730b93212f21c1810b14e5c69a7f84581c720dbf0
Python
3,451
116
import copy import numpy as np import pandas as pd import pytest import vak.common # for constants import vak.common.files.spect import vak.common.labels @pytest.mark.parametrize( 'labelset, map_background', [ ( set(list("abcde")), True ), ( set(l...
6bd5f61cf9d85ab7a5007bdb7cd1af5a2cb918a87fc2a3c77aa0230b96e04e24
Python
3,452
112
# -*- coding: utf-8 -*- """ @Time:Created on 2019/9/17 8:54 @author: LiFan Chen @Filename: main.py @Software: PyCharm """ import torch import numpy as np import random import os import time from model import * import timeit def load_tensor(file_name, dtype): return [dtype(d).to(device) for d in np.load(file_name ...
0fd0bf2251ebf3fcc302fed8fae3a357fd9e22e0e4c5fa822e39bbf07ede5457
Python
3,453
68
import pandas as pd import numpy as np from currentscape_calculator.partitioning_algorithm import partition_iax class CurrentscapeCalculator: """ Represents a calculator for performing Currentscape analysis for input data. This class is designed to calculate positive and negative membrane current componen...
28b5f109a664f73f38bccb5fe8273cb3c4d3a0284aa69193c0bc3da7f5908d7c
Python
3,457
102
# @license # Copyright 2025 Google Inc. # 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...
fe625c8a62d5696aaa96f4248a1d56749d2ef41dc4595c2a4f590c70d09debaa
Python
3,457
81
"""Guards for the packaging metadata. The optional-dependencies file (``requirements_extra.txt``) must stay a *valid* pip requirements file: Dependabot's dependency-graph parser reads every ``requirements*.txt`` in the repo, and a custom grammar (the old ``pkg>=x: tag`` format) makes that job fail with an ``InvalidReq...
03df163fb1759788ba4933049cb6e0c2bd93cd82459825a5533236be69fe2db2
Python
3,460
99
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ---------------------------------------------------------------------------------------------------------------------- # Author: Lalith Kumar Shyam Sundar # Institution: Medical University of Vienna # Research Group: Quantitative Imaging and Medical Physics (QIMP) Team ...
b0bbfea93ec84457946e2021310cb19e6297cac17c7d4448d7c64cfe8ab39bea
Python
3,460
94
import torch import torch.nn as nn import torch.nn.functional as F from core.modeling.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d class _ASPPModule(nn.Module): def __init__(self, inplanes, planes, kernel_size, padding, dilation, BatchNorm): super(_ASPPModule, self).__init__() self.atro...
1766b09b5166096a5586fa0d00ec1069294200b447ed699e59ce83989fa2a701
Python
3,463
101
#!/usr/bin/env python3 # This is used by the acceptance test script to test the GA. import argparse from bpreveal import gaOptimize import pysam import tqdm from bpreveal import utils from bpreveal.internal import disableTensorflowLogging del disableTensorflowLogging utils.setVerbosity("INFO") def runGaOptimization(...
ea099c980e375d7dcc97c67da3a2f5fed6a5c5235f0516d95d854d0253fcfc4f
Python
3,465
113
import pandas as pd import pytest from pgmpy.base import DAG, PDAG from pgmpy.metrics import OrientationConfusionMatrix # The models in true_dag and est_dag fixtures are taken from the paper: https://arxiv.org/pdf/2412.10039 @pytest.fixture def true_dag(): return DAG( [ ("x1", "x2"), ...
f41a41127dd329736e043eb3c60ca1637de26cff26f75214c0126ce351c4e749
Python
3,465
103
# -*- coding: utf-8 -*- # Copyright (C) 2023 Phillip Alday <me@phillipalday.com> # License: BSD (3-clause) """BrainVision Writer tests.""" import os from shutil import rmtree import mne from nose.tools import assert_equal, assert_raises import numpy as np from numpy.testing import assert_allclose, assert_array_equa...
347164235330844d9112ce8315c4285532b3cf6963f4dafec61a563fe2d59eda
Python
3,472
109
# 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 argparse import math import os import subprocess import sys import tempfile from collections import defaultdict from itertools import c...
eea3325e7a407eceddbe742e938d9a07f0e1b385ad1569544f96b2457fb9bdab
Python
3,472
93
"""Registry for models. Makes it possible to register a model declared outside of ``vak`` with a decorator, so that the model can be used at runtime. """ from __future__ import annotations from typing import TYPE_CHECKING, Any, Type import lightning if TYPE_CHECKING: from .factory import ModelFactory MODEL_FA...
ace8dc92128fb198405a6ea43a950f27c54a74490979659fdea383c87698c6a4
Python
3,473
84
from model.builders.prostate_models import build_pnet2_account_for task = 'classification_binary' # selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes_and_memebr_of_reactome.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', ...
0ff87cc9c236246b4a5c46c394c30dee9b7c6240fa1e9eff18b06bc181f9d107
Python
3,474
114
"""Implements models which run 1d convolutions along the read features.""" import enum import torch def make_1dconv_layers( kernel_sizes, in_feat, channels, use_batch_norm, activation="ReLU" ): """Make the 1d conv blocks.""" if not isinstance(channels, list): channels = [channels] * len(kernel_si...
11a68a9cd04aeca94c27695edaf783e18d4793ecabed67e55d108f4a5826d863
Python
3,474
93
import logging import numpy as np import pandas as pd import warnings from dynamicTreeCut import dynamicTreeCut from dynamicTreeCut import R_func as dtc_utils from scipy.cluster import hierarchy from scipy.spatial import distance from mentor import _metrics as metrics from sklearn.base import BaseEstimator,ClusterMixin...
93fd54fe115b189fa07a8bfc3f5e8884d9e1e1c84e445e705ffc089756647c8c
Python
3,474
106
"""Retrieve PubMed abstracts and full text content when available. Feed the document database with abstracts and full text retrieved from PubMed. """ import asyncio import itertools from collections.abc import Iterator, MutableMapping from aiotinydb import AIOTinyDB from aiotinydb.storage import AIOJSONStorage from...
c644a5050f9c2a24b358a016be0c89ccaa2eeee06fadfdedd4435896a121f1c2
Python
3,474
82
import pandas as pd from pgmpy.causal_discovery._base import BaseOrderDiscovery class VarSort(BaseOrderDiscovery): r"""Causal discovery by sorting marginal variances and regressing on predecessors. Sort variables by increasing marginal variance to obtain an estimated causal order, exploiting the varsortabil...
016581cbe9374e25cc879df0c14f9104bf7b9adee4cc01c83427141a7868d640
Python
3,476
92
from copy import deepcopy import numpy as np from model.builders.prostate_models import build_pnet2 task = 'classification_binary' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', 'params': { 'data_type': ['mut_imp...
be62da66c43e81b39eefb71e1c02cbb6450788e4a19225d3b94d67190f590549
Python
3,477
75
import numpy import numpy.testing import pandas import unittest from metax.gwas import Utilities as GWASUtilities # from metax.Constants import SNP from metax.Constants import EFFECT_ALLELE from metax.Constants import NON_EFFECT_ALLELE from metax.Constants import ZSCORE from metax.Constants import CHROMOSOME from meta...
4f591603e7e6cb4444ca182731705e6b4e394afdd0bba7138a12865ee3c16328
Python
3,483
108
from __future__ import annotations from contextlib import contextmanager from pathlib import Path from tempfile import TemporaryDirectory from typing import TYPE_CHECKING from poetry.utils.env.base_env import Env from poetry.utils.env.env_manager import EnvManager from poetry.utils.env.exceptions import EnvCommandErr...
ca190be7a8a577bb36dae099ca6dd1fa48c940421aeab77b87d059f160660fe3
Python
3,483
115
import logging import os from functools import partial import jax import jax.numpy as jnp import numpy as np __all__ = () log = logging.getLogger(__name__) DEVICE_AXIS = "device_axis" @jax.pmap def broadcast_to_devices(pytree): return pytree def split_rng_key_to_devices(rng): return broadcast_to_devices...
d5f4d76da411c00ec1162a383de05b1e48cbf6d6e83d70f6174e2a375378a275
Python
3,484
127
# 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 gc import os import random import shutil import numpy as np import torch import tqdm from examples.textless_nlp.gslm.speech2unit.pretr...
5c6f073b3450c5ea6c95003ed0460c30c81d2165c420c2149abb5f1dbe2b6bfd
Python
3,487
88
""" Logic to generate sobol samples for pTau,agg dynamics with A\betaReelin dynamics parameters fixed """ from SALib.analyze import sobol from SALib.sample.sobol import sample import numpy as np from scipy.stats import qmc np.random.seed(0) #This was not set for large simulation def induction_linear(max_y...
79819598cd1e366eaa8f2a4fee2d638b6ef0686e490402fae792ccce58d876c0
Python
3,487
103
#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
93643a8b93caca6edea17fec6b8e14f7a520ead072c77926bc5412cb6a72e936
Python
3,487
103
""" Utils """ import warnings warnings.filterwarnings("ignore") import pandas as pd import numpy as np import os import requests from tqdm import tqdm import tarfile def get_shapes_dict(dataset_path): shapes_dict = {} datasets_df = pd.read_csv(dataset_path) sorted_dataset_names = sorted(datasets_df["nam...
66eaffbbc7910fbf2996f881fca88176b78b3730b6e96734218d4495b20084e4
Python
3,490
98
import os import numpy as np import json from meld_classifier.meld_cohort import MeldCohort, MeldSubject from meld_classifier.paths import CLIPPING_PARAMS_FILE #Generate feature lists ds_gmfrac_features_to_generate = [] ds_gmdist_features_to_generate = [] ds_wm_features_to_generate = [] hemispheres = ['lh', 'rh'] ...
8836a2e5e9a8f51a8f7bab76bc5d3a571a4059dd6cb1c19f46e61ef50de0a324
Python
3,491
118
""" Copyright 2020 The Google Research Authors. Copyright (c) Microsoft Corporation. Licensed under the MIT License. Based on code from https://github.com/yang-song/score_sde_pytorch/blob/main/sde_lib.py which is released under Apache licence. Abstract SDE classes, Reverse SDE, and VE/VP SDEs. Key changes: - Rename...
13e2a5cb628805c1645a9b7cc0fad40422b123b2effcfe85be0bfc8047e57591
Python
3,492
70
#!/usr/bin/env python3 """figure1_workflow.py — workflow with the current two-gene Tier-1.""" import matplotlib.pyplot as plt from matplotlib.patches import FancyBboxPatch, FancyArrowPatch fig, ax = plt.subplots(figsize=(7.5, 10.5), dpi=300) ax.set_xlim(0, 10); ax.set_ylim(0, 14); ax.axis('off') CI="#E3F2FD"; CP="#FF...
41c13457ecc7813539b983097738631574ee11c5f136fd80253fc79b451db8ca
Python
3,492
156
# flake8: noqa from .charts_options import ( BarItem, BarBackgroundStyleOpts, BMapCopyrightTypeOpts, BMapGeoLocationControlOpts, BMapNavigationControlOpts, BMapOverviewMapControlOpts, BMapScaleControlOpts, BMapTypeControlOpts, BoxplotItem, CandleStickItem, Chord...
5ec9c29d0563a45a988bfb82210e43a76b68b47a196eb77f8d63ab7504cbf894
Python
3,492
73
import numpy as np import torch from torch.utils.data import DataLoader import time from pathlib import Path from input_data_from_mesh import prep_input_data from fit import fit, fit_with_early_stopping from optim import * from plotting import plot_field def train_continue(disp_idx, field_comp, disp, pffmodel, matpro...
98d29c99f478145c238afd328812ff0262edd986b613e7c1ac444baca863e4ac
Python
3,494
122
#!/usr/bin/env python """ Thin Slurm-facing entry script for cluster-based HbO power simulations. Small test version: - 3 x 5 = 15 block/subject grid cells - reduced iterations Choose the scenario by setting SCENARIO below. Supported: - "null_vs_null" - "signal_vs_null" - "signal_vs_signal" """ import sy...
a8fee5b8a01523e3d35e3f8f1116c13470e97fabbff790364268d8b48fbde623
Python
3,495
97
import vtk, qt, slicer from math import sqrt, cos, sin import numpy as np from .CircleEffect import AbstractCircleEffect class AbstractShrinkExpandEffect(AbstractCircleEffect): def __init__(self, sliceWidget): # keep a flag since events such as sliceNode modified # may come during superclass constructio...
123275502ec4a7bfee8f09d00d989447883ddeb0a3c9c56eac6fd88913b372fe
Python
3,496
94
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from collections import defaultdict from itertools import combinations from typing import Any, Callable, Iterable, TypeVar import numpy as np from pymatgen.core import Structure from pymatgen.core.lattice import Lattice from pymatgen.entries.com...
8aaf0e83b46c9de58759ef439eda368a142a9b582ce1f1d89edf1ad835f2c964
Python
3,501
106
"""A later batch item's store read overlaps an earlier item's replay. `_resolve_layer_boundary_cached` submits every hit's `store.get` to a single background thread before replaying any of them, so the thread can be reading item `n + 1` while the trainable top layers replay item `n`'s prefix. A version that reads and ...