sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a1095997bea941d1180906b7afa4a04d7057a56583ef14797458ca261079c138
Python
13,629
295
""" This file evaluate the testing dataset for the SPLAM model. Parameters: MODEL_VERSION : the version of the model. Input directory : "./INPUTS/"+SEQ_LEN+"bp/input_pos/" Output directory: "../src_tools_evaluation/splam_result/"+MODEL_VERSION+"/" """ import os, sys sys.path.append(os.path.dirname(os.p...
c3c57b6c25a0d42517e4ad49687ad1f2d7d06922bdcc6f587c50fedf37f1c33b
Python
13,630
435
import os import pandas as pd import datetime import numpy as np from joblib import Parallel, delayed import torch from torch import nn from torch.utils.data import DataLoader from torch.optim import Adam from hyperopt import hp import ray from ray import tune from ray.tune.schedulers import AsyncHyperBandScheduler f...
99260c9aeb9ec300068a9834cc32c17159999a5743d46eda291cd50128dec877
Python
13,632
299
import argparse import pickle from typing import Dict, List import numpy as np import torch import tqdm import lib.data_utils.data_util as du import lib.data_utils.dynamic_data_util as ddu import lib.dataset_config_parser.dataset_config_parser as dcp from generate_cropped_glm_hqs_reconstructions import make_glm_stim_...
56a44effe653ac21a985438d98301463971ad587415f59bbe6fe4c192d4f2c93
Python
13,636
347
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils import spectral_norm from torch.optim import Adam import math import numpy as np from utils import * from lookahead import Lookahead class SelfAttention(nn.Module): def __init__(self, hid_dim, n_heads, dropout, device): ...
86c84b508f8c7247c47c268891b668af57ffb539f3ad94f0836a7a795ff48ff0
Python
13,654
288
''' Unit testing ''' __author__ = "Jonathan Dan" __email__ = "jonathan.dan at epfl.ch" import unittest import numpy as np from src.timescoring.annotations import Annotation from src.timescoring import scoring class TestAnnotation(unittest.TestCase): def assertListOfTupleEqual(expected, actual, message): ...
a4c681b970be08a3ce784cd53ffd6f5f96fce3496b1fc6c0625ee3fe080e8cac
Python
13,660
401
#!/usr/bin/python # -*- coding: iso-8859-15 -*- # System imports import sys, os, re, math import subprocess import argparse import numpy as np import seaborn as sns import pandas as pd import matplotlib import matplotlib.pyplot as plt import matplotlib.font_manager from matplotlib.ticker import PercentFormatter from...
9967ed0e694c7a36ff5b07252cf9a39b6ce33ca15095eb39233778865fba6f90
Python
13,661
388
from subprocess import Popen, PIPE import numpy as np import itertools import re def view( infile, *args, **kwargs ): ''' A simple wrapper around samtools view command that will just return the stdout iterator The command should accept the same arguments as samtools view except that any single argu...
9f403ec6815df43cc1bae4eafe621c4a29daf684f0f111d4d89a7b36047c78dc
Python
13,662
361
import copy import numpy as np from spinnaker2.mla import conv2d params_conv = { "op_a_use_noc": 1, "op_a_is_signed": 1, "op_b_is_signed": 0, "op_a_is_16bit": 0, "op_b_is_16bit": 0, "output_shift_width": 8, "output_mode": 0, # only tested for 32 bit output ...
97844421b7c932fe29c41aff07a95d4ca10e4f15e50f3c55d840aa332148abdf
Python
13,664
383
#%% # -*- coding: utf-8 -*- """ Created on Tue Sep 12 13:22:36 2023 @author: meaha """ import seaborn as sns import pandas as pd import matplotlib.pyplot as plt import numpy as np from scipy import stats from scikit_posthocs import posthoc_dunn from scikit_posthocs import posthoc_tukey from statannotations.Annotator ...
2971424c66b70346667dea8a72999329bc6e705387cbf6f25d43ad23be263b72
Python
13,672
394
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 15 20:10:37 2021 This script is for de novo generation of novel antimicrobial peptides. The RNN language model was adapted from the pytorch tutorial "NLP from scratch: generating names with a character-level RNN" by Sean Robertson. (https://pytorc...
5d7febfc8dadc2fd8f4b4e6d6a0df502ea655cb786dd10fbe21102cc8bf7a404
Python
13,682
396
# Copyright 2021 AlQuraishi Laboratory # # 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 i...
82f02ab0559119ef3e0e2ad8b18d39cbee3f0c28cb79575e3e8a5887c9bf40b4
Python
13,687
396
# Copyright 2021 AlQuraishi Laboratory # # 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 i...
bd8f8b755b7fac874d47d6d5ccb73b054ccdcb7e05f6a635f3f7fccb59d0bcab
Python
13,688
339
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
06ecbeedf2f963cd1d7b5210c1842876c2e9d72bb84b9e0413871a7ceb5d2574
Python
13,689
348
# Ultralytics YOLO 🚀, GPL-3.0 license """ Ultralytics Results, Boxes and Masks classes for handling inference results Usage: See https://docs.ultralytics.com/predict/ """ from copy import deepcopy from functools import lru_cache import numpy as np import torch import torchvision.transforms.functional as F from ult...
b95238cb81c047b95bf4c573421be762316e3d664ad084f1c7bc51bd64fffc5e
Python
13,690
367
# Copyright 2021 Google LLC # 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
6b3bd358e0b5dee35b714b0b79a6e11a244c69bb4475d2e87ef0fb9f5c583972
Python
13,691
393
"""Code in this file is heavily based on the code from the following repository: https://github.com/CompVis/invariances""" import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import BatchNorm2d class DenseEncoderLayer(nn.Module): def __init__(self, scale, spatial_size, out_size, in_c...
36bfc711c4171e41aaf37d805225a44dbd6ae4c217d8c86d3c64339f15f6aac4
Python
13,692
471
""" For historical reasons, this script generates two separate plots which were combined in inkscape. """ from utils.grid_funcs import ( gridpop_clustering, gridpop_conj, gridpop_repsupp, gen_offsets, traj, traj_pwl ) from utils.utils import ( convert_to_rhombus, get_hexsym, get_pat...
2d30c2d224ea252c612a4cdc891d430bc34600d75b1d74e3696642f2445fc752
Python
13,695
408
# Copyright 2021 Google LLC # 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
8bc94f182e53809a4cff4a5fb592cb20e9be7f1c310922e13bd171bd47bc74bb
Python
13,695
353
""" The intention of this script is to easily sync a given IonTorrent or IonProton run path into the :doc:`NGSData <../ngsdata>` structure You need to ensure that the run directory for the run you want to sync is available and that you know the path to it. The run directores for IonTorrent and IonProton are located u...
4dbda6192ec5b337c2ebc7e68991d6b345cbddc497806e428503c96b60bf1ba1
Python
13,696
398
#!/usr/bin/env python3 # # Copyright 2021 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
5d8c67f42b3858809a54c46954cfaa13d406c710f820d45fab834ceb8653dda3
Python
13,700
321
r"""FCS (Flow Cytometry Standard) reader for OmicVerse I/O. WHY THIS LIVES IN ``ov.io`` --------------------------- Reading an FCS file is I/O, not an assay. The only FCS reader omicverse had was ``ov.single.ev.read_fcs``, buried inside the single-extracellular-vesicle module, and it was shaped for that assay: it stam...
b7e52a8682aa81fbeecccac83e6fb0d57bb83667fc009d88216cd1bc19752cdd
Python
13,701
365
# coding: utf-8 # In[18]: import csv import pandas as pd import numpy as np import os as os import sys as sys from collections import defaultdict import time from IPython.display import display import copy import traceback # In[2]: from datetime import datetime now = datetime.now() current_time = now.strftime...
fbae16e483f1c7aa19f8d5e007b3fb78bf54fd7cf660a1d1f76a721457133ca9
Python
13,703
352
import os import torch import time import argparse import numpy as np from torch.utils.data import DataLoader from torch.optim import lr_scheduler from data_preprocessing import ABUSsetNew import logging from config import CFG from monai.utils import set_determinism from sklearn.metrics import roc_auc_score classes=[...
97cb401e453307cd4323ebe4a1d2d89f670dc983461bf5596fe9d337625b9084
Python
13,704
426
#################################################################################################### # Copyright (c) 2020 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
1ad6e9a8642286bbd4fd3155dbb80e278adfaa160b9bcd92f436d99abae07bec
Python
13,706
346
r"""Tissue-zone / cellular-compartment discovery via NMF. After a spatial deconvolver (Cell2location, Tangram, SpatialDWLS, ...) writes a per-spot cell-type abundance matrix, a common follow-up is to ask *which groups of cell types co-locate?* That answer becomes **tissue zones** (germinal centre, T-cell zone, stromal...
a9d190c32a5b16496fb53fd8b02229d78e81fb8e8edce2abd533511cc5c0308f
Python
13,707
398
import argparse, os, sys, glob import clip import torch import torch.nn as nn import numpy as np from omegaconf import OmegaConf from PIL import Image from tqdm import tqdm, trange from itertools import islice from einops import rearrange, repeat from torchvision.utils import make_grid import scann import time from mul...
dee0faeee2f75a3aee997e64b60f16b5aed6aac40ff1fe0f88e0ac39a2ffd9b3
Python
13,708
371
# -*- coding: utf-8 -*- r"""Co-located cell combination model - de-novo factorisation of cell type density using sklearn NMF.""" import matplotlib import matplotlib.pyplot as plt # + import numpy as np import pandas as pd from ...models.base.base_model import BaseModel # defining the model itself class CoLocatedGr...
837ddbe0f80a612b96398f94cbd5d04a82be28c16d9566e015712190da7c74da
Python
13,713
366
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations import contextlib import itertools import tempfile import zipfile from collections.abc import Generator, Iterable, Iterator, Sequence from concurrent.futures import ThreadPoolExecutor from pathlib import Path from ...
c9f429951edaecd744c86a75732719ecc1230b5a9716a73c91afe486a060769f
Python
13,714
317
r"""Regulatory-element strength & expression prediction. Predict how strongly a construct is transcribed and translated, from sequence: * :func:`rbs_strength` — translation-initiation rate from a 5'UTR, via a thermodynamic model (Salis-style): the Shine–Dalgarno : anti-SD (16S rRNA) hybridisation energy minus the...
3367d435ace14999793c493c2c13957b69da900d4623288d604fabccbeba2026
Python
13,717
304
"""R CellChat pipeline steps around ``computeCommunProb`` (OmicVerse port). Each function ports the R function named in its docstring from jinworks/CellChat 2.2.0 (presto 1.1.0 for the Wilcoxon test, igraph/sna for centrality) and is checked numerically against R in ``tests/single/test_cellchat.py``. Communication ten...
77e082e9ceb26ded46a829042b5cff284addf5efe09c07b10f5fed1b331098a9
Python
13,717
239
from nilearn.connectome import ConnectivityMeasure from sklearn.covariance import LedoitWolf, EmpiricalCovariance import numpy as np import pandas as pd from neuroCombat import neuroCombat import matplotlib.pyplot as plt import seaborn as sns def connectivity_matrix(timeseries, roilabelid=[], ...
2e6977689106a334db693c929754794a11c6065db0d77beb9fda1707f90557f2
Python
13,719
324
from mozaik.storage.queries import * import pylab import math from scipy.interpolate import griddata import matplotlib.cm as cm from mozaik.meta_workflow.analysis import load_fixed_parameter_set_parameter_search from collections import OrderedDict import pickle from builtins import zip def single_value_visuali...
0128f9625b8567c00c6c2800a0032211f97ca16d698fa45e64e8eff58f6659ce
Python
13,734
357
import unittest import numpy as np import pytest import torch from pfrl import action_value from pfrl.testing import torch_assert_allclose assertions = unittest.TestCase("__init__") class TestDiscreteActionValue: @pytest.fixture(autouse=True) def setUp(self): self.batch_size = 30 self.actio...
08a89652e4ebf6ee77e7c421820f5dcd7d6b212d97a2c61a70b2e1d90dfbbe79
Python
13,735
334
import argparse from utils.utils import load_data, define_logger, tokenize_gen, evaluate_gpt2, gpt2_evaluate, compute_ppl import random import numpy as np import torch from model.generatively_model import gpt2_generate, bart_generate from transformers import AdamW, GPT2LMHeadModel, GPT2Tokenizer import sys import torch...
3b99c6c953f5743bb968dc9c52caa4e1d14b9c13bb1207f05e7996b21762cc27
Python
13,736
364
import numpy as np #import matplotlib.pyplot as plt import os import struct import gzip import pickle from sklearn.cluster import KMeans from sklearn.mixture import GaussianMixture import scipy.io def format_float(num): return np.format_float_positional(num, trim='-') def download(): ''' From http://ufldl...
203e1fb3e1a6f4d9ef4591ccc24b7fe91dbf395c888a34cf64cb2e90533ff7b9
Python
13,739
350
import numpy as np import nibabel as nib import json import argparse import os from os import makedirs from os.path import isdir, splitext import matplotlib.pyplot as plt from skimage.measure import label, regionprops from scipy.ndimage import binary_dilation import lib __scriptname__ = 'idif' __version__ = '0.3.2' ...
f749067a79bcc2a0196364b653a7f1f090be7ad2c64fbc332bb0efbbc6ac74e9
Python
13,739
347
import math from typing import Callable, Dict, List, Set, Tuple import numpy as np from rdkit import Chem from GR_pKa.args import InterpretArgs from GR_pKa.data import get_data_from_smiles, get_header, get_smiles, MoleculeDataLoader, MoleculeDataset from GR_pKa.train import predict from GR_pKa.utils import load_args,...
c6c0df15b7cf544efe7d3770cfa23cee61b090e88b30654914b1ffbf49e463b4
Python
13,742
354
import os from progress.bar import Bar import numpy as np import pandas as pd from pyfaidx import Fasta import itertools '''Run all parts in sequence''' def run_all(db_name, overwrite_all=False): types = ['noN', 'N'] versions = [1, 2, 3, 4, 5] print('AGGREGATING SPLAM DATA...') splam_aggregator(db_na...
2546a4cfd2dd4f9caf6dba1bb2ce41c6a805c03279d09c4bb794e032a8a0fa87
Python
13,743
350
# coding=utf-8 # Copyright 2023 HuggingFace 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 ag...
6879b9f1458633176cec14d2231b6ebe0c33e88e7bc605555a50de8990cfe010
Python
13,744
382
#################################################################################################### # Copyright (c) 2020, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This library is free softw...
2cacf516beee6ca480f8ab3b5e8f8a4301d7b23a96ffc430ad8f3f78d6a86ec6
Python
13,747
338
"""Self-contained enrichment plots — the running-ES GSEA curve, dot-plot and bar-plot used by :mod:`omicverse.bulk` enrichment. These were previously imported from the vendored ``gseapy`` package (``omicverse.external.gseapy.plot``). gseapy has been removed in favour of omicverse's own NumPy GSEA/ORA backends (:mod:`o...
4548642627ede1e166182a38d8845d879ca5412aa75510bb933e65a64fac4dc6
Python
13,752
313
import logging as log import pandas as pd import numpy as np import numbers from matplotlib import pyplot as plt from sklearn.model_selection import KFold, ParameterGrid, ParameterSampler from sklearn.metrics import mean_squared_error from sklearn.feature_selection import RFECV from sklearn.utils.multiclass import type...
a094dc2a3ed4dd071afef93b9339142e094a838ce4a5bf025851dbd8ea58fb3c
Python
13,755
266
from numpy import * intro = "This subroutine evaluates the " pgstr = ["potential ", "potential and its gradient "] intro2 = "\n\n .. math::\n\n" eq_start = "u(x) = " eq_start2 = "\sum_{j=1}^{N} " str1 = "c_{j} \\frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|}" str2 = "v_{j} \cdot \\nabla \\left( \\frac{e^{ik\|x-x_{j}\|}}{\|x-...
34b90449d71d3957112d6771b53ac3dd39eedcc372aa8d7a085b623c1d5016cc
Python
13,756
372
from typing import Dict, List, Sequence, Union, Tuple, Optional import torch import torch.distributed.distributed_c10d as dist import torch.nn as nn from monai.networks.blocks import SubpixelUpsample from monai.networks.layers import Act from torch.nn import functional as F from src.networks.vqvae.vqvae import VQVAEB...
84e4ebf041ab98b64adfcdd91ac019044ebd10ab6712f6adf6a05b93bccfb284
Python
13,757
382
from typing import Optional, Dict import scanpy as sc import networkx as nx import numpy as np import pandas as pd import anndata as ad import networkx as nx def filter_low_confidence_edges(adata: sc.AnnData, edge_threshold: float, flowsig_network_key: ...
f44da722c0a70c923b07b5db2ce8e1d894214168092afc78228279729d02b426
Python
13,757
474
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
964a01ef1ac06623361ea71bb2e0d767909ed30200ff31c9ac8919c481933ad0
Python
13,764
388
import os import time import random import numpy as np import torch.utils.data as data import torch import threading import queue from dataclasses import dataclass, field from typing import Any import torchvision.transforms as transforms @dataclass(order=True) class PrioritizedItem: priority: int ...
4121976deb78d367a01fcb320d9da49c7cc8bcfaeadfabff667ba6c9d462730d
Python
13,768
400
###RF1-SRA ###shared reward, event related from psychopy import visual, core, event, gui, data, sound, logging import csv import datetime import random import numpy import os #maindir = os.getcwd() #parameters useFullScreen = True useDualScreen=2 DEBUG = False frame_rate=1 instruct_dur=3 initial_fixation_dur = 4 #...
1707747065a6cf4e7cfb00997272081208661ec2de6394bb080c59edc786a98d
Python
13,772
375
"""A Python class containing an implimentation of MPPCA denoising. Inputs are a 4D image with dimentions (X x Y x Z x N) Usage: import mpdenoise as mp imgdn, sigma, nparameters = mp.denoise(img, kernel=[7,7,7], M=60, shrinkage='frobenius') LICENCE Authors: Benjamin Ades-Aron (...
f7d31c09f4d93d791e76f67a4c577b8acdd0c9bde9762790920c4c73ed9590f1
Python
13,773
370
#!/usr/bin/env python import argparse import os import sys import subprocess import dxpy ENCODE_DNA_ME_PROJECT_NAME = 'long-rna-seq-pipeline' ''' This DNA Nexus project holds all the created applets and folders''' ENCODE_REFERENCES_PROJECT = 'ENCODE Reference Files' ''' This DNA Nexus project holds Reference files ...
f4894b71e3288ce0df84b78481f9a081281e742ba202ee56ade5b62377ad3809
Python
13,777
354
# Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted # provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this list of # ...
ead0c2e44585ca475c5e56da1f6a6e827b33eefcc08fe3b66d6636e1a58c4756
Python
13,782
319
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # Adrien Fleury <adrien.fleury@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.co...
ca25b3a3e75461ea03fc1a9b8492733a6dccf46bfc2a4b91d48ed03586461982
Python
13,785
331
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. FastCSP - Fast Crystal Structure Prediction Workflow This module provides the main orchestration script for the FastCSP (Fast Crystal Structur...
606ab8a5f155ebf15996d7f981d2a85e89dbf9c6c45622d8bf513b6f4f16ea67
Python
13,789
345
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion): # --------------------------------------------------------------------------------...
e64bd231cc97d212f8b3a0daec0696eb7d0e61e667cc964d4b4872d13aa961b8
Python
13,795
373
from typing import List, Tuple import numpy as np from torch import Tensor import torch, copy, math import torch.nn as nn from torch.nn.functional import log_softmax from ..utils.model_utils import Feature_extract, Embeddings, PositionalEncoding """ Generate mask for padding position and causal mask """ def subseque...
113bd128df0804878c176e7ab1081decf1cb9ef0cbb1d4c308c6afa07ce8355b
Python
13,798
350
# Copyright 2026 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
d5c9e640d311b251ea4a7dc069f059984c35939cee9b83a8da02f26d8d75550f
Python
13,802
461
"""Utility functions for tensors and arrays.""" from typing import Any, Dict, Iterable, List, Literal, Mapping, Union import numpy as np import torch from numpy.typing import NDArray from torch import nn class RefTensor: """A tensor with reference indices along the last dimension. Attributes: value...
4b68b7342f22fd80fdec4e6f2fa0b2f1db84771309d6bad4130fa0262177f280
Python
13,810
221
import collections import os import pickle import random import struct import sys import zipfile import numpy as np def remove_low_intensity_peaks(array, removal_threshold, removal_percentage): candidate_indices = np.where(np.logical_and(array > 0.0001, array <= removal_threshold))[0] indices_to_remove = np.r...
84e206fbe29521808b1ea7f979b235271dd685a33f8e9251ada3bf02d51c80fe
Python
13,811
513
import numpy as np import matplotlib.pyplot as plt import glob from pyboat import WAnalyzer def gaussian(x, mu, sigma): return np.exp(-0.5*((x-mu)/sigma)**2) # 1. Retrieve info from file names def get_file_names(): data_dir = './RAFL_data/' return np.array(glob.glob(data_dir+'*.txt')) ...
79120b38865e090f75d539cab8b214dcd92db6446e6218e128c929f35c7e1128
Python
13,816
353
import scanpy as sc import numpy as np import networkx as nx from community import community_louvain from sklearn.ensemble import IsolationForest, RandomForestClassifier from sklearn.decomposition import PCA from collections import Counter from scipy.spatial.distance import pdist, squareform from tqdm import ...
38b1faf8ad48afb8eac9b1f325e11ed50544e6e350b0ac2d1071d838022b22b9
Python
13,819
427
# -*- coding: utf-8 -*- # """ svfile.py Wrap the pysam API to permit clustering of standardized SV VCF records. """ import numpy as np from collections import defaultdict from .utils import recip, make_bnd_alt, update_best_genotypes, get_called_samples from .genomeslink import GSNode class SVFile(object): def _...
912fa86228c77d0da9556a0866b010a5066202a9cd544b0598d3ed64f9b1b6f1
Python
13,824
337
from utils import * import csv import pandas as pd import torch import torchvision import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import Dataset, DataLoader from torchvision import datasets, transforms from torchvision.transforms import ToTensor def get...
919c65625cbca45d4a3f4995dfa29c4cdb74b032b6a2b35db08ae4ae14bdcfd5
Python
13,832
250
import torch from torch import optim import lightning as L import sys from .mask import mask_graph_batch from .position import add_noise_to_batch_pos, scale_batch_pos, unscale_batch_pos, wrap_batch_pos sys.path.append('/crystal-transformer') class TrainerGANLit(L.LightningModule): def __init__(self, generato...
7f7021f439253a3679c59417cb57b491810ff312ae660fa19c1e8e9e5f6f3f19
Python
13,836
344
import torch import random from sklearn.metrics import accuracy_score, roc_auc_score, confusion_matrix, auc, precision_recall_curve, precision_score import matplotlib.pyplot as plt from torch.utils.data import DataLoader, Dataset import calibration as cal import logging import yaml import os import pandas as pd import ...
c35a707e9c22a23fdbf50318bf58b003db2b34937108e9fc415856139bd9af4e
Python
13,837
362
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import time from contextlib import suppress from dataclasses import dataclass from datetime import time...
349f1352223c0980ea81bef1200347bd25a7ba3890f41c04b154a3e027ed3a7d
Python
13,840
429
import json try: import itertools.izip as zip except ImportError: pass import numpy as np import pandas as pd import scipy.sparse as sparse from scipy.ndimage import generate_binary_structure from lib5c.util.system import check_outdir class DirectedDisjointSet(object): """ Based on https://stackover...
d66a27d0a77c038094c8f7e8ad1aad58cffa031635004e9c3cc076cea7ef5222
Python
13,841
457
# Copyright 2024 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
b27c770d1e54299a27cb67bd89d0b39802c6a38897cb7b6f92049678592275f6
Python
13,842
313
# Copyright 2023 Katherine Crowson and The HuggingFace Team. 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...
b8ca3d1cded2b4803e821002972f92867995256d6fa40bcaf21ec78b131adaaa
Python
13,842
369
# import numpy as np import warnings from deeplift.layers import BatchNormalization from keras.layers import SpatialDropout1D warnings.filterwarnings('ignore') import tensorflow as tf from tensorflow.keras import initializers from tensorflow.keras.layers import Layer, InputSpec from tensorflow.keras import ba...
72546b28880b10948d3f32c21721f34ad2d3659ec6ffc2ad9c5da515a16cbb01
Python
13,848
384
import pdb import os from itertools import product from tqdm.auto import tqdm import numpy as np from connectivity import Connectivity from pathos.pools import ProcessPool class DataStore(object): def __init__(self, dirname): self.directory = dirname self.data_arr = [] self.data = dict() ...
8ac3fd4da777f48476b567017d19043ccf4b326bb0c7c5409f960ec7978e8ec7
Python
13,849
350
#!/usr/bin/env python # -*- coding: utf-8 -*- """Merging of spatially overlapping components that are temporally correlated Created on Tue Sep 8 16:23:57 2015 @author: agiovann """ #\package caiman/source_extraction/cnmf #\version 1.0 #\copyright GNU General Public License v2.0 from builtins import range import n...
2ce4f2545803a05b26838414e0fabda56ca8a59f19795caec1675fc0dac28ca4
Python
13,855
320
r"""``ov.pl.bonsai`` — draw the Bonsai tree computed by :func:`omicverse.tl.bonsai`. Bonsai returns a tree, not coordinates, so the layout is computed at draw time by :func:`omicverse.external.bonsai.equal_angle_layout`. Branch lengths survive the layout, which is the point: distance along the drawing is distance in t...
4f414deb594b6e4e2914d4d118f29166f00dab281085a18408c106356aa61e4d
Python
13,859
322
from typing import List, Dict, Tuple import torch from common import TrainingRecord, TrainingScenarios, SEED from utils import load_json_file, append_date, dump_as_pickle, load_pickle import torch from torch.optim import Adam from torch.nn import CrossEntropyLoss from torch.utils.data import DataLoader, TensorDataset...
82b5354ac9b33e32e08a92bd56f6451bcf9756934b1e4835bd77a7ad3880d0d2
Python
13,860
301
import re, unidecode, datetime, pickle, os, logging import pandas as pd from pymed.article import PubMedArticle try: from nltk import pos_tag from nltk.tokenize import regexp_tokenize from nltk.stem import WordNetLemmatizer from nltk.corpus import wordnet as wn except: logging.fatal("call nltk.down...
b6202f4fd2c0019580f26beaa511e5c8b86462b8a0d61241ab1f74585bd73b4e
Python
13,866
319
import numpy as np import torch from torch import autocast from torch.cuda.amp import GradScaler from typing import List, Tuple, Callable, Iterator, Optional, Union import lib.data_utils.dynamic_data_util as ddu from convex_optim_base.prox_optim import ProxFISTASolverParams from convex_optim_base.unconstrained_optim ...
f44cf96c3d40ab9387f8c961a122825a175814e5e2bbcf1aa95cf222c5a7a91e
Python
13,868
367
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
82d0a3910ad7d47cc505bc45bf469bbc271b471317b34471780b77f3235aae6d
Python
13,871
449
# # Copyright (c) 2021, NVIDIA CORPORATION. # # Licensed under the Aeache 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...
7172c8833a2667e3017e472a1d067476f6b2c7045ca0bed0e0ebf63ce4f280e5
Python
13,875
309
#!/usr/bin/env python import sys import os import warnings import enum import argparse import tempfile import pysam from typing import List, Text, Optional, Iterator from sv_utils import common, genomics_io # noinspection PyArgumentList class FlippedIntervalStrategy(enum.Enum): end_to_pos = enum.auto() fli...
d2e9e0eb29b6064dab9e715510048dcc4f8c9c61b0b005d1e0fce701e32e0b32
Python
13,876
331
#lisa modules import lisa.core.gene_selection as gene_selection from lisa.core.utils import LoadingBar, Log, LISA_Results from lisa._version import __version__ from lisa._version import __file__ as version_file from lisa.core.data_interface import DataInterface, PACKAGE_PATH, DatasetNotFoundError #standard library im...
58a8ed5814232b41f30c2fda6ac10206f3e696d7801a9d1883febda0049e3b1c
Python
13,878
322
from functools import partial from typing import Any, cast, Dict, List, Optional, Union import torch import torch.nn as nn import torch.nn.functional as F class VGG(nn.Module): def __init__( self, features: nn.Module, num_classes: int = 1000, init_weights: bool = True, dropout: float = 0.5 )...
a98da5144181f0aec304f21955c68f764229a0fb51d740b8ed123f8a57bbd578
Python
13,882
436
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 22 16:11:44 2019 @author: gary """ from tools.radialShape import * from scipy.interpolate import splprep, splev import pickle import os from skimage.filters import threshold_otsu, threshold_yen import time #################### #File managment de...
835c57ab11299b5762923f25d8e8f08bb4ca49ebda1e885317589c4aaa10c7a5
Python
13,885
293
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
518119bc16ff417cfcc64817862b66f00a024628418799427688c9a052390f3b
Python
13,899
300
import os import csv import gzip import torch import anndata import numpy as np import pandas as pd import scanpy as sc import tensorly as tl import sklearn.neighbors from scipy.io import mmread from scipy.sparse import coo_matrix tl.set_backend('pytorch') def preprocessing(raw_data_path, PPI_data_path, load_label...
65060e5e02dc71b26e871cc3d8f7a6fa3520576c3d261f542ee0f68a4cb09937
Python
13,903
309
# Copyright 2023 Katherine Crowson and The HuggingFace Team. 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...
98e50a4ff5cd920fe1ccf62f5960b0cb0b61422c1590878c6b52380b79f3bb59
Python
13,908
370
import math import operator import random import scipy from scipy import sparse import numpy as np def select_stable(full, modality = "RNA", stable_number = None, criterion = "signal"): ''' full is the data in np array format, either dense or sparse ''' if sparse.issparse(full) is True: f...
33adaa5d268e660064c1c6cfda5d995a28d222099743d4ac4be0171ba2ae6f8a
Python
13,923
344
import pandas as pd import numpy as np import sklearn.neighbors import networkx as nx from .mnn_utils import create_dictionary_mnn from .._pymclustr import fit_pymclustr def match_cluster_labels(true_labels,est_labels): true_labels_arr = np.array(list(true_labels)) est_labels_arr = np.array(list(est...
47a58da00647158d4fbc748c2220d50fb06e8ca45705b759d89d6f9610a2661f
Python
13,930
346
"""Prompt template engine — composable prompt construction for OVAgent. Breaks monolithic prompt strings into reusable template blocks and deterministic overlay composition. The engine guarantees that the same set of overlays always renders in the same order. Prompt composition contract --------------------------- *...
e1b0a3ab28f4bbcb24ba0cc5a2f71b7e2596d0dc6c2543c66fa1b82e5cc529e5
Python
13,930
441
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """aihwkit example 22: 2-layers LSTM War and Peace dataset on a 2-layers LSTM inspired network based on the paper: https://www.frontiersin.org/articles/10.3389/...
337629be4c70f8e79dd284e789d3029e1f0461f27f36ffa9ba18b0511506f459
Python
13,940
425
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """aihwkit example 6: analog CNN with hardware aware training. Mnist dataset on a LeNet5 inspired network. """ # pylint: disable=invalid-name, possibly-used-bef...
25d58df2cacd175c9cc9ac4d4bc63be05b4547938966ae4be4a851bbc510450d
Python
13,942
478
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
45349a4f8dc732df7e61e954d969db219a4c2aad5f19a87b53626c62ef3d45b5
Python
13,942
397
from typing import Optional, Dict import scanpy as sc import networkx as nx import numpy as np import pandas as pd import graphical_models as gpm import networkx as nx def filter_low_confidence_edges(adata: sc.AnnData, edge_threshold: float, flowsig_netw...
a889476651a83e535cc53f2f64f8db02d645944a0bacaef6162a8555874684f6
Python
13,944
430
import os import re import sys from tempfile import TemporaryDirectory from unittest import mock import pytest from ci.ray_ci.linux_tester_container import LinuxTesterContainer from ci.ray_ci.tester import ( _add_default_except_tags, _get_all_test_query, _get_container, _get_flaky_test_targets, _g...
c561cc32938b3d17cdffc886b1355187545b55a58ecf9ec17174b18e774cc1da
Python
13,955
341
import pandas as pd import scanpy from collections import defaultdict import numpy as np from scipy.optimize import nnls import scanpy as sc from scipy.stats import pearsonr import matplotlib.pyplot as plt from ..utils import pyomic_palette import matplotlib from typing import Union,Tuple import anndata from .._registr...
b767128d7a180339566c74ad1ad02a3ab7c35dcc9e82120e6f5860f177724a19
Python
13,957
293
import serial import numpy as np from collections import deque from time import gmtime, strftime from scipy.signal import butter, lfilter LOG_DIR = "logs/" class QRSDetectorOnline(object): """ Python Online ECG QRS Detector based on the Pan-Tomkins algorithm. Michał Sznajder (Jagiellonian University...
839b90ade6a1c4558910bd7bd30198fa94ddb87c9e6fe9ae50108627323e5991
Python
13,966
495
""" Logger copied from OpenAI baselines to avoid extra RL-based dependencies: https://github.com/openai/baselines/blob/ea25b9e8b234e6ee1bca43083f8f3cf974143998/baselines/logger.py """ import os import sys import os.path as osp import json import time import datetime import tempfile import warnings from collections im...
1125f1ebb5b107fa88161b6c3e8793557b17534a6372d10420bea49083f87a8b
Python
13,967
381
""" Integration tests for the pyamdsmi wrapper functions. Run on a machine with AMD GPU(s): python3 -m unittest discover \ -s python/ray/_private/thirdparty/pyamdsmi/tests \ -p "test_pyamdsmi.py" -v """ import importlib.util import pathlib import unittest _mod_path = pathlib.Path(__file__).parent...
b653a4ce3cb915bd5dc452a02851f1300dc0d9a31d2c5c9ab8dbda8a35f3134b
Python
13,971
387
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
c2e33b75b613364b791020445d038d41ad21e3d20af9e7280e49166060364880
Python
13,975
376
""" Build the chunk lists that drive the Experanto ``RandomizedExperanto`` experiment. A *chunk list* is a JSON file named ``{trial}_{chunk}.json`` holding, in presentation order, the stimuli that one simulation job presents:: [{"modality": "image", "file": "00042.yml", "trial": 0}, ...] Those three fields are t...
327b2a40baa5b9ffb1c539173f5c6975fa3dd77e4b49d03700c4a43a80fc0553
Python
13,984
395
import os from glob import glob from logging import Logger from math import e, log, ceil from pathlib import Path from typing import Tuple import ignite import ignite.distributed as idist import pandas as pd import monai import torch from ignite.utils import setup_logger from monai.utils import set_determinism from s...
cc72b36065a1f97ebeeda309c43cdf46a1d58ccb0267dc91aede19351eaec86e
Python
13,985
276
import grpc import projectmetis.python.utils.proto_messages_factory as proto_factory from projectmetis.python.logging.metis_logger import MetisLogger from projectmetis.python.utils.grpc_services import GRPCServerClient from projectmetis.proto import controller_pb2_grpc class GRPCControllerClient(GRPCServerClient): ...