sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7eb5056ddc04e9e1adfbb68c1e98d7063a211ce33be43dc9aacd145ecd19d238
Python
2,237
47
# Created by woochanghwang at 08/07/2021 import pandas as pd from toolbox.data_handler import save_obj, load_obj import networkx as nx def id_mapping(protein, mapping_dict): return mapping_dict[protein] def save_graph(threshold): # threshold = 700 human_interaction_df = load_obj(f"/Users/woochanghwang/Py...
cd1b721f37e8fec8484516ae9305387b3c1f6575b5ff7beb8d0189fbfa3e3e61
Python
2,241
61
import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches import matplotlib import h5py as h5 from importlib import reload 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 ...
fda55301803182e396ecff687306338f7045586f35de11427296b7cbfd0e5609
Python
2,243
67
import cv2 import numpy as np from functools import partial """ Adapted from https://www.life2coding.com/crop-image-using-mouse-click-movement-python/""" cropping = False x_start, y_start, x_end, y_end = 0, 0, 0, 0 def mouse_crop(ori_image, event, x, y, flags, param): # grab references to the global variables...
8f4d48c616e2a3ffec0667c52068234bb4eb4e4e64a38f591057007e82c66fb4
Python
2,245
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...
67b62809bb90dd11ca9b5e3631bcd316fb671a7a351cef50860fb23d6e57b774
Python
2,247
46
import torch import torch.nn as nn class LightAttentionMaxAblation(nn.Module): def __init__(self, embeddings_dim=1024, output_dim=11, dropout=0.25, kernel_size=9, conv_dropout: float = 0.25): super(LightAttentionMaxAblation, self).__init__() self.feature_convolution = nn.Conv1d(embeddings_dim, em...
692e89f768bb3b3d39ab4ac9d7d0f651e4210e71855a68a1d4bd80a5ae33f371
Python
2,248
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...
c7da9370ad297af3c14cb887b84921d6438c990e35a62f49b0f9381db376d693
Python
2,249
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...
e35f5f9ca9620f1643c3027a98e7fdc9ba1a5f601c3ecc94637ae090e6736645
Python
2,251
67
""" Misc classes """ import torch import torch.nn as nn from numpy.core.multiarray import ndarray from graph_embedding import get_emb class LayerNorm(nn.Module): """ Layer Normalization class """ def __init__(self, features, eps=1e-6): super(LayerNorm, self).__init__() self.a_2 =...
b9ae3829a6b282a2704db253b09cd6836d99a8366ebe525b3327c73036d5eb63
Python
2,255
79
# 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...
1f833d474531f8da4ced93a1e934b34e093ecfab2223c1105f0a8eb27c3ef302
Python
2,256
58
# @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...
4880603a7e2fc5564c434d4931dbb46a2e6044c6ee77b5cc20114b89b60334f2
Python
2,260
51
# @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...
c0358ba29ba7573b4c7524982ab46e472922acadc80c3a6fd4f76d799d72189a
Python
2,265
65
from deep_phospho.proteomics_utils.drawing_area.ax_utls import set_thousand_separate from matplotlib import pyplot as plt import numpy as np def pcc_hist(pcc_list, bin_num=18, bin_color='#696969', bin_alpha=0.75, median_line=True, median_color='#009ACD', median_width=3, percent...
c653ff3f388d1b200401842c3577957a1423048a0af3f3a022aac0bee7fb8549
Python
2,266
60
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.rt_train...
3361c9762e9b1cafd37866dd8c52975422612ee94cd81f3af40d19c59732abc0
Python
2,269
77
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Runs abagen processing pipeline using specific parameters """ import argparse from pathlib import Path import time import numpy as np import pandas as pd import abagen from vibecheck import abautils DATA_DIR = Path('./data/derivatives').resolve() def gen_expressio...
38287c5078014f43d076702a4e23bde93ea04222d89a3490a90dab5734707c7b
Python
2,269
72
from .sn_constant import * import re from deep_phospho.proteomics_utils import rapid_kit class ModProcess(object): @staticmethod def add_mod(pep: str, mod_type=None): """ Add fixed modification 'C[Carbamidomethyl (C)]' Variable modificaion: only M[Oxidation (M)] is supported now, onl...
8de37aa8cf3f04382ab8f23500ce5d252417557355347db8db0e47b3d33108af
Python
2,269
80
from __future__ import division import torch class PenaltyBuilder(object): """ Returns the Length and Coverage Penalty function for Beam Search. Args: length_pen (str): option name of length pen cov_pen (str): option name of cov pen """ def __init__(self, cov_pen, length_pen): ...
19f612f920e02f776175c1e75e3eb01546074de4b79b6523ba6e63454b57dfee
Python
2,270
53
import torch import torch.nn as nn import torch.nn.functional as F class ConvMaxAvgPoolMiddleConcat(nn.Module): def __init__(self, embeddings_dim: int = 1024, output_dim: int = 10, dropout: float = 0.25, kernel_size: int = 7, conv_dropout: float = 0.25): super(ConvMaxAvgPoolMiddleConcat, ...
4fe971f281244c8832b6e0ddf2d836a535793c922159afcb34025d2e46214b53
Python
2,273
53
from scipy.signal import butter, lfilter, filtfilt, periodogram import analyzeMEA.read_rhd_controller as read_rhd_controller import numpy as np def extractLFPs(rhdFile,filterFreq=250,sampleRate=20000,downSample=10,stimChannel=1): """ Extract LFPs from RHDfiles Input: rhdFile - string, filename fo...
1cf3fea0d110a01841b84ca410ee041d0b2486a5324d1d49f5047aa983ab1256
Python
2,274
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...
8afc4ca74c1e44790acc83be670947a448c9c1a6141bef4b49299cbc2f56429e
Python
2,277
75
# 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...
1693361c96595ae7b2b641d626071e808b8fd55d724a39fa2c562880f13d8030
Python
2,278
79
import os from pathlib import Path from typing import Literal import pooch from cellfinder import DEFAULT_CELLFINDER_DIRECTORY DEFAULT_DOWNLOAD_DIRECTORY = DEFAULT_CELLFINDER_DIRECTORY / "models" MODEL_URL = "https://gin.swc.ucl.ac.uk/brainglobe/cellfinder/raw/main/models" HF_1CH_URL = "https://huggingface.co/brai...
d53f12d2ba6bf684e008a18fe867d03b56033dd749e444466d102ae51321d17e
Python
2,283
73
# 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...
4b676f22d56984a59cbd0b890aba08c116061a9cf4897ef48471ed88d925469b
Python
2,284
84
#!/usr/bin/env python import os, sys, re usage = "usage: {} longest_orfs.cds.scores longest_orfs.cds cds.gff.scored\n\n".format(sys.argv[0]) if len(sys.argv) < 4: sys.stderr.write(usage) sys.exit(1) def main(): cds_scores_file = sys.argv[1] cds_fasta = sys.argv[2] scored_orfs_file = sys.argv[...
71e9a683e522b9f8352447403d18ca1e4900985d229852ac70649fc4425b54cf
Python
2,291
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...
1c2a4c684e04eb9e71f3a43dc7196e684234d6e8365366390ad5f6ef86eeacd5
Python
2,302
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...
71961a250df91ad3f00d55814f042d7cf8886c3b15335cad7275461e05241af2
Python
2,304
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...
fd6a0f96bf1b123198aba4bb95d701c21306023279720c1825a13723068bcd3b
Python
2,308
73
from importlib import reload import numpy as np 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) import functions as f import nest # Create data fil...
d6905ce246789a958f7accb6d0dee6f0a12b90919b9f39ec2d9313d376a8fed0
Python
2,311
55
# 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...
b8c63193b25bde69bfdb83243b47243340af0cb71d45c94781511a9e43c6c4f8
Python
2,313
54
# @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...
b94e029ffb0570102062f0bfc6b0c957c2243d0a18557b0181b1195aedba86fa
Python
2,315
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...
12ebf16831d76e11d64ded94a2a323470ec8df6c7a4b7aeb223e5ce4d0c2e932
Python
2,316
72
import pandas as pd import numpy as np import logging from spikey.io.spikesort import ks_phy_load from spikey.curate.curate import get_good_spikes from opendirection.tools.io import load_sync_parameters def get_spikes( spike_time_file, spike_clusters_file, cluster_groups_file, sync_param_file, nu...
a5738fe63482540b42751c79d114325e9fb11174b9f1319afaf6e2c90de21a50
Python
2,323
45
from SurvivalClustering.CentroidOperations import CentroidOperations import tensorflow as tf import numpy as np from SurvivalClustering.CustomLosses import CustomLosses from sklearn import metrics import pandas #Class Description: Contains custom callback implementation for on_epoch_end method, a callback used with cl...
83999314b4f8aab4bb021ab813ca73704451fed2d14cb081ad18dff0ce0fca80
Python
2,325
70
from ANNarchy import * setup(dt=1.0,seed=101) import matplotlib as mp mp.use('Agg') import numpy as np import os import scipy.io as sio from net import * def preprocessData(matData): # function to split the prewhitened images into on and off counterparts images = matData['IMAGES'] w,h,n_images = np.shape(...
50489b97f6a015644075392c5cca04f9acacd285be367603ef4824f7b59b4e61
Python
2,326
73
# 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...
46dfdfbfc329ac3401a20a9080c854f63c2167976a4f1d581c04a1c903a2d9a9
Python
2,333
82
# 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...
78e3ca19ceea91a32b6cb9b395ba10f30cb778c0541c3a1957448a75c9e80d69
Python
2,340
68
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Generates CSVs containing all combinations of processing parameters to test """ import itertools from pathlib import Path import uuid import pandas as pd DATA_DIR = Path('./data/derivatives').resolve() # generate giant list of lists of dict with different parameter ...
b5c567bd6eda874078e3f4d025a96159dc082558e8c072be726b696677c5da9b
Python
2,341
70
import matplotlib.pyplot as plt import numpy as np import PIL.Image import tensorflow as tf from tf_keras_vis.activation_maximization import ActivationMaximization from tf_keras_vis.gradcam import GradcamPlusPlus from tf_keras_vis.utils import normalize from tf_keras_vis.utils.callbacks import Print preproc...
304f189e62b5d4e8fd870ae46b9971399bdca94be09e0b0242e9313255972a16
Python
2,342
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...
958d2b28343579fe9e95597f129bdc96ffdc88ca38e0fa733fa6479360187fb7
Python
2,343
73
# 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...
76552a9745f4e4f19991c98cf9be4dfa06f466d1c4f95baa492671cfd84ca8e5
Python
2,344
62
# MIT License # Copyright (c) 2020 Vijay Prakash Dwivedi, Chaitanya K. Joshi, Thomas Laurent, Yoshua Bengio, Xavier Bresson """ Utility functions for training one epoch and evaluating one epoch """ import torch import torch.nn as nn import math from .metrics import MAE def train_epoch(model, optimizer, dev...
c6de69dca5775994806b17723d08b1474a9548b0feb5e099e0696476eddbd9b7
Python
2,345
81
# 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...
12fec16c7d85d875a9c94b1ab77a389bebe9995fbe61c9600a6116651854502a
Python
2,355
69
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 3 10:48:02 2018 @author: Frank Kane """ from surprise.model_selection import train_test_split from surprise import KNNBaseline class EvaluationData: """ Split the hotels dataset in training/testing set and build a KNN Ev...
e22e5ef37387535132860852328f511ccfcdf76569c1c68c80b0259e8b07dfd9
Python
2,359
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...
83ffaa4b810976c7aeb4010c98d08921aa23fb4cd6c133ff1a2a9b92fce634a3
Python
2,365
75
# -*- coding: utf-8 -*- """ ************** The GUI module ************** Creates the graphical interface .. note:: This module depends on importing OpenGL.GL although it doesn't uses it directly but it is used by the Qt interface. :author: crousse """ import os import sys # WARNING: Hack ...
2977cb2e4136c646dbf55c4634913df622e0f164a203e9f6ac0ff25dcfa4d7cf
Python
2,366
62
# MIT License # Copyright (c) 2020 Vijay Prakash Dwivedi, Chaitanya K. Joshi, Thomas Laurent, Yoshua Bengio, Xavier Bresson """ Utility functions for training one epoch and evaluating one epoch """ import torch import torch.nn as nn import math from .metrics import accuracy_MNIST_CIFAR as accuracy def trai...
c2bd40f56fa035c784df275137a593f987cf62a6ab3764622097c32a5baf8b0d
Python
2,369
61
import torch import torch.nn as nn import torch.nn.functional as F class ConvsAttendConcat(nn.Module): def __init__(self, embeddings_dim: int = 1024, output_dim: int = 12 , dropout=0.25): super(ConvsAttendConcat, self).__init__() self.conv1 = nn.Conv1d(embeddings_dim, 512, 21, stride=1, padding=1...
94e944c28152760eda73378e84703070a1065093e2eefd080d58c8c1db312d7c
Python
2,371
67
# 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...
37ea93cbff9acc7334b99a37c7a851c3508c68d8d15748c6ad1bcbcd84c8e33f
Python
2,373
76
from __future__ import print_function import argparse import numpy as np import neuroglancer import neuroglancer.cli voxel_size = np.array([10, 10, 10]) shape = (100, 100, 100) segmentation = np.arange(np.prod(shape), dtype=np.uint32).reshape(shape) class SkeletonSource(neuroglancer.skeleton.SkeletonSource): ...
3b887a45c887157c54573b8bb66f2a7913db1763272f5a1ea2d831c05c11d6fc
Python
2,373
73
# 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...
2a68e33a7c57e2ca973e2d7972cf8160df2fac3afe5dcd397374e4b0d560271c
Python
2,378
73
# 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...
5fe23c16024520d035859b55f161bad7c8d0e1c6020e7c9c4e5760e03c733662
Python
2,385
87
# 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...
c396ad1e976e6486ae5e62178c271dd8704b38db5802a6229578b69ccf36832d
Python
2,393
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...
e1f67cb1957bd1e771bc18821501bf920b0220866e29d16785b58824753dff64
Python
2,397
81
# 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...
fe88f3def18c670d347c3311527c12c7b8737c611dd152905b5a1f4b3964714e
Python
2,399
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...
026082abaa2160352b765ac0ed7148113480a82ecbb3fd3690c117650aaadbf2
Python
2,406
69
# 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...
99cefe9ccfdaff33c98fa8388b6adadb07be8adc311e509e11c38b1fae4b74ed
Python
2,407
82
#!/usr/bin/python # -*- coding: utf-8 -*- from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * import os import sys from functools import partial import xml.etree.ElementTree as ET import lxml.etree as lxmlET import yaml from .frame_range_dlg_ui import * # import frame_range_dlg_ui ...
1c001e32715c215c7f48d59e8c9142b45635edfb385759a41d2a646a23bebdda
Python
2,408
66
import pandas as pd import logging def tidy_behaviour(df): df_new = pd.DataFrame() df_new["time"] = df.time df_new["Back_x"] = df.Back_x df_new["Back_y"] = df.Back_y df_new["total_speed"] = df.total_speed df_new["absolute_head_angle"] = df.absolute_head_angle df_new["head_velocity"] = df.B...
569bc14d72edde6bb3152e48d1edff7dbdb25de47a4866457abe2410e4075cd0
Python
2,413
76
from __future__ import print_function import numpy as np from skimage import io from tqdm import tqdm import argparse import os from config import palette, invert_palette def convert_to_color(arr_2d, palette=palette): """ grayscale labels to RGB-color encoding """ arr_3d = np.zeros((arr_2d.shape[0], arr_2d.sh...
dff82bc217b0191a74fd08f75db18f1a361361258f48b9b8f327e601b3cac88d
Python
2,425
83
class ElementMass: Mono = { 'C': 12., 'H': 1.0078250321, 'O': 15.9949146221, 'N': 14.0030740052, 'P': 30.97376151, 'S': 31.97207069, 'Na': 22.98976967, 'Cl': 34.96885271, 'Ca': 39.9625912, 'Fe': 55.9349421, 'Cu': 62.9296011, ...
3e084ffd0deaf8d372f8204f30d133eff06373c60e5e819f664356800a607860
Python
2,429
84
# 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...
f92714e7c6be26ee9387da1b988eb64a916b53c5cb9c194fe0b9ef4193a8b178
Python
2,435
43
import tensorflow as tf #Class Description: Custom keras losses class CustomLosses: groupAssignments = None groupCentroids = None #Description: Reconstruction loss #Parameters: y_true = true data, y_pred = predicted data #Returns: loss def reconstruction(y_true, y_pred): mse = tf...
94811f7e6a95d36f4de81fdd9ca3036a60f2a4c86f8ed6206b70400d6ba9e19a
Python
2,436
50
import torch import torch.nn as nn import torch.nn.functional as F class LightAttentionNonLin(nn.Module): def __init__(self, embeddings_dim=1024, output_dim=11, dropout=0.25, kernel_size=9, conv_dropout: float = 0.25): super(LightAttentionNonLin, self).__init__() self.feature_convolution = nn.Con...
5af1333ebeeffa884b0e7cdfe27d774cc70de4e60801738491a4a6ac7cdd9f07
Python
2,438
92
from pathlib import Path import keras from brainglobe_utils.general.exceptions import CommandLineInputError def get_subdirectories(directory, names_only=False): """ Return all subdirectories in a given directory :param directory: :param names_only: If true, dont return paths, but the names :retur...
2133e4a8a66258cd517a948a1fd6e4abcf38ca626e8a29aa54377c12a64d64a4
Python
2,442
62
import pandas as pd import re import pandas as pd import warnings warnings.filterwarnings("ignore") def get_softclipping_TES(s): res = [re.findall(r'(\w+?)(\d+)', s)[0] ][0] if res[0] == 'S': return int(res[-1][::-1]) else: return 0 def get_cigar_vals(df,strand): """Returns se...
6d16d769bab8110d729368419069d385d1a7f3dd0609f1630d704123773eeae5
Python
2,442
81
# 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...
b9fe6e3cf7683dd34eec1851855c314ff0966210804b841d6a92d18f83b24ab3
Python
2,445
62
# Before executing the script, we need selenium. Run `pip install urllib3` import shutil import zipfile import os import sys import requests from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_...
c6c4d82ba775ece11eab9689417eb8721f681d06329bb5b7147d76e05a42d30f
Python
2,445
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...
958b4753eb4f33b9270614679c851f771cf65f53a2bdad5edf9930530fbb94db
Python
2,447
84
# 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...
f8790fb92b04dd9ade5877e5360011a79de0f4520c64fc3ba54858ab736479a3
Python
2,447
73
# 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...
38481d94fe84dd609cb5349745debec0219d4a5eb402c5e7b524994f30fd2236
Python
2,450
59
""" Fit torus graph to auditory phase data using pyTG. """ # %% Imports import numpy as np from tqdm import tqdm import os.path root_path = '/'.join(os.path.abspath(__file__).split('/')[:-1]) from pyTG import torusGraphs from scipy.io import loadmat, savemat # indicate whether to refit model/redo bootstrap if resul...
d2598eb556112a39a02cc0d3c8eb67e4fa8b6be40c14089c032f45284bbd9da8
Python
2,453
65
import numpy as np def load_ratio(green_path): header, greens, reds = load_green_red(green_path) cells_ratios = greens[:, :, 0] / reds[:, :, 0] return cells_ratios def load_green_red(green_path): red_path = green_path[:-5] + "2.csv" header, greens = load_fluo_profiles(green_path) ...
5404690c260fddcc8aedc4a734bc8fa56fe1a235209eb216a521bcccb1b9486e
Python
2,455
95
import re import sys import time from pathlib import Path import black import click import nbformat import notedown from nbclient import NotebookClient from jinja2 import Environment env = Environment() def run_notebook(text, kernel_name, timeout, execute) -> str: # We add two blank lines at the end to ensure ...
a041d099a2e2e4c8d629905df2b6b4ebc1d8df55082ce5c49a000e87190d4676
Python
2,456
71
import os from Bio import SeqIO import pandas as pd import matplotlib.pyplot as plt from utils.general import LOCALIZATION, LOCALIZATION_abbrev import seaborn as sn from utils.preprocess import remove_duplicates sn.set_style('darkgrid') fasta_path = '../data/fasta_files/new_hard_set.fasta' fasta_path = '../data/fas...
97d0f62afb81ac9e3dfc13d968206a65dcbb4dd9313e06c12477365cf87f6c9b
Python
2,459
53
import torch import torch.nn as nn import torch.nn.functional as F class MultipleAtt(nn.Module): def __init__(self, embeddings_dim=1024, output_dim=11, dropout=0.25, kernel_size=7, conv_dropout: float = 0.25): super(MultipleAtt, self).__init__() self.conv1 = nn.Conv1d(embeddings_dim, embeddings_d...
93e7de5c8e22fe6959e9c848459225dabf5cd2938dcbcd99de36135abef272dc
Python
2,470
91
# 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...
b45b506001e744d218fa09661a59602d80635c886ff95c52ceb8071c79132fc0
Python
2,472
76
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Runs three analyses on outputs of abagen pipelines """ import argparse from pathlib import Path import time import numpy as np import pandas as pd from vibecheck import abautils, analysis RAW_DIR = Path('./data/raw').resolve() DATA_DIR = Path('./data/derivatives').r...
19ba3625ca388c106b027f7b4ca66b9ec266928c8eea0b300b1e2baf9433c1d2
Python
2,474
63
import numpy as np # create 2D Gabor def makeGaborMatrix(xPos,yPos,amplitude,theta,sigmaX,sigmaY,k,phi,x_c,y_c,offset,patchsize): #xPos = index/12 #yPos = index - 12*xPos xPos = (xPos - x_c) / np.float(patchsize) yPos = (yPos - y_c) / np.float(patchsize) xp = xPos*np.cos(theta)+yPos*np.sin(thet...
486330a02bd59ca3ea8d529f48462ed0c4339c07ca125088f107f6cf4598c16a
Python
2,490
86
# 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...
98b5223e4e8b3428f681bbe3c17e4fc13fdede1f5575f491c19ac48c7d2bdc77
Python
2,492
96
# 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...
d66370553324862eb242852bb862c46ee607a8095ce50a6762e7eae8b66fec05
Python
2,492
110
# 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...
d50e51f4a5224b3a9909884cd5d25e6f6f29f6b81b6a6080e17f12e916555636
Python
2,499
82
#!/usr/bin/env python # coding: utf-8 """ This file is part of BrainMolecularAtlas. This module provide helper functions Copyright (c) 2021-2022 Blue Brain Project/EPFL 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 Fre...
5ca9de3b9d3c1ff3d804cacc9e904ccf9d8420aae73fe46a943c825677d76ad9
Python
2,504
72
# 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...
1b75932f6b55e55004c73d4c056c11c6adee734a185ea406892152f21b975eed
Python
2,506
64
import numpy as np import matplotlib.pyplot as plt # create 2D Gabor def makeGaborMatrix(xPos,yPos,amplitude,theta,sigmaX,sigmaY,k,phi,x_c,y_c,offset,patchsize): #xPos = index/12 #yPos = index - 12*xPos xPos = (xPos - x_c) / np.float(patchsize) yPos = (yPos - y_c) / np.float(patchsize) xp = xPo...
451e665b56ca3893c08ce860f1379a7e9dca5967d8969c4ecc38ce0eca79d943
Python
2,509
67
# 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...
90dee22ed65563f0cd60fcc7485b8326f7753a5f9f4a4c604f223d49d94169dc
Python
2,510
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...
dfdd9c4abac94c74714dd2d507e760d16ca89481424e0cac4a007937c5bc4ca0
Python
2,510
54
import torch import torch.nn as nn import torch.nn.functional as F class LogSoftmax(nn.Module): def __init__(self, embeddings_dim=1024, output_dim=11, dropout=0.25, kernel_size=7, conv_dropout: float = 0.25): super(LogSoftmax, self).__init__() self.conv1 = nn.Conv1d(embeddings_dim, embeddings_dim...
74f2481e056e726621828a59c7a510ab96d5be83ffd27a4b653ac4a79f4804b0
Python
2,512
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...
5a2e97bf324ed4e84abd523209868fbd292ae0a21a4cf71076bfd372e3605a44
Python
2,516
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...
b42e14d79cffd71f5c1cf0ffa075fa121e78f2734047432b8105bdc32ee28efc
Python
2,522
57
from __future__ import print_function import argparse import numpy as np import neuroglancer import neuroglancer.cli from example import add_example_layers def _make_viewport_adjust_command(adjustments): def handler(s): with viewer.txn() as s: for i, amount in adjustments: s...
b42f458ebb4561fb31b420541e174fd4acfb15951a6233e7b89bf3f66df2e221
Python
2,524
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...
e3a9875a3512acd8f1cfb5a9bd25d447543e96f55ffa2851b5f00f449ee51bb7
Python
2,525
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...
e1c45274fb051ac1ec3077da64a487186725f025dfcd6e8a8ee4de78176de11f
Python
2,528
82
# Created by woochanghwang at 17/07/2021 import pandas as pd import toolbox.data_handler as dh import networkx as nx import matplotlib.pyplot as plt import seaborn as sns from venn import venn def draw_venn_diagram(): virus_list = ['SARS-CoV', 'SARS-CoV-2'] ####################### # CoV , DIP vs DEP ...
f29afd4dfa0a159af625de98faca4afa1c7a173a5a4dbd2d66717e593f72fe85
Python
2,528
88
# 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...
a32c1c12aeaf4e1a65ab2ac4215f84e904434ed1d11de0e4651df81ba9c0582d
Python
2,534
52
import torch import torch.nn as nn class LightAttention(nn.Module): def __init__(self, embeddings_dim=1024, output_dim=11, dropout=0.25, kernel_size=9, conv_dropout: float = 0.25): super(LightAttention, self).__init__() self.feature_convolution = nn.Conv1d(embeddings_dim, embeddings_dim, kernel_s...
4495b020542beec99ce8291a6afc2abb5b85b2452ea1a9208633253c3616440e
Python
2,537
87
# 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...
e5dcfebe36070d9262874fc30049ba54241b28dcccd55a45a2db0d0067c6aced
Python
2,540
55
import torch import torch.nn as nn import torch.nn.functional as F from sparsemax import Sparsemax class SparseSoftMax(nn.Module): def __init__(self, embeddings_dim=1024, output_dim=11, dropout=0.25, kernel_size=7, conv_dropout: float = 0.25): super(SparseSoftMax, self).__init__() self.conv1 = nn...
f8f454c975792808419e4cf6b50a978d0ce6aa58f7c61b578f775e87a1218a2f
Python
2,543
56
import torch import torch.nn as nn import torch.nn.functional as F class LSTMConvs(nn.Module): def __init__(self, embeddings_dim: int, output_dim, lstm_hidden_dim, n_layers, dropout): super(LSTMConvs, self).__init__() self.conv1 = nn.Conv1d(embeddings_dim, embeddings_dim, 21, stride=1, padding=21 ...
65b3c541f76e1943278f05b841051227fa8385432d22cd046e92f098c7addaef
Python
2,546
60
import torch import torch.nn as nn import torch.nn.functional as F class ConvMaxAvgPoolLateConcat(nn.Module): def __init__(self, embeddings_dim: int = 1024, output_dim: int = 10, dropout: float = 0.25, kernel_size: int = 7, conv_dropout: float = 0.25): super(ConvMaxAvgPoolLateConcat, self...
8f5e318ec10b25971578133ca768628cb9b1a9c6fb0adb2e955280a6ddf3d14b
Python
2,549
55
import torch import torch.nn as nn from sparsemax import Sparsemax import torch.nn.functional as F class LogSparsemax(nn.Module): def __init__(self, embeddings_dim=1024, output_dim=11, dropout=0.25, kernel_size=7, conv_dropout: float = 0.25): super(LogSparsemax, self).__init__() self.conv1 = nn.C...
2e97dac6466f01c6ab52d93729414552334021c391ec76117e6f66bc3cb3ea35
Python
2,555
53
import os import pandas as pd from sklearn.metrics import matthews_corrcoef deep_loc_results_dfs = [] path = '../data/results/deeploc_hard_set' for filename in os.listdir(path): if filename.endswith(".csv"): csv = pd.read_csv(os.path.join(path, filename)) deep_loc_results_dfs.append(csv) results =...