sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
4ce3e503f7e4c84bddc770ec9c61355575a61390296c69ac2094673850da127d
Python
2,671
78
# 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 import json from fairseq import utils from fairseq.models.text_to_speech.vocoder import CodeHiFiGANVocoder #...
7b039d3b1850d56be8dad63b4af1c67555f2ff93b947fb12bef0a30a01816f04
Python
2,671
81
from __future__ import annotations from typing import TYPE_CHECKING import pytest from packaging.utils import canonicalize_name from poetry.factory import Factory from poetry.repositories import Repository if TYPE_CHECKING: from tests.types import PackageFactory @pytest.fixture def repo() -> Repository: ...
2801fb9a4c78a7e30c31ce1bfd0b9083563e80362799afd701f62253fb966f3e
Python
2,672
67
#!/usr/bin/env python import argparse import torch from .layers import v2_positional_encoding as v2 # def main(): # parser = argparse.ArgumentParser() # parser.add_argument("--inverse", action="store_true", help="Inverse the tone curve") # parser.add_argument("--no-grad", action="store_false", des...
04b728a94422f7eef3af9febfcf7d0f292c49931584e8e87c7472722727ab325
Python
2,673
106
""" This is a modified version of the code present in: https://github.com/nanoporetech/pipeline-umi-amplicon/blob/master/lib/umi_amplicon_tools/reformat_consensus.py """ import argparse import logging import sys import os import pysam def parse_args(argv): """ Commandline parser :param argv: Command li...
be123a0d40a563bdd8d4697fe51c6599f2800039399ce128f220a377d16c1e23
Python
2,673
79
# @license # Copyright 2020 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...
7ea029cdddd7849bb2a79353ea9c54b278e53b2f76f92222a5615b7262b3d331
Python
2,674
81
__author__ = 'Robbert Harms' __date__ = '2017-10-23' __maintainer__ = 'Robbert Harms' __email__ = 'robbert@xkls.nl' __licence__ = 'LGPL v3' class NumDiffInfo: """Encapsulates information necessary for numerical differentiation of a parameter.""" @property def max_step(self): """Get the maximum nu...
d9d5ca240a8bed7986d3e55a45b2e6d08dab35cdcada321e8e05c59391cc6018
Python
2,674
69
import logging import shlex import sys from unittest.mock import patch import pytest from gsMap.main import main def parse_bash_command(command: str) -> list[str]: """Convert multi-line bash command to argument list for sys.argv""" cleaned_command = command.replace("\\\n", " ") cleaned_command = " ".joi...
dedc12bf1812cb093e2ccad82cfed95fcd12917552af95044223a8c42fddb18f
Python
2,674
75
import logging from typing import Any from pydantic import root_validator from pydantic.main import BaseModel class BulkRNABertConfig(BaseModel): n_genes: int n_expressions_bins: int embed_dim: int init_gene_embed_dim: int project_gene_embedding: bool = False use_gene_embedding: bool = True ...
6cd8635d94fed2883b9d4bbbb943b27cef2d53988097ee34bada6b6a0d2f5e99
Python
2,677
108
""" Misc wrappers for some VTK classes. """ # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause from vtk.util.vtkConstants import VTK_ID_TYPE from .base import BSVTKObjectWrapper from ..decorators import unwrap_input, wrap_output class BSCollection(BSVTKObjectWrapper): """Wrapper for...
7a5c4287bb68328aeea310915e2ee4c7c57c0d37c80fcdcfa7786e49a2ed3ed4
Python
2,678
84
import os import zarr import tskit import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pandas as pd from tqdm import tqdm from multiprocessing import Pool import glob # get number of windows from glob # TODO: maybe change this from glob to look at the zarr directly tree_files = glob.glob(o...
b5e0640f11ce1ad0207696e3292caffe70ac4dae6c029c5e162cf14abe3360e2
Python
2,678
82
# # 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 os import numpy as np import cv2 from MLPerf_cal_images import get_cal_fns from ...
93ae4c47792ba7aadd141c7228145add272e0dcc7736602cf8e7a6814ae52ef9
Python
2,680
40
from predify.modules import PCoderN from predify.networks import PNetSeparateHP from torch.nn import Sequential, ReLU, ConvTranspose2d class PVGG16SeparateHP(PNetSeparateHP): def __init__(self, backbone, build_graph=False, random_init=False, ff_multiplier=(0.2,0.4,0.4,0.4), fb_multiplier=(0.05,0.1,0.1,0.1), er_mul...
a0c02d49eecf2bea2269764d4164783e81b5f360de09f629eaac1b7b36d2d80a
Python
2,680
75
""" 06_tissue_enrichment.py Brain vs. blood tissue enrichment comparison. Computes PCDH co-expression in GTEx whole blood (n=755) and compares with brain regions. Harbert D. (2026) BMC Genomics """ import sys, os sys.path.insert(0, os.path.dirname(__file__)) from utils import * def main(): ensure_dirs() cac...
20e96f2f18de0a068b962a4c2f583b908460a24bf72ef7a85518bcac841148aa
Python
2,681
79
import unittest from unittest.mock import patch from pyecharts import options as opts from pyecharts.charts import Kline data = [ [2320.26, 2320.26, 2287.3, 2362.94], [2300, 2291.3, 2288.26, 2308.38], [2295.35, 2346.5, 2295.35, 2345.92], [2347.22, 2358.98, 2337.35, 2363.8], [2360.75, 2382.48, 2347...
3cbbdbb4753449d33f799f69f0dbd5d504907bd1316061597f77f7a6b90e8345
Python
2,681
88
from mdt import CompositeModelTemplate import numpy as np __author__ = 'Robbert Harms' __date__ = "2015-06-22" __maintainer__ = "Robbert Harms" __email__ = "robbert@xkls.nl" class BallStick_r1(CompositeModelTemplate): model_expression = ''' S0 * ( (Weight(w_ball) * Ball) + (Weight(w_stick...
785e2fefda2fe0ec3e55b088ad6af403c9bb5e740efa2ece8c88584425f7d391
Python
2,682
85
"""Utility functions that streamline preparing vertex arrays for plotting""" import os import numpy as np DATA = os.path.abspath(os.path.join(os.path.dirname(__file__), 'data')) def add_fslr_medial_wall(data, split=False): """Add medial wall to data in fsLR space Data in 32k fs_LR space (e.g., Human Connect...
4ec600ab7af0a2ea407bb8ad52d640f9030dc70691f5c5b6af4d914b77190cef
Python
2,683
73
import os from os.path import join, basename, dirname import pandas as pd from matplotlib import pyplot as plt from config_path import PLOTS_PATH, PROSTATE_LOG_PATH base_dir = join(PROSTATE_LOG_PATH, 'review/fusion') files = [] files.append(dict(Model='Fusion', file=join(base_dir, 'onsplit_average_reg_10_tanh_large...
7f956e2d98fa2e07f6fb3a7fc657a54368f38f6aaa250c899327e7b2bec7b519
Python
2,683
91
import pandas as pd import pytest from mock import MagicMock, Mock, call from pgmpy.estimators import BIC from pgmpy.estimators.ScoreCache import LRUCache, ScoreCache def test_caching(): function_mock = Mock(side_effect=[1, 2]) cache = LRUCache(function_mock, max_size=2) assert cache("key1") == 1 as...
1618d60bfe6431600c6b0a182193806853fef2d399b422f2199a4ca07f20aca6
Python
2,684
80
#!/usr/bin/env python3 """Unit tests for SIVmac split-read fixtures (no Nextflow).""" import glob import os import sys import tempfile import unittest REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, os.path.join(REPO, "bin")) from filter_reads import parse_args, filter_reads, is_...
86feafa0c9f6aa12dd3b53121f782a49c75a4e28a17fac831a83617bdf1fe8f2
Python
2,685
70
from ... import options as opts from ... import types from ...charts.chart import Chart from ...globals import ChartType class ThemeRiver(Chart): """ <<< ThemeRiver >>> ThemeRiver graph is a special kind of flow graph, which is mainly used to show the changes of events or themes over ...
914639b4587f79396e8b9da7d42e2e3f3d4e6e065661789522016b53fbc3a24e
Python
2,685
79
# 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 logging import numpy as np import re from pathlib import Path from collections import defaultdict import pandas as pd ...
d6c4616f7c6c24620621a6abc007f8b0ad1ede703ad84f08b9377d23bee57c97
Python
2,685
85
from time import sleep from pathlib import Path import mne_bids import pylossless as ll def load_openneuro_bids(subject="pd6", timeout=20): """Download and Load BIDS dataset ds002778 from OpenNeuro. Parameters ---------- subject : str The subject to load. Defaults to ``"pd6"``. Returns...
ca1124ad251a83b24e90fb662ac6dd86cbc320318c66c2221a1ddea8afe0fdba
Python
2,687
103
import functools import time import torch import torch.autograd as autograd import torch.cuda.comm as comm import torch.nn as nn import torch.nn.functional as F from torch.autograd.function import once_differentiable class CA_Weight(autograd.Function): @staticmethod def forward(ctx, t, f): # Save con...
049a5546fb3f6620d79f70ccda0ae76fd091e710c0a261d717d3ddfe5acb2ea5
Python
2,688
90
from __future__ import annotations 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 from poetry.utils.env import Env class EnvInfoCommand(Command): ...
173340855ad89499eafbf9c7fc65e07aea9ec5b6235ba14452c77a00e1906949
Python
2,689
70
import torch import torchvision.ops from torch import nn class DeformableConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, bias=False): supe...
d9684922a884f7f40a94fe5839e21acf9bf15c07c61c848386b62e6a5bdab40d
Python
2,691
84
# 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 typing as tp def _safe_readline(fd) -> str: pos = fd.tell() while True: try: return fd.readline...
24816d08696ca51cc1f5f623d55ba5677a7ff767f0c3cc4d38b013a7226a6266
Python
2,695
101
"""Top-level GOATOOLS command-line dispatcher.""" from __future__ import print_function import importlib import sys from goatools import __version__ SUBCOMMANDS = { "compare_gos": ( "goatools.cli.compare_gos", "Compare two or more sets of GO IDs.", ), "fetch_associations": ( "go...
0fa8cb54e58beeeea4254bd21d4457d11557da590b4106a6fff85dfa71e82786
Python
2,697
91
import npyx from npyx.c4.dataset_init import get_paths_from_dir, extract_and_check from npyx.c4.acg_vs_firing_rate import main as acg_main from npyx.c4.dataset_init import save_features import pandas as pd import npyx.feat as feat import numpy as np import os from celltype_ibl.params.config import DATASETS_DIRECTORY #...
07f90b1cc44e09fd4737d278c9897ac6136f0ddd15d152c502bf387555de7036
Python
2,698
76
"""Smoke tests for the minimal pattern-analysis upload. Recompute a few reported values and assert them. Read the original data via `source: server`; skip cleanly if the data is not mounted. pytest -q # fast pytest -q -m slow # + permutation / atlas-loading checks """ import numpy as np import pandas...
0216992e4263cd2285c088a825af363d3c1949c1ccad78e879e79c8c51ff0148
Python
2,700
86
from __future__ import annotations from pathlib import Path from .df_common import detect_photometry_file_type, expected_analysis_output_path from .df_dual import compute_dual_options, run_dual_analysis from .df_single import compute_single_options, run_single_analysis def run_analysis( selectedfile: str | Path...
446610946a1a6feb18744960bf96857d77e5e678afacb21d20d64b1541e62982
Python
2,704
80
#!/usr/bin/env python # ENCODE DCC blacklist filter 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 Blacklist filter.', ...
54031ba80260ba1132ded1c492c6a29c9a2c4468d4eacc0ae6631f5406a4369e
Python
2,704
63
#!/usr/bin/env python3 import polars as pl import argparse from src.utils import read_fasta, write_fasta, read_gtf, collapse_isoforms_to_proteoforms def main(): parser = argparse.ArgumentParser(description='Filter genome_gffs from TransDecoder with novel transripts') parser.add_argument('--mode', action='...
7d1c4a49307411defeee1d08e6d06176aebd8b40f34b61cf22954979bff33292
Python
2,704
79
# # 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 ...cores.analog_core import AnalogCore from scipy.linalg import dft clas...
95ef3893fd230b42b8cc199337435e320a670c0da3a6ca562c87a8ee69945242
Python
2,705
90
import os from random import randint APP_NAME = '%s-%d' % ('fashion-mnist', randint(0, 100)) LOG_FORMAT = '%(asctime)-15s %(filename)s:%(funcName)s:[%(levelname)s] %(message)s' JSON_FORMAT = '%(message)s' RUN_LOCALLY = False ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) + '/' TEST_DIR = ROOT_DIR + 'test/' DAT...
96079c97453c8d2de8adedaeccf49273545c6a01b4c91f14ee35788988e80e32
Python
2,707
80
import os import numpy as np def create_dir(path : str): # create directory if it doesn't exist if not os.path.exists(path): os.makedirs(path) # 3D euclidean rotation around the y-axis def Ry3D(θ : float) -> np.ndarray: return np.array([ [np.cos(θ), 0, np.sin(θ)], [0, 1, 0], ...
1a4c49eef20aeba21b959baa04f5a15c6a71e5d6eeac5d7ea0933a038d1da0da
Python
2,708
79
import os from copy import deepcopy from os.path import dirname import numpy as np from model.builders.prostate_models import build_dense base_dirname = dirname(dirname(__file__)) print (base_dirname) filename = os.path.basename(__file__) task = 'classification_binary' # need to stired under 'data/genes' selected_ge...
7f0e943fa30e6fde17cd24f3a6bbf374223f331cca9be9c3a0d4c9b69e2a2337
Python
2,708
74
#!/usr/bin/env python3 import argparse import csv from collections import defaultdict def parse_args(): parser = argparse.ArgumentParser(description="Summarize UMI stats from multiple stats files.") parser.add_argument("stats_files", nargs="+", help="Input stats .tsv files (one or more)") parser.add_argume...
91bae3f0f127be6ad5ee425410e688aea3866a99295d6604a02544a96da2ba03
Python
2,708
89
# -*- coding: utf-8 -*- # Copyright 2017 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 require...
cb414a443ee70fcb121820ee222244c65e9091fcccedbb2cb0819ff7187ad480
Python
2,709
70
from mdt import CompartmentTemplate, FreeParameterTemplate from mdt.model_building.parameter_functions.transformations import ScaleTransform __author__ = 'Robbert Harms' __date__ = '2018-09-15' __maintainer__ = 'Robbert Harms' __email__ = 'robbert@xkls.nl' __licence__ = 'LGPL v3' class GDRCylinders(CompartmentTempla...
7276d5a94c754083401caed07de9f94e7bfd9bc02b3ea74ff1b884b706200484
Python
2,710
73
#!/usr/bin/env python3 # MIT License # # Copyright 2026 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...
e57febc59ecb70ee7418ac45600cab7fc4cd409b4eead0e886f44176b6b728ff
Python
2,713
71
#!/usr/bin/env python3 # MIT License # # Copyright 2025 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...
0da09c646c3e70bba619b5fc0c74fc302226eaa808824ae9e4a58bc554d72094
Python
2,714
61
import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt from matplotlib.patches import FancyBboxPatch, FancyArrowPatch plt.rcParams.update({"font.family": "DejaVu Sans"}) fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(16, 7.6), gridspec_kw={"width_ratios": [1.08, 1.0]}) #...
c95301261e65ce697102e84488b21421c75ab4650a18215b3507949470981213
Python
2,714
91
#!/usr/bin/env python3 -u # 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 os import hydra import torch from hydra.core.hydra_config import HydraConfig from omegaconf i...
a24702e73d1cffc4f1b7ea33c1beff0f59512a8fdaa457a6cc84fcc0dd6c61b8
Python
2,715
87
import itertools import os import platform from cffi import FFI dir_path = os.path.dirname(os.path.realpath(__file__)) #samver is pulled from this file in the Makefile samver = "1.20" htslib_dir = os.path.join(dir_path, 'submodules', 'samtools-{}'.format(samver), 'htslib-{}'.format(samver)) deflatever = "1.10" defla...
e5e7013c30ce13993046fb6ec66af32a02617938bbe0fc2109512583e7411fe6
Python
2,716
58
"""Validate browser-generated ZIPs with the unchanged desktop/Colab reader.""" import json from pathlib import Path import sys import tempfile import numpy as np from PIL import Image ROOT = Path(__file__).resolve().parents[2] sys.path[:0] = [str(ROOT / "SegRef3D"), str(ROOT / "ColabNotebooks"), str(ROOT / "ColabNote...
245afef0c314f8096b4569b99156f939a7e84d35a94ba9b6a053bad0db6aca94
Python
2,719
79
# 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 . import BaseWrapperDataset, data_utils from fairseq.data.text_compressor import TextCompressor, TextCompressionLevel cla...
9933b9bbb66cdbc427ee8f72847fb60784be75879de8d5da1c716eea53a1386b
Python
2,719
86
import os from utils.paths import ROOT_DIR # --- Define Valid Network Names --- # These are names of the different CNN architecture classes defined in ROOT_DIR/src/networks/cnn.py # While there are sevetal CNN architecture classes defined in cnn.py, only a few (e.g. "BINND") are relevant for BINND VALID_NETWORK_NAMES ...
f262b14a6d76a11ad932e34c3c5f6e67472a226d6d750c8de849197ac4357407
Python
2,719
75
"""Inference-API tests for hippie.inference.HIPPIEClassifier. These tests exercise the public inference surface without requiring a real pretrained checkpoint. Network-dependent tests (from_pretrained on HuggingFace Hub) are marked with the `network` pytest marker. """ from __future__ import annotations from pathlib...
2a1c1daaf1ba435a9c4aadc2464a9219bd387786f8292f9d269f77da589a9b7b
Python
2,720
51
"""Sensitivity of the fruit-juice results to the disputed composition entry for sample p59. The spreadsheet records p59 as 65 % orange juice; the sample-coding scheme (100 - 5n, followed by all 54 other samples) implies 55 %. The analysis uses 55 %. This script re-runs the fruit-juice benchmark both ways so the depend...
61033455f89e515a6f5703ea2d31e8c2a024d56e0e3d0b953fca97179892e9a2
Python
2,721
93
from abc import ABC, abstractmethod from typing import Dict, Optional import importlib import os import numpy as np class AudioTransform(ABC): @classmethod @abstractmethod def from_config_dict(cls, config: Optional[Dict] = None): pass class CompositeAudioTransform(AudioTransform): def _from_...
0b47c680aa1a444032ecfb56dd5540b0db854031f424c0d4d6ef0b968c6b0ad1
Python
2,725
90
"""`brenda_references.scripts` must import without the root's dev group. Its `__init__` installs beartype's import hook, and beartype is declared by no runtime dependency anywhere in the tree, so every module there was importable purely as a side effect of a developer install. The probe runs in a subprocess because th...
486ec3a8d3ee5aa9e9082055ec75664f058c95d67c23e6abb58afe6d5d7f1d03
Python
2,725
60
#!/usr/bin/env python """Script for generation table with data/models from list.json in .md format""" import argparse import json DATASETS_SOURCE = "list.json" def generate_table(fn): with open(fn) as infile: data = json.loads(infile.read()) datasets = sorted(data["corpora"].items(), key=lambda kv:...
9e644b39fa4e38059fc253928796c61219b1f6b60f49e403f954150c6fdd8b12
Python
2,726
64
#!/usr/bin/env python3 # MIT License # # Copyright 2025 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...
1d8b2e23a25e5841e4cfa68b7b9f8ac82de542ffb4c54de245bf3bda1b31102a
Python
2,730
87
import matplotlib.pyplot as plt import numpy as np # Function to read data from a file and calculate mean, min, and max def calculate_stats(file_path): with open('./date/'+file_path, 'r') as file: data = [float(line.strip()) for line in file if line.strip()] mean = np.mean(data) min_val = n...
3b6423b39f55d9007926e3fada95b740c697a028b80939976e5932304425bc86
Python
2,734
84
from typing import List, Tuple import re from itertools import product, zip_longest import pandas as pd import numpy as np _FASTA_VOCAB = "ARNDCQEGHILKMFPSTWYV" def single_mutant_names(sequence: str) -> List[str]: """Returns the names of all single mutants of a sequence.""" mutants = [] for (i, wt), mut ...
7eb7b88960f77a4fa36e90b443c0e446a0f0c05bfc9f1edce593312e37fb8148
Python
2,734
88
import matplotlib.pyplot as plt import numpy as np import loompy from .colors import colorize from .scatter import scatterc, scattern def batch_covariates(ds: loompy.LoomConnection, out_file: str) -> None: xy = ds.ca.TSNE plt.figure(figsize=(12, 12)) if "Tissue" in ds.ca: names, labels = np.unique(ds.ca.Tissu...
8032e56cd6115d8e928423dd71c2ea7c7d9987011dbb91be984aae5681e5e290
Python
2,734
101
from __future__ import annotations import locale import sys import warnings from contextlib import suppress from pathlib import Path if sys.version_info < (3, 11): # compatibility for python <3.11 import tomli as tomllib else: import tomllib from importlib import metadata as _metadata WINDOWS = sys.p...
1da5487dd9bd29612b2e10dc1e681140ebc8a8f494c9825a42cb3c6df644c691
Python
2,735
65
import json import os import urllib.request import numpy as np from oneqmc.molecule import Molecule if __name__ == "__main__": data_dir = os.path.join(os.path.dirname(__file__), os.pardir, "data") reference_energy_dir = os.path.join( os.path.dirname(__file__), os.pardir, "experiment_results", "03_tin...
7e82bc3d749974fad15b1c0a4fac28ffa795779e8d34186172e2a54633c6081d
Python
2,735
88
#!/usr/bin/env python3 # 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. # # Adapted from examples/wav2vec/wav2vec_manifest.py """ Data preparation for the speech normalizer """ import argpars...
bd57eead9498cdb01266847de3f8812d03cf885c8380b029cd3d21f3b1bcdd6f
Python
2,736
91
''' Wrapper functions for fancy dendrograms ''' import gzip as gzip_module import logging import numpy as np import os import pandas as pd import pathlib import shlex import shutil import subprocess def fancy_dendrogram( distances, clusters, map, outdir, outfile, ...
eef22c82217d074af122f4ec4ae627b90f0224f8d6f2977a7a250ca91de93949
Python
2,737
65
from mdt import LibraryFunctionTemplate __author__ = 'Robbert Harms, Francisco J. Fritz' __date__ = "2015-06-21" __maintainer__ = "Robbert Harms" __email__ = "robbert@xkls.nl" class SSFP(LibraryFunctionTemplate): """Implementation of the SSFP signal attenuation. This uses the algorithm described in: "T...
1bbd38dc29664ddc5262d8e7e933fca2d3a3fc3c4e65f0ec54ba087ee454d4f3
Python
2,741
58
#!/usr/bin/env python3 """Make sure that all of the schemas are correct by testing them on known good and bad inputs.""" # flake8: noqa: T201 import json import os import argparse import jsonschema import bpreveal.schema as schemas from bpreveal.internal import interpreter p = argparse.ArgumentParser(description="Check...
ec050d049e3651a106dc84204ff4737e1a729884a47121eed04cece142479fe9
Python
2,741
61
import cv2 as cv import numpy as np #选取一幅图片, def Draw_Save_Border(rootpath,borderimgpath): img = cv.imread(borderimgpath,flags=-1) a,b = [],[] def on_EVENT_LBUTTONDOWN(event, x, y, flags, param): if event == cv.EVENT_LBUTTONDOWN: xy = "%d,%d" % (x, y) a.append(x) ...
12fa03bbea122dde23b456a564079954ff58ff735712d4127e50264879955685
Python
2,742
77
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ python %prog study.file population.file gene-association.file This program returns P-values for functional enrichment in a cluster of study genes using Fisher's exact test, and corrected for multiple testing (including Bonferroni, Holm, Sidak, and false discovery rate...
43c2bec8d763b167ed742fdc9b9d207627b433c51194a4026078901842e50bae
Python
2,743
85
import os from typing import Optional, Any from collections import defaultdict from simulation_encoder.logger import Logger from simulation_encoder.loaders.loader import Loader class AlphanumericLoader(Loader): """Loader class for loading labeled images from a directory.""" def __init__( self, ...
eb07e52f1142f170bd28582190af520a29885b4fbc0bcb595e76e4f02c779f34
Python
2,743
65
# 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 fairseq import utils from fairseq.modules import TransformerEncoderLayer from .multihead_linear_attention import MultiheadL...
a3930f850c696364b43f34dd9779fcff05e0d6d3a9787f806efde136d4d85a68
Python
2,744
88
# # utils.py # Copyright (c) 2020 Daisuke Endo # This software is released under the MIT License. # http://opensource.org/licenses/mit-license.php # #---------------------------------- # 作成者:Daisuke Endo # 連絡先:daisuke.endo96@gmail.com # 最終更新日 2020/5/17 #---------------------------------- # ここには3つの関数を記述している。 # 1. ファイルの読...
beaf6caf5bf5bb63817a54f87cc4e1d247b1f913d0264a859c0ad11d5d3117cf
Python
2,747
91
from typing import Literal import torch from torchmetrics import Metric class ElboMetric(Metric): """Elbo metric aggregator for scvi-tools experiments. Parameters ---------- name Name of metric, used as the prefix of the logged name. mode Train or validation, used as the suffix o...
0b8e82ed55ae022f0eb52e46184f276429c75937de113c721f67926100345441
Python
2,748
63
#!/home/s/shreejoy/nxu/miniforge3/envs/patch_seq_spl/bin/python import polars as pl import argparse from src.utils import read_fasta, write_fasta, read_gtf, collapse_isoforms_to_proteoforms def main(): parser = argparse.ArgumentParser(description='Filter genome_gffs from TransDecoder with novel transripts') ...
b96aecc62da7992dd673b0bac547bcc30a48f0281ca39e3cb4a1467a6bbb48af
Python
2,751
69
"""Featurize the SIESTA-PBE-relaxed polymorphs with OCE Wave-1.5. Mirrors featurize.py but reads the relaxed geometries from siesta_production_results.json (instead of the xtb results). Formal charges (A=+2, B=+4, O=-2) are pulled from the original structures.json by name. Writes feat_siesta/features_combined.npz for ...
229821055fdd6602c2be0f8b283d1e043a6fe0239ca483ab90de27d099d5f5bc
Python
2,754
81
"""Visualize the category distribution in the selected stimuli.""" # Imports import os import click import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from datasets import load_from_disk from scipy.stats import chi2_contingency from compositionality_study.constants import COCO_SELECTED_STIMULI...
935ca4cdec25a70e8bff4dad977d1e1e6e73bcff668c5c8bf82e7caae14a61a8
Python
2,754
87
""" Logic to generate sobol samples for analysing A\beta Reelin dynamics based on the related parameters. Sequences to enable second order analysis are generated. """ from SALib.analyze import sobol from SALib.sample.sobol import sample import numpy as np from scipy.stats import qmc ## RE # alpha_base 4680...
06b1586aa25725836bfff0e1c5e5b362aa8dec690621efd0ab043f197f3c0c4a
Python
2,756
69
import logging import shutil from pathlib import Path from .. import config, learncurve from ..common.logging import config_logging_for_cli, log_version from ..common.paths import generate_results_dir_name_as_path logger = logging.getLogger(__name__) def learning_curve(toml_path): """generate learni...
1e6990568bad858fc8a3d9c2b703befc86cee5c9597a0fc41b578702d691998b
Python
2,757
83
# 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 from dataclasses import dataclass, field from typing import Optional import torch from .dummy_dataset import DummyDataset from...
a43b90d333aeeb7422d7a95d568330bca1a2244bb82f608d928288ff023ade7c
Python
2,757
71
from collections.abc import Sequence from typing import Optional import jax import jax.numpy as jnp from ....geom import masked_pairwise_diffs, norm def psiformer_masked_pairwise_diffs( x: jax.Array, y: jax.Array, x_mask: jax.Array, y_mask: jax.Array, *, eps: float = 1e-26, ) -> tuple[jax.Ar...
8bf8b6e3ae5e67cac0f2d31d545e624d89d8a7769c2f07aa43dd27235190462f
Python
2,760
83
# 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 from typing import List from omegaconf import II from fairseq.dataclass import FairseqD...
25d88b410d33b6828dd8bb389e91e72640df3eb664d6b9fb7f2bc31b44a4860b
Python
2,761
61
import os import tempfile import unittest import numpy as np from medaka.common import Region, Sample from medaka import datastore class TestStore(unittest.TestCase): @classmethod def setUpClass(cls): pos = np.array([(0, 0), (0, 1), (1, 0), (2, 0), (2, 1), (2, 2), (3, 0), (4, 0), (4, 1), (4, 2), (4...
64708adb2fb2cbfed56ed5b425f0db540a4f7c4cec0193be835ec9ab027e6aa2
Python
2,761
85
import time import numpy as np from omegaconf import DictConfig, OmegaConf import torch from pathlib import Path import os import json import copy import argparse import random # from torch.nn.parallel import DistributedDataParallel as DDP # from torch.distributed import init_process_group, destroy_process_group from...
d4b40afeb9cb572fa1f6039123b69ac74957121c9d24e01f9594567e37b69175
Python
2,761
67
# 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, sys import subprocess import re from subprocess import check_call, check_output WORKDIR_ROOT = os.environ.get('WORKDIR_ROOT', Non...
400038e5e20279bb2523e4710a6f6bdb316622e09cefe40eeb9c4d13bc4501e6
Python
2,762
67
# from data_specific.Proc_TS_Dataset import Get_TS_Datasets, Save_TSImgDatasetInfo, Load_TSImgDatasetInfo # from data_specific.Proc_Features import Save_Features_FromTSDatasets # from data_specific.Proc_TSImgs import Save_TSImgs_FromTSDatasets, Load_TSImgs_PT # from LibKIME.LibML import Split_Dataset_PT import sy...
967cec40286871c5e99ea83cc56712c0d4759aba91a8f03bbcd0c26a3400a174
Python
2,763
101
import pandas as pd import pytest from pgmpy.models import DiscreteBayesianNetwork from pgmpy.structure_score import ( AICCondGauss, AICGauss, BICCondGauss, BICGauss, LogLikelihoodCondGauss, LogLikelihoodGauss, ) @pytest.fixture def small_df(): return pd.DataFrame(data={"A": [0, 0, 1], "B...
4a098c3a2de5db5454e1db68011fdf2ebd798a9e38de5519aa4a677d83f54715
Python
2,767
80
import unittest from unittest.mock import patch from pyecharts.charts import Bar from pyecharts.render.engine import RenderEngine from pyecharts.datasets import EXTRA, FILENAMES from pyecharts.globals import CurrentConfig class TestEngine(unittest.TestCase): def test_generate_js_link(self): FILENAMES.up...
4fe4cec5d9a65616204d6e72714b4f317f1f993b22a4a287a53c180c85f06e11
Python
2,768
103
""" Copyright (c) Facebook, Inc. and its affiliates. Copyright (c) Microsoft Corporation. Licensed under the MIT License. Adapted from https://github.com/FAIR-Chem/fairchem/blob/main/src/fairchem/core/models/gemnet/layers/embedding_block.py. """ import numpy as np import torch from mattergen.common.gemnet.layers.base...
ee78ae920bcd7b2bb1cdea1abcd59126a58c5dd145723a558757b1bff28166f2
Python
2,768
70
from os.path import join from config_path import PATHWAY_PATH from model.builders.prostate_models import build_pnet_KEGG task = 'classification_binary' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', 'params': { 'd...
f960369560b2e3acc0acc4ca23a93babeb55b74d26096ecfd0017370e8e1272c
Python
2,769
77
import vtk, qt, slicer from math import sqrt, cos, sin from slicer.util import VTKObservationMixin from .PointerEffect import AbstractPointerEffect class AbstractCircleEffect(AbstractPointerEffect, VTKObservationMixin): sphere = None sphereModelNode = None def __init__(self, sliceWidget): AbstractPointer...
06a3930bfc3e3ca2bbd9e65d3af4bd5f7c97045d95c866821906c1b43e6567ac
Python
2,770
75
import h5py import numpy as np import tensortools as tt import pickle import os # Set parameters num_animals = 12 replicate = 0 n_components = [3] total_runs = 100 for run in range(0, total_runs): print('Replicate: ', run+1) print('\n') output_dir = f"tca_factors" os.makedirs(output_dir, exist_ok=Tru...
878276fc499527cef9c5c58ab8f771cbeb06e0f3db5745cffdadb31d3231e230
Python
2,771
88
"""Helper functions for working with datasets represented as a pandas.DataFrame""" from __future__ import annotations import pathlib import numpy as np import pandas as pd def get_dataset_csv_filename(data_dir_name: str, timenow: str) -> str: """Get name of csv file representing dataset. This function is ...
192865c236b6c71c542c199f2b8e962ed04df1d3c6f442a5e55a55294da6c945
Python
2,772
76
import unittest from types import SimpleNamespace from unittest.mock import patch from GMXMMPBSA import make_top from GMXMMPBSA.exceptions import MMPBSA_Error class RequireComplexTopologyTest(unittest.TestCase): def _checker(self, **file_overrides): files = SimpleNamespace( complex_tpr='com.t...
c305d5ee1610e5f27e3e76d38bca3a29ac18b51cd7d69fd894e8085f77a525af
Python
2,772
63
import attrs @attrs.define class ConfigMetadata: """Dataclass that represents metadata about a configuration file Attributes ---------- filename : str The name of the configuration file. model : str The name of the model in :mod:`vak` that the configuration file is use...
c7e630a4dc4737a08a684bbc58301dbdf9c66507e69d55e810ab8ce6de9b9d64
Python
2,773
64
import torch.nn as nn from ..layers.convolutions import Convolutional class Residual_block(nn.Module): def __init__(self, filters_in, filters_out, filters_medium): super(Residual_block, self).__init__() self.__conv1 = Convolutional(filters_in=filters_in, filters_out=filters_medium, kernel_size=1, ...
f9cac1ad2fbeb37801aab7b617b350aaec3c788beb77eceb98cb70c06f780a58
Python
2,774
75
import h5py import numpy as np import tensortools as tt import pickle import os # Set parameters num_animals = 12 replicate = 0 n_components = [3] total_runs = 100 for run in range(0, total_runs): print('Replicate: ', run+1) print('\n') output_dir = f"tca_factors" os.makedirs(output_dir, exist_ok=Tru...
99d85d8565e1f03874eebaca2f70624337d507f81ba2bdcbdec55d198f2031df
Python
2,775
95
# 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 csv import io import logging import os import os.path as op import sys from dump_hubert_feature import HubertFeatureReader from featur...
559f634312722234a47cc5f9b235a721790aefd9fbd557ea2b6310edd0d599d1
Python
2,779
77
import os from os.path import join, basename, dirname import pandas as pd from matplotlib import pyplot as plt from config_path import PLOTS_PATH, PROSTATE_LOG_PATH base_dir = join(PROSTATE_LOG_PATH, 'review/cnv_burden_training') files = [] files.append( dict(Model='P-NET with CNV burden', file=join(base_dir, ...
f65dbcd67eb2dbfee8859d81aab1825795f698192c4339903c547637ca51d907
Python
2,779
92
import json import re import unicodedata from examples.mms.data_prep.norm_config import norm_config def text_normalize(text, iso_code, lower_case=True, remove_numbers=True, remove_brackets=False): """Given a text, normalize it by changing to lower case, removing punctuations, removing words that only contain di...
3829578f6632314699be17d6f12a9aceaaaacdb510b66dd4c99f7f6be38d79e4
Python
2,780
85
from __future__ import annotations from logging import LogRecord from pathlib import Path from typing import TYPE_CHECKING import pytest from poetry.console.logging.io_formatter import IOFormatter from poetry.console.logging.io_formatter import _log_prefix from poetry.console.logging.io_formatter import _path_to_pac...
0804004b881bb4fc08358ddde0caca4261f532cbd6f10bf7079cac23911f491a
Python
2,781
96
"""Regression test for the dropped `store_strains` await in `sync_doc_db`.""" import asyncio from apiadapters.straininfo import AsyncStrainInfoAdapter from apiadapters.straininfo.straininfo import StrainRef from brenda_references import brenda_references as bref from brenda_references import db as db_module from bre...
67336b4d5812f53e7e94e401227fbf9245af3ae17b98cfa7bbf60cfd1c042e42
Python
2,781
83
import colour import numpy as np from matplotlib import rcParams from matplotlib.colors import Colormap, LinearSegmentedColormap def set_axes(): rcParams["axes.spines.right"] = False rcParams["axes.spines.top"] = False rcParams["axes.edgecolor"] = "black" def set_figure(): rcParams["fig...
bcdea719fe6ada7d53a82a644728eb9ac73d1a0d74a64feb1871df9ad59c12df
Python
2,782
76
# -*- coding: utf-8 -*- import os import gc import argparse import json import random import math import random from functools import reduce import numpy as np import pandas as pd from scipy import sparse from sklearn.model_selection import train_test_split, ShuffleSplit, StratifiedShuffleSplit, StratifiedKFold from sk...
5eb82f8479e48599834285f21c5702823b9043ae70e5baca6c98e79951443c5c
Python
2,783
84
"""Per-epoch batch-weighted metric aggregation and full-training stat history (replaces Logger.stat lists).""" from __future__ import annotations from collections import OrderedDict from typing import Any, Dict, List, Optional class RunningWeightedAverage: def __init__(self) -> None: self._sum...
104859160cc41b1b99ffdcad94551012d47cc2e64f9aded3f33aeaa0b4dc6f35
Python
2,786
75
import h5py import numpy as np import tensortools as tt import pickle import os # Set parameters num_animals = 12 replicate = 0 n_components = [3] total_runs = 100 for run in range(0, total_runs): print('Replicate: ', run+1) print('\n') output_dir = f"tca_factors" os.makedirs(output_dir, exist_ok=Tru...