sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c372cf3d5179a75c6bf0a6ff03580bb7a3e3fd58f394ff9757412a49ee66301e | Python | 247 | 13 | """Profiler for running Semsimian performance tests"""
import pstats
import sys
def display_stats(filename):
p = pstats.Stats(filename)
p.sort_stats("tottime").print_stats(20)
if __name__ == "__main__":
display_stats(sys.argv[1])
|
f283ca9e46c74686882c3958d7331af1049755a5d9c4864f63136d67c8d4c230 | Python | 247 | 13 | import os
import tmkit as tmk
from . import dir_data
def test_mapping_pdb2uniprot():
res = tmk.mapping.pdb2uniprot(
id="101m.A",
ref_fpn=os.path.join(dir_data, "map/pdb_chain_uniprot.csv"),
)
assert res == "P02185"
|
a8d679ff3294de18a2209534b3f1bdfc82fee1982fe0460c68c3535a83e54618 | Python | 249 | 17 | import os
cmd = 'mkdir Embeddings'
os.system(cmd)
cmd = 'python3 fasta_to_ds.py'
os.system(cmd)
cmd = 'python3 predict_embed.py'
os.system(cmd)
cmd = 'python3 append_embed.py'
os.system(cmd)
cmd = 'python3 make_predictions.py'
os.system(cmd)
|
9d5f38b429ad29d73ec792449ba9515c17afaf52f59c7cf8bf3279a591432c8b | Python | 250 | 14 | import os
def build_index():
f_index = open("indexing_file")
index = f_index.read()
index = index.split("\n")
dict_index = {}
for i in index[:-1]:
i = i.split(",")
dict_index[i[0]] = i[1]
return dict_index
|
dc905143097ee1f4a1445446d776a3576c7d74e0372a438a708289f0f2e2c5c4 | Python | 250 | 14 | """
© 2022, ETH Zurich
"""
import requests
from rescoss_logp_ml.data_handling.download import DATA_URL, SAVED_MODELS_URL
def test_islinkup():
for remote in [DATA_URL, SAVED_MODELS_URL]:
r = requests.head(remote)
assert r.ok
|
a66230f678c8269ee249dda1523f2b1aefcc23f20ef5cffa03011e6077c46a5e | Python | 251 | 8 | from .ade import ADE
from .voc import VOC
from .cityscapes import Cityscapes
from .camvid import CamVid
# from .stuff10k import Stuff10K
from .pcontext import PascalContext
__all__ = ['ADE', 'VOC', 'Cityscapes', 'Stuff10K', 'CamVid', 'PascalContext'] |
ad817a70438703702386b1e7fb492412160708b8bc47f72829a0153afd5efd88 | Python | 251 | 5 | custom_params = {}
custom_params['cache_dir'] = 'nn_models/sc05/cache/'
custom_params['model_dir'] = 'nn_models/sc05/all_feat/model_data/'
custom_params['desc_dir'] = 'descriptors/sc05/all_feat/'
custom_params['feat_mask'] = [1.0, 1.0, 1.0, 1.0, 1.0]
|
07387b788c79db1f2a9824c2eda7f05378451de54917c33804181ecdc4649cb2 | Python | 252 | 10 | from setuptools import setup, find_packages
setup(
name = "darela",
version = "1.0",
description = "DA Release Analysis",
author = "Shashaank N",
packages = find_packages(),
install_requires = ['autograd', 'alive-progress'],
)
|
2a8d7d51d3a3d4cc8810412b231698e71940e3fdc0ae7175f8a5fa6e472e0555 | Python | 252 | 10 | __author__ = "Christopher Preusch"
__copyright__ = "Copyright 2017, Christopher Preusch"
__email__ = "cpreusch[at]ust.hk"
__license__ = "MIT"
from snakemake.shell import shell
shell("samtools flagstat {snakemake.input[0]} > {snakemake.output[0]}")
|
7318ed660f87aa4a6b2e03a8b2a3091df62ef4d579b4dcc4558c9a640a6fddf1 | Python | 252 | 13 | from .treba_model import TREBA_model
model_dict = {
'treba_model' : TREBA_model
}
def get_model_class(model_name):
if model_name in model_dict:
return model_dict[model_name]
else:
raise NotImplementedError
|
8e34a0e364f95f897350d3eacb35b32ddc3e63eb5f1fd930db79f24105d2bc03 | Python | 253 | 8 | import pandas as pd
from settings import *
def plot():
df = pd.read_table(f'{OUTPUT_FILE}_fit.tsv')
ax = df.plot.line(x='epoch', y=['desire_ratio', 'valid_ratio'], ylim=(0,1))
fig = ax.get_figure()
fig.savefig(f'{OUTPUT_FILE}_fit.png')
|
ce2bfaa51dd047fde7ce3d52a8ecd82388791547fdf3e6e043a17f7fa5b6b4af | Python | 254 | 9 | from collections import defaultdict
from typing import Tuple, Any, Dict, List, Iterable
def pairs_as_dict(pairs: Iterable[Tuple[Any, Any]]) -> Dict[Any, List[Any]]:
d = defaultdict(list)
for p in pairs:
d[p[0]].append(d[1])
return d |
ed2e8ed2f5f4f33e69481a57a9d58332718a502356423beeda38db6710f28430 | Python | 254 | 11 |
from snakemake.shell import shell
log = snakemake.log_fmt_shell(stdout=False, stderr=True)
shell(
"vcfallelicprimitives -t DECOMPOSED --keep-geno {snakemake.input[0]} "
"| vcffixup - | vcfstreamsort "
" > {snakemake.output[0]} {log}"
)
|
148ffbb3eb2691514ee991c0c1100393d64278f91245a7c55705fe24308e229d | Python | 255 | 16 | #%%
import numpy as np
from graspologic.simulations import er_np
p1 = 0.05
p2 = 0.03
p3 = 0.02
p4 = 0.01
ps = [p1, p2, p3, p4]
n = 100
As = np.zeros((4, n, n))
for i, p in enumerate(ps):
As[i] = er_np(n, p, directed=True, loops=True)
As.sum(axis=0) |
355c6954b7268baf86a8babf5301fa687de41d372cec0acaeed5047b5b7c4a1e | Python | 255 | 10 | from ppqm.utils import shell
def test_steam_timeout() -> None:
cmd = "echo 'hello_world' && sleep 1 && sleep 1 && sleep 1 && echo 'too_slow'"
timeout = 1 # seconds
stdout, _ = shell.execute(cmd, timeout=timeout)
assert stdout is None
|
c2689a30644f480055faf5d0489f91f7abfb2224d41820dbdc3d83e7fd0b8a64 | Python | 255 | 9 | from setuptools import setup
setup(name='fdtd_env',
version='0.0.1',
author='Renjie Li',
description='FDTD environment for optimizing photonic crystals by RL',
license='MIT',
install_requires=['gym>=0.2.3']
)
|
8899c2576736d1d665b2f27476be6b534fc7a7328729333958417e9fe836d70f | Python | 257 | 8 | """
This module contains classes and methods for making and analyzing
predictions with models that have already been trained.
"""
from .model_predict import AnalyzeSequences
from . import predict_handlers
__all__ = ["AnalyzeSequences", "predict_handlers"]
|
c84f0ed439c0e95545a41130d5ce2f216a76f0fd139ccc5184b1b7d550de3c2c | Python | 257 | 8 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
"""
data module contains data_handler that allows basic preprocessing for input
into the sample-wise and feature-wise encoder-decoder.
"""
|
5563ff4857652c186266bee22de77f6b45774022e2fe1111eaf2e629e24b03ac | Python | 259 | 17 | """
__init__.py
Created by: Martin Sicho
On: 17.05.22, 9:53
"""
import logging
import sys
logger = None
if not logger:
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def setLogger(log):
setattr(sys.modules[__name__], 'logger', log) |
6032fb05ffb041d70d7e7d0f731c8014052a7f65a98cfdc26ab7e7601467ca30 | Python | 260 | 6 | import numpy as np
data = np.load('./inputs/sociodemographics_correlation_input.npy')
labels = np.load('./inputs/labels.npy', allow_pickle=True)
corr = np.corrcoef(data.T)
np.save('corr.npy', corr)
|
4ff54deb3968e64d408b77a96dc2c6cda1fb17c15174dcb21a0f6c1a8a9d607d | Python | 261 | 15 | class RelationshipMap:
def __init__(self):
pass
Forward = {
"Located_in": "Located in",
"Neurotransmitter": "Releases",
}
Backward = {
"Located_in": "Includes",
"Neurotransmitter": "Released by",
} |
f61983f9705d25b52662e862ad802218907c1ab78e40ce283325ba5968bb890a | Python | 261 | 4 | from utils.decomposition.Decomposition import Decomposition
from utils.decomposition.GloVeDecomposition import GloVeDecomposition
from utils.decomposition.ParafacDecomposition import ParafacDecomposition
from utils.decomposition.LDA_idf import LDADecomposition
|
012a0bb921e29161f435c42ee3458d1d230ccb5a672f253812e020b67f4f4810 | Python | 262 | 11 | pcr_prediction_config = dict(
amplification_full_cycle_number=40,
training_cycle_number=21,
interpolation_method='cubic',
train_test_split_ratio=0.95,
prediction_timestep=5,
interpolation_number=10,
)
if __name__ == "__main__":
pass
|
f3f98852d67bc4b88e5083f3817997f5f16749542eba7974592a6d77e576aadf | Python | 262 | 9 | """
This is the main module for Selene.
"""
__all__ = ["sequences", "targets", "samplers", "utils",
"predict", "interpret", "__version__"]
from .version import __version__
from .evaluate_model import EvaluateModel
from .train_model import TrainModel
|
ae835f39f264bf94297d2e65fef4e19dfac08105ea473fd7187ec94659793d19 | Python | 263 | 6 | from setuptools import setup
from torch.utils.cpp_extension import CUDAExtension, BuildExtension
setup(name='syncbn_gpu',
ext_modules=[CUDAExtension('syncbn_gpu', ['syncbn_cuda.cpp', 'syncbn_cuda_kernel.cu'])],
cmdclass={'build_ext': BuildExtension}) |
e0071bdbdd5e9e0eb0caae66b03a7bf601c97f984969af76c456a121938b6da5 | Python | 263 | 7 | from mb_dual_dan.connectome.loader import Connectome, load_winding, summary
from mb_dual_dan.connectome.mb_extract import MBSubgraph, extract_mb, mb_summary
__all__ = [
"Connectome", "load_winding", "summary",
"MBSubgraph", "extract_mb", "mb_summary",
]
|
1eec72a776e1d934f0c58259e2c083f7e01d0947fd4d23beb5d191ffd64b8229 | Python | 264 | 12 | __author__ = "Dayne Filer"
__copyright__ = "Copyright 2019, Dayne Filer"
__email__ = "dayne.filer@gmail.com"
__license__ = "MIT"
from snakemake.shell import shell
shell(
"bcftools norm {snakemake.params} {snakemake.input[0]} " "-o {snakemake.output[0]}"
)
|
844f55a6a63e7e452ce31388f3527cf38d174e20f00f41a673e82f00f2b33c51 | Python | 264 | 12 | mylines = open('bc-100.out').readlines()
for line in mylines:
# Go through every PDB in the line
pdbid_chain = line.split()
for pc in pdbid_chain:
chain = pc.split('_')[1]
if len(chain) == 1:
print (pc)
break
|
8bd337e33a7ccdea0bce8dc3eac745d021570a4331ea54aa66d3c6bedf8dfda5 | Python | 264 | 7 | from torch.nn.parallel import DataParallel, DistributedDataParallel
from mmcv.utils import Registry
MODULE_WRAPPERS = Registry('module wrapper')
MODULE_WRAPPERS.register_module(module=DataParallel)
MODULE_WRAPPERS.register_module(module=DistributedDataParallel)
|
cfae4350773a41275caaa19424e4195efb70aaed5f2a2b12ea707d192a591697 | Python | 265 | 25 | import gurobipy as gp
ARCHITECTURES = {
1: [784, 10],
2: [784, 16, 10],
3: [784, 16, 16, 10]
}
INT = 0
BIN = 1
CONT = 2
EPSILON = 1e-4
LOG = False
MULTIOBJ = False
TARGET_ERROR = 0.1 # 90% Accuracy
MARGIN = 0.5
DO_CUTOFF = True
GUROBI_ENV = gp.Env()
|
893f6fa6acb5ee4ae75776127fa22334c4eac26ef831518f28a5c9c35dd0bda9 | Python | 267 | 13 | from .constants import SEARCH_CONFIG
from .ols_implementation import (
BaseOlsImplementation,
OlsImplementation,
TIBOlsImplementation,
)
__all__ = [
"SEARCH_CONFIG",
"BaseOlsImplementation",
"OlsImplementation",
"TIBOlsImplementation",
]
|
cb27b2004db62bd1f58bce983f3caf0164d1b4e70e3d2826f0214fdbca550b59 | Python | 267 | 10 | __author__ = "Johannes Köster"
__copyright__ = "Copyright 2016, Johannes Köster"
__email__ = "koester@jimmy.harvard.edu"
__license__ = "MIT"
from snakemake.shell import shell
shell("samtools index {snakemake.params} {snakemake.input[0]} {snakemake.output[0]}")
|
9ea5a3ce7b22dee0c5fc6b75b1af6c63e53527c3cbb9005edba694627a098b7e | Python | 268 | 8 | from .ba_houses import BA_Houses
from .gcn import GCN
#from .utils import train, test
from .testing import train, test
from .testing import GCN_1layer, GCN_2layer, GCN_3layer, GCN_3layer_basic
from .testing import GIN_1layer, GIN_2layer, GIN_3layer, GIN_3layer_basic |
ae6a75d764e4aecacc0610a703c7d7cfab09ce23219e6d9d05e30fce76a59952 | Python | 268 | 10 | from .toy import get_toy_palette, sample_toy_networks
from .utils import get_random_seed, set_warnings
from .wrangle import (
get_paired_inds,
get_paired_subgraphs,
get_seeds,
remove_group,
to_largest_connected_component,
to_pandas_edgelist,
)
|
18a7244971966e6f48710c8f7c5f3745175a620f850d7bd840123fee95394171 | Python | 269 | 10 | __author__ = "Michael Chambers"
__copyright__ = "Copyright 2019, Michael Chambers"
__email__ = "greenkidneybean@gmail.com"
__license__ = "MIT"
from snakemake.shell import shell
shell("samtools faidx {snakemake.params} {snakemake.input[0]} > {snakemake.output[0]}")
|
3e61ec39c8a23f2ea7d8bb9c8cf1dce24591c135ff36849d33ceac34dd2d6c65 | Python | 270 | 9 | import numpy as np
from sklearn.metrics import roc_auc_score
posd = np.load('pos_dists.npy')
negd = np.load('neg_dists.npy')
ytrue = np.concatenate([np.ones_like(posd), np.zeros_like(negd)])
ypred = 1.0/np.concatenate([posd, negd])
print(roc_auc_score(ytrue, ypred))
|
4532a19ff3d1f70bde2aedad51d0684b4861a70198299f9d84b40505f8ffe5f4 | Python | 270 | 11 | # Copyright (c) Open-MMLab. All rights reserved.
from .hook import HOOKS, Hook
@HOOKS.register_module()
class ClosureHook(Hook):
def __init__(self, fn_name, fn):
assert hasattr(self, fn_name)
assert callable(fn)
setattr(self, fn_name, fn)
|
a509932ebf8dbdbd002bc7d49f9003270d6e4576e2a697e36924df722d8acc65 | Python | 270 | 11 | #! /usr/bin/python
import numpy
import sys
import umap
# run with python input_file.txt > output_file.txt
dataarray = numpy.loadtxt("data_in.txt",delimiter="\t")
embedding = umap.UMAP().fit_transform(dataarray)
numpy.savetxt("data_out.txt",embedding,delimiter="\t")
|
c13cf1a5740e9786a2aa7c5f9cbe78bf708f694241aa7b12d01d0a06f4f1a4b2 | Python | 270 | 11 | import torch
from torch import nn
class Scale(nn.Module):
def __init__(self, init_value=1.0):
super(Scale, self).__init__()
self.scale = nn.Parameter(torch.FloatTensor([init_value]))
def forward(self, input):
return input * self.scale
|
e535bc94bd91d7b2a08be592893191f905635c7b975455f8953ebecd62d3c554 | Python | 271 | 9 | # Flask settings
# FLASK_SERVER_NAME = 'localhost:8888'
FLASK_DEBUG = False # Do not use debug mode in production
# Flask-Restplus settings
RESTPLUS_SWAGGER_UI_DOC_EXPANSION = 'list'
RESTPLUS_VALIDATE = True
RESTPLUS_MASK_SWAGGER = False
RESTPLUS_ERROR_404_HELP = False |
b1da86221ddcfa72fe3ab57c951d5e6cc7051236c5a7eedbeec9d4bb8745a421 | Python | 273 | 8 | """
Code is based on https://github.com/MichSchli/GraphMask.
"""
from .lagrangian_optimization import LagrangianOptimization
from .hard_concrete import HardConcrete
from .multiple_inputs_layernorm_linear import MultipleInputsLayernormLinear
from .squeezer import Squeezer
|
0638a6d242f069740330afe1428dfc8fcdd49731b1833606e558ecf794adc24d | Python | 274 | 10 | """
Dummy conftest.py for gratin.
If you don't know what this is for, just leave it empty.
Read more about conftest.py under:
- https://docs.pytest.org/en/stable/fixture.html
- https://docs.pytest.org/en/stable/writing_plugins.html
"""
# import pytest
|
20812bebdefb1b10e773ec4a3c5b7fd5300a414ec8fd3290c7df1cc6bbd47718 | Python | 274 | 6 | from .matrix import cascade, tree_cascade, triangular, psvd
from .vector import balanced_tree, unbalanced_tree, vector_unit
from .forward import ForwardMesh
from .coupling import CouplingNode, PhaseStyle
from .rectangular import rectangular
from .component import Component
|
83841c1375778701a46b7c10fea8a16c73acc5b1ea418c6486b8dd33b2a544f8 | Python | 275 | 10 | from setuptools import setup
setup(name='carpet',
version='2021',
# description='',
url='https://cfaed.tu-dresden.de/friedrich-home',
author='Anton Solovev, Benjamin M Friedrich',
license='MIT',
packages=['carpet'],
zip_safe=False) |
e21ee90976386e603fb559257d232ec7917d0e49d265c4e2fe403b24d75ea6d7 | Python | 275 | 8 | from .grid import Grid, YeeGrid
from .fdfd import FDFD
from .fdtd import FDTD
from .mode import ModeLibrary, ModeSolver
from .utils import Box, Material, SILICON, POLYSILICON, NITRIDE, OXIDE, TEST_INF, AIR
from jax.config import config
config.update("jax_enable_x64", True)
|
6ee719cd3fc397c9c1e6d3627a0136bc81b230ce8a706769a4c61476282e663b | Python | 276 | 14 | import numpy as np
row_range = np.arange(4, 102)
file_name = 'hc'
with open(file_name, 'r') as f:
content = f.readlines()
for row in row_range:
if content[row] == 'YES\n':
content[row] = 'NO\n'
with open(file_name, 'w') as f:
f.write(''.join(content))
|
9f3ef737c6ee7e43b9355994405eed5a0dc99ea6486351869e0d1d82ccd5c6ac | Python | 276 | 12 | #!/usr/bin/env python
from rectool import RecognizerToolbox
rt = RecognizerToolbox()
if not rt.use_existing_lnas():
if not rt.use_existing_adaptation():
rt.generate_lnas()
rt.decode_state_segmentations()
rt.estimate_adaptation()
rt.generate_lnas()
rt.decode_batch()
|
6cd5f4e6d077b149f1cd7033935796749b4e325a95054d81e31ac679c92afce1 | Python | 278 | 9 | from .trainer import Trainer
from .torch_setup import setup
from .training_state import load_training_state, save_training_state
from .incremental import IncrementalFNOTrainer
from .adamw import AdamW
from .tensorgrad import (
TensorGRaD,
fno_tensorgrad_param_groups,
)
|
a4f83e4b52b630fa90fe2d3b6e4f83fe900c4a344e868bf2472b6653d0cf18e2 | Python | 278 | 10 | """
Dummy conftest.py for palm_tools.
If you don't know what this is for, just leave it empty.
Read more about conftest.py under:
- https://docs.pytest.org/en/stable/fixture.html
- https://docs.pytest.org/en/stable/writing_plugins.html
"""
# import pytest
|
eac30f05bb8fd9bdb9fe53a36265873c32b40a9fc283f1aade253d876951acf7 | Python | 278 | 10 | '''
Initializes for model running mode.
See the documentation of Clampy for initialization files for amplifiers.
'''
from brian2 import *
from clampy.brianmodels import *
dt = 0.1*ms
board = RC_and_electrode(Ce = 3*pF)
board.set_aliases(Ic1='Ic', Ic2='Ic', I_TEVC='I', V1='V')
|
9ae8cc2dbcf215faad1e4c14e659f06b4db3d3143f516ba9e3ec9062e66758fb | Python | 279 | 7 | # Copyright (c) Open-MMLab. All rights reserved.
from .base import BaseFileHandler
from .json_handler import JsonHandler
from .pickle_handler import PickleHandler
from .yaml_handler import YamlHandler
__all__ = ['BaseFileHandler', 'JsonHandler', 'PickleHandler', 'YamlHandler']
|
6524860f84282821fe9ec8ea8c7a4a14d337c77e131b119049ca5999acf19fa0 | Python | 281 | 13 | dataset_paths = {
'celeba_train': '',
'celeba_test': '',
'celeba_train_sketch': '',
'celeba_test_sketch': '',
'celeba_train_segmentation': '',
'celeba_test_segmentation': '',
'ffhq': '',
}
model_paths = {
'stylegan_ffhq': 'pretrained_models/stylegan2-ffhq-config-f.pt',
}
|
ba79360cbd010ae2e60d6ddc05bf5dedbc221048524dd04d3e34addffc342523 | Python | 281 | 14 | """Main init for phys2bids package."""
from ._version import get_versions
__version__ = get_versions()["version"]
del get_versions
from . import _version
__version__ = _version.get_versions()["version"]
from . import _version
__version__ = _version.get_versions()["version"]
|
00db7b216b07e27ca79564b078d0e40ef58c1288275b53ca9170c261834e439e | Python | 282 | 9 | from eelbrain import *
configure(False)
ds = datasets.get_mne_sample(-0.1, 0.2, src='ico', sub="modality == 'A'")
res = testnd.ttest_1samp('src', ds=ds, tstart=0, tfce=True, samples=100)
# ds = datasets.get_uts()
# res = testnd.ttest_1samp('uts', ds=ds, tfce=True, samples=1000)
|
5c1cd620176e1f3bdf818682769c8d764bce7485e9cdca5e796787821601d509 | Python | 282 | 13 | import os
import configparser
NEO4J_CONF_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../config/neo4j_config.ini")
def get_config():
conf = configparser.ConfigParser()
conf.read(NEO4J_CONF_PATH)
return conf['NEO4j']
neo4j_config = get_config()
|
32a8172884a03cd4e1c1ccd09d7b777912071370b28242f09c8366fa3c27f4c5 | Python | 283 | 8 | from .bbox_nms import multiclass_nms
from .merge_augs import (merge_aug_bboxes, merge_aug_masks,
merge_aug_proposals, merge_aug_scores)
__all__ = [
'multiclass_nms', 'merge_aug_proposals', 'merge_aug_bboxes',
'merge_aug_scores', 'merge_aug_masks'
]
|
7c4605d9d2e98394ed0014654ca07a9bbb3864bc5ed34f3ff88f0a9a22504daa | Python | 283 | 15 | '''
Some tools for file management
'''
import os
__all__ = ['up_dir', 'make_subdir']
def up_dir(path):
return os.path.split(path)[0]
def make_subdir(path, dir):
folder = os.path.join(path, dir)
if not os.path.exists(folder):
os.mkdir(folder)
return folder
|
a72d91296c1ee0a3dac71deb2fc4e75a2e273d6a69cf6b314c3007651ccaf229 | Python | 283 | 11 | from snakemake.shell import shell
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
shell(
"(whamg "
"-x {snakemake.threads} "
"-a {snakemake.input.fasta} "
"-f {snakemake.input.bam} "
"-c {snakemake.params.include_chroms} > {snakemake.output}) {log} "
)
|
c484d53b22ec85aad8f9288ffb27069f8cd829c2b58e98aabfdd992e124e779d | Python | 283 | 21 |
import gzip
import sys
import os
fh = gzip.open(sys.argv[1],'rt')
fho = gzip.open(sys.argv[2],'wt')
print("in: "+sys.argv[1])
print("out: "+sys.argv[2])
for line in fh:
line = line.replace('chr','')
fho.write(line)
fh.close()
fho.close()
os.rename(sys.argv[2],sys.argv[1])
|
fac3e50917eb3edc33cc870e5e1ebbbac1199a098ad52492ac48a561f795be0a | Python | 283 | 14 | from setuptools import find_packages, setup
setup(
name='M2TR',
version='0.1.1',
requires= ['timm',
'fvcore',
'albumentations',
'kornia',
'simplejson',
'tensorboard',
],
packages=find_packages(),
license="apache 2.0")
|
0607483f7ae0672816a665ab73f8458df1f5fa3381c0be694f47be7ee24855d4 | Python | 284 | 8 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from .transforms import Compose
from .transforms import Resize
from .transforms import RandomHorizontalFlip
from .transforms import ToTensor
from .transforms import Normalize
from .build import build_transforms
|
703dadf865d0fbfa89fa46072d938f65cfcf9e62032ad26659bf2c09f7bde755 | Python | 284 | 9 | __version__ = "0.0.1"
#from ._widget import PalmariWidget
from .data_structure.experiment import Experiment
from .data_structure.acquisition import Acquisition
from .processing.image_pipeline import ImagePipeline
# from .processing.image_pipeline_widget import ImagePipelineWidget
|
9427b984a05e6fc4178a9611b3e2a84a14c8b5be7059900e02e363efc6fff949 | Python | 285 | 8 | from mmcv.utils import Registry
CONV_LAYERS = Registry('conv layer')
NORM_LAYERS = Registry('norm layer')
ACTIVATION_LAYERS = Registry('activation layer')
PADDING_LAYERS = Registry('padding layer')
UPSAMPLE_LAYERS = Registry('upsample layer')
PLUGIN_LAYERS = Registry('plugin layer')
|
39550060902bd67efd54c597faf7de22f7e25b654ab11dddf0971143067e5222 | Python | 286 | 10 | from crossmapy.embed import *
from crossmapy.utils import *
from crossmapy.mi import *
from crossmapy.dataset import *
from crossmapy.gc import *
from crossmapy.te import *
from crossmapy.ccm import *
from crossmapy.cme import *
from crossmapy.cmc import *
from crossmapy.plot import *
|
5916ed19f7fa7933d21bd15cc8cce67de37610b6e2076a1950612325803025a6 | Python | 286 | 11 |
import torch
from torchsummary import summary
from nets.yolo import YoloBody
if __name__ == "__main__":
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
m = YoloBody([[3, 4, 5], [1, 2, 3]], 80).to(device)
summary(m, input_size=(3, 416, 416))
|
fef30e799419053da4baaec5d1f845819afd6a4c7c18b02db0e69fb5df857701 | Python | 286 | 10 | from .data_losses import LpLoss, H1Loss
from .equation_losses import BurgersEqnLoss, ICLoss
from .differentiation import FourierDiff, non_uniform_fd, FiniteDiff
from .meta_losses import (
WeightedSumLoss,
FieldwiseAggregatorLoss,
Aggregator,
Relobralo,
SoftAdapt,
)
|
6501f936dbe48b9153504c24942f114627b5f0489a4f895adc097abca74d9ffd | Python | 287 | 9 | # %%
# start demo here
import pymaid
from pymaid_creds import url, name, password, token # my private CATMAID credentials
rm = pymaid.CatmaidInstance(url, token, name, password)
skids = [992646, 15599768]
pair_morpho = pymaid.get_neurons(skids)
pair_morpho.nodes.loc[:, ['x', 'y', 'z']] |
6c3b1bbe95904ef3d99b378709f4c914018bb4ab512f3fb4109973ac42f216f0 | Python | 287 | 8 | from torch.nn.modules.module import Module
from ..functions.roi_crop import RoICropFunction
class _RoICrop(Module):
def __init__(self, layout = 'BHWD'):
super(_RoICrop, self).__init__()
def forward(self, input1, input2):
return RoICropFunction()(input1, input2)
|
a90f9de427999e05e12c4c47b0696a5a86abe970f0a70d88d2920c3977bacb69 | Python | 287 | 11 | # optimizer
optimizer = dict(type='SGD', lr=0.005, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=500,
warmup_ratio=0.001,
step=[16, 22])
total_epochs = 5000
|
b553a3c8be7aec8a147eeee5939bf17ef373327abf3e042eea68e49493cab64e | Python | 287 | 4 | user = 'stephan'
exec(open("./AIS_parameters_sak.py").read())
EU_COUNTRIES = ["AUT", "BEL", "BGR", "HRV", "CYP", "CZE", "DNK", "EST", "FIN", "FRA", "DEU", "GRC", "HUN", "IRL", "ITA",
"LVA", "LTU", "LUX", "MLT", "NLD", "POL", "PRT", "ROU", "SVK", "SVN", "ESP", "SWE"]
|
d25d8b7e816e158b28773580a4d60bd02f192ea0e13af6b1dec1e67c951605b6 | Python | 287 | 11 | from dataclasses import dataclass
from typing import Any, List, Optional
@dataclass
class Settings:
impl: Any = None
autosave: bool = False
associations_type: Optional[str] = None
preferred_language: Optional[str] = None
other_languages: Optional[List[str]] = None
|
537cfd5b87d8c132a566a46acb061a926bc45299dc593edc72cc4274c29276fb | Python | 288 | 10 | import numpy as np
from matplotlib import pyplot as plt
import seaborn as sns
from bayesian_bootstrap import linear_regression
X = np.linspace(-5, 5, 50)
y = 2 * X + np.random.normal(0, 1, 50)
results = linear_regression(X.reshape(-1, 1), y, 1000)
sns.distplot(results[:, 0])
plt.show()
|
78338812f03142191505e0ca4a3afdd0ccb622f3c0c7ebfa6a6543bd424ffa4d | Python | 292 | 14 | import pytest
from AFQ.viz.utils import Viz
def test_viz_name_errors():
Viz("fury")
with pytest.raises(
TypeError,
match="Visualization backend contain"
+ " either 'plotly' or 'fury'. "
+ "It is currently set to plotli"):
Viz("plotli")
|
b7bca2f5eebc172aadf5841249f1efba8707c7492ff08eb1854063ce515dc975 | Python | 292 | 9 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tflib.data.dataset import *
from tflib.data.disk_image import *
from tflib.data.memory_data import *
from tflib.data.tfrecord import *
from tflib.data.tfrecord_creator import *
|
b8e89fefacaa0fbc33fdd6b7567e7b1137c2bde06cd3d70be7ee646819a67825 | Python | 292 | 13 | from snakemake.shell import shell
extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
shell(
"gatk FilterMutectCalls "
"-R {snakemake.input.fasta} -V {snakemake.input.vcf} "
"{extra} "
"-O {snakemake.output.vcf} "
"{log}"
) |
33eddf63758a918e3ff61bff6261762ddee61e354dd01fecc2f4a10ce43d6444 | Python | 293 | 28 | """
``HERBS Code``
================
Functions present in herbs are listed below.
For Image Processing
--------------------------
...
...
For Atlas
--------------
...
For Others
------------------
...
"""
from .run_herbs import run_herbs
from .czi_reader import CZIReader |
3c7b30af8880b21a14bf20fa569719e9dc8fb5c1e6fc52a6126d29e825ddc2d2 | Python | 294 | 5 | from .augmentation import AugmentationLayer
from .uncertainty_weighting import UncertaintyWeighting, UncertaintyWeightingWithRollingAverage
from .upsampling import UpSampling1D, UpSampling2D, UpSampling3D
from .depthwise_conv_3d import DepthwiseConv3D
from .b_splines import interpolate_spline
|
d5d054bd5e232f941cda2cf2e61aec2d2234c2035abbc467d94f909e81555988 | Python | 294 | 8 | import os
with open('../README.md', 'r') as file:
content = file.read()
content = content.replace(
'_images/', 'https://raw.githubusercontent.com/UN-GCPDS/python-gcpds.visualizations/main/docs/source/notebooks/_images/')
with open('../README.md', 'w') as file:
file.write(content)
|
bf11fab3e2e0a84d61fa07c1b0c5578cc99073425a79c39f729f59ff0fbc1ca6 | Python | 295 | 11 | from utils import Config
from utils.ArticlesProvider import ArticlesProvider
class PostProcessing:
def __init__(self, config: Config, articles: ArticlesProvider):
self.config = config
self.articles = articles
def apply(self, tensor):
raise NotImplementedError
|
0d0f581848d411db67261cecda37d294a92e92c1a52a356e0e0a4e770efde2c3 | Python | 296 | 9 | from eelbrain import *
from eelbrain._wxgui import get_app
if __name__ == '__main__':
get_app()
ds = datasets.get_uts(True, nrm=True)
# res = testnd.ttest_rel('utsnd', 'A', match='rm', ds=ds, samples=100)
res2 = testnd.anova('utsnd', 'A*B*nrm(A)', ds=ds, samples=100, pmin=0.5)
|
6c0dc6ebbac9fb98b83554cb1ed9b0a50c53f3eda5e902b8d286f745266da1f4 | Python | 297 | 9 | """Statistical tests for multidimensional data in :class:`NDVar` objects"""
__test__ = False
from ._stats.testnd import (
NDTest, MultiEffectNDTest,
t_contrast_rel, corr, ttest_1samp, ttest_ind, ttest_rel, anova,
Vector, VectorDifferenceRelated,
)
from ._stats.spm import LM, LMGroup
|
706047714913a931547ba789b5cf65c58c57aa8c41cc6060149f5251893120e2 | Python | 298 | 9 | from deeprank_gnn.GraphGenMP import GraphHDF5
pdb_path = './data/pdb/1ATN/'
pssm_path = './data/pssm/1ATN/'
ref = './data/ref/1ATN/'
GraphHDF5(pdb_path=pdb_path, ref_path=ref, pssm_path=pssm_path,
graph_type='residue', outfile='1ATN_residue.hdf5',
nproc=1, tmpdir='./tmpdir')
|
68944fed24d9952d1ba1c7c06961dd900241e5b93b96c30a96a164ba810a9a4c | Python | 299 | 11 | """Entrypoint module, in case you use `python -m selene_sdk`.
Why does this file exist, and why __main__? For more info, read:
- https://www.python.org/dev/peps/pep-0338/
- https://docs.python.org/3/using/cmdline.html#cmdoption-m
"""
from .cli import main
if __name__ == '__main__':
main()
|
82d8e696ded5f5c7d10eaef63385b658d0cbd0ea8f685e49b35d97c45fb11fef | Python | 299 | 12 | from __future__ import absolute_import
import torch
import numpy as np
from ._ext import nms
import pdb
def nms_gpu(dets, thresh):
keep = dets.new(dets.size(0), 1).zero_().int()
num_out = dets.new(1).zero_().int()
nms.nms_cuda(keep, dets, num_out, thresh)
keep = keep[:num_out[0]]
return keep
|
dac81ae2e2a7aa319ae0b0a79356fe1ecc53f6d11ef0d2aa0e30bcc4797f4354 | Python | 299 | 12 | # Pablo Gainza Cirauqui 2016 LPDI IBI STI EPFL
# This pymol plugin for Masif just enables the load ply functions.
from pymol import cmd
from loadPLY import *
from loadDOTS import *
import sys
cmd.extend("loadply", load_ply)
cmd.extend("loaddots", load_dots)
cmd.extend("loadgiface", load_giface)
|
eb2d1bd64f51cde893215daeaad19a496dd69606f56c42d69714400c3251eb23 | Python | 299 | 8 | from ppqm import chembridge
from ppqm.gamess import GamessCalculator
from ppqm.gaussian import GaussianCalculator
from ppqm.mopac import MopacCalculator
from ppqm.orca import OrcaCalculator
from ppqm.utils.files import WorkDir
from ppqm.version import __version__
from ppqm.xtb import XtbCalculator
|
56faf8e32b2d970450c18eff02edaba688003b6f785a48f4105168e19862b2f3 | Python | 300 | 7 | from .anchor import * # noqa: F401, F403
from .bbox import * # noqa: F401, F403
from .evaluation import * # noqa: F401, F403
from .fp16 import * # noqa: F401, F403
from .mask import * # noqa: F401, F403
from .post_processing import * # noqa: F401, F403
from .utils import * # noqa: F401, F403
|
876b99db9e49f1b5168f71e395f8a84a2648677b1795e43697eafd30b3fe3642 | Python | 300 | 24 | """Hopefully importing everything."""
from . import (
_version,
io,
regressors,
signal,
stats,
utils,
viz,
workflows,
)
__all__ = [
io,
regressors,
signal,
stats,
utils,
viz,
workflows,
]
__version__ = _version.get_versions()['version']
|
bcf7fb9dc8b7a84864c4b8eaea522616c7ee399e3fb509572eac0049eee47609 | Python | 300 | 13 | import sys
import pdbfile as p
file = sys.argv[1]
i = int(sys.argv[2])
with open(file) as f:
for line in f:
for c in line:
c = c.strip()
if len(c)>0:
print(p.join(p.row([0.0,0.0,i*3.81],p.find_aa_stat("tla","abc",c),i,i)))
i = i+1 |
e9c2065a22ae100ea882eba6e25f169d26907467fc976bdfe18e7e11e4168b72 | Python | 300 | 8 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from .coco import COCODataset
from .voc import PascalVOCDataset
from .concat_dataset import ConcatDataset
from .abstract import AbstractDataset
__all__ = ["COCODataset", "ConcatDataset", "PascalVOCDataset", "AbstractDataset"]
|
fd9fdde6727c1c4e2af19656af9dfc43ba79bbb61f7dfa57bb50775f2e83f413 | Python | 300 | 14 | import pandas as pd
import fire
def main(input_file, output_file):
df = pd.read_csv(input_file, names=['SMILES'])
nrows = len(df)
df['ID'] = list(range(nrows))
df.to_csv(output_file, header=True, index=False, columns=['ID','SMILES'])
if __name__=='__main__':
fire.Fire(main)
|
160bf2e0bd0cd78508d0839dfb5a07a1d6e5a387a4a83cf8f9b92480b1d9ef2f | Python | 301 | 14 | import pytest
from oaklib.utilities.publication_utils.pubmed_wrapper import PubmedWrapper
@pytest.fixture
def pubmed_wrapper():
return PubmedWrapper()
def test_retracted(pubmed_wrapper):
objs = pubmed_wrapper.objects_by_ids(["PMID:19717156"])
[obj] = objs
assert obj["retracted"]
|
0f79938524dcbba34c775c90328a87a841eae15e73b029f32e04073864c78e2c | Python | 303 | 16 | import numpy as np
import math
def mag2db(y):
"""Convert magnitude response to decibels for a simple array.
Args:
y (numpy array): Power spectrum, raw magnitude response.
Returns:
dby (numpy array): Power spectrum in dB
"""
dby = 20 * np.log10(y)
return dby
|
7e3cad3e20b645f05506a95963dbfa132ed2b29edf25ee9cfe2629161c0aed6d | Python | 303 | 12 | __author__ = "Johannes Köster"
__copyright__ = "Copyright 2016, Johannes Köster"
__email__ = "koester@jimmy.harvard.edu"
__license__ = "MIT"
from snakemake.shell import shell
## Extract arguments
extra = snakemake.params.get("extra", "")
shell("bcftools index" " {extra}" " {snakemake.input[0]}")
|
354fa2f2d7d8b538eb6ce3dea261645503a5df3c28515536a0908aaf61f7f97d | Python | 304 | 11 | __author__ = "Antonie Vietor"
__copyright__ = "Copyright 2020, Antonie Vietor"
__email__ = "antonie.v@gmx.de"
__license__ = "MIT"
from snakemake.shell import shell
log = snakemake.log_fmt_shell(stdout=False, stderr=True)
shell("samtools idxstats {snakemake.input.bam} > {snakemake.output[0]} {log}")
|
57fafc20444755f4843aeb22b9ef0ad35e186a8c487db3bb19b1e8c6a682432e | Python | 304 | 10 | from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='Ischemia monitoring via out of distribution detection',
author='Division of Intelligent Medical Systems at the German Cancer Research Center',
license='MIT',
)
|
af403e8bab1c360564d5c9a643e7d2b4a30ea6850f6eacce2428d429643fd402 | Python | 304 | 10 | from Classes.Relationship import Relationship
class GapRelationship():
def __init__(self, end1, relationship1, gap, relationship2, end2):
self.Relationship1 = Relationship(end1, relationship1, gap)
self.Relationship2 = Relationship(gap, relationship2, end2)
self.Gap = gap |
5257f5ef79ccd089f2758eab0e2e76a82ccb13a51e3901affaaeea4355ec59e5 | Python | 306 | 13 | import argparse
def get_args():
argparser = argparse.ArgumentParser(description=__doc__)
argparser.add_argument(
'-c', '--config',
dest='config',
metavar='C',
default='None',
help='The Configuration file')
args = argparser.parse_args()
return args
|
7ff4f6561e60f0e6909b64ba0b981b52c7e413b7c5663e31628004faf3f96d05 | Python | 306 | 14 | """The Python package of the Oxynet project"""
from importlib.metadata import PackageNotFoundError, version
try:
__version__ = version('pyoxynet')
except PackageNotFoundError:
__version__ = 'unknown'
from . import utilities
from .utilities import *
from . import testing
from .testing import *
|
b27c3df1d13b0262c7e9e9a9f18a1b53f4a2ef6979097b1dfb9964cca2717c7d | Python | 306 | 16 | import torch
exp_types = ['GES', 'GCF', 'GGF']
exp_methods = [
'GCAM', 'GRAD', 'RAND',
]
def agg_parallel_dicts(exp_method, exp_type):
'''
Aggregates dictionaries that result from parallel
'''
pass
def summarize_data(exp_method):
'''Summarizes readings from one file'''
pass |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.