sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
402eb8b28891333f06a459918209dd8f7119f36f35febafbb82186306b0cffa0
Python
2,935
110
#%% import os try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') print(os.getcwd()) except: pass #%% import sys sys.path.append("/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/") import pandas as pd import numpy as np import math import matplotlib.pyplot as plt impo...
8329017f02883bd2840406d6bff8835c5d375156980aafe6863c027f769c50dd
Python
2,936
88
#!/usr/bin/env python3 import glob import itertools import os import pytz import click import matplotlib.pyplot as plt import numpy as np import pandas as pd import scipy.signal as sg from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error SRC_DATA_DIR = "./00-PREPROCESSED-D...
f404234506a64f8b41923c5a70f7b708ceca63a7440625091a6b48850143725b
Python
2,936
81
import torch import torch.nn as nn import math class se_block(nn.Module): def __init__(self, channel, ratio=16): super(se_block, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) self.fc = nn.Sequential( nn.Linear(channel, channel // ratio, bias=False), ...
ec1e45bc2e9d6cd07b778c08320bb0b865d3478d2c926a55dd8eb3aed9feea33
Python
2,937
69
#!/usr/bin/env python3 """Compile and sample .scenic files with NO simulator. Triage before you run. A `--simulate` failure conflates three very different causes. This separates them: COMPILE-FAIL syntax, model import, missing .xodr, or a blueprint category Scenic has no entries for on this client ...
f35e9b009dce7e271d02c1eba4c414f79cf7b8631bb0124d87a0d6e8202e5184
Python
2,937
131
# Copyright 2020-2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
ae5d8892dd083d83c21b58b9b7186577335f3ca2c8d048ca007e3c412a665854
Python
2,938
118
# Copyright (c) Open-MMLab. All rights reserved. from time import time class TimerError(Exception): def __init__(self, message): self.message = message super(TimerError, self).__init__(message) class Timer: """A flexible Timer class. :Example: >>> import time >>> import mmcv ...
0d5dbb7b8247e04554dc549dde2b30a08c6735b7184a52852692a1c283602f95
Python
2,940
156
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from tmkit.topology.pdbtm.Segment import Segment as fetchfasids class toFastaId: def __init__(self, type="tmh"): self.type = ty...
390f14128d7b8dd904983020264738b4e855fed50df2306e9a1d38a41ea59d4a
Python
2,940
89
""" HeartENN architecture (Richter et al., 2020). """ import numpy as np import torch import torch.nn as nn class HeartENN(nn.Module): def __init__(self, sequence_length, n_genomic_features): """ Parameters ---------- sequence_length : int Length of sequence context on ...
69e7533b9f41d898cb5cd1c69aa11860afd39a230e5293a49fd77d5c3c75174a
Python
2,940
114
''' download_s2.py Download Sentinel-2 imagery over dump sites ''' from argparse import ArgumentParser import geemap import geopandas as gpd import ee import os from shapely.geometry import mapping # initialize GEE ee.Initialize() # set some defaults S2_ID = 'COPERNICUS/S2' S2CLOUDLESS_ID = 'COPERNICUS/S2_CLOUD_...
c07e27192af5943cb53772bf389de6d54e4d3174ac6d4f355ce3910f28c8f632
Python
2,940
95
# Copyright 2017 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
d1b14e4a769435e8838222c14ce954c3717c6875b8e72cfa23defca4e486bcf4
Python
2,941
83
""" © 2022, ETH Zurich """ import os import chemprop from rescoss_logp_ml.two_d_models.chemprop_tools import run_training from rescoss_logp_ml.utils import SEED, get_output_dir class ChempropModel: def __init__(self, random_state=SEED, **h_params): self.random_state = random_state super().__init...
adedbd1e96e23787270c0e274b783268f9ab1fc6dde0c7d95eb253d5570befdb
Python
2,942
117
import copy import json import pickle import tempfile import weakref as _weakref from io import StringIO from pathlib import Path from types import TracebackType from typing import Any import numpy as np class WorkDir(tempfile.TemporaryDirectory): """Like TemporaryDirectory, with the possiblity of keeping log fi...
e31a951b98d31397a1a029817a494ff4b42ff87abb91d82463b60ccdcb45671a
Python
2,942
82
""" Description: Used for the _in silico_ mutagenesis section in this case study. Randomly selects some sequences from the test set to use. Output: Saves randomly selected sequences to a FASTA file. Usage: get_test_regions.py <features-bed> <genome-fa> <output-fa> [--seq-len=<l...
284c6cf512dc92bb477f3dd7ee9d1dc9e76531e0305bf1b49a5256e5eae4d2ca
Python
2,945
76
import logging import unittest import networkx as nx from oaklib.datamodels.vocabulary import IS_A, PART_OF from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation from oaklib.resource import OntologyResource from oaklib.utilities.graph.networkx_bridge import ( relationships_to_multi_...
4619be438a9cad53de3b0a44024012721da0c87bd5dc76580164a5fadca72e48
Python
2,945
120
import pytest import tensorflow as tf from typing import List, Tuple from multi_phase.networks.components.discriminator import Discriminator #------------------------------------------------------------------------- @pytest.mark.parametrize( "depth,img_dims", [ (3, [2, 16, 16, 8, 1]), (4, [4...
f809d6cc55d22fefebe25da3444d4092342436c8ff151025196dc1452ef53fc6
Python
2,945
79
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # Modifications Copyright 2017 Abigail See # # 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...
c71f79a83f3c7bb4be6d3385b138b73f642d7ed6c0ad239b7a1cde8b60f54fd8
Python
2,946
102
""" Extends the functionality of the metric axes class to include specific functions of plotting localization results """ import numpy as np import pandas as pd from lib.metric_axes import metric_axes as ma class metric_axes(ma): def format_by_speaker_location(self, x:bool=True, y:bool=True, withSymbol:bool=Fal...
7c1e703b993eb080d55d5f678c58a8d771214109427414d27405597bc3cf7e86
Python
2,947
81
#!/usr/bin/env python3 """ Plotting functions generating all plots of the paper. The data needed for this can be generated using the script :py:mod:`record_experiment`. """ from functools import partial from model_paper_mc_genetic.helpers import name_wrapper from model_paper_mc_genetic.plotting import PaperPlots, se...
c78f99a019a5443576eebf7e6fafca6d2d4b69cf947505ad9f535709c7df3989
Python
2,947
50
IMAGENET_WEIGHTS_PATH = ( 'https://github.com/Callidior/keras-applications/' 'releases/download/efficientnet/') IMAGENET_WEIGHTS_HASHES = { 'efficientnet-b0': ('163292582f1c6eaca8e7dc7b51b01c61' '5b0dbc0039699b4dcd0b975cc21533dc', 'c1421ad80a9fc67c2cc4000f666...
10300476b50d871741730f74880412aff057d4e97803fa8eec818f8177f0528d
Python
2,948
92
import sys, os, urllib.request, zipfile, subprocess #not importing because imports torch internally #FIXME #from base.paths import path_to_main_module assert 'torch' not in sys.modules WHEEL_URLS = { 'torch==1.10.1+cpu' : 'https://download.pytorch.org/whl/cpu/torch-1.10.1%2Bcpu-cp37-cp37m-win_amd64.whl', ...
72054a0ec04c345683444682d2d0fa19c9b1f30d91a41e685bd3adbd6a57b890
Python
2,949
67
import pandas as pd import numpy as np import cvxpy as cp import cplex import slideflow as sf from slideflow.util import log def generate(data, category, values, crossfolds = 3, target_column = 'CV3', patient_column = sf.util.TCGA.patient, site_column = 'SITE', timelimit = 10): """Generates 3 site preser...
d9b58cc7d00d20aa776177de7e294c96d1cbafdb02bd14d90e3ea6d45d4d29be
Python
2,949
73
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
ee71cef20bb0686c49ffe872091a10b922122e33329c87fe57b36a0e1c45aaf3
Python
2,950
107
from cgtasknet.tasks.reduce import ( DMTask, DMTaskParameters, DMTaskRandomMod, DMTaskRandomModParameters, ) def test_dm_task_size(): assert DMTask().feature_and_act_size == (2, 3) def test_dm_task_run_one_data_set(): DMTask().one_dataset() def test_dm_task_run_just_run_some_data_set(): ...
fc103dd3cc0819fb199526a2684598f758ed7bd815a6c9b2c212771bf97d344c
Python
2,950
78
import logging import unittest from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation from oaklib.implementations.sqldb.sql_implementation import SqlImplementation from oaklib.resource import OntologyResource from oaklib.datamodels.vocabulary import IS_A, PART_OF from oaklib.utilities.sub...
2c502e3ead52914646d49b51178c16a8ae8c9f8fefc2b4b9c0d9dca6f21469bf
Python
2,953
44
"""Side impact at the sp8 junction, recorded and filmed from a chase camera (Cinematic).""" import os, sys, queue, math import numpy as np, carla sys.path.insert(0, os.path.dirname(__file__)); import scene OUT = sys.argv[1]; os.makedirs(OUT, exist_ok=True) c, w = scene.connect(); tm = c.get_trafficmanager(8000); lib = ...
88bb16111aca9a638272ca6bde11488f74255242503fc3dc80c3d15242b08ea5
Python
2,954
105
import numpy as np from torchvision import transforms # from utils.build_vocab import Vocabulary from recurrent_rsa.train.image_captioning.char_model import EncoderCNN, DecoderRNN import torch from recurrent_rsa.rsa_utils.numpy_functions import softmax class Model(torch.nn.Module): def __init__(self,path,dictionari...
bf9db3c3292f807aca96bd6e83be02e23b874cb0e81ea2ab5e3a2f57e04534c4
Python
2,954
84
""" File: covariate_clustermap.py Created: 2020/06/02 Last Changed: 2020/06/19 Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, ei...
eb9a9a48d2cbab7fbf28a878b3ffd1286c1758d527715d09d790d42eda8b5d41
Python
2,954
54
from .basic_params import BasicParams class TrainTestParams(BasicParams): """ This class is a son class of BasicParams. This class includes parameters for training & testing and parameters inherited from the father class. """ def initialize(self, parser): parser = BasicParams.initialize(se...
8491f98b37188e2cb1cf90aa504beaeb419abd46f1d307727666d7fdd18b7c8a
Python
2,956
77
import os import pickle import pandas as pd import numpy as np import sklearn.preprocessing import matplotlib import utils_Florian as utils matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.rcParams['ps.fonttype'] = 42 matplotlib.rcParams['font.sans-serif'] = "Arial" matplotlib.rcParams['font.family'] = "sans-serif"...
052e25b143ebc6c2728e067fb00b93509ab18d1634da7bbf3339c958db78efb9
Python
2,957
87
# Copyright 2020 Google Research. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
a57e77f3cf6b15e304bf90b355e84c8883513238fc01a220cb767e0dbb5c429c
Python
2,957
95
import tensorflow.keras.layers as layers def add_layer(x, ch, drop, architecture, arch_params): """ Passes the input tensor layer to the model according to the arcitechture specified """ if architecture == 'conv_1D': conv_size = arch_params.conv_size x = conv_bn_activate(x, ch, conv_s...
4fd03b1d4851a202f9a1c05898b79bd1b5434e9d57a07af8d6bf2a59c5962665
Python
2,962
61
from utils.decomposition import Decomposition import sparse from tensorly.contrib.sparse.decomposition import tucker class ParafacDecomposition(Decomposition): def apply(self): tensor = self.get_tensor_coocurrence(self.config.embedding.size_word_co_occurrence_window, ...
3babe95f1bd104fdb1f54e49e68e2a12478933058d6a09c2a46401e80fab06c9
Python
2,963
80
# Copyright 2020 Google Research. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
352297c1cc44196fd6c713a3137072995524fd23d3bb3c1f81f0b5645c06eece
Python
2,967
106
""" File: storage_container.py Created: 2020/10/14 Last Changed: 2020/10/21 Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, eith...
6b2cef18adcbb84623874b728f3d6b6b1b3cd9378d5820045d81d8d96e8af5e9
Python
2,968
75
#%% import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from tqdm import tqdm import pymaid from pymaid_creds import url, name, password, token from data_settings import data_date_projectome rm = pymaid.CatmaidInstance(url, token, name, password) # this CSV comes from a script...
0d274c20a7cab3a4511ac45ae204bd4a31bb45640768b4e04a52045c3edb1cb4
Python
2,969
93
''' Written by Nathan Neeteson. A class for creating a csv file with a header and then writing data to it. Initially created for logging training results, but also turned out to be useful for recording results from test data and morphological analysis. ''' import csv from datetime import datetime class LogWriter(obj...
11f9715a887691b8e64d762b28846b6bffa86854bc98e649beb49e1bd1da57ae
Python
2,970
89
""" Utilities for traversing Ontology Graphs ==================== """ import logging from copy import copy from typing import Iterable, List, Union from oaklib.interfaces.basic_ontology_interface import ( RELATIONSHIP, BasicOntologyInterface, ) from oaklib.types import CURIE, PRED_CURIE # PATH = Tuple[CURI...
58978498f3eca8b5c2e51cd246fb9fe15c6baa8c96efae61d03cb7dc90bb7e69
Python
2,971
81
# Copyright 2020 Google Research. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
c48bd0bab008925633289934af894ff217c30d3d07d1726a0a8f774714eaf287
Python
2,971
71
from tempfile import TemporaryDirectory import shutil import os import sys class Module(): def __init__(self, module_pointer): self._ptr = module_pointer # ptr to module function def run(self, simulation): return self._ptr(simulation) class Simulation(): class SharedFiles(): # Contains ...
dfe04f07938d375f0acf1b6b3ed1376826a700d1389b972ad5d180eb7e66d856
Python
2,972
80
import logging import unittest from oaklib.datamodels.vocabulary import IS_A, PART_OF from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation from oaklib.resource import OntologyResource from oaklib.utilities.graph.networkx_bridge import relationships_to_multi_digraph, transitive_reduction...
1927d7c155eec85ee169c12f949309d4f7ef71d00407d865f48e6e5dae0ed044
Python
2,974
86
''' @author: Mahbub Ul Alam (mahbub@dsv.su.se) @version: 1.0+ @copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se) @license : MIT License ''' '''@file early_sepsis_detector.py run this file to go through the complete neural net training, testing and evaluating procedures, look at the 'early_sepsis_detector_con...
70fd712f9032ffb4a0fbef48e37eee1dcfe24d2ff9a86eda038cc49b789ec4d9
Python
2,974
102
import os import sys import glob import numpy as np import matplotlib import socket MACHINE = socket.gethostname().lower() datadir = '/home/satsingh/plume/plumedata/' if MACHINE == 'mycroft': datadir = '/data/users/satsingh/plumedata/' if (MACHINE == 'salarian') or (MACHINE == 'cylon'): datadir = '/data1/users/satsi...
16f3465ce16e0fd6464d46bb31471b9ff87afcb348d82e90e1fc1ba88534997c
Python
2,975
104
import unittest from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation from oaklib.resource import OntologyResource from oaklib.utilities.axioms.logical_definition_summarizer import ( logical_definitions_to_matrix, parse_axes_to_config, ) from tests import INPUT_DIR TEST_ONT = IN...
798e4cb8d57db803b8b5ce32b389aae0ba69819d1ad94699cfbd9db6b19a6d48
Python
2,977
102
#!/usr/bin/env python # coding: utf-8 # Transformer Dose Calculation ## Import libraries and define auxiliary functions import h5py import json import random import sys sys.path.append('./src') import numpy as np from generators import DataGenerator from models import dota_energies from preprocessing import DataResca...
9929ebfa07551d0b0fbb5e13bcc615d949a95b21381c51e7c6d07c39a6e30486
Python
2,977
65
import numpy as np from cenfind.core.measure import Assigner from cenfind.core.structures import Centriole, Nucleus def _square_contour(x0, y0, size): return np.array( [[[x0, y0]], [[x0, y0 + size]], [[x0 + size, y0 + size]], [[x0 + size, y0]]], dtype=np.int32, ) def test_assign_centrioles_...
f1268f099453a9067810df601dd9a7bc2a2c952d972c7b4b2fc4ae336fc728c5
Python
2,978
55
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
6ed76abb4cdd6ef1f10ceaa4c9e2a87c3544323d15ba3430b2d1362be8cf8180
Python
2,979
88
import os import time import pandas as pd import numpy as np from arboreto.utils import load_tf_names from arboreto.algo import grnboost2 from sklearn.preprocessing import scale ## Plots import matplotlib # matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.colors as colors impo...
d78ba973b6665bd9f3f031344895b5967d35f6e28f223e05b87c6b485f42f70c
Python
2,983
103
# Copyright 2017 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
11496fcdebe24eceb665084c33c77943f11aab3c61ad7d0344958e650ff0be92
Python
2,984
54
from __future__ import print_function from cmseq.cmseq import CMSEQ_DEFAULTS from cmseq.cmseq import BamFile from cmseq import __version__ import pandas as pd import numpy as np import argparse def bd_from_file(): parser = argparse.ArgumentParser(description="calculate the Breadth and Depth of coverage of BAMFILE...
233e8149044a329a58f996f7931549d0b9535fbad5e6a8a8889f20b596ce4eb4
Python
2,984
103
import torch.nn as nn import torch.nn.functional as F import torch class U_Net(nn.Module): def __init__(self, classes=2, aux=True): super(U_Net, self).__init__() n1 = 64 filters = [n1, n1 * 2, n1 * 4, n1 * 8, n1 * 16] self.Maxpool1 = nn.MaxPool2d(kernel_size=2, stride=2) ...
cbac50884ea798d8a0de5f2f25f88490fe2247b6d005a395a170d66126e31fb9
Python
2,985
95
''' @author: Mahbub Ul Alam (mahbub@dsv.su.se) @version: 1.0+ @copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se) @license : MIT License ''' '''@file early_sepsis_detector.py run this file to go through the complete neural net training, testing and evaluating procedures, look at the 'early_sepsis_detector_con...
8098a348fdc7887cd5326ab6712179dfb7bfc61f223c85a565c16b9326226d0f
Python
2,987
69
BaseCase = __import__('base_case').BaseCase import pytest, os, subprocess class TrackingTest(BaseCase): @pytest.mark.slow def test_basic_tracking_success(self): self.open_main(static=False) #open the tracking tab self.click('a:contains("Tracking")') filenames = [ ...
b0bde087df68b1c249fa9b2705acd5ec8cff7a75a3dea62ea49247db5320b207
Python
2,987
96
import time import torch import pandas as pd import networkx as nx import numpy as np import matplotlib.pyplot as plt from torch_geometric.utils import from_networkx from sklearn.model_selection import train_test_split from graphxai.datasets.utils.bound_graph import build_bound_graph from graphxai.gnn_models.node_cla...
c10c0d24ffa94ff8677466cf899a0d0323c1a391a8ed6539e2f2579525f1a2f1
Python
2,989
101
# This script is part of navis (http://www.github.com/schlegelp/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
1cd03bcb6208658d9e084d0c24d03f4934d4e0a3fb47dd7ab95aed49ba8e081e
Python
2,990
82
import requests import gzip import nibabel as nib import numpy as np from os.path import isfile def init_brainweb(): """ Download the Brainweb Phantoms if they do not already exist in the current directory """ if not isfile('classes.mnc'): print('Downloading classes') params = {'downlo...
9a1a6506f530cbc0cd603ce125aa9372db4d17296cd6ce49c8b7da1fb632f0e2
Python
2,990
82
import csv import pickle import numpy as np from tqdm import tqdm from chemprop.args import SklearnPredictArgs, SklearnTrainArgs from chemprop.data import get_data from chemprop.features import get_features_generator from chemprop.sklearn_train import predict from chemprop.utils import makedirs, timeit @timeit() de...
ae97d4b5c7cb3d2c7a4b4b0af8899dcaedc7fd3ff7373c8248e7467cce7aa343
Python
2,990
71
########################################################## ## ccAF: sensitivityAnalysis_plot.py ## ## ______ ______ __ __ ## ## /\ __ \ /\ ___\ /\ \/\ \ ## ## \ \ __ \ \ \___ \ \ \ \_\ \ ## ## \ \_\ \_\ \/\_____\ ...
65ed40a741b94b4e7606ef5645b8c2584749c8ee0defc0982acf0475af857c18
Python
2,992
70
def parse_info(seq): info = {'SVTYPE': '', 'SVLEN': 0, 'END': 0} for i in seq.split(';'): # SVTYPE=INV;END=139008588;SUPPORT=13;STD_SPAN=4.4;STD_POS=1.5 if i.split('=')[0] in ['SVLEN', 'END']: try: info[i.split('=')[0]] = abs(int(i.split('=')[1])) except: ...
de9669856bf299de6efd687be45c8ca1d6968a43a81d1ab3f7d3368a387457db
Python
2,992
97
import math import glob import argparse parser = argparse.ArgumentParser(description='Create slurm jobs to call genotype on merged gVCFs (all batches within the directory)') parser.add_argument('merged_vcf_dir', help='Directory that contains the merged gVCFs') parser.add_argument('jobs_dir', help='directory to write...
e45057721dd1d229aec9c1240f7eb3b45226a6c6f08a68531bdb9cf3a3242ef8
Python
2,993
85
import gzip import argparse parser = argparse.ArgumentParser(description='Get top SNPs for metabrain and eqtlgen') parser.add_argument('metaBrain', help='File with the metaBrain results') parser.add_argument('eqtlGen', help='File with the eqtlGen results') parser.add_argument('output', help='Output file name') parser....
6b60a589eccae3703db576ff1e53ea66760a1cb2a1c455625a3af3b9b7e9950c
Python
2,995
87
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
924a682540a3ad790eb93121d9a22096a150679b0cb7fa1dc991b1ef85186210
Python
2,996
82
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
b5d8d0126ed0d9668db54252e29594b2978ba9829995b11b213058118da923e2
Python
2,996
113
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
1d20b8bfea61f3a8d266e7ab5be2a8f87ef92037e18adefca429665fd2a6911a
Python
2,997
84
import os.path import torch from torch import nn import torch.optim as optim from base import BaseModel import copy class Forward(nn.Module): def __init__(self, in_dim: int): super().__init__() self.fwd = nn.Sequential(nn.Linear(in_dim, 2*in_dim), nn.LeakyReLU(), nn.Linear(2*in_dim, in_dim), nn.L...
4d31298ba04b3616e310dee1f97436569fa6cb85690e9228350561c5c2056d75
Python
3,000
86
# coding: utf-8 ## Import libraries and define auxiliary functions import h5py import json import numpy as np import time import sys sys.path.append('../src') from models import dota_energies from preprocessing import DataRescaler from evaluation import gamma_analysis start = time.perf_counter() # Load model and data...
95faae74d2f9104671efb28dcc0048724e24401a3a43fbea1e4e2944250637ab
Python
3,000
99
''' Loads data sets magic_load_data: only useful for data with old formats. ''' from brian2 import * from clampy import * import os from .data_preparation import merge_data from .file_utils import up_dir __all__ = ['rename_electrophysiology_data', 'magic_load_data', 'load_multiple_data'] def load_multiple_data(path,...
1391d9e85dd68563563e2dfb788b1c6d4df8ad87e5d2cd1839a03cc70c6c8b29
Python
3,001
104
import os, errno import sys import time from random import shuffle import random def read_cases(path): cases = [] headers = [] with open(path, 'rb') as csvfile: reader = csvfile.readlines() n = len(reader[0].split()) for i, row in enumerate(reader): case = row.split()[:]...
2dd011e76764847d818294a08d9d469cb492a9e377195a5e3488be10d433f827
Python
3,002
68
import numpy as np import numpy.testing as npt import nibabel as nib from AFQ.utils import streamlines as aus import dipy.tracking.streamline as dts from dipy.io.stateful_tractogram import StatefulTractogram, Space def test_SegmentedSFT(): affine = np.array([[2., 0., 0., -80.], [0., 2., 0....
a848852574bba443f7c8e4f808790602fe93a6c5e175f8416d73de4ffa80a6da
Python
3,002
80
import torch import torch.nn as nn from typing import List import numpy as np from torch.autograd import Variable def cal_distance(m: torch.Tensor, n: torch.Tensor) -> torch.Tensor: vector = m - n distance = torch.norm(vector, p=2, dim=1) torch.clamp_(distance, min=0.1) return distance ...
197fb2a3b6eb122a306947001504c13e6f47b7a992a842ebf04e0d27de41d173
Python
3,004
91
# This script is part of navis (http://www.github.com/schlegelp/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
85061e32a0828c0427a2b11a4e98b51b434c096c849e1985b9928f380bd862e8
Python
3,004
95
""" PARAMETERS: Documentation This module specifies all the parameters necessary for a neuronal papopulation made up of: - Excitatory cells - Inhibitory cells """ from brian2 import * cm_fig_conv = 1/2.54 rc('font', size=6) ########################################### # User defined parameters ###################...
f3441002cb6aaa59c6d68c58e155a178c51c2a768f5b5691151cc226707d9216
Python
3,004
98
import pytest import torch # Skip tests if torch_harmonics is not installed try: import torch_harmonics except ModuleNotFoundError: pytest.skip( "Skipping because torch_harmonics is not installed", allow_module_level=True ) from ..discrete_continuous_convolution import ( DiscreteContinuousConv...
fac8b2c040fb50e8c5df54558410c73f4284a2567b91bb090fcaa036481ac9de
Python
3,005
86
import h5py import numpy as np class ImageDataset(): def __init__(self): self.velocity_colnames = ['u', 'v', 'w'] self.venc_colnames = ['venc_u', 'venc_v', 'venc_w'] self.mag_colnames = ['mag_u', 'mag_v', 'mag_w'] self.dx_colname = 'dx' def _set_images(self, velocity_images,...
763960f1c2757c3c2900a536a2395f07d6be17ba1f5ec99bab46fc767b8ab0c5
Python
3,008
81
#!/usr/bin/env python3 """``uvx`` stand-in installed as ``/usr/local/bin/uvx`` in the image. cosmos-transfer2.5 resolves every checkpoint with ``uvx 'hf>=1.3.5' download <repo> [<file>] --revision <sha> [--include ..] [--exclude ..] [--quiet]`` (``cosmos_transfer2/_src/imaginaire/utils/checkpoint_db.py``). Inside the...
d99ee6651034ae0c19df997d97f752de96b207b77defd82839afdf270b86eabb
Python
3,008
81
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
589ba2b3dee88d0236886fc898e662528abf1a66f0df57f4611d9d895119317a
Python
3,009
98
# -*- coding: utf-8 -*- from .core import * from .. import _logging as logging import tensorflow as tf __all__ = [ 'ExpandDimsLayer', 'TileLayer', ] class ExpandDimsLayer(Layer): """ The :class:`ExpandDimsLayer` class inserts a dimension of 1 into a tensor's shape, see `tf.expand_dims() <https:/...
5e77a643b144c7cf6d8204878f1fa1764717a525fa69d48fd9c605d56687dca1
Python
3,009
89
# -*- coding: utf-8 -*- """ Created on Fri Mar 13 11:54:09 2020 @author: Sandi """ import pandas as pd import numpy as np from datetime import datetime from sklearn.model_selection import train_test_split from sklearn.model_selection import GridSearchCV from sklearn.neural_network import MLPRegressor from sklearn imp...
292a2565b226bff6caccc198c193ba201581adbe9f5ec67866dda53ca12f7845
Python
3,011
44
import pandas as pd import numpy as np import argparse import sys from cmseq import __version__ from .cmseq import CMSEQ_DEFAULTS from .cmseq import BamFile def polymut_from_file(): parser = argparse.ArgumentParser(description="Reports the polymorpgic rate of each reference (polymorphic bases / total bases). Focuses...
e1d3ab4aa201451f725fc9c18ef6d2e1376b87b3be0a75300ee4f29b42d98e41
Python
3,012
116
from __future__ import absolute_import from __future__ import division from __future__ import print_function import datetime import timeit class Timer(object): """A timer as a context manager. Modified from https://github.com/brouberol/contexttimer/blob/master/contexttimer/__init__.py. Wraps around a t...
587f31cd2e3a449928e45b2300d2f9a1971cfd83d88bb09dcb50da2c254de07d
Python
3,014
82
import csv import sys import numpy as np import pandas as pd from scipy import stats ## Tests for significantly higher mean validation R^2 after adding data manipulations when compared to (a) the results of Dadi et al. in the ## 10k UKB release and (b) our replication of those results in the 20k UKB release. def sig...
c4a60c164277dc158fdbd53dd6de6ab36bf0acde8770eb7231250eb64cb6aaf4
Python
3,015
87
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
05f99feca74f9e929df61c0672dc2d569d8cc6368ae7510c97a480ab021fe14d
Python
3,016
72
import nibabel.tmpdirs as nbtmp import nibabel as nib from nibabel.streamlines import ArraySequence as Streamlines import numpy as np import os.path as op import numpy.testing as npt import dipy.core.gradients as dpg from dipy.data import default_sphere from dipy.reconst.gqi import GeneralizedQSamplingModel from AF...
0879075a89476e6001ae41eaee0a80dbbb478c54565ca76757f101881790a231
Python
3,016
84
from rdkit import Chem from drugex.logs import logger from drugex.data.corpus.interfaces import Corpus from drugex.data.corpus.vocabulary import VocSmiles, VocGraph class SequenceCorpus(Corpus): """ A `Corpus` to encode molecules for the sequence-based models. """ def __init__(self, molecules, vocab...
09414b7eb1a81f0533e6a07fd2b1acbd28e447c74193cc4e8f348b65e7a37548
Python
3,016
77
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
6cd30224d26a0c7e00c6da57321a67fbe6b2db1aeabe4e14c6b8a7418db75758
Python
3,016
139
# %% import numpy as np import pandas as pd import logging from box import Box import matplotlib.pyplot as plt import pathlib import argparse parser = argparse.ArgumentParser() parser.add_argument("offset", type=int, help="processing_offset_filenum") args = parser.parse_args() print(f"proc...
df8fcc3b1efa5cacb04ccf7d364b30917e1b5f782662358d93398431c36bd5dc
Python
3,016
81
"""CARLA left-handed to Alpamayo right-handed coordinate conversions.""" from __future__ import annotations import math from collections.abc import Sequence import numpy as np Y_REFLECTION = np.diag([1.0, -1.0, 1.0]) def carla_rotation_matrix(pitch_deg: float, yaw_deg: float, roll_deg: float) -> np.ndarray: ...
5b5c1a28f58864bf3603e0ad6901771dffa6211b81d330de6809a8c906f1b79a
Python
3,023
94
from __future__ import annotations from bonelab.util.aim_calibration_header import get_aim_density_equation from bonelab.util.vtk_util import vtkImageData_to_numpy import numpy as np from enum import Enum # create an ImageType Enum with two options: density image or mask ImageType = Enum("ImageType", "DENSITY MASK") ...
d98b7877b340fe64b3b5faf5d397cf80762d0e61886bafef68845a4f8a492681
Python
3,023
91
from scipy.special import expit import numpy as np import os def mean_squared_error(prediction, target, exclude_diagonal=False): """Calculate the mean squared difference between two numpy arrays :param prediction: Predicted values :param target: Target values :param exclude_diagonal: If True, ignore...
2301fde4a056de4c1922106727ab3aa4e63c04dae5f3c4afe8848013895c9114
Python
3,024
87
# %% import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from pymaid_creds import url, name, password, token import pymaid rm = pymaid.CatmaidInstance(url, token, name, password) import connectome_tools.process_matrix as pm import connectome_tools.celltype as ct import navis ...
43ca3a9b52dc13c8efb5484a35225d3299f4b5484e1e636ce652771f221671ed
Python
3,024
82
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from torch import nn from maskrcnn_benchmark.structures.bounding_box import BoxList from .roi_mask_feature_extractors import make_roi_mask_feature_extractor from .roi_mask_predictors import make_roi_mask_predictor from .inference imp...
9b88a8ca3fa322db422648a8eabda787f155495f6d93ae5c22cba758a52121c7
Python
3,024
54
# Usage: python3 multiple_fasta.py -i Fastas/ --cpu 4 --parallel 2 # (run 2 parallel instances of Porter5 on 4 cores - total of 8 cores) import os, sys import argparse from multiprocessing import Pool ### parallel code ## def loop(line): if args.fast and args.tmp: os.system('python3 %s -i %s --cpu %d --fa...
a59887f95e9e47e492c5d4508fb0e837ff79a9f4b9b61f6fc95f98728919d7d5
Python
3,025
68
#!/usr/bin/env python3 import wget import os import pandas as pd import re ''' Download the AAIndex from the official website, https://www.genome.jp/ftp/db/community/aaindex/aaindex1 And format it into CSV: $ cat AAIndex.csv A,R,N,D,C,Q,E,G,H,I,L,K,M,F,P,S,T,W,Y,V,AAIndex 4.35,4.38,4.75,4.76,4.65,4.37,4.29...
b881706ff6966e23f75328175645b66e6d36f2a5b7ab0d76fd72315315a553bc
Python
3,025
84
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
d217f3b45d4f0177c10cdbe02ba4420a92fe597dfe29ade94260bc7ff32bc18d
Python
3,025
84
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
697e3ed0f86b5713a2e2f574f2ab2d15c6fa2b1b9e6640a4969da9ac26b795d1
Python
3,026
47
#Import necessary functions, set number of measurements to perform for mammalian cortical area development network from functions import * GiacoPath = "./28nets_rules/Giacomantonio2010.txt" nrshots=10000 #Print a circuit for performing a synchronous state transition: syncTransitionCircuit = synthesizeFullNetworkUpdate...
131ceb837b3ff24a89d7a3b9ae7c7b30e0be01264207f2b179974428853bc729
Python
3,028
83
# Copyright 2021 Xiaomi Corporation (Author: Junbo Zhang, Yongqing Wang) # Apache 2.0 # This script trains a simple polynomial regression model to convert GOP into # human expert scores. import sys import argparse import pickle import kaldi_io import numpy as np from concurrent.futures import ProcessPoolExecutor fr...
be003dd60267bf5090b4aa806b30ab17069f05c452116a753848c977853e188d
Python
3,028
74
import sys import numpy as np import n5_metadata_utils as n5mu from glob import glob from os.path import split def read_coords(path): with open(path, 'r') as f: offset = np.array(f.readline().split(' ')).astype(np.float64) extent = np.array(f.readline().split(' ')).astype(np.float64) index ...
4e0f91189d38af760e637b40e00fbaa5b9d88696dd5d3a0f1433c6a7047f1b98
Python
3,029
75
# Copyright 2020-2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
6635e9d529bb69c25ed70262877d60ca2ba74ad534cdfb02fec3072883dc8045
Python
3,029
80
import torch import matplotlib.pyplot as plt import numpy as np import argparse import pickle import os from torchvision import transforms from build_vocab import Vocabulary from model import EncoderCNN, DecoderRNN from PIL import Image # Device configuration device = torch.device('cuda' if torch.cuda.is_available() e...
f086a84863c4621ebb05e2215d47fa899023cea8329f0ff0c7cbb36b4f594451
Python
3,029
96
""" This module provides the NonStrandSpecific class. """ import torch from torch.nn.modules import Module from . import _is_lua_trained_model def _flip(x, dim): """ Reverses the elements in a given dimension `dim` of the Tensor. source: https://github.com/pytorch/pytorch/issues/229 """ xsize = ...