sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b6066d26e67055234413c72d7e195fc3d9a197b9475882a1f37e5f9b294b85b6
Python
1,508
38
import os import numpy as np import nibabel as nib import pandas as pd import tarfile import shutil #extracted up to 8841 path_from = '/mnt/aertslab/USERS/Ben/BRAIN AGE/ABCD/Package_1200046/fmriresults01/abcd-mproc-release4/' #"/Volumes/aertslab/USERS/Anna/ModelsGenesis/keras/data/ngz/" extract_to_path = '/mnt/aertsla...
9b32320a5998da48adb3649296f29a1c8a585268d67874a571d6dafb03032be1
Python
1,510
53
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["splicepoint_model_spec"] = dict( type="BothLSSIModels", acceptor="model/splicepoint-model-acceptor-1", donor="model/splicepoint-model-donor-1", ) msp.architecture["num_motifs"] = 82 msp.arch...
2fb643986cbf9ea22f388ee9f6983aa09914e24092c5e96cdda16e8c7e481bce
Python
1,512
57
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) selected_splicepoints = [ dict( type="FromLoadedSplicepointModel", splicepoint_model_path=f"model/msp-216a1_{i}", splicepoint_index=2, ) for i in (2, 3, 4, 5) ] msp.architecture["num_...
7a76121c1b4db7d32c49c0f9392b5db7c51a797ee98c8d25173d1278992d552e
Python
1,512
45
import torch from survival_plus_x.models.vit import vit_output_head from survival_plus_x.models.cox_lightning import metrics_from_step_outputs from survival_plus_x.losses.cindex_boosting import cindex_approx from survival_plus_x.models.model_head import SurvivalModelHead class CindexHead(SurvivalModelHead): def ...
cdd1e3d888b63b06386245a7493002c7e76f5d27029eef4593e8a60b33f7b385
Python
1,512
51
#!/usr/bin/env python """ Convert from interval file to interval index file. usage: %prog <options> in_file out_file -c, --chr-col: chromosome column, default=1 -s, --start-col: start column, default=2 -e, --end-col: end column, default=3 """ import optparse from bx.interval_index_file import Indexes ...
e826a42607b3e66ffaa161b1e8983ebf42a4d255cab8fca33ba9b1d83b1e92dc
Python
1,512
40
import numpy as np def eclips_from_onehot(all_eclip_motifs): """ Produce a list of eclip peaks from a one-hot encoding of eclip peaks. Parameters ---------- all_eclip_motifs: a matrix of shape (N, L, M, R, 2), where M is the number of motifs, R is the number of replicates, and 2 is the on...
0f6317c01a4b36b0e27c6f781ca64d30914c5cb2751c4239bdc38d6355a23c1b
Python
1,513
55
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ Change the title from a molecule file to metadata value of a given-id of the same molecule file. """ import argparse import random import string from openbabel import openbabel, pybel openbabel.obErrorLog.StopLogging() def main(): parser = argparse.Arg...
618bc143897b90aa10b69862af5e888d0f70a91662f9078b2c394212f34521f3
Python
1,513
58
#!/usr/bin/python import sys import os import re import pandas as pd import numpy as np import math import json import glob import ConfigParser def main(): ##### check argument ##### if len(sys.argv)<2: sys.exit("ERROR: not enough arguments\nUSAGE ./magma_expPlot.py <filedir>") ##### get command line arguments #...
1f769252ea0eb98bab34231e887c93223d718d2971e764ff93bb1f6d362e534f
Python
1,514
41
from io import open from os import path from setuptools import find_packages, setup import versioneer here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, "README.md"), encoding="utf-8") as f: long_description = f.read() # Arguments marked as "Re...
cf805a4a072f134cbcc572374664dc560cc8541cd63a876d4893dc232701329a
Python
1,515
48
import cv2 as cv import F01, F02, F03, F04, F05, F06, F07, F08, F09 class Features(object): def __init__(self): self.features = { "F01": F01.F01(), "F02": F02.F02(), "F03": F03.F03(), "F04": F04.F04(), "F05": F05.F05(), "F06": F06.F0...
9740d8054771b0a2358f2fca3c27298ba19885e87e1784c424fdde6cba9b20e1
Python
1,516
54
'''bdpy.mri.image''' from itertools import product import numpy as np import nibabel from bdpy.mri import load_mri def export_brain_image(brain_data, template, xyz=None, out_file=None): '''Export a brain data array as a brain image. Parameters ---------- brain_data : array Brain data arra...
6bfc083603e2397f8c5bd2e6f1edaa8749115da293946548cb458d7a1a50d643
Python
1,517
53
"""ANTS interfaces.""" import logging import os from nipype.interfaces.base import isdefined, traits from niworkflows.interfaces.fixes import ( FixHeaderApplyTransforms, _FixTraitApplyTransformsInputSpec, ) LOGGER = logging.getLogger('nipype.interface') class _ApplyTransformsInputSpec(_FixTraitApplyTransfo...
6ced96b91f2ddb97fbf10900ced74951642217270a7ef5a0f0d17d729bba43c4
Python
1,517
61
import re import sys shape_file = sys.argv[1] pattern = re.compile("^>.*$") toWrite = "" count_for_id = 1 seq_counter = 0 new_id = "" seq_id = [] seq_string = [] orig_id = [] name_file = "FASTA/data.names" array_all_chunks = [] with open(name_file, "r") as f: for line in f: if len(line.strip()) == 0: ...
b2ea7a4f0413033e438fc59a1e0507d7305ff1c79dc5e400f60dbfaaee1d1cee
Python
1,517
57
import configparser import os try: import pathlib as plib plib.Path() except (ImportError, AttributeError): import pathlib2 as plib except (ImportError, AttributeError): raise ImportError("no pathlib detected. For python2: pip install pathlib2") thisDirectory = os.path.dirname(os.path.abspath(__file...
4edfd8866cfb359e43419fd1762e098ec7542479897779b01e450e7170ddd8dd
Python
1,518
53
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["splicepoint_model_spec"] = dict( type="BothLSSIModels", acceptor="model/splicepoint-model-acceptor-1", donor="model/splicepoint-model-donor-1", ) msp.architecture["num_motifs"] = 82 msp.arch...
9525127b9b784af2867127a04c36a1b19b93f5267f5c62a24f9c8401858dc52a
Python
1,518
60
"""myapp.py Usage:: # The worker service reacts to messages by executing tasks. (window1)$ python myapp.py worker -l INFO # The beat service sends messages at scheduled intervals. (window2)$ python myapp.py beat -l INFO # XXX To diagnose problems use -l debug: (window2)$ python myapp.py beat -l de...
064941bd065a807b887bf7b3e741baea11d57a7dac54b3f8459c7530e5ca7182
Python
1,519
39
import pathlib import sys import unittest from asmc.asmc import DecodingParams, DecodingMode data_dir = pathlib.Path(__file__).resolve().parent.parent / 'ASMC_data' if not data_dir.exists(): print(f'ERROR. {data_dir} does not exist. Did you clone ASMC recursively with submodules?') sys.exit() class TestDeco...
48fddccac8ab4326601ae1cd825c528347effcf3144d5d0a77a2435207fec677
Python
1,519
57
""" Graph Neural Network training utility methods :author: Afan Secic (main developer), Anna Saranti (corrections and refactoring) :copyright: © 2020 HCI-KDD (ex-AI) group :date: 2020-12-01 """ import networkx as nx import copy import numpy as np import torch #class gnn_training_utils: def check_if_...
71d05eb2f02d7cb462aafe4b877c7a7c9bfc619539097f899f580bc223c3cb96
Python
1,519
53
from unittest.mock import MagicMock, Mock from click import Option from celery import Celery # This module defines a mocked Celery application to replicate # the behavior of Pyramid-Celery's configuration by preload options. # Preload options should propagate to commands like shell and purge etc. # # The Pyramid-Cel...
dfeafba1898af5d6b1ca1bd52727db974ca0dd54615295a2f80f450a56d8bf1b
Python
1,519
45
import numpy as np import math import pdb # ------------------------------------------------------ # ParentIndex Check def parentindex_check(swc_matrix, soma_rows, tree_rows, check_list_df): set_root_flag = False invalidparent_to_root_flag = False # check root ParentIndex is -1 check_list_df.loc[3...
c14f0af8d74f701fd1e018f7b3346ab9bb9412f3e0c89c16cc6ef899cfd3aa38
Python
1,520
46
#!/usr/bin/env python # Created on: October 30, 2013 __author__ = "Sven Kreiss, Kyle Cranmer" __version__ = "0.1" import optparse parser = optparse.OptionParser(version=__version__) parser.add_option("-i", "--input", dest="input", default="atlas_counting_model/standard_combined_meas_2ph_model.root", help="Input ro...
aa53fc40c697a4e74ebfd511d68d5b4191b9b6d3a92234542fe5c3b65c794b63
Python
1,521
49
import warnings import numpy as np from sklearn import preprocessing from sklearn.pipeline import Pipeline import copy warnings.filterwarnings("ignore", category=DeprecationWarning) warnings.filterwarnings("ignore", category=FutureWarning) class LogStandardScaler: def __init__(self, selected_columns): su...
2f708433fa526b91a35a9bbeda1562b225d1c3ead302f19c86774c412f0b548d
Python
1,522
58
from .bulletin import Bulletin from bs4 import BeautifulSoup class WestBengal(Bulletin): def __init__(self, basedir): statename = 'WB' super().__init__(basedir, statename) self.bulletin_url = 'https://www.wbhealth.gov.in/pages/corona/bulletin' self.match_text = '2019 ncov bullet...
57e5ab84630a64a29e28f0159afb97de83e462463560edb091ae1201119275a6
Python
1,522
49
"""Options shared by the test suite. Tests marked `acceptance` take minutes, so pyproject.toml deselects them by default; select them with `pytest -m acceptance`. """ import pytest def pytest_addoption(parser: pytest.Parser) -> None: group = parser.getgroup("acceptance", "acceptance tests (pytest -m acceptance)...
9bf69b13670497f7849cab9d3fbd3f244c3989d7fd1b60d92c597582a0c2c973
Python
1,522
43
import argparse import os import shutil import sys THIS_DIRECTORY = os.path.dirname(__file__) parser = argparse.ArgumentParser( prog="search_for_new_screenshots", description="Searches a Selenium screenshot directory for screenshots used in the admin docs and grabs new ones if available", ) SEARCH_FOR = [ ...
663ce4d9d37a52d3472a861429ef81f1b26030a898609fa0f2ea9bd852cd113d
Python
1,524
48
from unittest import TestCase import numpy as np from scipy import stats import spateo.segmentation.bp as bp from ..mixins import TestMixin class TestBP(TestMixin, TestCase): def test_create_neighbor_offsets(self): neighborhood = np.zeros((3, 3), dtype=bool) neighborhood[0, 1] = True ne...
cb50a4a50e8bdfd3f9b1a218cd86d9bd7075e9dde445025a1084257af9706366
Python
1,524
48
""" Verify that we use the correct trained models. This test should FAIL if we use re-trained models, and it will have to be updated. """ import unittest import joblib from pathlib import Path from metal_auxiliaries import MD5_HASH_CODES class TestTrainedModels(unittest.TestCase): def test_correct_hash(...
222722b7becc1b1548f044cc3d304ae63fab1d61cd464550fe694dbb9987e509
Python
1,526
49
import tensorflow as tf from tensorflow.keras.layers import Dense from tensorflow.keras.models import Sequential from gradient_accumulator import GradientAccumulateModel def create_model(): input = tf.keras.layers.Input(shape=(10,)) x = Dense(32, input_shape=(10,), activation="relu")(input) x = Dense(16,...
870e26cc48c61579bebf1bacd8305f2855b49caa06d226cbe521fa4a17dc86b6
Python
1,526
49
import os import subprocess # base directory BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # pip installation if not os.path.exists(os.path.join(BASE_DIR,'biomedisa/settings.py')): # metadata import importlib_metadata metadata = importlib_metadata.metadata("biomedisa") __all...
134f3de5208e61ccb2b790e8872f3deb75f99cef6bb1b0e011df22b080f88023
Python
1,527
40
import json from tabulate import tabulate # results = json.load(open("output/output.json","r")) def write_fancy_output(results, out_file: str = 'output.md'): output_md = "" output_md += f'## PeptideCRF - Results\n' output_md += f'### Summary of {results["INFO"]["size"]} predicted sequences\n' output...
716c21104a477d88cfa8981ada2d257a3347b222309c991b90adf92d1935d023
Python
1,527
58
""" Code here relates to measurements performed on ABF sweeps. """ import numpy as np import pyabf def getMeanSweep(abf, baseline=None): assert isinstance(abf, pyabf.ABF) meanSweep = np.zeros(len(abf.sweepY)) for sweepNumber in abf.sweepList: abf.setSweep(sweepNumber, baseline=baseline) m...
114aaba6f73c99470fcae81900793a809c4212ea1effc22d23590b3a1fbc5f2c
Python
1,528
49
""" This file tests retrieval of values from the user list. The user list replaces one cell in the waveform editor for episodic files. Instead of using a value and a delta, the user can provide a list of values to apply by sweep. """ import sys import pytest import numpy as np try: # this ensures pyABF is import...
11ecf5ec49e0722ad51d5568c9b0a55d2e77d78fd8cf9e091735e576e6c47608
Python
1,528
38
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Tests for clustering API""" import unittest from sknetwork.clustering import * from sknetwork.data.test_graphs import * class TestClusteringAPI(unittest.TestCase): def setUp(self): self.algos = [Louvain(return_aggregate=True), Leiden(return_aggregate=Tru...
48a06027b2b1318b4ad8c1cf70281929447d3062991c154668b1c50e1fa638f9
Python
1,528
34
from pyrosm.data_manager import get_osm_data from pyrosm.frames import prepare_geodataframe from pyrosm.utils import validate_custom_filter import warnings def get_poi_data(nodes, node_coordinates, way_records, relations, tags_as_columns, custom_filter, bounding_box): # Validate filter custom...
6385d8616825043dce50920f799ffd7628175ab4db49c185fef3a3b973ff3cd1
Python
1,528
32
import pysam.utils annotate = pysam.utils.PysamDispatcher('bcftools', 'annotate') call = pysam.utils.PysamDispatcher('bcftools', 'call') cnv = pysam.utils.PysamDispatcher('bcftools', 'cnv') concat = pysam.utils.PysamDispatcher('bcftools', 'concat') consensus = pysam.utils.PysamDispatcher('bcftools', 'consensus') conve...
64d796cf8382e44744ecdc85eec870fc6bfe69d44ae79f4178feeb2288641036
Python
1,528
37
from os.path import abspath, join def run(num_procs): from spitfire.chemistry.mechanism import ChemicalMechanismSpec from spitfire.chemistry.tabulation import build_nonadiabatic_defect_transient_slfm_library import spitfire.chemistry.analysis as sca from spitfire.data.get import datafile import nu...
481de19f501dd54b5b6fcdc9c97af6e23b64cb1378ab6e6dcb2e07137c96283b
Python
1,530
54
"""Tests for specparam.modes.mode.""" from collections import OrderedDict import numpy as np from specparam.modes.definitions import ap_powerlaw from specparam.modes.paramdef import ParamDefinition from specparam.modes.mode import * ##################################################################################...
d043124a91296abcbb0f3ab3f0be64d4c09a3c5963d4121429a28a1fd3299250
Python
1,530
49
import torch import torch.nn as nn import math import numpy as np import torch.nn.functional as F from torch.autograd import Function class ReverseLayerF(Function): @staticmethod def forward(ctx, x, alpha): ctx.alpha = alpha return x.view_as(x) @staticmethod def backward(ctx, grad_out...
51b0c141b42e8041b72b1b3bae97d906de114a4fc3910f14cc7d485a26c3a458
Python
1,531
64
import os import tempfile import subprocess import json import tqdm.auto as tqdm def load_architecture(path): overall_path = f"experiments/{path}" if not path.endswith(".py"): return None if path in {"msp-266a1.py", "msp.py"}: return None if not os.path.exists(overall_path): re...
7b4a8879717cf00d849490e75f1c52e421f18a3893d542aa27f49d127d561b31
Python
1,531
57
"""Phase 5a tests for site collections.""" from __future__ import annotations import torch import torchlens as tl from torchlens.intervention.sites import SiteCollection, sites as _sites def test_sites_builds_structured_sweep() -> None: """``sites()`` should compose layer, op, and mode sweep dimensions.""" ...
e83a3844042d1040b4b91dc3b033dcaea2fddb44c901dfccb084fa30a351e755
Python
1,531
45
# Import the necessary modules and functions from pathlib import Path import matplotlib.pyplot as plt from BM3D.src.denoise import bm3d from Loader.src.utils import load_nii from NLM.src.denoise import nlm if __name__ == "__main__": # Get the base path of the current file base_path = Path(__file__).parent ...
85a37c58b7688885e6da412120f522ec88f4321da1af487588614aaa00b5e001
Python
1,532
62
import sys sys.path.insert(1, '/u/home/r/ryo10244/Xiao_lab/dsRNA_pred/script/utils') import re import pysam import argparse as ap import pandas as pd import numpy as np from utils import * def main(args): argp = ap.ArgumentParser(description="concatanate train and null file", ...
e0cef8b0bd6b9cc1fe165b26bdb560117d100766d52162597d326160a2b6c710
Python
1,532
70
"""Replace a module output with a raw PyTorch forward hook. Run with: ``python examples/intervention/17_raw_forward_hook_replacement.py`` """ from __future__ import annotations import torch import torchlens as tl class HookedMlp(torch.nn.Module): """Tiny MLP with a raw-hook replacement site.""" def __in...
a943d76c4a1f16cd77d52c5ae26910d1609315944469b256eb57e0c72982f27d
Python
1,533
55
import json import os import appdirs import logging from score_behavior import appauthor, appname """ the system will search for config files: 1) in the default user application data folder (changes by OS), under score_config.json 2) in the current directory, under score_config.json 3) the command line argument give...
9c345bcf53ce5168ed6d28fe8d22d10a3295db8c458d230c8df8dbd06557046f
Python
1,534
48
import os import warnings import h5py import numpy as np import scanpy as sc from scbig import run_scbig, preprocess, setup_seed warnings.filterwarnings('ignore') for dataset in ['DPT', 'YAN', 'Deng']: print('---------------- data: {} ----------------- '.format(dataset)) setup_seed(0) method = 'scBiG' ...
fda3a48de6a49d14470b06429e17a42dc71f97011ff72b44a57e59db0ad45f3c
Python
1,534
40
from setuptools import setup, find_packages with open('README.md', 'r') as fh: long_description = fh.read() # Read install requirements from requirements.txt REQUIREMENTS = [i.strip() for i in open("requirements.txt").readlines()] setup( name='rcc-xcorr', # the name used for pip install version='1.0.14'...
a1b69e7f2fda09eeec0c5d58546cfa26ad85503fe6eab5e52925e1e0b5cc2cd8
Python
1,535
65
import cv2 import numpy as np def contrast_adjust(image, CLAHE_grid, CLAHE_clip): """contrast adjust images Parameters ---------- image: numpy.ndaray image to pre-process. CV_8UC1 (uint8) or CV_16UC1 (uint16) CLAHE_grid : int passed as tileGridSize to cv2.createCLAHE. If -1, skipp...
eaa44f0fecdd93a28bfc93a84e7e13e844b9ba394b0f518c5094c2bd04efad64
Python
1,535
42
""" Demonstrate how to load many ABFs and use a cached stimulus waveform from an ATF file which only gets loaded once. Since the ATF file is kept in memory, this is stimulus waveform caching. NOTE: this type of caching is not actually used! The Stimulus class is used for this! """ import os import sys import glob im...
69fb095e9353e1e5a014494635aac46f32babbef3a1ee60416b4f737ff15c7fc
Python
1,536
41
"""Prepare ADE20K dataset""" import os import shutil import argparse import zipfile from gluoncv.utils import download, makedirs _TARGET_DIR = os.path.expanduser('~/.mxnet/datasets/ade') def parse_args(): parser = argparse.ArgumentParser( description='Initialize ADE20K dataset.', epilog='Example:...
a90d04c248d726e16b15f9bd189421d0e5d09f9d9c576928687ddd85a41da51c
Python
1,536
50
""" Keycloak OpenID Connect backend for Galaxy. This backend extends Galaxy's base OIDC implementation with Keycloak-specific features. """ from galaxy.authnz.oidc import GalaxyOpenIdConnect class KeycloakOpenIdConnect(GalaxyOpenIdConnect): """ Keycloak OIDC backend for Galaxy. Inherits PKCE support, l...
cee2069efbba1f2703815a249c5c11ff7ec714913ed19658bd23c8aa3b0e3dfe
Python
1,536
39
import sys from ij import IJ # Fiji Jython interpreter implements Python 2.5 which does not # provide support for argparse. input_file = sys.argv[-8] image_datatype = sys.argv[-7] filter = sys.argv[-6] radius = sys.argv[-5] mask = sys.argv[-4] light_background = sys.argv[-3] dont_substract = sys.argv[-2] tmp_output_p...
833557b323e481c0d9479352d0636380cba221f37e5a138aaa9a5c524e919272
Python
1,537
60
class LLSpyError(Exception): """ Generic exception indicating anything relating to the execution of LLSpy. A string containing an error message should be supplied when raising this exception. """ class ParametersError(LLSpyError): """ Exception indicating something is wrong with the parame...
e4143f1fb17f467e294480f29e5e4f527aabfa7e68f4224164281a137da13910
Python
1,537
47
"""Add workflow_source and workflow_source_type and public column Revision ID: a99a5b52ccb8 Revises: 7ffd33d5d144 Create Date: 2024-10-10 14:23:29.485113 """ import sqlalchemy as sa from galaxy.model.migrations.util import ( add_column, column_exists, drop_column, transaction, ) # revision identifi...
18649f3f0eb5892a838542aaf4a45b8591eca46ceb568c675fa1c999c4785a64
Python
1,538
45
import numpy as np import tqdm.auto as tqdm from permacache import permacache, stable_hash from modular_splicing.gtex_data.annotation.compute_optimal_sequence import ( compute_optimal_sequences_all, ) def compute_psis_from_annotation(sites, index_juncs, tpm_junc_each, annotations_chosen): psis = np.zeros((l...
67637c8db1ada42dc7985fdeea5e7bc345b12e70e93a11902cf96bec2809a821
Python
1,538
29
import os import slicer from slicer.ScriptedLoadableModule import * # Source: https://github.com/lassoan/SlicerSegmentEditorExtraEffects class SegmentEditorBiomedisa(ScriptedLoadableModule): """Uses ScriptedLoadableModule base class, available at: https://github.com/Slicer/Slicer/blob/main/Base/Python/slicer/S...
828e95ab5eb6397b24df3f774aa360ea0f4c46ca11d0b7c57f0c99b91a7e2e8d
Python
1,538
54
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["splicepoint_model_spec"] = dict( type="BothLSSIModels", acceptor="model/splicepoint-model-acceptor-1", donor="model/splicepoint-model-donor-1", ) msp.architecture["num_motifs"] = 82 msp.arch...
b8b1a6441063a09eed4528cedf4316ce1c23e815959a3869e111a74f1b85c40d
Python
1,540
54
from typing import Optional, Union import numpy as np from anndata import AnnData import logging as logg import scipy.spatial as spatial def disk( adata: AnnData, use_data: str = "X_umap", radius: float = 10.0, rates: int = 1, method: str = "mean", copy: bool = False, ) -> Optional[AnnData]: ...
4d31c81171370f279cc47759d15850f96c0662736d4b435ba5f03b2eeb0fa1c4
Python
1,543
50
""" Test ABF with variable length sweeps. """ import glob import os import sys import matplotlib.pyplot as plt import numpy as np try: PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_DATA = os.path.abspath(PATH_HERE+"../../../data/abfs/") PATH_SRC = os.path.abspath(PATH_HERE+"../../../src/") ...
8cc3e28adda3da33f4059b1398c47e984d94ce12376f48de0e3fdca485472285
Python
1,543
56
import pytest from . import utils import rpy2.rinterface as rinterface rinterface.initr() def _just_pass(x): pass @pytest.fixture(scope='module') def silent_console_print(): with utils.obj_in_module(rinterface.callbacks, 'consolewrite_print', _just_...
a6c6730c928ff15e56c5d27a39aacc14cd4e3cc48c6d390472c7aaab2c7ac596
Python
1,545
53
import json import tns.validator as tested from jsonschema.exceptions import ValidationError from nose.tools import assert_raises from pathlib import Path DATA = Path(__file__).parent.resolve() / 'data' def dummy_params(): with (DATA / 'params2.json').open() as f: data = json.load(f) return data de...
d9bae89f1337738ac8b0dd0b2468a52cf47311f866f96684d7d3540c18f9b8e0
Python
1,545
51
import os import pytest from mirp._images.digital_xray_image import DXImage from mirp._masks.base_mask import BaseMask from mirp.extract_features_and_images import extract_features_and_images, extract_images CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) @pytest.mark.ci def test_basic_dx_feature_extractio...
63005718af7b23e6a3214369cc79b1efd0e7596f1d10adcc125f36e5add9dd17
Python
1,546
57
import pathlib import shutil import tempfile import h5py import numpy as np import pytest from impose import formats data_path = pathlib.Path(__file__).parent / "data" def test_load_brillouin(): path = data_path / "brillouin.h5" data, meta = formats.load(path) # check metadata assert np.isnan(met...
68e3d930144949b3c48ab744c9499520b209b111027f1aab938d3f4f75b1dfc3
Python
1,546
50
import os import numpy as np from modular_splicing.data_pipeline.create_dataset import create_dataset def select_to_match(lengths, small, large): [large_idxs] = np.where(large) np.random.RandomState(0).shuffle(large_idxs) lengths_ordered = lengths[large_idxs] lengths_cumulative = np.cumsum(lengths_ord...
bf62aeb3edd21743d3aa0698476003ee260741bdebdbd91bfb882e8d873ed2a5
Python
1,546
33
from tensorflow.keras.callbacks import TensorBoard from tensorflow import GradientTape import tensorflow as tf # This extends TensorBoard to save gradients as histogram # ExtendedTensorBoard can then be used in replace of tf.keras.callbacks.TensorBoard. class ExtendedTensorBoard(TensorBoard): def _log_gradients(s...
01b854b54851a6ce426dd6b2d8d564954873344cfa0d9206f447340910a5bdf1
Python
1,547
42
import torch import numpy as np import torch.distributed as dist # define the strategy of weight decay class Scheduler(): def __init__(self,end_lr,decay_factor,checkpoint,lr_scheduler,restart,optim,model,swa_model,save_pes): self.best_loss = 1e30 self.rank=dist.get_rank() self.end_lr=end_lr...
33347c30a126ae3cb9ac7b80cdf0802cb7adba31457adf90e9728503f1bfc1f3
Python
1,547
52
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict( type="ParallelSpatiallySparse", sparse_specs=[ dict(type="SpatiallySparseAcrossChannels"), dict(type="SpatiallySparseAcros...
6239f18d461db50843128a977affdb253b2cd8c9e9c39fa38bbacda64192a368
Python
1,547
36
"""Prepare DIV2K - bicubic downscaling x4 competition datasets""" import os import argparse import zipfile from gluoncv.utils import download, makedirs def parse_args(): parser = argparse.ArgumentParser( description='Initialize DIV2K - bicubic downscaling x4 competition dataset.', epilog='Example: ...
0663e8131f41d9cc74303d2412c82a6f633b585cb9e1bcaa61ecd924293fab44
Python
1,548
48
import numpy as np from keras.models import load_model from Bio import SeqIO from load2data import onehot def Pred_Genomic(model_path, chrom_path,result_path,step): """ :param model_path: :param chrom_path: :param result_path: :return: """ model = load_model(model_path.encode(...
21e50e22b3c7cd2d0df3e1c0aaa4bec65f941b44ced6731826dd5f06a0aecb9c
Python
1,548
48
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> import pickle import numpy as np from numpy.testing import assert_array_equal from eelbrain import datasets from eelbrain._stats.spm import LM, LMGroup def test_lm(): ds = datasets.get_uts() model = ds.eval("A*B*Y") coeffs = ds['uts'].ols(model) ...
70d247c799a3ea0c8a619f6065a5658dc451fcf6526d2ba77d89be261b1b2694
Python
1,549
42
""" This module create TransformerClassifPerProt """ # pylint: disable=W0223 import torch.nn as nn class TransformerClassifPerProtMultipleLayer(nn.Module): def __init__(self, originalModel): super(TransformerClassifPerProtMultipleLayer, self).__init__() # Partie multi level embedding NB_LA...
89da2f6f81cc472c28f11dabb19d49d3f67926ec565738448c9e384220894aa6
Python
1,549
49
import sys import torch from src.datasets.base import BaseDataset class CadenaDataset(BaseDataset): def __init__(self, root, split, ntau, normalise=True, scale=1): super().__init__(normalise, scale, False) # Load dependencies sys.path.append(f"{root}/dependencies/Cadena2019PlosCB") ...
e4cc133a0c071876d06e50aaf3bd00bafe7cd4ae784a4869fab862609c6543d5
Python
1,549
39
def entire_model_types(): from modular_splicing.models.lssi import SplicePointIdentifier from .preprocessed_spliceai import ( PreprocessedSpliceAI, ) from .spliceai_as_downstream import SpliceaiAsDownstream from .modified import ( DroppedMotifFromModel, DiscretizeMotifModel, ...
5adf9c333f42682a9e7bf5b404bcdaae7dffed62b2cc97773888e66a25798ac9
Python
1,550
48
import itertools import numpy as np import pandas as pd import tqdm.auto as tqdm from modular_splicing.utils.io import model_steps from modular_splicing.evaluation import standard_e2e_eval pattern = "model/msp-266a1-{splice},{left},{right}_{seed}" CL_VALUES = list(range(0, 1 + 20, 2)) def accuracy_results(splice, ...
bcef3e1acd0825656445851f46e402300a226180c61e554d69818311dfff807f
Python
1,550
49
from setuptools import setup #, find_packages CLASSIFIERS = """ Development Status :: 1 - Planning Intended Audience :: Science/Research Intended Audience :: Developers License :: OSI Approved :: MIT License Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 Progra...
12f6b4fa6ce412739970acc61f610ff76a076bbe92c1e5e47ee12541e862e237
Python
1,551
39
""" Conv2d w/ Same Padding Hacked together by Ross Wightman """ import torch import torch.nn as nn import torch.nn.functional as F from typing import Tuple, Optional from .padding import pad_valid_time, get_padding_value def conv2d_valid_time( x, weight: torch.Tensor, bias: Optional[torch.Tensor] = None, str...
42db69f6e400e2e0a2e4a934cf6a3e4e0b068c7758a9f7bf3c86e6fd625771c8
Python
1,551
43
#!/usr/bin/env python import datetime import os import sys def extract_datetime_from_line(line, year): # Expected format: I0210 13:39:22.381027 25210 solver.cpp:204] Iteration 100, lr = 0.00992565 line = line.strip().split() month = int(line[0][1:3]) day = int(line[0][3:]) timestamp = line[1] p...
4a2d898051c6e7f2cb4c4a1b9bb3684d1d479b938b59db305e55cbbd544f809c
Python
1,551
1
import numpy as np import pandas as pd import time import random # [1] data preprocessing # df = pd.read_csv('./data/GSE75688_GEO_processed_Breast_Cancer_raw_TPM_matrix_gene_filtering_log.csv', index_col=0) # dimension = (genes x cells) sample_inf = pd.read_csv('./data/GSE75688_final_sample_information.csv', index_col...
9316ddec8c57c790cc22a82f8c1a2d342be50de318f09817df8d18a44cc643f5
Python
1,551
44
import setuptools with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setuptools.setup( name="gradient-accumulator", version="0.5.2", author="André Pedersen and David Bouget and Javier Pérez de Frutos and Tor-Arne Schmidt Nordmo", author_email="andrped94@gmail.com", ...
964a4b9ef1f8a5e3cabf16c2a267fd6fcf82314d4cf7fb89aac38ff54f3b6b10
Python
1,551
62
from .models_for_testing import EndToEndModelsForTesting, STANDARD_DENSITY, TEN_EPOCHS FM = EndToEndModelsForTesting( name="FM", path_prefix="model/msp-273.665a3", seeds=(1,), density=STANDARD_DENSITY, binarized_seeds=(1,), binarized_step=TEN_EPOCHS[10], ) # extra FMs just for the e2e tests #...
da0b3b9bfc9d146754ca99a33a1457b64311f2c074df3e2cee9027395488eeb7
Python
1,551
51
import os import pytest from mirp._images.digital_xray_image import MGImage from mirp._masks.base_mask import BaseMask from mirp.extract_features_and_images import extract_features_and_images, extract_images CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) @pytest.mark.ci def test_basic_mg_feature_extractio...
fee15fca2b3f3e6efed1631dac7cfa9a92da9975b1c8a99033d7e474f4e88864
Python
1,551
65
# -*- coding: utf-8 -*- """ Created on Fri Aug 26 09:15:06 2022 @author: LABadmin """ import numpy as np from matplotlib import pyplot as plt import random import sklearn import seaborn as sns import scipy as sp from matplotlib import rc import matplotlib.ticker as mtick import matplotlib as mpl from scipy import s...
58350c9982dd3f262cfc61e11bf258092582c65f9e77ba904876b544a47c31b9
Python
1,552
83
#!/usr/bin/python import sys import os import pandas as pd import numpy as np import math import re filedir = sys.argv[1] if re.match(".+\/$", filedir) is None: filedir += '/' width = 300 #px height = 300 #px obsP = [] f = open(filedir+"input.snps", 'r') f.readline() for l in f: l = l.rstrip() l = l.split("\t")...
cf60ec3adfea85685394a9430e5b0b21b0d3ffb070791328804b32226d3f2a7a
Python
1,552
44
from anndata import AnnData from .logging import logger_manager as lm def copy_adata(adata: AnnData) -> AnnData: """wrapper for deep copy adata and log copy operation since it is memory intensive. Args: adata: An adata object that will be deep copied. logger: Whether to report logging info ...
a9e129212b9f468fd688ecf4873dce8b6410db080b1862dcacc51a6a1b00f781
Python
1,553
38
"""Prepare ILSVRC 2015 DET dataset ========================================= `ILSVRC DET dataset <http://image-net.org/>`_ is a dataset for object localization/detection and image/scene classification task. It contains two hundred full labeled categories for detection and 1000 categories for Object localization This ...
eb30aa0054067dbee3b9326dc80f14fa6a80ddb1524090453084373e4d7ed4eb
Python
1,554
44
"""Tests for specparam.plts.model.""" import numpy as np from specparam.tests.tutils import plot_test from specparam.tests.tsettings import TEST_PLOTS_PATH from specparam.plts.model import * ################################################################################################### #########################...
3b88a4ea7532a3e7ee5f7227aa4a44d4bdd71d1ae1d1e09694dcf97d793f354e
Python
1,555
55
import torch from typing import List from tqdm import tqdm import numpy as np @torch.jit.script def spectrum(E: torch.Tensor, osc: torch.Tensor, sigma: torch.Tensor, x: torch.Tensor) -> torch.Tensor: """ Function for Gaussian broadening of the XAS spectra so that ...
7b00819ce16226506f51fa8a15568efd2aa7e669aecbbfca39f8f5bbd339817a
Python
1,555
58
from permacache import permacache, stable_hash import tqdm.auto as tqdm from modular_splicing.legacy.remapping_pickle import permacache_with_remapping_pickle from modular_splicing.utils.arrays import Sparse from modular_splicing.utils.run_batched import run_batched def _predict_motifs_raw(m, xs, bs): """ Pre...
8f0bf012a8464fd7253a76d3b635eebfc0b1b2416381fe86459282c4c4e62ec4
Python
1,555
48
from __future__ import annotations from pathlib import Path from typing import Optional from grpc import RpcError from bream4.device_interfaces.devices.base_device import BaseDeviceInterface def get_run_output_path(device: BaseDeviceInterface, filename: str, subdirs: Optional[list[str]] = None) -> Path: """Ret...
abc5129a520ea21b656b451ec1f591652935951048aef63cd81dce50bacec90c
Python
1,555
54
""" Flow analysis datatypes. """ import logging from galaxy.datatypes.binary import Binary from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, ) from . import data log = logging.getLogger(__name__) @build_sniff_from_prefix class F...
b7bb888863c692772da6d820ab2f1455f50414e76811579af5394144f03b158d
Python
1,555
54
import exrex import pandas as pd import re import vampire.xcr_vector_conversion as xcr_vector_conversion # We don't take the gap character. aas = xcr_vector_conversion.AA_LIST[:20] # This is how we specify the "tcregex" format. replacement_dict = { # . means any amino acid '\.': '[' + ''.join(aas) + ']', ...
155a0fda095f7e90123a12984844e59013bcff45d544d91d4168b9465053d1a3
Python
1,556
40
import pathlib from PyQt6 import QtCore, QtGui, QtWidgets class DirectoryDialogMultiSelect(QtWidgets.QFileDialog): def __init__(self, *args): """A dialog that lets the user select multiple directories""" QtWidgets.QFileDialog.__init__(self, *args) self.setOption(self.Option.DontUseNativeD...
e42f7cdb0fa47fa024df21a3e42ff77698db5668bf7c75dd0a509efc5aedff46
Python
1,556
51
import os import pytest from mirp._images.digital_xray_image import CRImage from mirp._masks.base_mask import BaseMask from mirp.extract_features_and_images import extract_features_and_images, extract_images CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) @pytest.mark.ci def test_basic_cr_feature_extractio...
e9d27a70727493982d6d8b84b3192cb6e9de58382cad30c583224e4b3ac90b82
Python
1,556
54
#!/usr/bin/env python """The setup script.""" from setuptools import setup, find_packages with open("README.md", encoding="utf8") as readme_file: readme = readme_file.read() with open("HISTORY.rst") as history_file: history = history_file.read() with open("requirements.txt") as f: requirements = f.read...
fd043df9566c07381f9ce6567b73aa5267a704df79f8ef203d85becc99afd505
Python
1,556
53
from unittest import mock import torch from pytest import CaptureFixture from lightly.utils import dist class TestDist: def test_eye_rank_undist(self): assert torch.all(dist.eye_rank(3) == torch.eye(3)) def test_eye_rank_dist(self): n = 3 zeros = torch.zeros((n, n)).bool() e...
91ae525d66bf42182bb2a72344488761239213bc7ca2b0c5661d2ff767e7d4bb
Python
1,557
52
import itertools import os import random ########################################## # main setting finetuned archs ########################################## GLOBAL_PARAMS = { 'ngrams': [1, 2, 3, 4, 5, 6, 7], 'layer': ['last_hidden_state_mean'], # 'pooler_output' } PARAMS_LIST = [ { 'datas...
9fd5493bc9ef984fc000171a52b58d1ee69c8648e6505b4fe09d7b571936233c
Python
1,557
36
import numpy as np def run_2D(pace=100, nsteps=100000, sigma=0.1, height=0.5, biasfactor=10, ipos=np.array([-1,-1]),tag=1): with open("plumed.dat","w") as f: print("""p: DISTANCE ATOMS=1,2 COMPONENTS ff: MATHEVAL ARG=p.x,p.y PERIODIC=NO FUNC=(7*x^4-23*x^2+7*y^4-23*y^2) bb: BIASVALUE ARG=ff METAD ARG=p.x,p....
cef5fabc29bc90bac5df20d5fa84ba18c76a5d468086f78f9f4c2d993c8f7e64
Python
1,557
42
import torch import numpy as np import torch.distributed as dist # define the strategy of weight decay class Scheduler(): def __init__(self,end_lr,decay_factor,checkpoint,lr_scheduler,restart,optim,model,swa_model,save_pes): self.best_loss = 1e30 self.rank=dist.get_rank() self.end_lr=end_lr...
7c0421ed28efeadbbc9f31b6a7048cea45ea8b595943fbc2a93e726307102b36
Python
1,558
53
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"]["motif_width"] = 13 msp.architecture["motif_model_spec"]["motif_feature...
985e78718563852682268a69dfa26e3608f97b8086b24e8a36c58690ddd9cc76
Python
1,558
58
# skip test: data unavailable """Compute TRFs with boosting""" from eelbrain import * # load the data ds = load.fiff.events('Data/R2290_HAYO_P3H_1-8-raw.fif') ds = ds.sub("trigger == 167") ds['meg'] = load.fiff.epochs(ds, 0, tstop=60) # load the saved DSS todss, fromdss = load.unpickle('Data/R2290_HAYO_P3H_DSS.pickl...
c86baf510560a5b92fa56f482d270a9e4832996cc693502f1f17eb29c9f76c10
Python
1,558
61
"""add user defined file sources Revision ID: c14a3c93d66b Revises: c14a3c93d66a Create Date: 2023-04-01 17:25:37.553039 """ from sqlalchemy import ( Boolean, Column, DateTime, ForeignKey, Integer, String, Text, ) from galaxy.model.custom_types import ( JSONType, UUIDType, ) from...