sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
5e98d850134e036d9648248afd3c5809e90a70d5dfd4d2e2630f0047d4ceeecc | Python | 736 | 20 | import unittest
from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation
from oaklib.utilities.ontology_builder import OntologyBuilder
class TestOntologyBuilder(unittest.TestCase):
def test_builder(self):
"""
Tests simple ontology building operations
"""
... |
b6471a222b8dd91ca5db1d7f79c52497fd1ee28395322dba81c06cd9b048ad0f | Python | 736 | 15 | # Copyright 2019 The TensorFlow Authors, Pavel Yakubovskiy. 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 ... |
bb08134523205a0f58c9f46c75eae79aa9b4b48f2f99393aa61844546a44aa3c | Python | 737 | 20 | import torchvision
import torch
import os
from net.models.modeling import VisionTransformer, CONFIGS
num_classes =1000
arg = CONFIGS['R50-ViT-B_16']
model = VisionTransformer(arg, 256, zero_head=True, num_classes=num_classes)
# print(model)
state_dict = torch.load(r'./checkpoint.pth')
for k in list(state_dict.keys()):... |
ea3a06f88800685c928e01203531e3deaf3ed785e28f7dfe2a9fac9ae580c13d | Python | 737 | 21 | import numpy as np
import nibabel as nib
import sys
import os
from utils import largestAfterOpen
from scipy import ndimage
input_name = sys.argv[1]
stem_name = sys.argv[2]
atlas_path = sys.argv[3]
if atlas_path[-1] != '/':
atlas_path = atlas_path+'/'
valid_roi = nib.load(atlas_path+'valid_roi.nii').get_fdata().astyp... |
1e40f52ab2249ec91ffc248681c1792b27f776720a20085b041c6e883d0e6328 | Python | 740 | 20 | import numpy as np
import h5py
def save_to_h5(output_filepath, col_name, dataset, expand=True):
if expand:
dataset = np.expand_dims(dataset, axis=0)
# convert float64 to float32 to save space
if dataset.dtype == 'float64':
dataset = np.array(dataset, dtype='float32')
with h5py.Fil... |
2e2295b736f2b33ad53a0ad01d0c8b0f8919b145e41f38f7b482308801521e82 | Python | 740 | 17 | # 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... |
27b3c99d757c9564e29416a9d6991c8f108b2de3ee3a2dffd9cc125f31bf224e | Python | 741 | 23 | import gzip
line_per_chr = {}
print('start reading')
with gzip.open('eQTL-Cis-EUR-1Mb-biogenformat.txt.gz', 'rt') as input_file:
header = input_file.readline()
for index, line in enumerate(input_file):
if index % 10000 == 0:
print(index, 'lines processed')
chr = line.split('\t')[2]
... |
2af0c8f9462c79a9aa8042c2faeb35705e6815e5e8a4c40deb18188c607849c2 | Python | 741 | 26 | import logging
from dataclasses import dataclass
from kgcl_schema.datamodel.kgcl import Change
from kgcl_schema.grammar.render_operations import render
from linkml_runtime.utils.yamlutils import YAMLRoot
from oaklib.io.streaming_writer import StreamingWriter
@dataclass
class StreamingKGCLWriter(StreamingWriter):
... |
3fddeabf6faca5e2a6faf3d39d3a34be33fd6811bddc77e742eab9389f456402 | Python | 741 | 29 | #!/usr/bin/python
import sys
import os
import shutil
if len(sys.argv) < 2:
print("enter the impulse wavelength please")
exit(0)
print("creating a series of photon impulses")
pulse_value = sys.argv[1]
# create a directory with the pulse_value
if not os.path.exists(pulse_value):
os.makedirs(pulse_value)
e... |
80eae5ce6f15f4d2b3e0b8633c04aaf77abe4996ce8f88cb4ff236827e85731f | Python | 742 | 15 | from torch.utils.tensorboard import SummaryWriter
import M2TR.utils.distributed as du
class TensorBoardWriter(SummaryWriter):
def __init__(self, log_dir=None, comment='', purge_step=None, max_queue=10, flush_secs=120, filename_suffix=''):
super().__init__(log_dir, comment, purge_step, max_queue, flush_sec... |
f5013023d2137e1cc7a6cc6271054928de10197cb1609c6ca00d18238dfdb054 | Python | 742 | 26 | #coding:utf-8
import time
import numpy as np
import torch
from torch.autograd import Variable
def runtime(model, inputsize, iter=100, device=-1):
model.eval()
time_spent = []
if device >= 0 and torch.cuda.is_available():
input = Variable(torch.rand(inputsize).unsqueeze(0), requires_grad=False).c... |
5d92e89eccd8a3e623dc88024c86d6b9cccfbcf90e865ceb523b1ca870b3c323 | Python | 743 | 28 | import os
import sys
from openmmlib import pymol_show
if len(sys.argv) != 5:
print("---------wrong arguments---------")
print("usage python movie.py trajectoryPath moviePath start end;")
print("example: python movie.py myTrajectory movieFolder 1 30")
moviepath = sys.argv[2]
if os.path.exists(moviepath):... |
e1ce36d419e87fab4a7713c36cba8bb3954bfd05fddf45453f61e9c48a74762b | Python | 743 | 29 | """General utilities."""
import numpy as np
def window_data(data, window_length, hop):
"""Window data into overlapping windows.
Parameters
----------
data: np.ndarray
Data to window. Shape (n_samples, n_channels)
window_length: int
Length of the window in samples.
hop: int
... |
5d0e3dbe966639c99146f65f3d39477edf3bb011b6612822b8cb27d2c2be3a44 | Python | 744 | 23 | #!/usr/bin/python
from setuptools import setup
import sys, site, os
setup(name='fasticlip',
version='0.9.3',
description='Fully Automated and Standardized iCLIP (FAST-iCLIP) is a fully automated tool to process iCLIP data.',
#install_requires = ['numpy>=1.7', 'pandas>=0.14', 'matplotlib_venn>=0.... |
4326b88c561c6adb67f131a40b478e19d5e7280925226acb5eda0dd513d3d8e3 | Python | 745 | 23 | from setuptools import setup, find_packages
setup(
name='bds_api',
version='0.0.0',
description='Brain Data Standards Ontology restful API that wraps data search and query endpoints.',
url='https://github.com/obophenotype/brain_data_standards_queries',
author='Huseyin Kir',
classifiers=[
... |
cb7f2c2c14787fab6bd0c2a5f8b36350c30e2c9acb0b2398e6cbc9f82bcac96b | Python | 745 | 19 | from snakemake.shell import shell
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
# replace symbolic <INS> alleles so that snpeff will annotate against genes
# https://github.com/pcingola/SnpEff/issues/344
replace_ins = "zcat {snakemake.input} | sed 's/<INS>/N/g' | sed 's/<INS:ME:ALU>/N/g' | sed 's/<INS:ME:LI... |
e17e039348a3a257c21d2f4e1057bb1acdc01bf6dc9da03cb0ebcfbaa7d0e651 | Python | 745 | 30 | import sys
import torch
import torch.nn as nn
from torch import Tensor
from torch.nn import Module
from maskrcnn_benchmark.utils.registry import Registry
sys.setrecursionlimit(10000)
MODULE_FLOPS_COMP = Registry()
@MODULE_FLOPS_COMP.register("Conv2d")
def build_conv2d_flops(module: Module, oup: Tensor):
kh, ... |
14c38e792a6b9ba76d44b4710baeab4f283067d57e524eeca43685c0412c9747 | Python | 746 | 16 | # 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... |
bd32e37ba9058248967f2c041abe8239e975dbafb11ecd028b4f4f4e449d2010 | Python | 746 | 34 | import torch
from src.models.fc_inn import FullyConnectedINN
def test_fc_inn():
ndim_x = 16
optim_kwargs = dict(
__init__='torch.optim.Adam',
lr=1e-3,
)
scheduler_kwargs = dict(
__init__='torch.optim.lr_scheduler.MultiStepLR',
milestones=[]
)
inn = FullyConnec... |
1ce7dd5574a0323a08fa5a13215c67ffabcc70aeae9b195e6e29fbb00bc384cf | Python | 747 | 31 | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 18 13:00:49 2022
@author: csb
"""
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_theme(context='notebook', style='ticks',font='arial',font_scale=1.2)
#%% Tristable
data=pd.read_csv('Tristable.csv')
f, ax = plt.subplots(figsize=(5,4... |
720ae3743c36c51ea05cb19987bae5180c146648ee2b0be3a9c1c24d4ed9866b | Python | 747 | 18 | from drugex.data.corpus.vocabulary import VocSmiles
from drugex.data.datasets import SmilesFragDataSet
from drugex.training.models import SequenceTransformer
from drugex.training.monitors import FileMonitor
from ..settings import *
def main():
data_sets = [SmilesFragDataSet(f'{OUTPUT_FILE}_{split}.tsv', rewrite=F... |
8d79c52d43a180c73787878c2e4eb3cb8a9e70d355b59eb08227297b14ed3ed7 | Python | 747 | 47 | import gzip
import sys
import os
inputfile = sys.argv[1]
tmpfile = inputfile+"_tmp.txt.gz"
print("Stripping non-rs IDs from: "+inputfile)
fh = gzip.open(inputfile, 'rt')
fho = gzip.open(tmpfile, 'wt')
rsvisit = set()
norsctr = 0
for line in fh:
elems = line.split(":")
if len(elems) < 3:
print("Error parsing l... |
69f41fc9cbc6b8cf0327b501507d5ff566903c8e20ac687869005710d1cf1ffb | Python | 749 | 27 | #!/usr/bin/env python3
import sys
import subprocess
import xml.etree.cElementTree as ET
jobid = sys.argv[1]
try:
res = subprocess.run("qstat -f -x {}".format(jobid), check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
xmldoc = ET.ElementTree(ET.fromstring(res.stdout.decode())).getroot(... |
9540a2c9d65b2cb48120e2055668ece20d521b4baaad71f1797e68da4fcbb9e4 | Python | 749 | 28 | from dark_ships.behavioral_classifier.transformation_pipeline import process_data, parse_sample, parse_sample_auto, parse_tfrecord
import tensorflow as tf
from glob import glob
from tqdm import tqdm
directory = ''
def count_empty(ds):
labels = []
count = 0
for x in tqdm(ds.__iter__(), desc='to... |
d7906986c3e0b27890e7d1d0b86ae89d35e8d3ae2a1e09feb8f35c7f9f9b4f05 | Python | 750 | 16 | # 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... |
103fb69175f5b16228604704c434abcd7f38dfb59e2024589055c910f316b6ff | Python | 751 | 19 | from typing import Iterator, List
from oaklib.datamodels.vocabulary import IS_A
from oaklib.interfaces.mapping_provider_interface import MappingProviderInterface
from oaklib.interfaces.obograph_interface import OboGraphInterface
from oaklib.types import CURIE, PRED_CURIE
PREDICATE = [IS_A]
def propagate_terms_over_... |
5335da19a95698e00fa9a7a881b876ebcc98f274a2d68abb7181756d79e10233 | Python | 751 | 32 | __author__ = "Johannes Köster"
__copyright__ = "Copyright 2016, Johannes Köster"
__email__ = "koester@jimmy.harvard.edu"
__license__ = "MIT"
from snakemake.shell import shell
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
outfile = snakemake.output[0]
compress_flags = ""
if outfile.endswith("vcf.gz"):
... |
c827f3b2605db424c3bb9a687796dbef76738920ad03839a9360626151c1ddaa | Python | 751 | 31 | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 18 13:00:49 2022
@author: csb
"""
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_theme(context='notebook', style='ticks',font='arial',font_scale=1.2)
#%% Tristable
data=pd.read_csv('Tristable_low.csv')
f, ax = plt.subplots(figsize=... |
e04e8c4ca1786ee318b055e176e30bab4e9c7e6df6b58db6c7bfbbd8804b4865 | Python | 752 | 33 | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 18 13:00:49 2022
@author: csb
"""
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_theme(context='notebook', style='ticks',font='arial',font_scale=1.2)
#%% Bistable
data=pd.read_csv('Bistable.csv')
f, ax = plt.subplots(figsize=(5,4)... |
9f7b69f83d039e6917683a77fb8df1f3188483f6e16b0621cd71ebca54650c83 | Python | 753 | 39 | __author__ = "Jianfeng Sun"
__version__ = "v1.0"
__copyright__ = "Copyright 2023"
__license__ = "GPL v3.0"
__email__ = "jianfeng.sunmt@gmail.com"
__maintainer__ = "Jianfeng Sun"
import os
def root_dict() -> str:
"""
Get the absolute file path of the root directory.
Returns
-------
str
T... |
fae5336b4f2cb82cb8020cc770ea53bef84f11ff1fbbc5538c2d01ae60c19b05 | Python | 753 | 35 | #!/usr/bin/env python
"""
__init__.py
ALL THE CODE IN THIS FOLDER WAS COPIED/ADAPTED FROM
https://github.com/alecheckert/quot
Which is under MIT LICENSE
"""
# Enforce PySide2 backend to pyqtgraph
# import PySide2
# import pyqtgraph
# Core functions to run localization and tracking on single files
# or directories
#... |
1cdc73f9359334c3cd495c12a4750c204a08cc9454d2c18895935348b0148c70 | Python | 754 | 21 | import mesh
import mesh.plot.trimesh_viewer as mplot # visualize
plane_radius = 10
plane_width = 1
max_elem_area = 1 # maximum area of a triangle on the face of the plane
refinement = None # advanced
refine_bot = False # whether to refine both top and bot surfaces or only the top one
# Create mesh
plane = mesh.disk... |
6add2b6bbfae5fb9c872daaa4e03c6561172f18b1f4f7d79b1228f28a7270cc2 | Python | 755 | 16 | from typing import List, Iterator
from oaklib.datamodels.vocabulary import IS_A
from oaklib.interfaces.mapping_provider_interface import MappingProviderInterface
from oaklib.interfaces.obograph_interface import OboGraphInterface
from oaklib.types import CURIE, PRED_CURIE
def propagate_terms_over_mappings(oi: Mapping... |
469c55b9f1f67a1a6a9df14bd142de94d45ba55032cf4f5ad66f040f1dd09316 | Python | 756 | 38 | import random
import torch
import networkx as nx
def get_flag():
pass
# Set common shapes:
house = nx.house_graph()
house_x = nx.house_x_graph()
diamond = nx.diamond_graph()
pentagon = nx.cycle_graph(n=5)
wheel = nx.wheel_graph(n=6)
star = nx.star_graph(n=5)
flag = None
triangle = nx.Graph()
triangle.add_nodes_f... |
404f172dc92bd2b60303f8efe25ae97807c5111a32fce52ee33ce5371508d7e3 | Python | 757 | 21 | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import torch
from model.utils.config import cfg
if torch.cuda.is_availab... |
eab6783a7b381123d1ccec3dcd151bb06110e1b47a6485f310433db3bcea8198 | Python | 757 | 24 | from .centerCropCommon import center_crop
class positiveCenterC:
def positiveCenter(self):
acceptance_boolean, overlapping_percentage = (
self.check_if_lesions_and_gland_mask_overlapping(
self.prostate_gland_arr_slice, self.image_source_original_tumour, True
)
... |
f6889fd5aafd26caf974a308cef324f24bfe0f70d75392dd5738c7db8b3bbb05 | Python | 758 | 33 | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 18 13:00:49 2022
@author: csb
"""
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_theme(context='notebook', style='ticks',font='arial',font_scale=1.2)
#%% Bistable
data=pd.read_csv('Bistable.csv')
f, ax = plt.subplots(figsize=(5,4)... |
5a35b4661a19fa2a7571a68e1037d46d718a2cdcf677285c76f5dfb8db64964c | Python | 759 | 20 | """Plotting for data-objects"""
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from .._colorspaces import two_step_colormap
from ._base import reset_rc
from ._colors import (
ColorBar, ColorGrid, ColorList,
colors_for_categorial, colors_for_oneway, colors_for_twoway,
single_hue_colormap, soft_th... |
4ca5d450135b572862599e574eb9fd0f0c2058e913d9e484595ef6c2ee86ddff | Python | 760 | 24 | import numpy as np
from bayesian_bootstrap import mean, highest_density_interval
from matplotlib import pyplot as plt
import seaborn as sns # noqa: F401
def plot_group_hdis(samples, labels, alpha, n_replications):
for i, (s, l) in enumerate(zip(samples, labels)):
posterior = mean(s, n_replications)
... |
ba9d5ca6153013bbacb7b31237b4a9223d9a6350674da1e4c4e867cf8a2d6a4d | Python | 760 | 27 | import torch
import torch.nn.functional as F
cudaAvailable = False
if torch.cuda.is_available():
cudaAvailable = True
Tensor = torch.cuda.FloatTensor if cudaAvailable else torch.Tensor
BCELoss = torch.nn.BCELoss()
L1Loss = torch.nn.L1Loss(reduction='sum')
MSELoss = torch.nn.MSELoss()
def realTargetLoss(x):
target = ... |
6f130f2be8ceafe8d2f12f2a542d88d4e517891d7bab39699932fcebfa44bd4e | Python | 761 | 28 | import logging
import unittest
from linkml_runtime.dumpers import yaml_dumper
from oaklib.parsers.boomer_parser import BoomerParser
from tests import INPUT_DIR
EXAMPLE = INPUT_DIR / "boomer-example.md"
class BoomerParserTest(unittest.TestCase):
"""Tests parsing Boomer reports."""
def setUp(self) -> None:
... |
92c4a40d6196aecda10dd02df8be15da764d717f7dcbf5a30ee53846ec442cfa | Python | 761 | 23 | """The small helpers in pyoxynet.utilities."""
import numpy as np
import pytest
from pyoxynet import utilities
@pytest.mark.parametrize('text, seconds', [
('00:30', 30), ('01:00', 60), ('10:30', 630), ('00:00', 0), ('0:0', 0),
('00:00:30', 30), ('01:00:00', 3600), ('01:30:45', 5445),
])
def test_get_sec(text... |
1d1f820409cd6f65cc2a77d26f0bec100b37660cf9b37fee3877d430bb9ff3ba | Python | 762 | 29 | """Configuration for in-package doctests.
Should be importable (but not useful)
without development dependencies.
Where these files up and when they are deleted is documented
`here <https://pytest.org/en/stable/tmpdir.html#the-default-base-temporary-directory>`_.
"""
from pathlib import Path
try:
import pytest
... |
305190373fa7e9bc0da465aa27eafc6c30f57616a3105c3ff758f8b23ac31353 | Python | 766 | 17 | # 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... |
3a3812de642ca257b343aada219ef849ce2b34cd6e28db4dbbead30a84b3ffbd | Python | 766 | 23 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import bisect
from torch.utils.data.dataset import ConcatDataset as _ConcatDataset
class ConcatDataset(_ConcatDataset):
"""
Same as torch.utils.data.dataset.ConcatDataset, but exposes an extra
method for querying the sizes of the ima... |
9e63367142b58eb0ea84ad2e76f85c78cc19f2312283bf6fd4baaa5d1d9a9656 | Python | 766 | 31 | #! /usr/bin/env python
# Copyright 2016 Vimal Manohar
# Apache 2.0.
"""This script merges pocolm word_counts and write a new word_counts file.
A min-count argument is required to only write counts that are above the
specified minimum count.
"""
from __future__ import print_function
import sys
def main():
if... |
b6c44127c893efd1b61004e1c50f25c81a5136fb28b0642ecfe071c47d1c469a | Python | 767 | 36 | # %matplotlib inline
import community
import networkx as nx
import torch
from sklearn import manifold, datasets
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
from torch_geometric.data import Data
from deeprank_gnn.community_pooling import ... |
387338b347de2f4bb91b709afa1dbc2a60089232730a9a8dc20e524a9d0ec2f2 | Python | 768 | 18 | from . import inject_keras_modules, init_keras_custom_objects
from . import model
from .preprocessing import center_crop_and_resize
EfficientNetB0 = inject_keras_modules(model.EfficientNetB0)
EfficientNetB1 = inject_keras_modules(model.EfficientNetB1)
EfficientNetB2 = inject_keras_modules(model.EfficientNetB2)
Effici... |
79c7fc0a71611dd1f88957a89caf322f4a91454d669699c9867521524c8462a0 | Python | 769 | 16 | import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
def lstm_autoencoder(n_timesteps, n_features, name="LSTM_Autoencoder"):
inputs = tf.keras.Input(shape=(n_timesteps, n_features))
x = layers.LSTM(units=128, return_sequences=True, name="encoder1")(inputs)
x = layers.LS... |
13da87244456ba996f05e29b57070f894a5970722b925fb9da1879a6247685b5 | Python | 771 | 32 | """Snakemake wrapper for running mpileup."""
__author__ = "Julian de Ruiter"
__copyright__ = "Copyright 2017, Julian de Ruiter"
__email__ = "julianderuiter@gmail.com"
__license__ = "MIT"
from snakemake.shell import shell
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
bam_input = snakemake.input.bam
refere... |
a39114b69bdfffe6d60c6e5a6bc51eca90c9a6f7c126b09ec87b1b0bd9c89607 | Python | 771 | 30 | import os
from pathlib import Path # a class to handle os paths
def prepare_csv_line(*entries, delimeter=","):
'''
Prepare a list of objects for writing into a csv file.
'''
line_str_list = map(str, entries)
line = delimeter.join(line_str_list) + "\n"
return line
def subdirs(folder):
'''
... |
fa1640fb759cb08868c7f81797775c912010eb7c1a50dda1a6b26d10d7a7da43 | Python | 771 | 28 | #!/usr/bin/env python
"""
__init__.py for Catactor
"""
__author__ = "Kawaguchi RK"
__copyright__ = "Copyright 2021"
__credits__ = ["Kawaguchi RK"]
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "Kawaguchi RK"
__email__ = "rkawaguc@cshl.edu"
__status__ = "Development"
import pandas as pd
def read_marker_ta... |
988d29977dac72cd16881a48de40106d05afa09a0708fef8b090b6235141aa45 | Python | 772 | 18 | # Copyright 2019 The TensorFlow Authors, Pavel Yakubovskiy. 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 ... |
ade81c630cceb166c43f3819894fe85a109ba1f541d57f8a6278fe9a57a19fd6 | Python | 772 | 26 | from abc import ABC
from typing import Dict, List, Iterable
from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface
from oaklib.resource import OntologyResource
from oaklib.types import CURIE
class DifferInterface(BasicOntologyInterface, ABC):
"""
Generates descriptions of differences
... |
def794c5e1eff08fc0e7d93a91bfc83dcf780b3061ae4e2a67c2d1a64f5403e4 | Python | 772 | 23 | import numpy as np
import re
import os
def show_and_select(file_list, msg='Select a file by the number: ', int_if_single=True):
# If the selection is a single number, then return that number instead of the list of length 1
invalid_selection = True
while invalid_selection:
for i, f in enumerate(fil... |
6a44f894a1a6eea48e9447857a55f8d89f7538e05ea60f25a0848c72fd76c7b7 | Python | 775 | 28 | import sys
sys.path.insert(0, '../../')
from ML.networks.flat import CMFMLP
from ML.networks.graph import GraphCondGlobal, GraphCondSelective
def network_loader_flat(config_net):
"""
To load the networks for flat variants.
"""
if config_net["net"] == 'CMFMLP':
net = CMFMLP(config_net["d_cond"]... |
f0021f85f10505951f6d1154332d3e5fb4e8d5d31e55e8b6e4d0e5a21ee01ce4 | Python | 775 | 29 | import json
import logging
from pathlib import Path
import pymaid
base_path = Path(__file__).parent
try:
file_path = (base_path / "./pymaid_credentials.json").resolve()
with open(file_path, "r") as f:
cred_dict = json.load(f)
url = cred_dict["url"]
token = cred_dict["token"]
name = cred_di... |
29c22afb536d07aa34ffb1194c241db092cfbadfe0d0018fba35e6d55fdeec15 | Python | 777 | 31 | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 18 13:00:49 2022
@author: csb
"""
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_theme(context='notebook', style='ticks',font='arial',font_scale=1.2)
#%% Tristable
data=pd.read_csv('Tristable.csv')
f, ax = plt.subplots(figsize=(5,4... |
2c7b0a7d3084d4948269a676215453d28d74365c3ebad7a2549166d12b9a45bf | Python | 777 | 36 | import os
class config:
host = 'your_host_address'
username = 'test'
port = 5672
exp_name = os.path.dirname(os.path.abspath(__file__))
exp_name = '-'.join(i for i in exp_name.split(os.path.sep) if i)
log_dir = 'searchlog/DetNAS_300M_FPN'
test_send_pipe = exp_name + '-test-send_pipe'
... |
299330690a97520f6436c8181479f1e82fd6a0d34438ce58ea2c1245bc0f1483 | Python | 779 | 26 | #!/usr/bin/env python3
# Copyright 2018 Ashish Arora
# Apache 2.0
# This script prepares lexicon.
import argparse
import os
parser = argparse.ArgumentParser(description="""Creates the list of characters and words in lexicon""")
args = parser.parse_args()
### main ###
lex = {}
text_path = os.path.join('data',... |
05e0823369638cf5c05576546f2adc4c09d1f586f04eb99f0d532da34bc4e1d3 | Python | 780 | 33 | import os
import io
from setuptools import find_packages, setup
src_dir = os.path.abspath(os.path.dirname(__file__))
# Load README
def read(fname):
with io.open(os.path.join(os.path.dirname(__file__), fname), encoding="utf-8") as f:
return f.read()
setup(
name='chemproppred',
version='v0.1.0',... |
2546920f69920811f108f119e26568376b5176c01ab2f98dcb388573d8b2b100 | Python | 781 | 17 | from numpy import array_split
from scipy.stats import chisquare
import pandas as pd
from pathlib import Path
# read observed and expected frequency per taste
main_dir = '/Users/karimia/code/Brain_Network/matlab/figs/betas_taste_animal'
dirs = [Path(main_dir).joinpath(x+'.csv') for x in ['observed', 'expected']]
Ts = [p... |
cf92167f8906bdf82c3df35ec35762776228b64d3de6b319471af8656396a6db | Python | 781 | 23 | import os
NETWORK_HOME = os.environ.get("NETWORK_SIMULATION_HOME")
if NETWORK_HOME is None:
print("Please set the project root directory environment variable! (source configure.sh)\nExiting.")
exit(0)
paths = {
'local': {
'data_path': NETWORK_HOME + '/data/',
'jdf_template': None,
'matplotlib_rc': NE... |
3cabc7220347d5d2a32cf0851169b9015896713ad6652aa050bad00aa436a3db | Python | 783 | 25 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import logging
import os
import sys
def setup_logger(name, save_dir, distributed_rank, filename="log.txt"):
logger = logging.getLogger(name)
logger.setLevel(logging.DEBUG)
# don't log results for the non-master process
if distribu... |
7be5d00211ad5de6f4660febc2fc2d6f549d30043afd11495cfaeee8df4c6f7b | Python | 784 | 21 | import logging
from abc import ABC
from typing import Dict, List, Tuple, Iterable, Optional
from oaklib.datamodels.vocabulary import IS_A, HAS_DEFINITION_CURIE
from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface
import oaklib.datamodels.ontology_metadata as om
import sssom
from oaklib.types i... |
1c21850c2a633c274b6688fcbc6e6aeb454a147b370facf61075774bbcc3c646 | Python | 785 | 26 | from dataclasses import dataclass
from typing import Type, Union
import jsonlines
from linkml_runtime.dumpers import json_dumper
from linkml_runtime.utils.yamlutils import YAMLRoot
from oaklib.io.streaming_writer import StreamingWriter
@dataclass
class StreamingJsonLinesWriter(StreamingWriter):
"""
A writer... |
a7318e351be271e1a5f11ebdd6727e1df0e35e10b098cd33f07ed1a02c82d03b | Python | 785 | 30 | __author__ = "Johannes Köster"
__copyright__ = "Copyright 2019, Johannes Köster"
__email__ = "johannes.koester@uni-due.de"
__license__ = "MIT"
from snakemake.shell import shell
species = snakemake.params.species.lower()
release = snakemake.params.release
fmt = snakemake.params.fmt
build = snakemake.params.build
log ... |
02015294ad8f5cdfd47f969d50258430e602811da772b25d3cd59e476a1dcb27 | Python | 786 | 32 | from dataclasses import dataclass
from typing import Any, List
from oaklib.resource import OntologyResource
@dataclass
class OntologyInterface:
"""
An abstract parent for an ontology interface
"""
#engine: Any = None ## implementation object
resource: OntologyResource = None
strict: bool = F... |
89e51344168eb4c0167fcd5db7cd278516a1f5cea7c52c3b9e4e7dc19be3ecab | Python | 786 | 37 | import gzip
import sys
if len(sys.argv) < 4:
print("Usage: eQTLsFDR0.05.txt.gz eQTLCrossMapFile.txt.gz percentagecrossmap outfile.txt.gz")
else:
infile=sys.argv[1]
crossmapfile=sys.argv[2]
crossmapthreshold=float(sys.argv[3])
outfile=sys.argv[4]
selectedset = set()
fh = gzip.open(crossmapfile, 'rt')
fh.read... |
fef12a6504e2aca1636815e20c64353e0d880699a26bb22103467dc1dd6ad975 | Python | 786 | 29 | from abc import ABC
from typing import Iterator, List, Tuple
from oaklib.datamodels.obograph import DefinitionPropertyValue
from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface
from oaklib.types import CURIE
__all__ = [
"OntologyGenerationInterface",
]
class OntologyGenerationInterface(... |
c16fddcdc955e2c525539ef929ca31b01d60bd5a1fecb4bb55efac95f6a3a050 | Python | 789 | 28 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
from maskrcnn_benchmark.utils.metric_logger import MetricLogger
class TestMetricLogger(unittest.TestCase):
def test_update(self):
meter = MetricLogger()
for i in range(10):
meter.update(metric=floa... |
a77ba7e6ff4822a21aa1270f3b0e325acdce3d7a1952825c3966e433ad1a61b2 | Python | 790 | 39 | #!/bin/env python
# script credit: https://github.com/naumenko-sa/bioscripts
# $1 = file.bam.coverage = product of ~/bioscripts/bam.coverage.sh with -d on
# $2 = No of the field with coverage, 0-based
# $3 = character separator in the input file
import sys
import numpy
cov={}
levels = [0,1,10,20,30,50,100,200]
for ... |
a74c2a7e44a75037f4d3a49e803b43e9d6f5e758dbea7c5029ef5ed4904be7db | Python | 791 | 21 | import numpy as np
import joblib
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import precision_score,recall_score,roc_auc_score
from sklearn.preprocessing import StandardScaler
from scipy.io import savemat,loadmat
#Load Model
ss = joblib.load('scaler.joblib') #Please replace the sca... |
2128d78a484345948b7802521264bbd7e63f427c623b417bf347fa0103d273b3 | Python | 792 | 17 | # 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... |
3d3a477d98f91236b3d8ae901d062e052caf01aac45e63de72882b1ca788942e | Python | 792 | 23 | import sys
try:
import torch_geometric
except:
print(
"Torch geometric is not installed, see here for instructions: \nhttps://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html"
)
raise
if sys.version_info[:2] >= (3, 8):
# TODO: Import directly (no need for conditional) when... |
5a2f9a82c55896126f325c1bf5c1c89b6267e1654e0f1a4d490e1e1f0a3b5a7b | Python | 792 | 31 | from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="vame",
version='1.0',
packages=find_packages(),
entry_points={"console_scripts": "vame = vame:main"},
author="K. Luxem & P. Bauer",
description="Variational A... |
16751ea8d9919ec768a5d3878c2b4c9cf2a0515861e96afd9a1a29e991ed8ca5 | Python | 793 | 25 | import numpy as np
def save_results(results_dir, taskname, model, config,
train_metrics, val_metrics=None, test_metrics=None):
seed = config.seed
mod = config.get('filename_modifier', '')
mod = mod + '_' if not mod == '' else ''
prefix = f'{taskname}_{mod}seed_{seed}'
model.sav... |
105413097d51e6b50c4063a9d31d51f85dff005a348fb2f34e70e0865307f136 | Python | 794 | 28 | from argparse import ArgumentParser
from mmdet.core import coco_eval
def main():
parser = ArgumentParser(description='COCO Evaluation')
parser.add_argument('result', help='result file path')
parser.add_argument('--ann', help='annotation file path')
parser.add_argument(
'--types',
type... |
30e8ff42169cf8751e00539b7ab343619f620634fdf7f61d76c3c413dc7aea2c | Python | 794 | 20 | # 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... |
3eace117127b1e57f78d7f071bda12d22439b9e1e1497f86bb619680ddec88bc | Python | 794 | 31 | # Remastering old graphs because they had some problems
# Not to worry too much, I was a genius and had saved the data for the graphs and since I do not have to plot them, I can reuse them
# %%
# Imports
import numpy as np
import matplotlib.pyplot as plt
# First read the file using numpy
data = np.loadtxt("data.txt... |
4916dcd9a666911417fb12d079b46cfade23798d597e73357432d7d4de0d00f2 | Python | 794 | 29 | # Download eQTLs from Sieberts et al. paper (https://www.biorxiv.org/content/biorxiv/early/2019/05/17/638544.full.pdf)
import synapseclient
import getpass
import synapseutils
from datetime import datetime
today = datetime.today().strftime('%Y-%m-%d')
user = input("Synapse username:")
password = getpass.getpass('Syn... |
df59e60d9e52a92fa3d979eee38ba13f868dc3d6bd1990b0fa9318c88237af37 | Python | 794 | 18 | from . import inject_tfkeras_modules, init_tfkeras_custom_objects
from . import model
from .preprocessing import center_crop_and_resize
EfficientNetB0 = inject_tfkeras_modules(model.EfficientNetB0)
EfficientNetB1 = inject_tfkeras_modules(model.EfficientNetB1)
EfficientNetB2 = inject_tfkeras_modules(model.EfficientNet... |
3cd1706355d5dbb80dc6c656d53ff64f6cca4be2918270aedb406ebead6dbcf6 | Python | 796 | 24 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""Pytest configuration
Skipping slow tests: https://docs.pytest.org/en/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option
"""
import pytest
def pytest_addoption(parser):
parser.addoption("--runslow", action="store_true",... |
b38b04cb0edcc86b372c438427f381fa8f823d724e7aa30a7a96f627ab26a179 | Python | 796 | 26 | # Copyright (c) Open-MMLab. All rights reserved.
import pickle
from .base import BaseFileHandler
class PickleHandler(BaseFileHandler):
def load_from_fileobj(self, file, **kwargs):
return pickle.load(file, **kwargs)
def load_from_path(self, filepath, **kwargs):
return super(PickleHandler, se... |
7e8e065a5e1de6f43e1488afc6d5659f24c96441ddd4fe713d88575c1cf03003 | Python | 797 | 26 | import autograd.numpy as anp
from typing import Iterable
from ._impl import *
# Simple Uniform Release Model
class SUR(ODEModel):
def __init__(self, kinetics: bool = True):
super(SUR, self).__init__(kinetics)
# Spatiotemporal Uniform Release Model
class STUR(PDEModel):
def __init__(self, kinetics: b... |
3d84da738a285aa4ab0c0ceb94264d2d1d9862b5460a6c28cbd55693c4113eff | Python | 798 | 25 | """
Copyright 2020 - by Jerome Tubiana (jertubiana@gmail.com)
All rights reserved
Permission is granted for anyone to copy, use, or modify this
software for any uncommercial purposes, provided this copyright
notice is retained, and note is made of any changes that have
been made. This softwar... |
f2117694a94814ff8339c12389ef793b7afb7e004e96a1b941841c0cfe439bc8 | Python | 798 | 35 | #!/usr/bin/env python3
# Copyright 2017 Bengu Wu
# Apache 2.0.
# This script generate trials file.
# Trial file is formatted as:
# uttid spkid target|nontarget
# If uttid belong to spkid, it is marked 'target',
# otherwise is 'nontarget'.
# input: eval set uttspk file
# output: trial file
import sys
fnutt = sys.arg... |
61316d2ed790c8e93ca0269079c37a6e3bb6a734db9904ba41b819630352b453 | Python | 799 | 32 | import gc
import numpy as np
gc.enable()
import random
import numpy as np
random.seed(666)
from selene_sdk.utils import load_path
if __name__ == "__main__":
path = "/home/msindeeva/DeepCT/model_configs/boix_train_masked_ct.yml"
configs = load_path(path, instantiate=False)
k = configs["dataset"]["dat... |
181ad70504b0060db6bc075bec1b3c113b32339ede9609fbe8d45a70069e0e50 | Python | 801 | 18 | from drugex.data.corpus.vocabulary import VocGraph
from drugex.data.datasets import GraphFragDataSet
from drugex.training.models import GraphTransformer
from drugex.training.monitors import FileMonitor
from ..settings import *
def main():
data_sets = [GraphFragDataSet(f'{OUTPUT_FILE}_{split}.tsv', rewrite=False) f... |
a3a229886a63736e19da55c1cc264631210f48b368d6d9cba2af96a1425558fd | Python | 802 | 28 | import os
import re
import numpy as np
path = '/Volumes/GoogleDrive/My Drive/blender/animations/all_brain_neurons/neuropil/'
files = os.listdir(path)
files = sorted(files)
#regex = re.compile(r'\d+')
#ints = [int(regex.findall(x)[0]) for x in files]
#ints = list
ints = [x*2 for x in range(1, 1+len(files))]
names = [... |
c39b68e9370783257ed88dad02f136267e72456905e6e98f0eec71dbfdf16b0d | Python | 802 | 18 | # 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... |
f2eaf4fd499e4d9b59a7dc2f0c4ef2bd3bcedf8681d1fcab3ff58b99c6498dc4 | Python | 802 | 30 | import logging
import os
from importlib.metadata import PackageNotFoundError, version
# Hide the INFO messages of TensorFlow's C++ code (it must be set before
# TensorFlow is imported)
os.environ.setdefault("TF_CPP_MIN_LOG_LEVEL", "1")
from osl_dynamics.utils.logger import (
_setup_logger,
_setup_tensorflow_i... |
34c8f40faaa02e85ad9500ed4fb042416f9f69fcc833e622da66fc735b93e84d | Python | 803 | 34 | import logging
from dataclasses import dataclass
from typing import Iterator, TypeAlias
from pyhornedowl.model import Component
from oaklib import BasicOntologyInterface
from oaklib.inference.reasoner import Reasoner
logger = logging.getLogger(__name__)
Axiom: TypeAlias = Component
@dataclass
class OwlReasoner(Rea... |
8a3a2bef280dd9e0db57bd5ed08b831a63f36cf52f5bc22c2ddafec35fe9efd9 | Python | 803 | 32 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
phys2bids interface for acqknowledge files.
"""
from bioread import read_file
from phys2bids.physio_obj import BlueprintInput
def populate_phys_input(filename, chtrig):
"""
Populate object phys_input
"""
data = read_file(filename).channels
fre... |
923bae99a8a233320ab4e5a373cca34a74714b9f97affc9fad4a252c145ee271 | Python | 804 | 22 | from utils import full_target_file_pipeline
DATA_DIR = "/mnt/datasets/DeepCT/dataset_data/Biox_et_al/complete_clique1_with0"
fasta_path = "/mnt/datasets/DeepCT/male.hg19.fasta"
encode_blacklist_path = "long_hg19_blacklist_ENCFF001TDO.bed"
all_targets_path = "/mnt/datasets/DeepCT/dataset_data/Biox_et_al/Biox_et_al_dat... |
19015fea757591328f3155a9d27da7744522966271e26ea5a7fc427ad4f2b6fb | Python | 805 | 30 | # -*- coding: utf-8 -*-
import sys
import unetsl.data
import numpy
import skimage.measure
import skimage.morphology
import skimage.feature
from matplotlib import pyplot
if __name__=="__main__":
img, tags = unetsl.data.loadImage(sys.argv[1])
frame = img[0,0]
thresh = (frame>4)*1
local_maxi = skim... |
acbcf09ef511c8781c82dd28a08ec5e69b1aee51978019f5c89e53c3b3c9d179 | Python | 806 | 17 | import numpy as np
# 3LAA to tip atom conversion.
dict_3LAA_to_tip = {"ALA":"CB", "CYS":"SG", "ASP":"CG", "ASN":"CG", "GLU":"CD",
"GLN":"CD", "PHE":"CZ", "HIS":"NE2", "ILE":"CD1", "GLY":"CA",
"LEU":"CG", "MET":"SD", "ARG":"CZ", "LYS":"NZ", "PRO":"CG",
"VAL":"CB", "TYR":"... |
6c1c12a83179a0e5d274a868fcec4dddad85d5069a2e31c099fa01136893181f | Python | 807 | 43 | import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
def get_cube(a, b, c, A=0, B=0, C=0):
phi = np.arange(1, 10, 2) * np.pi / 4
Phi, Theta = np.meshgrid(phi, phi)
print(phi, Phi)
x = np.cos(Phi) * np.sin(Theta)
y = np.sin(Phi) * np.sin(Theta)
z = np.cos... |
bf910bc4ecfe9b5927b0fa25decd807017542dc73ca9403d27ed77b512fc4e4e | Python | 807 | 22 | # 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... |
59ae312686ba83d73f6fcca326ce97a997d02ac74c0ab668c5b08b7dffa70ddb | Python | 809 | 21 | from torch.utils.tensorboard import SummaryWriter
import aug_accuracy.utils
class Logger:
def __init__(self, log_path, model):
self.writer = SummaryWriter(log_path)
self.model = model
def log_train(self, loss, epoch):
print("{:05d} Training loss = {}".format(epoch, loss))
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.