sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d83641ca0fccaa95e736d19497d8ed04a443ce5551435127ae0ed4382aeb628a | Python | 1,131 | 29 | import sqlite3
from .db import DB
class FlightSurveillanceTable(DB):
def __init__(self):
self.table_name = "TN_flight_details"
self.table_desc = "Tamil Nadu 4 airports domestic flights passenger testing details till previous day, table number 3 from the top on third last page which continues to sec... |
1b15a1d94a362326670e07fb71b4257ff13a802f2eb0473a99941243b34acd18 | Python | 1,132 | 40 | import numpy as np
import seqpro as sp
import seqpro.transforms as spt
from numpy.typing import NDArray
from pytest_cases import fixture
@fixture
def seqs():
return sp.random_seqs((3, 5), sp.DNA)
def test_rc(seqs: NDArray):
rc = spt.ReverseComplement("dna", length_axis=-1, ohe_axis=None)
np.testing.asse... |
1df9719295e35859d6c889dc572f71bbc0ae88287651ffe607b59e25791249d6 | Python | 1,132 | 30 | """
WSGI config for proj project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` set... |
65842f9d596542b21a72758ec3a3031c1d42163855559a326e1d901fee91a699 | Python | 1,132 | 34 | """
This module create TransformerClassifPerProt
"""
# pylint: disable=W0223
import torch.nn as nn
import torch
class TransformerClassifPerProtLikeEnsemble(nn.Module):
"""
This class define a Transformer model that classify an entire protein to ONE classe
"""
def __init__(self, transformer_embedder, ... |
401a4461a83cc745c522723b143be3af24b21132fc5d3f94513b7736443621d3 | Python | 1,133 | 28 | from multiprocessing.sharedctypes import Value
import cantera
def check(qual, major, minor, patch=None):
"""Check cantera version, specify qualifier as one of ["pre", "at", "atleast", "post"] and major/minor/patch version numbers, using None to ignore a level of precision (default for patch is None to ignore)"""
... |
68270247d02b2979e136e4e1bbde3cf15937f3c6021ba70342f8cbf046939b5f | Python | 1,133 | 34 | # --------------------------------------------------------
# Based on BEiT, timm, DINO and DeiT code bases
# https://github.com/microsoft/unilm/tree/master/beit
# https://github.com/rwightman/pytorch-image-models/tree/master/timm
# https://github.com/facebookresearch/deit
# https://github.com/facebookresearch/dino
# --... |
bdd01e18f4449e016b8dee34c31d69663d70d6baa353b3b58894f900e8751a17 | Python | 1,133 | 38 | """Capture helpers shared by the validation-tripwire hardening test files.
``tests/test_validation_hardening.py`` and its sibling
``tests/test_validation_bool_exemption.py`` both build traces the way
``validate_forward_pass`` does and run the public path with provenance
warnings silenced.
"""
import warnings
import ... |
3a27193b053604c565df4ff4d72a1877a70bbd1c6d7872973e5762b0914ba4b7 | Python | 1,134 | 27 | import logging
from . import multi
log = logging.getLogger(__name__)
def set_basic_defaults(job_wrapper):
parent_job = job_wrapper.get_job()
parallelism = job_wrapper.get_parallelism()
parallelism.attributes["split_inputs"] = parent_job.input_datasets[0].name
parallelism.attributes["merge_outputs"] ... |
5a3cadcfe23526adf4b676a5c64b2263f899297c237da886d24382b3232e2390 | Python | 1,134 | 33 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl>
# All rights reserved.
"""
Module defines single :method 'get_proxy'.
Author:
Mateusz Kruszyński <mateusz.kruszynski@gmail.com>
"""
from .data_ascii_write_proxy import DataAsciiWriteProxy
from .data_buffered_wr... |
1edc40ee8737b1fb07b6174c3293b73add92a0d0a25a911044881a783d555f6d | Python | 1,135 | 43 | """
.. _exa-align:
Align datasets
==============
Shows how to combine information from two datasets describing the same cases,
but not necessarily in the same order.
"""
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
import random
import string
from eelbrain import *
# Generate a dataset with known seque... |
32af3f0a13f19e0073ac91bf242748d4b8e4f6d0f20668fb8970a024c916fe9b | Python | 1,135 | 37 | from sys import argv
from msp import MSP, starting_point_for_different_number_motifs
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",
)
... |
5591c77f44f4f128f16f22dec48a69e9e67cd07e4b757eac5b6ae69c10cdcda7 | Python | 1,135 | 46 | from sys import argv
from msp import MSP, rbnsp_split_90
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = msp.batch_size // 2
msp.lr = float(msp.lr) * 1 / 2
num_lm = 2
num_psams = 80
msp.architecture["num_motifs"] = num_lm + num_psams + 2
msp.architecture["channels"] = 200
psam_model = dict(... |
f17035c9c2d043bf829b70817e47120d03af0fac5a80020fd7efa63def55173a | Python | 1,135 | 38 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""tests for betweenness.py"""
import unittest
import numpy as np
from sknetwork.ranking.betweenness import Betweenness
from sknetwork.data.test_graphs import test_graph, test_disconnected_graph
from sknetwork.data.toy_graphs import bow_tie, star_wars
class TestBetween... |
37b49c928571570101d1bcafc915874ff8c699a68bb47a678046d5a7f50e8f2e | Python | 1,136 | 37 | """Wrapper for performing the LR GO analysis."""
import os
import stlearn.tl.cci.r_helpers as rhs
def run_go(genes, bg_genes, species, r_path, p_cutoff=0.01, q_cutoff=0.5, onts="BP"):
"""Running GO term analysis."""
# Setting up the R environment #
rhs.rpy2_setup(r_path)
# Adding the source R code... |
481c55ebe65c1ce58a898ccf27950a118fc66655f982c95a2d407a1de9ae8e52 | Python | 1,136 | 38 | from flask_restplus import Namespace, Resource
from workers.tasks import long_task
from config import Config
from database import UserModel, TaskModel
api = Namespace('info', description='Software related operations')
@api.route('/')
class Info(Resource):
def get(self):
""" Returns information about cu... |
7aba40f9b116b533f79c5bdfc4a2a963a2b56ac64445998b516be29f40f9c332 | Python | 1,136 | 45 |
import os
from glob import glob
import numpy as np
import torch
from torch.utils.data import Dataset
from torch.nn.utils.rnn import pad_sequence
def find_file(feature_dir):
file_name_list = []
for item in glob(os.path.join(feature_dir, '*.npz')):
file_name_list.append(item)
return file_name_list
... |
d3da489204908bd968be5633b885bace4c29a2a9019eef69ddc0c7c88e94672b | Python | 1,136 | 46 | from sys import argv
from msp import MSP, rbnsp_split_90
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = msp.batch_size // 2
msp.lr = float(msp.lr) * 1 / 2
num_lm = 10
num_psams = 80
msp.architecture["num_motifs"] = num_lm + num_psams + 2
msp.architecture["channels"] = 200
psam_model = dict... |
1945a06014d3d9e007e8a0938ab6d4a9d854e08df65e3d931f508f7c112543eb | Python | 1,137 | 31 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
def add_read_pair_num(input_filepath, output_filepath, read_pair_num):
to_add = "." + str(read_pair_num)
with open(input_filepath, "r") as input_file:
with open(output_filepath, "w") as output_file:
for line in input_file:
... |
93ffbec0684053803ccfd755ee97cd912fb60bf0044751937db03e0787986808 | Python | 1,137 | 46 | import pytest
from DeepDenoise.src.dataset import CESTDataset
from pathlib import Path
def test_dataset_len():
dataset_train = CESTDataset(
root_dir=Path("test/test_data"),
mode="train",
)
dataset_val = CESTDataset(
root_dir=Path("test/test_data"),
mode="val",
)
dat... |
b58877e63fb12515f773610fb567dab60bc5c6ff37d85e72ab5d17e9ffa878d1 | Python | 1,137 | 32 | from os.path import abspath, join
def run():
from spitfire.chemistry.mechanism import ChemicalMechanismSpec
from spitfire.chemistry.tabulation import build_adiabatic_eq_library
import spitfire.chemistry.analysis as sca
test_xml = abspath(join('tests', 'test_mechanisms', 'h2-burke.yaml'))
m = Chem... |
c3698b5ff2fe6f4e4d1c0761cb113e11c2f2bfac3fe823b2bb3369d172dab6b8 | Python | 1,137 | 31 | from __future__ import annotations
import panel as pn
from larvaworld.lib.reg.generators import ExpConf
from larvaworld.portal.config_widgets import build_collections_widget
from larvaworld.portal.simulation.parameter_resolution import (
resolve_base_experiment_parameters,
)
def test_collections_widget_builds_f... |
ed77f841a410651bed2cfce6dbcd31874c7a9614626dfa4126970ea77fa4ffa0 | Python | 1,137 | 37 | from sys import argv
from msp import MSP, starting_point_for_different_number_motifs
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",
)
... |
321e0244ed6ff167cf32230cf2ab8c32363c909c8bcdff18f1e23a98b113ba1b | Python | 1,138 | 32 | import torch
class EMA():
def __init__(self, model, decay):
self.model = model
self.decay = decay
self.shadow = {}
self.backup = {}
with torch.no_grad():
for name, param in self.model.named_parameters():
if param.requires_grad:
... |
5ef209907151dc3f058d1d06bfb6ad4f7acd3aa69db2dd091d880f13f58f6713 | Python | 1,138 | 34 | from typing import Dict, Sequence
import torch
from torch import Tensor
def mean_topk_accuracy(
predicted_classes: Tensor, targets: Tensor, k: Sequence[int]
) -> Dict[int, Tensor]:
"""Computes the mean accuracy for the specified values of k.
The mean is calculated over the batch dimension.
Args:
... |
bfd7236849b460c83cd8213037088ff1e2c668c0c408d1bc6d961548e698c708 | Python | 1,138 | 44 | from flask import Blueprint
from flask_restplus import Api
from .annotations import api as ns_annotations
from .categories import api as ns_categories
from .annotator import api as ns_annotator
from .datasets import api as ns_datasets
from .exports import api as ns_exports
from .images import api as ns_images
from .mo... |
4a0c1386d1f5d8b4b8062627ff30a1e6d370322a7a5300c40440af58ee6a834e | Python | 1,139 | 42 | from .bulletin import Bulletin
import datetime
class Telangana(Bulletin):
def __init__(self, basedir):
statename = 'TG'
super().__init__(basedir, statename)
self.bulletin_url = 'https://covid19.telangana.gov.in/wp-content/uploads/{}/{:02d}/Media-Bulletin-{:02d}-{:02d}-{}.pdf'
s... |
731d251566651192db983d8b0c8446447efd866dbb65ea04573a74d08afec4ae | Python | 1,139 | 41 | import os.path
import cv2
import numpy as np
from glob import glob
l = glob("/home/rassman/bone2gene/masking/data/val/*_ori.png")
# for path in l:
# img = cv2.imread(path)
# mask = path.replace("_ori.png", "_bin_pruned.png")
#
# img = cv2.cvtColor(img, cv2.COLOR_RGB2RGBA)
# img[:, :, -1] = cv2.imread... |
8034e509a32dbafd80eed1ae2e18f86a3b139194c002fa3113faa1ba341a9c57 | Python | 1,139 | 42 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._box import Box
from ._hoverlabel import Hoverlabel
from ._legendgrouptitle import Legendgrouptitle
from ._line import Line
from ._marker import Marker
from ._meanline import Meanline
from ._selected import Selected
fro... |
ced62d64072a8c2603c0ff96945e8488002c900b1904c317b6eaaf7e06489604 | Python | 1,139 | 29 | """For neatly implementing static typing in pip.
`mypy` - the static type analysis tool we use - uses the `typing` module, which
provides core functionality fundamental to mypy's functioning.
Generally, `typing` would be imported at runtime and used in that fashion -
it acts as a no-op at runtime and does not have an... |
d5da5588d0d2f0f547ca885615aa0ee107a5c927ab387bdd25f48de65aff7b78 | Python | 1,139 | 38 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
type="PSAMMotifModel",
... |
1bf90ab6eb570d2bfed36c19bb74b5c3d1bb21bcad008ba96b1cd31864f4540f | Python | 1,140 | 29 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""Pytest configuration
Skipping slow tests: https://docs.pytest.org/en/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option
"""
import pytest
def pytest_addoption(parser):
parser.addoption("--runslow", action="store_true",... |
6181ff4783b201a57ce4a6f5cc9f4b83a132fdc342a393db5e27785d7a7848b1 | Python | 1,140 | 32 | from os.path import abspath, join
def run():
from spitfire.chemistry.mechanism import ChemicalMechanismSpec
from spitfire.chemistry.tabulation import build_adiabatic_bs_library
import spitfire.chemistry.analysis as sca
test_xml = abspath(join('tests', 'test_mechanisms', 'h2-burke.yaml'))
m = Chem... |
ac5ca41b8b25101d755d1e50a0999bf8e0a8d868263ff2487919bb4dd73bb982 | Python | 1,140 | 31 | from typing import List
from carbonserver.api.errors import NotAllowedError, NotAllowedErrorEnum, UserException
from carbonserver.api.infra.repositories.repository_runs import SqlAlchemyRepository
from carbonserver.api.schemas import RunReport
from carbonserver.api.services.auth_context import AuthContext
class Expe... |
f44e2fa185c18ba1792f53621e71f44d4b8d368fdb8fe890df3b680cc4bc693f | Python | 1,140 | 30 | """Capability check for real-package tests that load a cached Hugging Face checkpoint.
The real-bridge tests run offline (``HF_HUB_OFFLINE=1``) against tiny
checkpoints that a CI leg warms into the local cache. Whether a checkpoint is
there is checked BEFORE loading, so a missing checkpoint is a visible,
conditional s... |
dd400f0acaa79c07f2db6929ef67da135953326f295cdfd66b3671e46fe24bc4 | Python | 1,141 | 35 | """
Get data from openneuro.
This will make a `data` directory in the main directory of the repo called data if it doesn't already exist.
"""
import os
import pathlib
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-download_preprocess", action="store_true",
h... |
ad6d7a9737f02981f6eae61da3019ab78e2d3b693926d3b3bb089a5ddfe62d8e | Python | 1,142 | 37 | from sys import argv
from msp import MSP, starting_point_for_different_number_motifs
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",
)
... |
e5ff825fb44b17cc8c42486718ae68c4c89bbd0c966f48d2e0ebfa7618c448da | Python | 1,142 | 23 | """
Copyright (c) 2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE BLUE BRAIN PROJE... |
f0016987fd46e5264fff6e23ac8bfaa885a8a0ed1432094be23320c7765d6084 | Python | 1,142 | 37 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Apr 2020
@author: Nathan de Lara <nathan.delara@polytechnique.org>
"""
import numpy as np
from scipy import sparse
from scipy.sparse.linalg import LinearOperator
def safe_sparse_dot(a, b):
"""Dot product with proper use of the sparse matrix format.
... |
982d96d523facee34c438297beda2e479f8805ce661d2d36a071c2ed378a148d | Python | 1,143 | 27 | import numpy as np
import torch
import opt_einsum as oe
from torch.autograd.functional import jacobian
from src.MODEL import *
#============================calculate the energy===================================
class Property(torch.nn.Module):
def __init__(self,density,nnmod):
super(Property,self).__init_... |
a76735b4cd9bbf9a976d1911a61daff3fd114f298be8d24cbf0ad64ce09c56eb | Python | 1,143 | 32 | import os
from data import srdata
class Flickr2K(srdata.SRData):
def __init__(self, args, name='Flickr2K', train=True, benchmark=False):
data_range = [r.split('-') for r in args.data_range.split('/')]
if train:
data_range = data_range[0]
else:
if args.test_only and l... |
c164b514c77cc78b393c10b7db3793b15e05dfb42a3433de8acb7a90e5f66a6d | Python | 1,143 | 32 | ##### THIS FILE IS NON FUNCTIONAL. AT SOME POINT IN THE FUTURE IT WILL
##### DO SOMETHING. HAVE A GREAT DAY.
def serve_files(filenames, tr):
ic = InfoClient('localhost', 15000, 'localhost', 15001)
for idx, filename in enumerate(filenames):
img = nb.load(filename)
if len(img.shape) == 4:
... |
ffde457b865efe539341e738df9fac246e9b81a0e5578da1d67a36f6cab7ae32 | Python | 1,143 | 44 | from neuron import h
def check_callable(get_instance, has_voltage=True):
for x, value in zip(coords, values):
get_instance(x).x = value
for x, value in zip(coords, values):
expected = 100.0 + value
actual = get_instance(x).x_plus_a(100.0)
assert actual == expected, f"{expected... |
9804208a69277c75d0e4e07b20b9af2bc4e7054dfc0c4ada42bfeb67e1d7459c | Python | 1,144 | 30 | from rpy2.robjects.packages import (importr,
WeakPackage)
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
dbplyr = importr('dbplyr', on_conflict="warn")
dbplyr = WeakPackage(dbplyr._env,
dbplyr.__rname__,
... |
f83e53402a653735b7b54246abca2b9c6ad26fb0afed4535b5e35fbd9accb874 | Python | 1,144 | 25 | import sys, os
hg38 = "/home/weiqi/project/00.DATABASE/hg38/hg38.fa"
hg38_size = "/home/weiqi/project/00.DATABASE/hg38/hg38.fa.size"
mm10 = "/home/weiqi/project/01.weiqi/20200929_inosine/process/index/GRCm38.p6.fa"
mm10_size = "/home/weiqi/project/01.weiqi/20200929_inosine/process/index/GRCm38.p6.fa.size"
def process... |
437811b844d002aee387aab555c234953ef6525ff7fdfecccc8b138260ce1409 | Python | 1,145 | 43 | #!/usr/bin/env python
import argparse
import sys
import readfile
def main(args):
# search for acitivity or target
url = "http://pubchem.ncbi.nlm.nih.gov/rest/pug/assay/"
if args.activity is None:
# target
url += "target/%s/%s" % (args.targettype, args.targetid)
else:
url += "... |
44d665185f482225f4077bd936210608afeb16d445b340e97b170f7341a31d26 | Python | 1,145 | 38 | 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"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
4eb5c839e9574d36788e919628c542116258bea9ed359fceeffba2686e423fb1 | Python | 1,145 | 44 | 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["motif_model_spec"] = dict(type="NoMotifModel")
msp.architecture["propagate_sparsity_spec"] = dict(type="NoSparsityPropagation")
msp.architecture["sparse_spec"] = dic... |
dfb56447a700bf12bcec11e61666888df275616219651d5637015dc56be343bf | Python | 1,145 | 31 | import pytest
from lightly.utils import version_compare
class TestVersionCompare:
def test_valid_versions(self) -> None:
# general test of smaller than version numbers
assert version_compare.version_compare("0.1.4", "1.2.0") == -1
assert version_compare.version_compare("1.1.0", "1.2.0") =... |
caaca99c1ce45e9ca03a5fca546f080a0205eb006b9bd14def9ab122a8766d79 | Python | 1,146 | 28 | # Copyright 2019 Novartis Institutes for BioMedical Research 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... |
2b5116747ba09b3f5ad85838763683c5e5fb7d8fca7e5d3de40d14247f609923 | Python | 1,147 | 32 | import pickle
import unittest
from os.path import join, abspath
from numpy.testing import assert_allclose
from tests.reactor.closed_reactors.rebless import run
from spitfire.chemistry.ctversion import check as cantera_version_check
if cantera_version_check('atleast', 2, 5, None):
class Test(unittest.TestCase):
... |
adac39deb3a141ac7b64989067af29ea75bd7d40d4e4b6ee1228471d6ea37633 | Python | 1,147 | 32 | """What an int4 block size implies: per-channel or grouped, and the scheme."""
from keras.src.quantizers.quantized_weight import WeightScheme
def is_per_channel(block_size):
"""Whether `block_size` selects per-channel (ungrouped) quantization.
`block_size` is validated to be `None`, `-1`, or a positive inte... |
c0dd293b1b9db33deb35666bfda78b884d8858dabb35ce6040cadd550beb298a | Python | 1,147 | 37 | from sys import argv
from msp import MSP, starting_point_for_different_number_motifs
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",
)
... |
cd1919b5cf3aaada3b54e21337471683958862069872e1b1d34c69b1bf1f912c | Python | 1,147 | 47 | import os
import sys
# Dirty fix, :TODO rewrite tools as a package - joined directly to Snudda or the lab
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, "tools")))
import unittest
from hash_value.make_hash import *
import json
import glob
import collections
class TestSynapses(uni... |
dfdd8f2ed63e40cd1046e8c18be6e448386617d95302058c4cd66801185e61ea | Python | 1,147 | 41 | from os.path import exists
import pandas as pd
# 1.23.0 since
# - numba(cell oracle needs) <=1.24, but
# - seaborn != 1.24.0
import numpy as np
import os, sys, shutil, importlib, glob
from tqdm.notebook import tqdm
import celloracle as co
from celloracle import motif_analysis as ma
from genomepy import Genome
import ... |
c3e16def41b3983da4ffe315dced59e44f918b06e475c66f0784d0e06cad3873 | Python | 1,149 | 40 | 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["motif_model_spec"]["motif_... |
f13aca18c9010dcc4619b3801e1ff5179bf99704bc4b075fc10d2900e2d6036a | Python | 1,149 | 35 | import paddle
import paddle.nn as nn
import numpy as np
from random import Random
from dataset import Subset
def split_dataset(dataset, idx, num_folds=10):
random = Random(0)
indices = np.repeat(np.arange(num_folds), 1 + len(dataset) // num_folds)[:len(dataset)]
random.shuffle(indices)
test_index = idx... |
bcb4e1cb13cb5027f2c0852f8ffbfa0cdb12535f4116c36bd3a1e9baeb5b9620 | Python | 1,150 | 44 | from os import path
from codecs import open
from setuptools import setup, find_packages
# get current directory
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()
# # read the API ... |
230aa0da2d2d939854f2933431ccb5008e53f0f1b956bb8ad411e8bdb4824e6a | Python | 1,152 | 42 | from sys import argv
from msp import MSP
msp = MSP()
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
msp.file = __file__
msp.seed = int(argv[1])
donor_seed = msp.seed % 1000
msp.architecture["splicepoint_model_spec"]["donor"] = f"model/msp-262da5_{donor_seed}"
msp.architecture["motif_model_... |
4a0fe2c547caf5572fa8f960c50c94101ddc5f59159a8b74ab1d78a83a8f7b27 | Python | 1,152 | 42 | """
Generate data used in the HDF5DataLayer test.
"""
import os
import numpy as np
import h5py
num_cols = 8
num_rows = 10
height = 6
width = 5
total_size = num_cols * num_rows * height * width
data = np.arange(total_size)
data = data.reshape(num_rows, num_cols, height, width)
data = data.astype('float32')
# We had a... |
86041521f77835a7a3b6855073af1e1be2a56be6105ff2ae1e545ee2797b5979 | Python | 1,152 | 31 | import torch.nn as nn
from features import GraphProteinFeaturizer
from cgnn import CGNNBlock
class SPIN_CGNN(nn.Module):
def __init__(self, d_model, n_heads, n_layers, n_virtual_atoms) -> None:
super().__init__()
self.featurizer = GraphProteinFeaturizer(
d_model=d_model, n_v... |
cb3bca4242943eeac1a60706eec3a4298753a6c9d405ca4f84529a84f6f2a652 | Python | 1,152 | 52 | import os
#import h5py
import matplotlib.pyplot as plt
import scipy
import scipy.io as sio
import sklearn
import pandas as pd
import umap
import numpy as np
from mda import *
# data = sio.loadmat('D:/MDA_visualization/Codes_For_Hongyi_MDA/Codes_For_Hongyi_MDA/mda/mda/data_MDA.mat')
# Y = data['Y']
# trainingFeatures... |
f7c1e10ce0d0c0ebbc4458fb4578c48e5b795775d216a2933f2fa03d75bfa548 | Python | 1,152 | 40 | from sys import argv
from msp import MSP
from msp_fly import fly_am
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
fly_am(msp)
msp.architecture["propagate_sparsity_spec"] = dict(
type="OnlyAllowInfluenceOnSplicesites"
)
msp.architecture["final_processor_spec"].update(
dict(
bottleneck_spec=... |
07ef4a27c442d908273be9e007d453c38fc62f291d7485cf1c14e6ab9c06e1db | Python | 1,153 | 34 | """
This module define a BCEWithIgnoreIndex
"""
# pylint: disable=W0223
import torch
from utils.utils import select_output_lm
from utils.utils import square_pad_sequence
class BCEWithIgnoreIndex(
torch.nn.modules.loss._Loss
): # pylint: disable=protected-access
"""
This class define a specific loss : cro... |
1c408eaed6f49de9f8c662993e1e27c75bceb90788eace6fb85a55544c8861ad | Python | 1,153 | 38 | 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... |
5c898347c4067252cb0fe3d1cfbac45c456482a64d22d176bb3dc7bc8fbba5e2 | Python | 1,153 | 64 | #!/usr/bin/env python
# coding: utf-8
# In[3]:
import argparse
import random
# In[ ]:
parser = argparse.ArgumentParser()
parser.add_argument('file', metavar='<file>')
parser.add_argument('-n', '--number', type=int)
parser.add_argument('-l', '--lines-per-sample', type=int)
parser.add_argument('--skip-header', typ... |
2d91d7fbac9de04e142723a50d549c04981610e2968ce9a65f4b0cb6857e0869 | Python | 1,154 | 37 | import os
import sys
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/")
sys.path.insert(0, PATH_SRC)
import pyabf
import matplotlib.pyplot as plt
if __name__ == "__main__":
abf = pyabf.ABF(PATH_D... |
47f38b1a4ab9aa76757bd0fd148d362179a6f65a6a0f919489b3ee13dc4c314c | Python | 1,154 | 50 | #!/usr/bin/env python
import json
import sys
output = {
"tool": {
"name": "hAMRonize",
"version": "?",
"description": "Tool for combining results",
"configuration": {
"verbose": "true", "multisetting": ["first", "second"]
},
},
"records": [],
}
with ope... |
52a68614234b6fac3f832927972d0fbd90f0c11bc38c2e85281226a9546a6fcf | Python | 1,154 | 46 | """Expose the model metadata module as a datatype module also,
allowing it to live in galaxy.model means the model module doesn't
have any dependencies on th datatypes module. This module will need
to remain here for datatypes living in the tool shed so we might as
well keep and use this interface from the datatypes mo... |
558f5b6ed1b46d51c04352516b8ef8cc88fc66611a85be5e9adef608ebd0c024 | Python | 1,154 | 33 | import os
from typing import Any
from pl_bolts.datasets.sr_dataset_mixin import SRDatasetMixin
from pl_bolts.utils import _PIL_AVAILABLE, _TORCHVISION_AVAILABLE
from pl_bolts.utils.warnings import warn_missing_pkg
if _PIL_AVAILABLE:
from PIL import Image
else: # pragma: no cover
warn_missing_pkg("PIL", pypi_... |
f89599e8d987009c2e7bde99cb7038a04db5ea2fa3d1b86c6b1d83983842771a | Python | 1,154 | 51 | """Add origin column to landing request tables
Revision ID: 81362686fd64
Revises: c0959ad462b2
Create Date: 2025-09-26 12:39:25.000000
"""
import sqlalchemy as sa
from galaxy.model.migrations.util import (
add_column,
drop_column,
)
# revision identifiers, used by Alembic.
revision = "81362686fd64"
down_re... |
1fda92b24f7eb4947b1ff2a3d22a377af56920462b1f96cdc7681cec25c0d049 | Python | 1,155 | 40 | """Wrapper for clipping actions within a valid bound."""
import numpy as np
import gym
from gym import ActionWrapper
from gym.spaces import Box
class ClipAction(ActionWrapper):
"""Clip the continuous action within the valid :class:`Box` observation space bound.
Example:
>>> import gym
>>> en... |
c68674759994eab085f3773ea9e89002aba2d761eabb2521c01d3cd34ec05b1d | Python | 1,155 | 40 | from sys import argv
from msp import MSP
from msp_fly import fly_am
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
fly_am(msp)
msp.architecture["propagate_sparsity_spec"] = dict(
type="OnlyAllowInfluenceOnSplicesites"
)
msp.architecture["final_processor_spec"].update(
dict(
bottleneck_spec=... |
dca497bf150ff47e2d08941751f5adfb8e7e96dc83d05ad58188d70ef44dfb24 | Python | 1,155 | 34 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for Leiden"""
import unittest
from sknetwork.clustering import Leiden
from sknetwork.data.test_graphs import *
from sknetwork.utils import bipartite2undirected
class TestLeidenClustering(unittest.TestCase):
def test_disconnected(self):
adjacency = ... |
8fcd38f222e0f7d6efbd515145486063396a068af24dd6589a0cbe9d1fe492b8 | Python | 1,156 | 48 | from sys import argv
from msp import MSP, rbnsp_split_90
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = msp.batch_size // 2
msp.lr = float(msp.lr) * 1 / 2
num_lm = 2
num_psams = 80
msp.architecture["num_motifs"] = num_lm + num_psams + 2
msp.architecture["channels"] = 200
psam_model = dict(... |
81a36c1f97ebce6927e28b11f229dbb72f80f1231a6d7c163e078f2ba1ad9597 | Python | 1,157 | 35 | #!/usr/bin/env python3
"""Quick recheck: severity stratification of figshare AD subjects
at the training-derived τ = -2.6511."""
from __future__ import annotations
import os, sys, json
import numpy as np
HERE = os.path.dirname(os.path.abspath(__file__))
OUT_DIR = os.path.join(os.path.dirname(HERE), "outputs")
sys.path... |
8a17cc99bd1fc7efbabd877106fa4300166c68be131845fc44478308a874e509 | Python | 1,157 | 48 | from sys import argv
from msp import MSP, rbnsp_split_90
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = msp.batch_size // 2
msp.lr = float(msp.lr) * 1 / 2
num_lm = 10
num_psams = 80
msp.architecture["num_motifs"] = num_lm + num_psams + 2
msp.architecture["channels"] = 200
psam_model = dict... |
9c8895b12d4c7e1010d0b4bb34894234f0f830b719a18959f5a4ecf3119ce514 | Python | 1,157 | 37 | """ Wrapper for performing the LR GO analysis.
"""
import os
import stlearn.tools.microenv.cci.r_helpers as rhs
def run_GO(genes, bg_genes, species, r_path, p_cutoff=0.01, q_cutoff=0.5, onts="BP"):
"""Running GO term analysis."""
# Setting up the R environment #
rhs.rpy2_setup(r_path)
# Adding the ... |
d133fc9f6802f360de5a5347b8c8e879b99f6f38de356dccf95d663a3d16cc44 | Python | 1,159 | 23 | from .base_options import BaseOptions
class TestOptions(BaseOptions):
"""This class includes test options.
It also includes shared options defined in BaseOptions.
"""
def initialize(self, parser):
parser = BaseOptions.initialize(self, parser) # define shared options
parser.add_argum... |
e43968e59761bf1e884f4676833a20e51dd4c370f26fb3513406973b8a2a31b8 | Python | 1,160 | 23 | from .base_options import BaseOptions
class TestOptions(BaseOptions):
"""This class includes test options.
It also includes shared options defined in BaseOptions.
"""
def initialize(self, parser):
parser = BaseOptions.initialize(self, parser) # define shared options
parser.add_argum... |
ffe2b2c697c64fb5919bee9a64c4d408dcb079062c12215d6b6f395f52c1a49b | Python | 1,160 | 46 | """
smooth.py
Modules for signal smoothing.
"""
import numpy as np
###################################################################################################
###################################################################################################
def convolve(data=None, win_len=0.02, mode='val... |
7ae9e81607a2e6b073447a5e6d4099edf2c4d4fcd8d8eea21572d5545c9f1e74 | Python | 1,161 | 37 | import numpy as np
import torch
import torch.nn as nn
import ipdb
class LstmModel(nn.Module):
def __init__(self):
super().__init__()
# self.input_dim = config.input_dim
# self.memory_cell = config.memory_cell
# self.body_dim = config.body_dim
# self.n = config.n
self... |
d75f5ce8d1f57d0c6afe4db1cd493d52f62db87e5ed934585cca88d0b760631e | Python | 1,161 | 44 | from .bulletin import Bulletin
import datetime
class Maharashtra(Bulletin):
def __init__(self, basedir):
statename = 'MH'
super().__init__(basedir, statename)
self.bulletin_url = 'https://arogya.maharashtra.gov.in/pdf/ncovidepressnote{}{:02d}.pdf'
self.startdate = datetime.date... |
f1fbe9ed49d62462088e3e4fa8cc580d0de395c0b1d4ca7a1c88ff0c789f251b | Python | 1,161 | 44 | import pathlib
import tempfile
import zipfile
import numpy as np
from impose import formats
data_path = pathlib.Path(__file__).parent / "data"
def get_czi():
td = pathlib.Path(tempfile.mkdtemp(prefix="impose_czi_"))
with zipfile.ZipFile(data_path / "lsm-fish.zip") as arc:
arc.extractall(path=td)
... |
1fd58a307e0acab1054b8e2683aa9ce74d4346e075f20a8f172f13b34f8066b4 | Python | 1,162 | 43 | """
.. _exa-colormaps:
Eelbrain Colormaps
==================
Eelbrain adds some colormaps to `matplotlib's standard colormaps
<https://matplotlib.org/gallery/color/colormap_reference.html>`_.
In general, the colormaps come with an ``*-a`` ("alpha") version which uses
transparency for low values instead of a solid col... |
4b0509dc8d3a122fd125ad0263fc15857137264d6145569e98fa10ab55c0b93b | Python | 1,162 | 38 | 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... |
705c8179ffd37a63c0a0fd32545f6b1bb885c9c75effd4973c422adff1f8d541 | Python | 1,162 | 30 | from carbontracker.components.handler import Handler
from typing import List
class SimulatedCPUHandler(Handler):
def __init__(self, name: str, tdp: float, utilization: float = 0.5):
super().__init__(pids=[], devices_by_pid=False)
if not isinstance(name, str) or not name.strip():
raise V... |
886cd6ac6c651bff5077542e759513f1df747f0348249aed303327858f9e7e87 | Python | 1,162 | 37 | """Market 1501 Person Re-Identification Dataset."""
import random
from os import path as osp
__all__ = ['LabelList']
def LabelList(ratio=1, root='~/.mxnet/datasets', name='market1501'):
"""Load the Label List for Market 1501 dataset.
Parameters
----------
ratio : float, default 1
Split label... |
9d49d83700766c192da55a5a65dba6a22bd86c95fc6f6e1dd4afa27ccdb02bc3 | Python | 1,162 | 51 | import sys
def neg(file_neg,strand):
#row = []
with open(file_neg) as f:
for line in f:
line = line.strip().split('\t')
if len(line) ==1:
continue
if line[3] == 'T':
ref_base = 'A'
elif line[3] == 'A':
ref_base = 'T'
elif line[3] == 'C':
ref_base = 'G'
elif line[3] == 'G':
ref... |
2bca3510e8cdde3aef13328adbb4a21a9a1cf6bd9a239d3e39f2e9706cb82afb | Python | 1,163 | 49 | #!/bin/env python2.7
import os, sys
import argparse
import numpy
from mpi4py import MPI
#from hhcrf5 import *
from hhcrf import *
from hhcrf_pred import *
comm = MPI.COMM_WORLD
nproc = comm.Get_size ()
me = comm.Get_rank ()
DefaultStructList = '/home/newton/database/tlist/list.test'
database = '/share/databas... |
cbfb330325a93ac57db8dba0ecb2758f8ee9ae54ef6136059b589b6140721f6e | Python | 1,163 | 35 | import numpy as np
import scanpy as sc
from scbig.utils import setup_seed,calculate_metric
import os
for dataset in ['DPT', 'YAN', 'Deng']:
print('----------------real data: {} ----------------- '.format(dataset))
setup_seed(0)
dir0 = '../'
method = 'Seurat'
r = np.load(os.path.join(dir0, 'results/... |
1baedee67bc6a78a98731402ab676c4cf542193ef73ea19d71412eb920138158 | Python | 1,164 | 45 | import pytest
import contextlib
import os
import tempfile
from rpy2.robjects.packages import importr, data
datasets = importr('datasets')
mtcars = data(datasets).fetch('mtcars')['mtcars']
from rpy2.robjects import r
from rpy2.robjects.lib import grdevices
@contextlib.contextmanager
def set_filenames_to_delete():
... |
5db750a7388a694566a598777c00c41f9acea678c2ef9f0067ea654c45902b64 | Python | 1,164 | 36 | """Phase 5a tests for experimental freeze controls."""
from __future__ import annotations
import torch
import torchlens as tl
def test_freeze_module_restores_requires_grad_and_grads() -> None:
"""``freeze_module`` should restore parameter training state."""
layer = torch.nn.Linear(2, 2)
for parameter ... |
7354f70adbbc93df5d602590d3a53710c740383b1751e4d027a1f8ad4fcea286 | Python | 1,164 | 24 | """
Copyright (c) 2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE BLUE BRAIN PROJE... |
7aa7674f29ed00a58ea335006db088dca9cc842182c4c3b529c775809ebbccee | Python | 1,164 | 44 | def main():
import os
import pkg_resources
import sys
import logging
from PyQt6 import QtGui, QtWidgets
from bmicro.gui.main import BMicro
from bmicro._version import version as __version__
"""
Starts the BMicro application and handles its life cycle.
"""
app = QtWidgets.QA... |
82e2de8a6c165e1980100c11494883e97def08b79ab92e1a5fcd864034238355 | Python | 1,164 | 31 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
This script:
Reads all image file names from a dataset folder.
Extracts person names from the file names.
Groups images by person name.
Saves the mapping (persons_names) into a pickle file.
"""
import pickle
import glob
dataset_folder = './dataset/knn_dataset' # De... |
d1bd36294282612e87acaecdc63668ba2e096bba172781468b48fe15154a4338 | Python | 1,164 | 29 | import numpy as np
import torch
def generate_random_index(num_shuffle, n_neurons, cell_nums_ramp, cell_nums_seq):
random_index_dict = {
'random': np.zeros((num_shuffle, n_neurons)),
'ramp': np.zeros((num_shuffle, n_neurons)),
'time': np.zeros((num_shuffle, n_neurons))
}
for i_shuf... |
db693c27607993c1c156cfc07dd02a753337360814d7abbc921ca2f78ddb2695 | Python | 1,164 | 44 | 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... |
18fc15902d97cf76c94e6e16bc0cac419741df25416e5045b608ec7d4e801545 | Python | 1,165 | 34 | import pytest
import os
import sys
import pathlib
PATH_HERE = os.path.abspath(os.path.dirname(__file__))
PATH_PROJECT = os.path.abspath(PATH_HERE+"/../")
PATH_DATA = os.path.abspath(PATH_PROJECT+"/data/abfs/")
PATH_HEADERS = os.path.abspath(PATH_PROJECT+"/data/headers/")
try:
# this ensures pyABF is imported from ... |
48abf028e8cc88bfd4bf9ea5d01fb4fd1a4d519e0e53f93e2047d46ba87dee9d | Python | 1,165 | 37 | #!/usr/bin/env python
import setuptools
VERSION = '0.0.1'
# Read in requirements
with open('docker/requirements.txt', 'r') as rf:
# Setuptools can't deal with git+https references
required_packages = [p for p in rf.readlines() if not p.startswith('git+https')]
# Fill in all this for the specific project
se... |
9c47a509e00a30f8841846edd47ba8847c72840e3d2289a51129de589df463b8 | Python | 1,165 | 35 | import pyrosetta
def make_option_string(**options):
"""
This just converts the key:value pairs to a command line string for the pyrosetta init.
>> make_option_string(no_optH=False, ex1=None, remodel=dict(blueprint='mod.blue'))
Bools are converted,
None results in a value argument,
Tuples are ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.