sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
a52b2ae7270159908619232b5f1a4787d9bb062993e3388ac652346bd79bbc36 | Python | 975 | 33 | import h5py
import csv
def rename_from_csv(h5file, csv_path):
with open(csv_path, newline="") as f:
reader = csv.DictReader(f)
rows = list(reader)
# Sort by path depth descending so children rename before parents
rows.sort(key=lambda r: r["path"].count("/"), reverse=True)
for row in r... |
c686f3657ba61bade8d68b20ef67c2faef2440b364f5026283b6235d5a31719a | Python | 975 | 28 | import sqlite3
from .db import DB
class DeathMorbiditiesTable(DB):
def __init__(self):
super().__init__()
self.table_name = 'TN_comorbidities_deaths'
self.table_desc = 'Tamil Nadu comorbidities or non comorbidities death facilitiestype, two tables on page 10'
self.cols = self.getc... |
471666c24662093a8ed3651161e3549f1ea88a06ac51c41e0c5eb5a318ac618e | Python | 976 | 32 | from sys import argv
from msp import MSP, am_one_to_3_motif_widths_above_90_shorter_donor
msp = MSP()
msp.batch_size = 5
msp.lr = float(msp.lr) / 15 * msp.batch_size
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChann... |
f1464744151ac49adef2ede8c76333c46ff4f07f6c5c69ebcb16c55a7a013d9b | Python | 976 | 30 | """The ``celery result`` program, used to inspect task results."""
import click
from celery.bin.base import CeleryCommand, CeleryOption, handle_preload_options
@click.command(cls=CeleryCommand)
@click.argument('task_id')
@click.option('-t',
'--task',
cls=CeleryOption,
help_g... |
558aeef5195420837a74a34e8a2b521253d0a88c5623b9aac77751e7377d36fd | Python | 977 | 38 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for polynomials."""
import unittest
import numpy as np
from scipy import sparse
from sknetwork.data.test_graphs import test_graph
from sknetwork.linalg import Polynome
class TestPolynome(unittest.TestCase):
def test_init(self):
adjacency = test_g... |
e3a4793b783813defa5af23cb0e641eed2c8ade7bc69532efcbd521a54bce831 | Python | 977 | 21 | 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... |
1cb24d2872c28621be677650dbaa9a8d22f9f35d7c03f391b329fd1d70764993 | Python | 978 | 33 | # Generated by Django 3.1.2 on 2020-10-30 17:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0080_auto_20200908_1611'),
]
operations = [
migrations.AddField(
model_name='upload',
name='flip_x'... |
d38582a958642b1c95110d8a34e617b3009ba941d0f14ddf3d9c858c4305d134 | Python | 978 | 39 | from typing import Literal
from pydantic import PositiveInt
from neurogym.config.base import ConfigBase
class AgentTrainingConfig(ConfigBase):
"""Training configuration for an agent.
Attributes:
unit: Unit for training duration.
value: Number of units to train for, based on the unit.
""... |
b2a8353e44dc4665a126c6eecbc7286417cba030281a8eb737d61d470462fbdc | Python | 979 | 30 | import sqlite3
from .db import DB
class HospitalInfraTable(DB):
def __init__(self):
self.table_name = 'WB_hospital'
self.table_desc = 'West Bengal hospital infrastructure snapshot'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
'date': 'DATE NOT NULL... |
300dc20333501591018ade5b12f5331346d7ce53f3e5905fc3131cbf3fe4c65d | Python | 980 | 38 | import setuptools
import codecs
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
exec(codecs.open("MisER/version.py").read())
INSTALL_REQUIRES = [
'numpy',
'pandas<2.0.0',
'pysam',
'parasail>=1.1.17'
]
setuptools.setup(
name='MisER',
version=VERSION,
au... |
3f66b3f5179852b8298363ce87f55449c706d52a0f529a376e3330672e771e95 | Python | 980 | 38 | from logging import getLogger
import numpy as np
import torch
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from PIL import Image, ImageFilter
logger = getLogger()
class LoGoDataset(datasets.ImageFolder):
def __init__(
self,
data_path,
tau_g,
... |
d15716fb82dcf4a99582dcfe7de3553862e412b091ffaa0c0e02cb55451a0c12 | Python | 980 | 26 | import glob, os, mne, numpy as np
d = "data/figshare_stroke/edf_extracted/edffile/sub-01/eeg"
print("--- files next to the EDF ---")
for f in sorted(glob.glob(os.path.join(d, "*"))):
print(" ", os.path.basename(f))
tsv = glob.glob(os.path.join(d, "*events.tsv"))
if tsv:
print("\n--- events.tsv (first 12 line... |
1a8230ed4d2feb1fceac3077e0c5b5b99d9ad02988a04dfdf3741501d34309bd | Python | 981 | 32 | from permacache import permacache, stable_hash
import tqdm.auto as tqdm
from .compute_perturbations import motif_perturbations_individual
@permacache(
"modular_splicing/motif_perturbations/perturbations_on_data/motif_perturbations_individual_on_data",
key_function=dict(m=stable_hash, xs=stable_hash, ys=stab... |
4bfb6adc5f7a09d337e78a940629b11f19a26e55f4f23bbfd692ccea25c8daec | Python | 981 | 31 | import unittest
from carbontracker.components.handler import Handler
class TestHandler(unittest.TestCase):
def setUp(self):
# Create a Handler instance
self.handler = Handler(pids=[], devices_by_pid={})
def test_devices_raises_not_implemented(self):
with self.assertRaises(NotImplemente... |
ad6333cb8e4ebf288222c061ce791b093be2a83e3cbc26ff37b374615b42423a | Python | 981 | 34 | # 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.
''' Testing customized ops. '''
import torch
from torch.autograd import gradcheck
import numpy as np
import os
BASE_DIR = os.path.dirname(... |
f21a5732018b16e9d7dc93601d3fcf28185038007579b2f27d520a86e1ac0377 | Python | 981 | 34 | 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"] = 5
msp.architecture["motif_model_spec"]["motif_feature_... |
ff3e7418e0154499a55780264f8e0b895c38542d202f73562d58c5cb94d7fcd4 | Python | 981 | 46 | """
Utilities for ensemble learning
"""
from collections import Counter
import numpy as np
__all__ = ['get_majority']
def get_majority(data, axis=0):
"""
Returns a list of majority elements in each row or column.
If more than two elements occupies the same numbers in each row or column,
'get_majo... |
74e739dc3d8f73b3f2ff0231b197fc45558d2c5e3d1b6f34c786a36fe875ef28 | Python | 982 | 41 | import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="acdc-nn",
version="0.0.17",
author="Giovanni Birolo",
author_email="giovanni.birolo@unito.it",
description="A deep learning predictor of protein stability change upon mutation",
long_d... |
a02373e4180c65f15bd92241bfd74e203065c197a2165bf8903aebe4564280d7 | Python | 982 | 36 | import logging
import gluoncv as gcv
gcv.utils.check_version('0.8.0')
from gluoncv.auto.estimators import ImageClassificationEstimator
from gluoncv.auto.tasks.utils import config_to_nested
from d8.image_classification import Dataset
if __name__ == '__main__':
# specify hyperparameters
config = {
'da... |
a4434bc60e7dc3def8fa4a3a4611ce8804b36202cdf31a3c9ec1fd51fd1fe275 | Python | 982 | 34 | 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... |
de575c2a03950d06c22a20edaedb44c2a07b9292ec5376c71438be6a10c9489d | Python | 982 | 34 | 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... |
e073c1b2156219a77f91e6512a535478c26f85935c49fba1387ec21aef8561e2 | Python | 982 | 30 | import numpy as np
from numpy.typing import NDArray
def check_nucleotide_balance(
seq_array: NDArray,
shuffled_array: NDArray
) -> bool:
"""Check that the nucleotide balance is preserved after shuffling.
Parameters
----------
seq_array : NDArray
The original input sequences with ... |
ef849214b8088cfb160d1eaa4e1489934b72c1166f90f5b87972783305af75c4 | Python | 982 | 34 | """Created on Tue Aug 18 17:16:10 2020.
@author: molano
Usage:
import neurogym as ngym
from neurogym.envs.collections import get_collection
kwargs = {'dt': 100, 'tr_hist_kwargs': {'probs': 0.9}}
# Make supervised dataset
tasks = get_collection('priors')
envs = [ngym.make(task, **kwargs) for... |
f6fb9c9ffbc437787145d0ad79ee9e4726196b988650f62369df8af74c9e5a8b | Python | 982 | 34 | 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... |
645457a6186bb1419c0922fadd95ac1f147478e477aec97345b63f5db3df94c7 | Python | 983 | 38 | import numpy as np
from fun_h import fun_h
from fun_dh import fun_dh
# import random
# from fun_theta import fun_theta
def fun_dtheta(x):
# the first order deriative of the bump function
# theta(x) = h(1-x)./(h(1-x)+h(x-1/4))
# that is
# theta(x) = -h'(1-x)./(h(1-x)+h(x-1/4)... |
a352fffedcbeb95cfcd09d41ffb01e14e74e313dd7500d64eccaa3ed4f04f5d0 | Python | 984 | 34 | 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"] = 11
msp.architecture["motif_model_spec"]["motif_feature... |
e276fe08f5d9ce9a98360fe41bce8001f6044e112ef5bb55c54107cdd1e70d8b | Python | 984 | 37 | from .params import params
# Number of networks to include:
N_networks = 30
# Number of sequence templates to run:
N_templates = 1
# Number of sequence templates that save dynamics data:
N_templates_with_dynamics = 0
# Toggle STD - always an iterable of 0 and/or 1
STDs = (0,1)
# Toggle TA - always an iterable of 0... |
1eb5916bfb7f04e8c3e67951ad14a0139eb604206b60235b95aa5969bb48331b | Python | 985 | 46 | # from .morpho import BA_align
# from .morpho_sparse import BA_align_sparse
from .backend import NumpyBackend, TorchBackend
from .deprecated_utils import (
align_preprocess,
cal_dist,
cal_dot,
calc_exp_dissimilarity,
)
from .morpho_class import Morpho_pairwise
from .morpho_mesh_correction import Mesh_co... |
41f29d5e830c953c26bd7e476f57627aa400489d696aec72b7422be33e7fa0de | Python | 985 | 34 | import sqlite3
from .db import DB
class DistrictCasesTable(DB):
def __init__(self):
super().__init__()
self.table_name = 'KA_district_cases'
self.table_desc = 'Karnataka districtwise abstract'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
'... |
bb069887c7d40118dcaa88fa7ca950c6ed8d5e1f382d77fbcef059c2c1f1421e | Python | 985 | 35 | import numpy as np
from nilearn.image import load_img, new_img_like
import sys
import glob
import os
def t_to_cohensd(t_stat, n):
# calc cohens d as t / sqrt(n)
cohens_d = t_stat / np.sqrt(n)
return cohens_d
# in path
inp_dir = sys.argv[1]
img_list = glob.glob(f"{inp_dir}/*stat-tstat.nii.gz", recursive=Tr... |
489bcffae894cb0473558a2e7a20b53cffdda5b56ff1fde28fc4125d26563ed7 | Python | 986 | 34 | """Regression tests for fastlog's lightweight event projection."""
from __future__ import annotations
import sys
import torch
from torch import nn
import torchlens as tl
class ManyOps(nn.Module):
"""Model that emits many cheap tensor operations."""
def forward(self, x: torch.Tensor) -> torch.Tensor:
... |
6eebc2af9a06a85ffc765dbd31cdc18ff8cf4338a9b9a018b4b9776ae71c19bd | Python | 986 | 28 | import os
from skimage import io
from nets.sesf_net import SESF_Fuse
def main(input_dir, output_dir):
"""
Image Fusion
:param input_dir: str, input dir with all images stores in one folder
:param output_dir: str, output dir with all fused images
:return:
"""
sesf = SESF_Fuse("cse")
ima... |
d75fa6650b7a32e15e85aa3c065ca0d2bb5663e18d015cc64a976a3e969d2482 | Python | 986 | 34 | import numpy as np
import math
import pdb
# ------------------------------------------------------
# -- set invalid ParentIndex to -1 (make it a root)
def set_invalidparent_to_root(swc_matrix):
nochange_flag = False
updated_swc_matrix = swc_matrix
if (swc_matrix.loc[:, "ParentIndex"].isnull().values.a... |
e5bc055e506df153b00171734d2421bcfa5c4dd9b776ad7bc6fe73d373c6d264 | Python | 986 | 26 | import numpy as np
import torch
from torch import nn
class Get_Loss():
def __init__(self,index_prop,Prop_class,Prop_Pol):
self.loss_fn=nn.MSELoss(reduction="sum")
self.index_prop=index_prop
self.Prop=(Prop_class,)
if Prop_Pol is not None:
self.Prop+=(Prop_Pol,)
def ... |
559ab25097d578df7ca25b01395392b7eaa6e626e2fda834a36483f5426a2914 | Python | 987 | 23 | 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_... |
85433ac07d06a225958ae3de5c120720ee408713a1259a0c109794eeef2ed869 | Python | 987 | 35 | 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=... |
0d0b8c3668211d000d8e14978e809b95a9500897520cafaae9ff1379ef86b5f9 | Python | 988 | 33 | """
Model coding
============
Illustrates how to inspect coding of regression models.
"""
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from eelbrain import *
ds = Dataset()
ds['A'] = Factor(['a1', 'a0'], repeat=4)
ds['B'] = Factor(['b1', 'b0'], repeat=2, tile=2)
##########################################... |
03c714615635b0b58f791807ce5c7469eb7d5deece9559f8fb05a504bb5e2b0a | Python | 989 | 27 | import unittest
from os.path import join, abspath
from spitfire import ChemicalMechanismSpec, FlameletSpec
class Test(unittest.TestCase):
def test_grid_copy(self):
test_xml = abspath(join('tests', 'test_mechanisms', 'h2-burke.yaml'))
mechanism = ChemicalMechanismSpec(cantera_input=test_xml, group_... |
0f8a08609cea7f5d134ee3cb14e7a36944d20c08511da079db6538da3a46835c | Python | 989 | 35 | import tqdm.auto as tqdm
from modular_splicing.dataset.h5_dataset import H5Dataset
def go(path):
dset = H5Dataset(
path=path,
cl=400,
cl_max=10_000,
sl=5000,
iterator_spec=dict(type="FastIter", shuffler_spec=dict(type="DoNotShuffle")),
datapoint_extractor_spec=dict... |
957be0042bc2f5c0b1e867557f4047a2d02c7e599baa965c5761564bf804b046 | Python | 989 | 35 | import os
from permacache import permacache, drop_if_equal
import torch
import numpy as np
from modular_splicing.utils.io import model_steps, load_model
def amm_get_step_with_dropped_motifs(path, n_dropped_motifs):
steps = model_steps(path)
num_dropped_motifs = np.array(
[len(dropped_motifs(path, s... |
e2244c31e1ceb65bc8d5a1249e0c56034eb9112cd353dad96bcb0f5915399a73 | Python | 989 | 29 | """Factory for building the appropriate AgentRegistry from config."""
import logging
from typing import TYPE_CHECKING
from .registry import (
AgentRegistry,
build_default_registry,
)
from .static_backend import StaticAgentRegistry
if TYPE_CHECKING:
from galaxy.config import GalaxyAppConfiguration
log = ... |
321c3fd6662609113f8c2e873b7c35fb7a9788a32a0e1639316194bf7d8ac5ef | Python | 990 | 25 | import numpy as np
from pathlib import Path
from pdb import set_trace
path = Path("/home/barrachina/Documents/cvnn/log/montecarlo/2021/03March/10Wednesday/run-15h12m52")
# init_weight = np.load(path / "initial_weights.npy", allow_pickle=True)
init_debug_weight = np.load(path / "initial_debug_weights.npy", allow_pickle... |
427e20038fa6926f148917164f4705f474aeea2248723af69539ff63eb628874 | Python | 990 | 24 | import numpy as np
from scipy.stats import spearmanr, pearsonr
def compute_spearman_rho_pair(activations):
""" Computes the spearman corrleation between the activations """
return spearmanr(activations[0].ravel(), activations[1].ravel())[0]
def compute_pearson_r_pair(activations):
""" Computes the spearma... |
e0e6b8646393832a45261b1e8a6fd9a4a30537828b27b21e7f57908e29aaa3d1 | Python | 990 | 34 | import pytest
from rpy2 import rinterface
from rpy2.rinterface import memorymanagement
rinterface.initr()
def test_rmemory_manager():
with memorymanagement.rmemory() as rmemory:
assert rmemory.count == 0
foo = rmemory.protect(rinterface.conversion._str_to_charsxp('foo'))
assert rmemory.co... |
096bfb04bfedc3da366d1c6dd2858e9b8d520843f08948d96b55bee57da72ce8 | Python | 991 | 23 | from tbparse import SummaryReader
import sys,os
def parse(directory,model,checkpoint_prefix,topk=5):
all_files = sorted([os.path.join(directory,f) for f in os.listdir(directory)])
cols = ['step', 'progress/accuracy', 'progress/class_accuracy', 'progress/lr',
'progress/patience','valid/accu... |
dd7054ce67b6e83388fed709b0ab1590759b5821d1e58105792e189c7f6b6a28 | Python | 991 | 25 | import os
import pandas as pd
import numpy as np
from pytorch_lightning.callbacks import BasePredictionWriter
class PredictionWriter(BasePredictionWriter):
def __init__(self, output_dir: str, file_label: str, write_interval="epoch"):
super().__init__(write_interval)
self.output_dir = output_dir
... |
ff378513c9c03f6307f0152d687664dc0eef94eabc2e8891f7e80aba4c05b8a3 | Python | 991 | 40 | """Add on-delete to fkey on event.session_id
Revision ID: 0c681a59dce1
Revises: 24feca8a6a5a
Create Date: 2025-03-22 11:49:53.739419
"""
from galaxy.model.database_object_names import build_foreign_key_name
from galaxy.model.migrations.util import (
create_foreign_key,
drop_constraint,
transaction,
)
# ... |
4cc548af646bea06ea3701e50ddd231c2f4c53853b796fa21a1910d75852273b | Python | 992 | 30 | from .compare_transitions import compare_transitions
from .detect_transition_markers import (
detect_transition_markers_branches,
detect_transition_markers_clades,
)
from .global_level import global_level
from .local_level import local_level
from .pseudotime import pseudotime
from .pseudotimespace import pseudo... |
9d4049401b7e6cb8d35af7cbd825e3f0fc35211e7a03f01eecbb7ec824bf2598 | Python | 992 | 34 | import asyncio
class EchoServerClientProtocol(asyncio.Protocol):
def connection_made(self, transport):
peername = transport.get_extra_info('peername')
print('Connection from {}'.format(peername))
self.transport = transport
def data_received(self, data):
message = data.decode()
... |
b37050aa50e3250b4c8218e487b0f4bf19cf9a80163a637d1b0314e527d763b0 | Python | 992 | 34 | import asyncio
class EchoServerClientProtocol(asyncio.Protocol):
def connection_made(self, transport):
peername = transport.get_extra_info('peername')
print('Connection from {}'.format(peername))
self.transport = transport
def data_received(self, data):
message = data.decode()
... |
e026270be47d2ad0da39bc91cfcc259d33aa4a2864a2d4b0bb99db974b3f6151 | Python | 992 | 37 | """
Scanner package for Ethoscope node.
This package provides device scanning and management functionality for both
Ethoscope devices and sensors in the distributed Ethoscope system.
Main components:
- BaseDevice and DeviceScanner: Base classes for all device types
- Ethoscope and EthoscopeScanner: Ethoscope-specific... |
0bae6d41534d3c4f9f135e782f9b32f6113e458794a9e3b835591579f67a8e50 | Python | 993 | 28 | import numpy as np
import pandas as pd
from SERGIO.sergio import sergio
import time
# import pickle
df = pd.read_csv('./bMat_cID7.tab', sep='\t', header=None, index_col=None)
bMat = df.values
sim = sergio(number_genes=1550, number_bins = 6, number_sc = 800, noise_params = 0.2, decays=0.8, sampling_state=1, noise_type='... |
caf8507ae24fe6de849cea7cd450052eb4aa9609c0edcf6bc75cc92a4a1a9b8c | Python | 993 | 33 | import torch
def mean(res, key):
# recursive mean for multilevel dicts
return torch.stack([x[key] if isinstance(x, dict) else mean(x, key) for x in res]).mean()
def accuracy(preds, labels):
preds = preds.float()
max_lgt = torch.max(preds, 1)[1]
num_correct = (max_lgt == labels).sum().item()
... |
e3b6b23a68c7b555bf4da390bf5857b8abc4009ef5c1525cc7b8c5460d5bb711 | Python | 993 | 32 | CODEBLOCK = """
self.nEpochNum[i] = readStruct(fb, "h")
self.nDACNum[i] = readStruct(fb, "h")
self.nEpochType[i] = readStruct(fb, "h")
self.fEpochInitLevel[i] = readStruct(fb, "f")
self.fEpochLevelInc[i] = readStruct(fb, "f")
self.lEpochInitDurat... |
1439904a7f0ebbf4c1bacaeaf786685b86edbfc34fd17a5c8e21397e8228e13d | Python | 994 | 42 | from importlib import metadata
from . import alphabets, bed, gtf, rag, transforms
from ._analyzers import gc_content, length, nucleotide_content
from ._encoders import decode_ohe, decode_tokens, ohe, pad_seqs, tokenize
from ._modifiers import bin_coverage, jitter, k_shuffle, random_seqs, reverse_complement
from ._type... |
1a0f4e6b1c1f6faae27edeccca85c6e1772c05f9415b3344318655bfe954970a | Python | 994 | 32 | from sys import argv
from msp import MSP, am_one_to_3_motif_widths_above_90_shorter_donor_shuffled
msp = MSP()
msp.batch_size = 5
msp.lr = float(msp.lr) / 15 * msp.batch_size
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAc... |
8701539ce62f2e4194c163f5fb72c3b77297f6dc1e8d3e5f97c64745dc67cdc1 | Python | 994 | 36 | import click
from .. import __version__
import os
@click.group(
name="stlearn",
subcommand_metavar="COMMAND <args>",
options_metavar="<options>",
context_settings=dict(max_content_width=85, help_option_names=["-h", "--help"]),
)
@click.help_option("--help", "-h", help="Show this message and exit.")
@... |
af5c1bde4131810ea698b07d0ec1dec083fab47d657494c0cfd64783e9e6d523 | Python | 994 | 25 | import unittest
from svim.SVIM_intra import analyze_cigar_indel
class TestSVIMIntra(unittest.TestCase):
def test_analyze_cigar_indel(self):
tuples = [(5,10), (4,20), (0,10), (7,10), (8,5), (0,5), (1,50), (0,30), (4,25), (5,15)]
indels = [(30, 50, 50, "INS")]
self.assertEqual(analyze_cigar... |
e0e1a2f98d843fac2d61f698b210eaca7e4f31e0cad011d314c9daab729afefa | Python | 994 | 33 | """
Classes that manage resources (models, tools, etc.) by using the current
Transaction.
Encapsulates the intersection of trans (or trans.sa_session), models,
and Controllers.
Responsibilities:
- model operations that involve the trans/sa_session (CRUD)
- security: ownership, accessibility
- common aspect-oriented ... |
697816a9a8c36230c4f9841ca2823a8f4a840722711d0890b528e6162203dd09 | Python | 995 | 46 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created in March 2022
@author: Thomas Bonald <thomas.bonald@telecom-paris.fr>
"""
from abc import ABC
import numpy as np
from scipy import sparse
from sknetwork.base import Algorithm
class BaseLinker(Algorithm, ABC):
"""Base class for link prediction.
Attr... |
9c62d92412f45f7050209c34026e2436e843be158956b054a2613c0425c0314b | Python | 995 | 36 | """A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.absp... |
1118a31ccb390dd4195a8aa32158755ceeb4ddbd0e8e6ecb5ffaa6a920dd2b86 | Python | 996 | 29 | # coding=utf-8
# Copyright 2024 The Google Research Authors.
#
# 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 applicab... |
19699124bb6f7aefb2d7cc3c6bc9a402a5bfe309588da1b1fed63e85991ecc4f | Python | 996 | 27 | #!/usr/bin/env python
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="Tabular Input File Name")
parser.add_argument("-o", "--output", help="Tabular Output File")
parser.add_argument("-c", "--columns", nargs="+", help="Column Headers to Sort By")
parser.add_argument(
"... |
608d5696159f4bd9953d8d1b21ba00e656b6a63276274aa03c921bbdd1236419 | Python | 996 | 29 | from pip._vendor.six.moves.urllib import parse as urllib_parse
class PackageIndex(object):
"""Represents a Package Index and provides easier access to endpoints
"""
def __init__(self, url, file_storage_domain):
super(PackageIndex, self).__init__()
self.url = url
self.netloc = urll... |
6b17653ca720e5546bf0fd3788561413d5efdfd629e43d18ea419e74ba7424fe | Python | 996 | 33 | from __future__ import division
import unittest
import numpy as np
from wyrm.types import Data
from wyrm.processing import logarithm
class TestLogarithm(unittest.TestCase):
def setUp(self):
raw = np.arange(1, 21).reshape(4, 5)
channels = ['ca1', 'ca2', 'cb1', 'cb2', 'cc1']
time = np.ara... |
aca99d3d6daaebc509681957d2cc888f06e2beacd7cee4b26885ab77c7b4da48 | Python | 996 | 34 | from sys import argv
from msp import MSP, amm_mean40v1
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"][... |
22c0cf3095fd72ee252adbee59f2352e8d8c17821d2d9501a05911cec60b073c | Python | 997 | 35 | 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=... |
331f518a84c1ce1eabc0e245c687c6e8dc85db144929e510587648d1b5965ba6 | Python | 997 | 26 | # Run this script from the parent Canonical directory, as
# PYTHONPATH=. python scripts/splicepoint_model_demo.py
import torch
from modular_splicing.models.modules.lssi_in_model import load_individual_lssi_model
which = "acceptor"
# load the model
m = load_individual_lssi_model(f"splicepoint-models/{which}.m", train... |
4b8678019396c95a829d387fb5831dfa4b500b34b63cec8de6ce04bf08b1028e | Python | 997 | 30 | # script to deconvolute a csv file
from decide_organ import *
import os
# look into app folder by default
model = tf.keras.models.load_model(model_name)
folder = "/app"
for file in os.listdir(folder):
custom_data_path = os.path.join(folder,file)
template = pd.read_csv("../../data/raw/composition_gtex_05_08.... |
a93ffd12b91b29430adc23efdd1d56ec5d06a26008101bdf0868248d9cfd8b52 | Python | 997 | 31 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._connector import Connector
from ._hoverlabel import Hoverlabel
from ._insidetextfont import Insidetextfont
from ._legendgrouptitle import Legendgrouptitle
from ._marker import Marker
from ._outsidetextfont import Outsidetextfo... |
1bde064ab0887cd9edc39ad593d2a34ac2310a99bbdc62ddff1ec8fcac16aa7d | Python | 998 | 28 | '''
Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands
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 requir... |
1f770072577f7a59a85b8bca278d4fb2f5d2c5ff04b755fe46c7654d92e71a29 | Python | 998 | 34 | import os
import sys
import glob
import pdb
import numpy as np
import pandas as pd
def eswc2swc(infile, outswcfile=None):
if outswcfile is None:
outswcfile = os.path.splitext(infile)[0] + '.swc'
try:
swc_matrix = pd.read_table(infile, comment='#', sep=r'\s+', header=None)
... |
5bbe2c168b09877a2609274d31a356026d6ce4866087b8ec9dd04d0c8a9b3f9c | Python | 998 | 34 | import numpy as np
from neurogym.utils.ngym_random import TruncExp
from neurogym.utils.scheduler import RandomBlockSchedule, RandomSchedule
def test_truncexp():
te = TruncExp(vmean=100)
te.seed(0)
a = [te() for i in range(1000)]
te.seed(0)
b = [te() for i in range(1000)]
assert (np.array(a) ... |
66ec60880fa531f18f5e079187e12813d6ccd8c3b9b40eba45ccbcb815f99882 | Python | 998 | 37 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture = dict(
type="PreprocessedSpliceAI",
preprocessor_spec=dict(type="Identity"),
spliceai_spec=dict(type="SpliceAIModule", output_size=3),
)
msp.data_spec = dict(
type="H5Dataset",
datapo... |
267664e3431ac056a0ff84873fecb9d3d2121becf89311874a762ae93ce546b0 | Python | 999 | 29 | from setuptools import Command, find_packages, setup
__lib_name__ = "STAGATE"
__lib_version__ = "1.0.1"
__description__ = "Deciphering spatial domains from spatially resolved transcriptomics with adaptive graph attention auto-encoder"
__url__ = "https://github.com/QIFEIDKN/STAGATE"
__author__ = "Kangning Dong"
... |
257d8e36bbc6147b9b625bf9e7138c0f2e77b76f9d97ac45043a618b79350801 | Python | 1,000 | 39 | import multiprocessing
from codecarbon import EmissionsTracker, OutputMethod
def cpu_load_task(number):
a = 0
for i in range(5):
for i in range(int(1e6)):
a = a + i**number
tracker = EmissionsTracker(
measure_power_secs=10,
force_mode_cpu_load=False,
log_level="debug",
o... |
8289590f0074b2ec3b00a91eaf01763f7dd3b19a32a6c973185c6af408fc9a05 | Python | 1,000 | 32 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import torch
def parse_args():
parser = argparse.ArgumentParser(
description='This script extracts backbone weights from a checkpoint')
parser.add_argument('checkpoint', type=str, help='checkpoint file')
parser.add_argument('output',... |
270abe4fe6a2f60cd2f62e0ee27994595ebd86359d4458e2e250caf81a7f8c40 | Python | 1,001 | 46 | import torch
import numpy as np
def pairwise_dist(X, Y):
n, d = X.shape
m, _ = Y.shape
assert d == Y.shape[1]
a = X.unsqueeze(1).expand(n, m, d)
b = Y.unsqueeze(0).expand(n, m, d)
return torch.pow(a - b, 2).sum(2)
def pairwise_dist_np(X, Y):
n, d = X.shape
m, _ = Y.shape
assert d... |
31cd0c6fd9257b401db2cf672d355bc505c6008c81ae49920206968f98d5d52c | Python | 1,001 | 41 | """
Galaxy AI Agents Module
AI agents built on pydantic-ai for Galaxy.
"""
from .base import (
AgentType,
BaseGalaxyAgent,
GalaxyAgentDependencies,
)
from .custom_tool import CustomToolAgent
from .error_analysis import ErrorAnalysisAgent
from .gtn_training import GTNTrainingAgent
from .history import Hist... |
8a0a5e05ffa00f9d7804a28e3feb758774e11c4727d873783da3dd9301e81153 | Python | 1,001 | 24 | import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="irnlm",
version="0.0.1",
author="Alexandre Pasquiou",
author_email="alexandre.pasquiou@inria.fr",
description="Python code to reproduce the analyses of the paper: `Inform... |
f5fbbeb9e4a6704e26a7cd4a525f71803e3e4cc04c038b421bbed7ba5258616e | Python | 1,001 | 36 | 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... |
3f5afaf1c0db095cf1526cd69538d697858ee2017dce626d075066f28704b4d4 | Python | 1,002 | 44 | from math import ceil
from modular_splicing.train.standard_train import train_model
def train(
*,
path,
dtrain,
deval,
architecture,
bs,
lr,
epochs_per_motif,
num_motifs,
):
train_limit = int(len(dtrain) * epochs_per_motif)
for i in range(num_motifs):
print("train... |
5ee45ae6bf0900bd0d8ca72e2d60f5086424a30c392896aae91214175ab47111 | Python | 1,002 | 37 | def main():
import os
import pkg_resources
import sys
from PyQt6 import QtCore, QtGui, QtWidgets
from impose.gui.main import Impose
from impose._version import version as __version__
for arg in sys.argv:
if arg == '--version':
print(__version__)
sys.exit(0)... |
847e8487d3449ec6c3beee20a47578b3a10b047094d20e85cc615b22cbc4691b | Python | 1,002 | 37 | 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... |
1fdf1a43c6e59e8d28b2ddf64db07effee52f97eba63f8af64ca5cd9b4a9b6bc | Python | 1,003 | 25 | import torch
import torch.nn as nn
from model.diversebranchblock import DiverseBranchBlock
if __name__ == '__main__':
x = torch.randn(1, 32, 56, 56)
for k in (3, 5):
for s in (1, 2):
dbb = DiverseBranchBlock(in_channels=32, out_channels=64, kernel_size=k, stride=s, padding=k//2,
... |
3d9e10e57d564f51d20288d95fbd9f526e28f58d0fc2871ec091280b5a5f80ca | Python | 1,003 | 32 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""tests for ranking API"""
import unittest
from sknetwork.data.test_graphs import *
from sknetwork.ranking import *
class TestPageRank(unittest.TestCase):
def test_basic(self):
methods = [PageRank(), Closeness(), HITS(), Katz()]
for adjacency in [t... |
8b181a6ea84c3987dc4add9539713f23d65b2220ba4d5b21218e75ca21a48c8f | Python | 1,003 | 40 | """Add on-delete to fkey on user_action.session_id
Revision ID: 24feca8a6a5a
Revises: cde5d2db77e7
Create Date: 2025-03-22 11:47:02.069491
"""
from galaxy.model.database_object_names import build_foreign_key_name
from galaxy.model.migrations.util import (
create_foreign_key,
drop_constraint,
transaction,... |
9f5042f6af210ba3cc26b3831bf4c4728fdbb23380d2270488d2d62e92da18d7 | Python | 1,003 | 39 | __version__ = "7.1.3"
__DESCRIPTION__ = "Tools to run ONT hardware"
import sys
import threading
# Ensure logging handler attached
import bream4.utility.logging_utils # noqa: F401
def install_thread_excepthook():
"""
Fix in Python 3.8
Workaround for sys.excepthook thread issue (https://bugs.python.org/... |
acd7b255e31dd8cb5a11511e9846c2c3608888d3ce226e2c72dd9145df5fedca | Python | 1,003 | 47 | import numpy as np
from impose import util
def test_basic_dicts():
d1 = {"a": 2}
d2 = {"a": 2}
assert util.equal_states(d1, d2)
d2["a"] = 3
assert not util.equal_states(d1, d2)
def test_nan_dicts():
d1 = {"a": 2, "b": np.nan}
d2 = {"a": 2, "b": np.nan}
assert util.equal_states(d1, d... |
848b7fdaa8dba72f7395b02b2947cbf01ebc8d6f2f99b76d84f63bc546917187 | Python | 1,004 | 29 | """
core.whitening — Symmetric inverse-square-root for PSD matrices.
Used by `proper_cv.fit_whitening_per_cohort` to whiten each cohort's
feature distribution by the inverse symmetric square root of its
HC-anchored covariance matrix:
W = (Σ_HC + λ I)^(-1/2)
x_whitened = W @ x
After this transform, the cohort... |
9b8f58bf2e056bb0e43ed7aea0f7d01f72d310eaf42e445dc512a2720067c151 | Python | 1,004 | 34 | import rpy2.rinterface as rinterface
from rpy2.rinterface import bufferprotocol
rinterface.initr()
def test_getrank():
v = rinterface.IntSexpVector([1, 2, 3])
assert bufferprotocol.getrank(v.__sexp__._cdata) == 1
m = rinterface.baseenv.find('matrix')(nrow=2, ncol=2)
assert bufferprotocol.getrank(m._... |
9e5659e25fdd7012eeba18e65e0ab0f5011e42066e91592971cea50043507de0 | Python | 1,004 | 28 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... |
b213661a6c96c852797ecd3a5a87c4a0961e8b2d58ca4a50d94ab90e31d2996c | Python | 1,004 | 35 | import os
import argparse
def filename_without_extension(filename):
filename = os.path.basename(filename)
filename, zip_ = os.path.splitext(filename)
assert zip_ == ".zip", "Expected a zip file"
return filename
def export_to(path, destination):
os.makedirs(destination, exist_ok=True)
os.syst... |
4c2e340ef7314dc3cba415f84beceea8d8a6206a65068607587aac82d4992908 | Python | 1,005 | 43 | from __future__ import annotations
import os
import subprocess
import sys
def test_canvas_widgets_root_import_is_lazy() -> None:
code = r"""
import sys
from larvaworld.portal.canvas_widgets import (
CanvasArena,
CanvasObject,
EnvironmentCanvasState,
env_params_to_canvas_state,
)
assert CanvasAre... |
737e5f3569269e584ee3541ea6ae4b967c4baaa90a20dc9602a61b7acd790d68 | Python | 1,006 | 30 | """
This module define a CrossEntropyContactPred
"""
# pylint: disable=W0223
import torch
from utils.utils import select_output_lm
from utils.utils import square_pad_sequence
class CrossEntropyContactPred(
torch.nn.modules.loss._Loss
): # pylint: disable=protected-access
"""
This class define a specific ... |
8abb276f16729bf701bd7b26e97d49ca108ca0ad89036f60b874e41a96beeb0b | Python | 1,007 | 33 | # Generated by Django 3.2.6 on 2023-02-22 17:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0098_auto_20230220_1550'),
]
operations = [
migrations.AddField(
model_name='tomographicdata',
name... |
af861060870b6dbcbb872602801a1ae771ebbf30552c8e9c77397791bb1540fc | Python | 1,007 | 26 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for link prediction by nearest neighbors"""
import unittest
from sknetwork.linkpred import NNLinker
from sknetwork.data.test_graphs import *
from sknetwork.embedding import Spectral
from sknetwork.utils import get_degrees
class TestNNLinker(unittest.TestCase):
... |
d7699a7bfb7c50abca980ef386630a91d1c5ab6bb55f5ad2c8d30962f55b3565 | Python | 1,007 | 38 | # UDP
import asyncio
class EchoClientProtocol:
def __init__(self, message, loop):
self.message = message
self.loop = loop
self.transport = None
def connection_made(self, transport):
self.transport = transport
print('Send:', self.message)
self.transport.sendto(s... |
352fb91be7780a30bd361c75e77124fe9bf99d4dd9b1129d27a05f9d6fc8590d | Python | 1,009 | 47 | 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"] = dict(... |
455684188a00432e37d0cbf596b837fb91a854f76a3945aaa8fdaeca8d00a6b3 | Python | 1,009 | 37 | import os
from tools.hash_value.make_hash import *
"""
Hash keys for parameter sets
"""
def make_parameter_hash_key(parameter_list):
hash_value = make_hash_name(parameter_list)
hash_key = hash_identifier(hash_value=hash_value, length=8, prefix="p")
return hash_key
def make_parameter_dict_hash_na... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.