sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
641e545e05ca4f4ff102534a82d34e7d54c4e8f2fffcc10c2c0b04d97393c7b5 | Python | 1,943 | 61 | import difflib
from collections import defaultdict
import h5py
import pandas as pd
# Using readlines()
import torch
import numpy as np
from Bio import SeqIO
from tqdm import tqdm
file1 = open('../data/embeddings/subCell_all_pssmFile.txt', 'r')
Lines = file1.readlines()
fasta_sequences = []
for record in tqdm(SeqIO.... |
abffd7ecbaf87ac9635089da1a4241cc249d6bc6ccf48b675cd2e643e03d402f | Python | 1,944 | 69 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
1feba9dad247c6e3fd06b3c0bed4662fb2dede9c0a8f9df0cf07875e1926519c | Python | 1,945 | 50 | import sys,os
import pandas as pd
import numpy as np
#EMT5p
if sys.argv[1] == "EMT5m":
shortnames = [["T5moins_rep1", "T5moins_rep2", "T5moins_rep3"]]
if sys.argv[1] == "EMT5p":
shortnames = [["T5plus_rep1", "T5plus_rep2", "T5plus_rep3"]]
if sys.argv[1] == "EMT1p":
shortnames = [["T1plus_rep1", "T1plus... |
0ee3cc75714380c0711a662cc4443338c1d826bd0be8197c2a73c98a36286941 | Python | 1,949 | 70 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
101e75bd1a688b6d2c3777688587a91456550061a56378b430c75fa4783dd161 | Python | 1,949 | 64 | import pooch
def fetch_from_registry(registry: pooch.Pooch, name: str, **kwargs):
"""
Fetch ``name`` from ``registry``, trying the secure endpoint first.
If the https download fails with an ``OSError``, retry once against the
http mirror.
"""
try:
return registry.fetch(name, **kwargs)... |
3fdefdaf41ac25326c0625fc4ae74c8fde33960677be3be245571ce27c860ca0 | Python | 1,951 | 43 | import numpy as np
from scipy.spatial import distance
#Class Description: To determine centroids and group assignments
class CentroidOperations:
#Description: Recalculate centroids based on data and groups
#Parameters: data = data to calculate centroids using, groups = groups to recalculate c... |
6ebe427ecc5d82639012259ab399ffe609ab22e9cd4583bb3282dc6bce93796a | Python | 1,951 | 62 | import torch
import torch.nn as nn
import torch.nn.functional as F
class GATLayer(nn.Module):
def __init__(self, in_dim, out_dim, edge_dim):
super(GATLayer, self).__init__()
# equation (1)
self.fc = nn.Linear(in_dim, out_dim, bias=False)
# equation (2)
self.attn_fc = nn.Li... |
77abf356c4e89f321fb506d275a611b7ae3cd0ed1c2623875bf4506e70c26dcc | Python | 1,951 | 60 | from ANNarchy import *
setup(dt=1.0,seed=101)
import matplotlib as mp
mp.use('Agg')
import numpy as np
import os
from net import *
# Present white noise patches for Spike-Triggered-Average
# R. Larisch, Technische Universitaet Chemnitz
# 2020-04-27
#--------------------------------------------------------------------... |
77bf0afca8dff5afaef4c5d70e66090c7efe7a2b0cac6e3f773254a7da314252 | Python | 1,961 | 65 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
91633927f2f7867cc0bd568fa199405504314d58da00c5a19f2b72b40b72285e | Python | 1,961 | 81 | from datetime import datetime
class UtilsException(Exception):
pass
def dprint(input_str):
"""
prints the input if in debug mode, skips otherwise
:param input_str:
:return:
"""
if __debug__:
print(input_str)
def print_rule(thick=False, line_length=70):
if thick:
sy... |
3b11270b4b8c1500430825239fc2cfd1ab22e1148549d744392b05496c9e0ef8 | Python | 1,964 | 63 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
82fafe3bc89438dd704e170bdcf7de6ed4ffbbf065f0b03314d6111b02bdb843 | Python | 1,972 | 63 | import hashlib
import os
import pickle
from zoltpy.quantile_io import json_io_dict_from_quantile_csv_file
from zoltpy import util
from zoltpy.connection import ZoltarConnection
from zoltpy.covid19 import COVID_TARGETS, covid19_row_validator, validate_quantile_csv_file
import glob
import json
import sys
UPDATE = False
... |
fa923523dbcdddc9d3bfbea4ac2e331f3415a7929c59b7b2179d441c330d19be | Python | 1,972 | 55 | import numpy as np
import tensorflow as tf
# originally from https://github.com/tryolabs/luminoth/blob/master/luminoth/models/fasterrcnn/
def generate_anchors_reference(base_size, aspect_ratios, scales):
"""Generate base anchor to be used as reference of generating all anchors.
Anchors vary only in width and... |
56e98b6000108f98a7b7b955f6e51930e4256117c788cbd43390d2a96f2fdcfe | Python | 1,974 | 55 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
e7ee04332d0773737179d17572e8f4fd4797707a9dafb8e7407ed3ef953385b7 | Python | 1,974 | 55 | from importlib import reload
import numpy as np
import matplotlib.pyplot as plt
import h5py as h5
import sys
direc = sys.argv[0].split('scripts')[0]
where = sys.argv[1]
sys.path.append(direc+'support')
import functions
reload(functions)
import functions as f
import parameters
reload(parameters)
import parameters as pa... |
b5099b88a7e8ea551e6e6cd50cb7aeda6bf45458bf1ba3b45ec7a58934bc7d18 | Python | 1,976 | 68 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
04f57f8a0e98bf5dbbf259d3306d7d0d4a0ec54ba3d082d1df46e08a487889dc | Python | 1,977 | 61 | #!/usr/bin/env python
import os
import logging
from metax import Logging, Utilities
import numpy as np
import h5py_cache
import pandas
def run(args):
if os.path.exists(args.output):
logging.info("Output exists, delete it or move it if you want it generated again")
return
Utilities.ensure_requ... |
fdbed001b2ff65db6ed242b5d46120df361260fd0993f6a8ccd643337d0b34f9 | Python | 1,979 | 36 | # Function for extracting data (the specified features) from .nwb files
##################################################################################
# MIT License
#
# Copyright (c) 2020 OscarSavolainen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and... |
c144aeb6b1944bc791795614d1c5efa3cdae60738bd8a7d0f01baac75b064baa | Python | 1,988 | 59 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
fd61a149313fb518c331d346c2b8bf2dffc87dd888897737e16ba1ae8f71d0b8 | Python | 1,991 | 46 | import ez_setup
ez_setup.use_setuptools()
import setuptools
import os
# Use app's version
import metax
# Use the readme as the long description baked into the application itself
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setuptools.setup(name="MetaXcan",
... |
28966e4d14dfa8c0383534a0f1b78517a5e740bc8b8bd5bc4435e5998afd41dc | Python | 1,994 | 80 | # --*-- coding: utf-8 --*--
import csv
from typing import List
import pandas as pd
import rdkit.Chem.AllChem as Chem
def load_sdf_data(sdf_file):
mols = Chem.SDMolSupplier(sdf_file)
mols = [m for m in mols if m is not None]
if len(mols) == 0:
return None
colums = list(mols[0].GetPropsAsDict(... |
460db9c702cbd2daf9978e94dc5f7d9e024e82eb991244642354310930f9e044 | Python | 1,994 | 72 | import json
import gzip
class ImageArray:
def __init__(self, raw_line):
raw_line=raw_line.split("\t")
raw_name=raw_line[0].split(":")
self.name=raw_name[0]+":"+raw_name[1]
self.strand=raw_name[2]
self.region=json.loads(raw_line[1])
self.is_valid= len(self.region) > 1... |
6f98fd277413e3d7f6457d60f9e129c2bef15ad70f32d1746732582f91eef5dc | Python | 1,994 | 68 |
"""
Created on Wed May 6 11:44:18 2015
.. moduleauthor:: C.V. Rousseau c.rousseau@ucl.ac.uk
"""
import os
import sys
from matplotlib import pyplot as plt
from experiment import Experiment
def checkFigExtension(extension):
"""
Check possible figure extensions
"""
fig = plt.figure()
formats = f... |
1eece7a64c221963c035f4459cb7651218767dd8ce9e8009d4e382a22dbe54d1 | Python | 1,995 | 60 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
727045f847b80fe330083151a8b273e4c3fc3d460ddd524a98b26803b0ad1e6b | Python | 2,001 | 64 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
07eb42e88578a95c9047d8d35eff6ff1edf0bd46140989afccb570e3a7492ca2 | Python | 2,006 | 57 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class GCNLayer(nn.Module):
"""
GCN layer, similar to https://arxiv.org/abs/1609.02907
Implementation inspired by https://github.com/tkipf/pygcn
"""
def __init__(self, in_features, out_features, bias=True, devic... |
a209321243ee5629ed4e0aaf8e42e38f349362ef3596c16a0118cd06966b35d9 | Python | 2,006 | 50 | import torch
from ogb.graphproppred import Evaluator
def train_epoch_sparse(model, optimizer, device, data_loader, epoch):
model.train()
epoch_loss = 0
list_scores = []
list_labels = []
for iter, (batch_graphs, batch_labels) in enumerate(data_loader):
batch_x = batch_graphs.ndata['feat'].to... |
5317d2f9dd2a133ae46742eeb899c772f19d4040f83146f5a9a3e5883ed030df | Python | 2,009 | 63 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
8c0e4cbf86046f054790007ff960166d55a181aa227a60e97d01baad22dbbbbd | Python | 2,010 | 57 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
bbf1e813617899fc98bae12cd64bab4f4500ca4fa3b20e3ba897d24df5bff2bb | Python | 2,014 | 71 | '''This code takes in a csv with two columns: HMM optimized transition matrix [0,0] and [1,1], and calculates the energy barrier, depth difference between two states, and a scaling factor. This code is created by Cathy Chen, Date: 05/2021'''
import pandas as pd
import numpy as np
import scipy.linalg
import os
... |
1ffeed5d2893bcc2601871b1802cabbb94e26ee90d5b84cc7255c2cb2f8a194f | Python | 2,018 | 69 | #!/usr/bin/env python
# coding: utf-8
#
# Author: Kazuto Nakashima
# URL: http://kazuto1011.github.io
# Created: 2017-11-19
from __future__ import absolute_import, print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
from .resnet import _ConvBnReLU, _ResLayer, _Stem
class _ASPP... |
497252b03f3b27fcbeb95e21073f938f301339d5b4b455a5568b282f3adb3ea0 | Python | 2,018 | 50 | import numpy as np
from skimage import __version__ as skimage_version
from skimage import morphology
from typing import List
BASE_CONNECTIVITY: int = 2
SKIMAGE_VERSION: List[int] = list(map(int, skimage_version.split(".")))
def remove_values_from_list(the_list, val):
return [value for value in the_list if value !... |
a4cc201c1e906e22a0f48b88996ce1b2c7627ea05b42982a8644f14275420ca3 | Python | 2,018 | 40 | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 16 16:08:59 2014
@author: crousse
"""
import numpy
class BoardConf(object):
def __init__(self, boardData):
adcFactor = numpy.isnan(boardData['ADCboard'])
self.adcBoard = self._parseBoardItem(boardData['ADCboard'], adcFactor)
self... |
f2bcb55bf75b16b48d22201cc52dd01c37b04a140b4ea0bf1b7d5c34268bd8b4 | Python | 2,021 | 56 | import os
import random
import numpy as np
import torch
from deep_phospho.model_utils.param_config_load import load_config_from_module, load_config_from_json
from deep_phospho.model_utils.script_arg_parser import choose_config_file, overwrite_config_with_args
from deep_phospho.train_pred_utils.rt_pred import pred_rt
... |
a4f5456df7fde57d389226a92fc742bbf1bef825d4877d16494bf121c4ade8ca | Python | 2,034 | 77 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
7388be558f30fac7da73c62514c85a6a9c257165357f4954e2e914a6e74179a0 | Python | 2,040 | 56 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
8d79d806475acae37a1c897d4ac77a6dcc4703394615c2cec882a7bc9d7c07ff | Python | 2,040 | 63 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
91c363df0deb06d6c4e7325194232b69d210fd9a17d34733312caf9e29266636 | Python | 2,040 | 47 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
c83599b7eab2c94c2b7c8d095e5539b6499dafc38f2f15f38f70edffe0f9c2f2 | Python | 2,046 | 45 | import torch
import torch.nn as nn
import torch.nn.functional as F
class AttentionBigDot(nn.Module):
def __init__(self, embeddings_dim=1024, output_dim=11, dropout=0.25, kernel_size=7, conv_dropout: float = 0.25):
super(AttentionBigDot, self).__init__()
self.conv1 = nn.Conv1d(embeddings_dim, embe... |
949e15a7cad984d71ace65f717196787e0d65c3150ff694baf6fcb25088a8ca3 | Python | 2,048 | 63 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
9ae28a6b5d44045cbada12f67423df29629b15c8b1705f167c2e122c565d2ca7 | Python | 2,048 | 56 | import os
import random
import numpy as np
import torch
from deep_phospho.model_utils.param_config_load import load_config_from_module, load_config_from_json
from deep_phospho.model_utils.script_arg_parser import choose_config_file, overwrite_config_with_args
from deep_phospho.train_pred_utils.ion_pred import pred_io... |
a4d266ba36d8819e0ac683fc9a1a2fe289f64bd5dbde689ece8aeb11e1401436 | Python | 2,049 | 56 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
35cb48e55e9734583606651602351ce75941f76baacf5c773b9a4513f396f06e | Python | 2,054 | 52 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
a9307ca0d443ef5110196895d10a84aceb6639028341a4c56015bddb7fba9d09 | Python | 2,059 | 75 | """
An implementation of sparsemax (Martins & Astudillo, 2016). See
https://arxiv.org/pdf/1602.02068 for detailed description.
"""
import torch
from torch.autograd import Function
import torch.nn as nn
def threshold_and_support(z, dim=0):
"""
z: any dimension
dim: dimension along which to apply the spars... |
a123c169be6d905ccadc05d549d16e7cc6d87a5300c0cac09e14ce07d4b20446 | Python | 2,064 | 74 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
352e43b497d35a88f9fbd3e9c0125093cd45deddd6f3f61de82ab8638f2dca7c | Python | 2,069 | 45 | import torch
import torch.nn as nn
class LightAttentionSoftmaxAblation(nn.Module):
def __init__(self, embeddings_dim=1024, output_dim=11, dropout=0.25, kernel_size=9, conv_dropout: float = 0.25):
super(LightAttentionSoftmaxAblation, self).__init__()
self.feature_convolution = nn.Conv1d(embeddings... |
65af7134fc84e6463ccbb4966f42daeff30ef831462546a6e3bb6f90cbb7467a | Python | 2,078 | 70 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
f18f5397be78df906ed1928dee9fdcff9879bd03ff38af199261bea293e12e94 | Python | 2,078 | 85 | # --*-- coding: utf-8 --*--
import csv
from typing import List
import pandas as pd
import rdkit.Chem.AllChem as Chem
def load_sdf_data(sdf_file):
mols = Chem.SDMolSupplier(sdf_file)
mols = [m for m in mols if m is not None]
if len(mols) == 0:
return None
colums = list(mols[0].GetPropsAsDict(... |
653f5bb3f1ece4666fee442b6f23060cb291d57547b2d75b5acc290210031ada | Python | 2,081 | 78 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
608f75fcd8971661f3ca1f6a76f25ac82e8af15b6182406d2565198cf90dc0c6 | Python | 2,087 | 74 | import os
from typing import List
os.environ["CUDA_VISIBLE_DEVICES"] = ""
import torch
from tqdm import tqdm
from fast_jtnn import JTNNVAE, MolTree, Vocab
from fast_jtnn.datautils import tensorize
cpu = torch.device("cpu")
import numpy as np
class FingerprintCalculator:
def __init__(
self,
mo... |
17ddef07698d42d8186fc7a1b81dd05150a632e196a82e3b0f097246f9e18587 | Python | 2,088 | 70 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
53e32245f4e6f43aaa84f5daadd744085f5dd5fdc21e59d29f79bc6b3444c183 | Python | 2,094 | 71 | # MIT License
# Copyright (c) 2020 Vijay Prakash Dwivedi, Chaitanya K. Joshi, Thomas Laurent, Yoshua Bengio, Xavier Bresson
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import confusion_matrix
from sklearn.metrics import f1_score
import numpy as np
def MAE(scores, targets... |
f4487563d0383c82d37d0983525d0776ba09a2ab41597ec5531004a4da17dc2f | Python | 2,096 | 54 | import time
import numpy as np
from matplotlib import pyplot as plt
def plot_events(trace, events_pos, peaks_pos, peak_ampls, half_rises):
plt.ion() # interactive
fig = plt.figure()
ax = fig.add_subplot(111)
x = np.linspace(-(50*0.04), 0.04, 100) # 2 secs
y = x.copy()
y.fi... |
f6976ad3433f33afcdd2c7b5e034f261848a37e59af42340c3f305da3b6bdbe6 | Python | 2,096 | 80 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
9f85b0709960d14e6845a554977c62c8566669835d9c8daa44ef07f99ec72461 | Python | 2,102 | 68 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
e80100c9d03254be6d912538f75dc2a80dfdb2fdf8bc500fb24e8f29347bb8d8 | Python | 2,103 | 76 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
e11f4b7428c2a2c7b2698749d95b1777d6a00e08c30a0cfbb84b4938c5cbe338 | Python | 2,106 | 58 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
1c7c21448b6d80748f5d788dd934998f2f464a8c4dcad8e6e3d0c746888697e0 | Python | 2,109 | 56 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
bb20fb4e66b154678ea29490feca007cfe311d5cc06f9a0381a807c384bcad89 | Python | 2,111 | 56 | import torch
import torch.nn as nn
import torch.nn.functional as F
class MultiConvMaxAvgPool(nn.Module):
def __init__(self, embeddings_dim: int = 1024, output_dim: int = 10, dropout=0.25, conv_dropout: int = 0.25,
kernel_size=7):
super(MultiConvMaxAvgPool, self).__init__()
self.c... |
171b868d53eee0f16f843cf813b8d413f0c73b81ee5598fef4feaaa5c2d34a2c | Python | 2,113 | 80 | from pytestqt.qtbot import QtBot
from cellfinder.napari.detect.detect_containers import (
ClassificationInputs,
DataInputs,
DetectionInputs,
MiscInputs,
)
from cellfinder.napari.detect.thread_worker import Worker
from cellfinder.napari.sample_data import load_sample
def run_worker_test(
qtbot: Qt... |
74e7f408d189a418fed62bd39ba69ea1520043aeff82a79cdd2b47a248d070b5 | Python | 2,116 | 62 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
db0fa30304b16a7abdef7d51e92e5b2304d18a3c1e8e6b25eeb34623f475ba85 | Python | 2,119 | 67 | """Test the fetchers module."""
from pathlib import Path
import pytest
from yasa import fetchers
SMALL_SAMPLE_FILE = "sub-02_hypno_30s.txt"
ALL_SAMPLE_V1_FILES = [
"ECG_8hrs_200Hz.npz",
"EOGs_REM_256Hz.npz",
"N2_spindles_15sec_200Hz.txt",
"N3_no-spindles_30sec_100Hz.txt",
"full_6hrs_100Hz_9chan... |
f061cb2e7f2ff464850f297099e804faf08eb31bb4f8eba301de808acfb7d907 | Python | 2,120 | 66 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
a72339f68613e20e7086e26f77169ae85382be663cccbcc7ad46fbc6864429fa | Python | 2,121 | 103 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
9d1932f0894c01e91643682693c22cb7fae75e5aebd6dc8f8760ad7f66c752d3 | Python | 2,122 | 63 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
1f15854c2bd9009ee8b207ceab6b03b6745ecc5cd5be190bd1b22d21dfdb9a3c | Python | 2,124 | 66 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
a968e8ebdea5b8a31b8b52ed633dda5a1d0267e11132c99af56fa539489757e3 | Python | 2,126 | 74 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from importlib import reload
import h5py as h5
import sys
direc = sys.argv[0].split('scripts')[0]
where = sys.argv[1]
sys.path.append(direc+'support')
import parameters
reload(parameters)
import parameters as par
import functions
reload(functions)
im... |
d885152652c6c0f6ab1fa1a51f3ceaba817fd3334207b1f24188b321863327e8 | Python | 2,126 | 78 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
5e9841083e22a1f66a1ce68e096fc2ef8fa3a8a81c698391c96e538a29f71a4c | Python | 2,130 | 54 | import pandas
from sklearn import preprocessing
import numpy as np
#Class Description: To read and scale data
class DataOperations:
#Description: To read file
#Parameters: filePath = path of file to read, sep = separator used, indexCol = column of file to be index
#Returns: pandas DataFrame
def readD... |
51e4bf57a47a0c03f204e62b12ad476779ef63c35d7feeab70c4e27e62502924 | Python | 2,131 | 78 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
70a95021cacf46f375daec879ae9efbb73ea96c2045aa696bc4057ad7d84b39b | Python | 2,132 | 58 | import pandas as pd
def correct_last(df:'DataFrame',strand) -> 'DataFrame':
"""Takes in dataframe returns a corrected blocksizes column with respect to
corresponding CPAS-diff value . CPAS-diff is the difference between most abundant
CPAS in TU and this read's CPAS value
"""
new_blocksizes = []
if strand == "-... |
3e25008c560d7acb8ad464621d72634359cf46fe915b09eee1147016ba7718b4 | Python | 2,133 | 67 | from matplotlib import pyplot as plt
def bar_anno(anno_text, x_pos, y_height=None, y_bottom=0,
thousand_separ=True, add_percent=False, denominator=None,
ha='center', va='center',
rotation=90, fontsize=8,
ax=None):
if ax is None:
ax = plt.gca()
if th... |
e3c078e39f8285d8f0fec5602cf926b65e291ca477148b9beeea58a033e66e33 | Python | 2,134 | 55 | import warnings
from rotation_analysis.analysis.cell import Cell
from rotation_analysis.analysis.probe.probe_block import ProbeBlock
from probez.spike_handling import cluster
class ProbeCell(Cell, cluster.Cluster): #TODO: dirty multi-inheritance, probably not a good long term strategy
CLUSTER_TYPES = ... |
90ed0a0eb3afd2b1fc618819fd3e93c50dda5b2f968cf5274134b96eed77d3bc | Python | 2,137 | 56 | import os
import numpy as np
from sklearn.metrics import matthews_corrcoef
from sklearn.neighbors import KNeighborsClassifier
from torch.utils.data import DataLoader, Subset
from datasets.embeddings_localization_dataset import EmbeddingsLocalizationDataset
from torchvision.transforms import transforms
from datasets.... |
50553d3c020f66ce7b53ed07ac6e76ea23b47929fb5f0951179bebdaf41e19d2 | Python | 2,139 | 102 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
0430d33e427bb5f7748aaafe45e72a3ac6de4e7e27f8081af35b8479cf24d187 | Python | 2,144 | 97 | # -*- coding: utf-8 -*-
# @Author: Weiyue Ji
# @Date: 2020-03-27 15:06:33
# @Last Modified by: Weiyue Ji
# @Last Modified time: 2021-06-06 17:44:19
import os
global paths, analysis_params_general, matching_info
def get_unique_filename(prefix, filename):
name = filename.split('.')[0]
filetype = '.'+... |
31b74b85441af399e044db5b6ce0228a90034894562d48804632103811412472 | Python | 2,145 | 55 | # @license
# Copyright 2020 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
545ff179eb4c35cb8a2afeddf180cdb53c0635af69166b3d8216de1b9778e4c4 | Python | 2,151 | 58 | #!/usr/bin/env python
"""Command line utility to inspect SAFE files."""
import sys
import argparse
import s2reader
import pprint
def main(args=None):
"""Print metadata as JSON strings."""
args = sys.argv[1:]
parser = argparse.ArgumentParser()
parser.add_argument("safe_file", type=str, nargs='+')
... |
40ec2199887919a49dde7434517924a794466cd5635538b507aa3620131819cb | Python | 2,157 | 59 | import logging
import os
import random
import numpy as np
import torch
from deep_phospho.model_utils.param_config_load import load_config_from_module, load_config_from_json
from deep_phospho.model_utils.script_arg_parser import choose_config_file, overwrite_config_with_args
from deep_phospho.train_pred_utils.ion_trai... |
55111122302512ba9d24729d09e53f73e91294db7939c74185dd7c7b6530219c | Python | 2,158 | 62 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
50bc8a6c1de9477e537a0b4e138d648aec24b6153bd74a6b6f197e1f3cd0216c | Python | 2,159 | 69 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
10fb3f36e1db1e39c56e7582bb95f952b5a2529122c409ba8751046db29af60c | Python | 2,160 | 81 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
777cafa2cba543e55ecc4f29aec5ab2e6d58072df7e52d27d3c6a7bd2a6d484f | Python | 2,162 | 57 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
1825f425e9d595a7e761b4fec38e9573be9ad4379a9a44f35a6a7385664b21cf | Python | 2,165 | 72 | import pyliftover
import logging
def coordinate_format(format, chromosome, position, ref_allele, alt_allele):
return format.format(chromosome, position, ref_allele, alt_allele)
def map_on_the_fly(mapping, format, chromosome, position, ref_allele, alt_allele):
r = None
v = format.format(chromosome, positio... |
6fb199eebfe8d32139011374628080186141dafd036bfc31a5d9df3af1b5a0b8 | Python | 2,175 | 66 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
14c034dcd5ea0cbf107ddde41457f8c9c4b24a81f80358d0adf2f2e3f4c55161 | Python | 2,183 | 76 | import json
import gzip
class ImageArray:
def __init__(self, raw_line):
raw_line=raw_line.split("\t")
raw_name=raw_line[0].split(":")
self.name=raw_name[0]+":"+raw_name[1]
pos=raw_name[1].split("-")
self.intron_name="{}:{}-{}".format(raw_name[0],int(pos[0])+15,int(pos[1])-15... |
436df7ef0f8151a9f72ef4cc0b560b5ab18c2153622aca26e4ae488337230ab0 | Python | 2,186 | 57 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
d71589ea0b5bcbb2035cf5c4311f8f6f978fe4b5afbbebb088064f9348133a39 | Python | 2,186 | 72 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
0e501cc18cf901b4ca3c3a898847126e50dac7cecaaf99bceb916749844fbb01 | Python | 2,190 | 61 | import os
import sys
if sys.platform.startswith('linux'):
from OpenGL import GL
from PyQt5.QtQml import QQmlApplicationEngine
from PyQt5.QtWidgets import QApplication
from analysis.probe.gui.backend_classes import PythonBackendClass1, Logger
from analysis.probe.gui.image_providers import PyplotImagePro... |
c127927ec3a713f01f625737da12593c63f9186bd39845c90169895b2701e1bc | Python | 2,194 | 71 | # -*- coding: utf-8 -*-
"""
Created on Sat May 22 00:39:09 2021
@author: whong
"""
import pathlib
import tensorflow as tf
import numpy as np
import tqdm
np.set_printoptions(threshold=5)
def AISdata_train():
print ("1")
data_root=r"/content/AISda... |
65d713c8e90f70dd78fd8d997696a7e8a33c4182e82d40aa0a5f30a268c8c5e0 | Python | 2,200 | 63 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
7715f9a7ade7623046e249a47739ecca35c0783b03e4a751b69922b9fcdd4f26 | Python | 2,205 | 60 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
f3230c31fba69c09b8f16ca26f06640c628f89c80cb71ce1c90f5f83b1878628 | Python | 2,205 | 76 | import torch
import torch.nn.functional as F
from torch.autograd import Variable
# GPU memory seems to get exhausted no matter what so we'll just use the CPU
use_cuda = False
def create_var(tensor, requires_grad=None):
if requires_grad is None:
t = Variable(tensor)
return t.cuda() if use_cuda els... |
e6935999042dc15bbcab196c02c732dc9b69045011b0182f8d5bb5c888d7a2ca | Python | 2,207 | 78 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... |
29458875c59238b9f8869a9951af778422726fcb02dc64f5695609b3369176f5 | Python | 2,211 | 86 | from pathlib import Path
import pooch
import torch
from torch.profiler import ProfilerActivity, profile
from torch.utils.benchmark import Compare, Timer
from cellfinder.core.tools.IO import fetch_pooch_directory
def get_test_data_path(path):
"""
Create a test data registry for BrainGlobe.
Returns:
... |
4c725b816262035d64c9bd15a923451418ae9623754bd64ec5469a34bddab486 | Python | 2,215 | 54 | # coding=utf-8
# Copyright 2026 The Edward2 Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
b1017a4c659bf83b40d5ca16ed48cca80602215556f227116cf7e1478f415036 | Python | 2,219 | 47 | import tensorflow as tf
import numpy as np
from ..utils.tf_utils import optimizer_fun, activation_fun
def RPN(feat_map, num_refanchors):
"""Compile a region proposal network
With reference to https://github.com/endernewton/tf-faster-rcnn/blob/master/lib/nets/network.py
and https://github.com/tryolabs... |
fa2a224b9692dfee3e059a43459ece227029c71c270b723703c0df28107fc441 | Python | 2,222 | 71 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
e7637693d46eef2ca8fdb25429631af31ef8c40b4db1ee5eab7cc450eee10ccf | Python | 2,223 | 61 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
2160a603f4bf875dc5b8e49306689361421c9283e14e6fb6cad28daddd60791e | Python | 2,234 | 62 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.