sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
2b9815d0977ff7df17b1430c931ca25284d70859ec38c7034a68aa88dddea488
Python
3,221
109
# slurm-launch.py # Usage: # python slurm-launch.py --exp-name test \ # --command "rllib train --run PPO --env CartPole-v0" import argparse import subprocess import sys import time from pathlib import Path template_file = Path(__file__) / "slurm-template.sh" JOB_NAME = "${JOB_NAME}" NUM_NODES = "${NUM_NODES}" NUM...
d58810f77d5b67aa90b34eb9cd00da39f8b3713fedca9e4440c76692240ad210
Python
3,221
89
import torch from ..utils.module_with_records import ModuleWithRecords class BaseDistance(ModuleWithRecords): def __init__( self, normalize_embeddings=True, p=2, power=1, is_inverted=False, **kwargs ): super().__init__(**kwargs) self.normalize_embeddings = normalize_embeddings ...
e70b08a3a1f715c18767d8318476aaab904473e31c512244e8737700a0ec8738
Python
3,221
61
import torch ######################################################################################################################## def create_feature_maps(init_channel_number, number_of_fmaps): return [init_channel_number * 2 ** k for k in range(number_of_fmaps)] def FFDrealign4(input): # batch channel time...
202ee0fac64e1df68a1d97b419e36e71156896c281cef5d3b1bd205dea1a4202
Python
3,222
94
import abc from enum import Enum from typing import Dict, List, Optional from ray.data._internal.execution.interfaces.common import NodeIdStr ResourceType = str ResourceDict = Dict[ResourceType, float] RequesterId = str LabelKey = str LabelValue = str LabelSelector = Dict[LabelKey, LabelValue] ReservedResources = Dic...
a6078cad45781806196a4bc306e3258926dd759fc04a51bc2d815957a1cfc744
Python
3,222
91
import os import subprocess from typing import Dict, List, Tuple from ray.autoscaler._private.docker import with_docker_exec from ray.autoscaler.command_runner import CommandRunnerInterface class FakeDockerCommandRunner(CommandRunnerInterface): """Command runner for the fke docker multinode cluster. This co...
87c95062249d5e1b69410c64df82005c81dec637467fab989c144d270dce861a
Python
3,223
83
import cv2 import numpy as np import torch from torch.utils.data import Dataset from torchvision import transforms from models_.detectors.YOLOv3 import YOLOv3 class LiveCameraDataset(Dataset): def __init__(self, camera_id=0, epoch_length=1, resolution=(384, 288), interpolation=cv2.INTER_CUBIC, mu...
d514ddca29cac5af4c017eb7eee3b4a0ff470d2543fc64da9e09c6a6673127d6
Python
3,223
101
#!/usr/bin/env python3.7 """Remove files except those specified from samples directories. The copyrights of this software are owned by Duke University. Please refer to the LICENSE and README.md files for licensing instructions. The source code can be found on the following GitHub repository: https://github.com/wmglab...
9e2da47c6d8b6427cf7dd4f283b8b60b686c98482027a6c928688f256224b4d0
Python
3,224
94
"""Store analysis results of an ensemble.""" import argparse import logging import pickle from flyvis import Ensemble from flyvis.analysis.clustering import umap_and_clustering_generator from flyvis.utils.config_utils import HybridArgumentParser logging.basicConfig( format="[%(asctime)s] [%(filename)s:%(lineno)d...
eda627c19bdf9b982544e90da236604d2543c2647b498e0fae772dc8d2eb759a
Python
3,224
108
# 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 writing, software # distributed under th...
8fffc1cdf1a743627f717a1d6ab8ecbe4b9bd0a6a1a2d1129f159642fc36885f
Python
3,225
107
# 3rd party dependencies import matplotlib.pyplot as plt import numpy as np import cv2 # project dependencies from deepface import DeepFace from deepface.modules import verification from deepface.models.FacialRecognition import FacialRecognition from deepface.commons.logger import Logger logger = Logger() ...
3d787be034bedd5793a52c0d4d0a7ac43489ca55dc8117b019e8b26bd0b59050
Python
3,226
105
""" 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 argparse import logging import torch import yaml def convert_fine_tune_checkpoint( fine_t...
6545533eb7ef52375d9e479f5138a8fbfcc3b6585624e2f9868538efc0d618e2
Python
3,226
112
from typing import Any, Tuple def generic_expectations( name: str, summary: dict, batch: Any, *args ) -> Tuple[str, dict, Any]: batch.expect_column_to_exist(name) if summary["n_missing"] == 0: batch.expect_column_values_to_not_be_null(name) if summary["p_unique"] == 1.0: ...
b3014fc925748bf5f970cc03a39b7dcc31dee337bf5c680074509f7f34c5bd05
Python
3,226
80
from numba import jit import numpy as np from sklearn.linear_model import Ridge from sklearn.model_selection import GridSearchCV from collections import namedtuple from sklearn.linear_model import LogisticRegression @jit(nopython=True) def test_train_sets(population, n_test): n_cells, n_t, n_reps = population.sha...
05b946780464561c24d51d5d1f63658ca2767686e636a747e7f896bdfe161c13
Python
3,227
102
import vamb import re import subprocess import unittest def grep(path, regex): with open(path) as file: for line in file: m = regex.search(line) if m is not None: g = m.groups() return (int(g[0]), int(g[1]), int(g[2])) raise ValueError(f"Could n...
26d06b874d0052e050a2193d514d638f9df0915410e13b8d98bb9f57eb2dc927
Python
3,227
91
""" 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. Tests: FAIRChemCalculator over the AllScAIP-OMol102M conserving checkpoint — single H2O molecule energies/forces, batched pred...
7ed87a7421fc59a443f6955d9cdf86099518b32f6e629beb05a696dff56fefed
Python
3,228
78
r"""Ambient / contamination-RNA removal for droplet scRNA-seq — ``ov.pp.ambient``. Ambient ("soup") RNA — cell-free transcripts released by lysed cells — contaminates every droplet during library prep. Left uncorrected it inflates marker genes in cell types that never expressed them and biases downstream DE, annotatio...
7f0d3b0d349ad8b2447a82491ecf7fa05ba61764404af343c9cb93cd0ffeeea5
Python
3,228
86
from typing import Union import numpy as np from merlin.core.compat import cupy from merlin.core.protocols import Transformable from merlin.dag import BaseOperator from merlin.dag.selector import ColumnSelector from merlin.schema import Schema from merlin.table import Device, TensorTable class Padding(BaseOperator)...
a6cc3f902f1d56a4955df541222f11f3fc06c0d44925bc1f9d04cf186371a9ec
Python
3,229
84
import os from deprecated import deprecated def read_token(pred_labels, valid_labels, tokens, offsets): if valid_labels != None: d = {'token': [], 'pred': [], 'valid': [], 'offset':[]} else: d = {'token': [], 'pred': [], 'offset':[]} with open(pred_labels) as f: for li...
b93f2d0414b66c29c8513431f51c3879e282d2050019eed9c53185317be8c823
Python
3,229
77
"""Fused CPU kernel for COMMOT's sparse l1-unbalanced Sinkhorn (``unot_sinkhorn_l1_sparse``). acceleration: playbook §4.4 (numba-jitted inner loop) + §4.1 (fusion), class (E). Each half-step evaluates exactly COMMOT's update f <- eps*log(a) - eps*log(sum_j exp((-C_ij + f_i + g_j)/eps) + exp((-m + f_i)/eps)) + f ...
12e70509aa8e039bb73b0bd3fa3cae7b64935ca3042c0e05b86ec6797d25ec8e
Python
3,230
89
import os import sys sys.path.append('.') import cv2 import math import torch import argparse import numpy as np from torch.nn import functional as F from model.pytorch_msssim import ssim_matlab from model.RIFE import Model from skimage.color import rgb2yuv, yuv2rgb from yuv_frame_io import YUV_Read,YUV_Write device = ...
dec881c84e955a866653922fb8799d4eb33ec55720210587d118bba040d73b5b
Python
3,230
86
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
e3a7651e18306033316d0a9a5d0fb7fa1330aa56f697192334bac7d6d97c22f1
Python
3,231
130
import argparse import torch import random import os import numpy as np import pandas as pd from chromoformer import ChromoformerDataset from chromoformer import ChromoformerRegressor from tqdm import tqdm from sklearn import metrics from scipy.stats import pearsonr def seed_everything(seed=42): random.seed(see...
740258f94648be352b022ed5e6c92903dd2f474e2673f46ca0f11c0a2d1adf04
Python
3,232
76
from get_Data import * from model import * import warnings from param import * def train(args): similarity_feature = similarity_feature_process(args) edge_idx_dict, g = load_fold_data(args) print("*************************starting the train*****************************") metric_result_list...
9114cb66e7180979604d7d27292c9ad5d392e78a02aacd4255b8e0cd62949930
Python
3,233
88
CODE_DIR = '/home/kelarion/github/' SAVE_DIR = '/mnt/c/Users/mmall/Documents/uni/columbia/assignment_errors/' import socket import os import sys import numpy as np import scipy as sp import scipy.linalg as la import scipy.io as sio from sklearn import svm, manifold, linear_model from sklearn.model_selection import cr...
08eef6e8dab2a835ccc8e491f7b9ba8e660a581289ae9cfc783953cca798f973
Python
3,234
109
import numpy as np import torch from torch import nn class EmpiricalNormalization(nn.Module): """Normalize mean and variance of values based on empirical values. Args: shape (int or tuple of int): Shape of input values except batch axis. batch_axis (int): Batch axis. eps (float): Smal...
17b974d9a4747fead8647766c7302d1f448b4e43e44c975b4e68f9ae8e6cf97f
Python
3,234
108
'''adapet the how-to-use guide from PEKNN, but check if CRP can handle it''' import numpy as np import matplotlib.pyplot as plt import seaborn as sns from task import CSW from model import PECRP from utils import compute_smth_mean, to_sqnp from scipy.spatial import distance_matrix sns.set(style='white', palette='colorb...
95880f0f571e866fbea6c3a9c61cf3937015a31ea93c7b24a6e6ff271a1272e8
Python
3,234
86
#################################################################################################### # 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...
d70722d91fded6880754d2651aebb5d7834ee1cdca08f9882cc5f3cd76e5d31f
Python
3,234
69
import argparse import json import os.path import keras import glob import numpy as np import PIL.Image from tensorflow import keras as k import time from utilities import extract_patches from osgeo import gdal PIL.Image.MAX_IMAGE_PIXELS = 500000000 def calculate_qs(tile_path, w_path, json_name, mod...
48c2e4b7c2024e3beeae9ec4d1d47ba97123484345cf0b5fd2696b079a2e675c
Python
3,236
41
from fr import * import matplotlib; matplotlib.use('Agg'); import matplotlib.pyplot as plt plt.rcParams.update({"font.family":"DejaVu Serif","font.size":8.5}) fit0=json.load(open('fr_fit.json')); x=np.array(fit0['const']['x']); al,rh,lk,be,br,_=unpack(x,'const') g=v.groupby(['age','sp']) fig,ax=plt.subplots(2,2,figsize...
c0cfadfbf9c416a591bbe2879985aa53c181447e70969678de1174823e45b75e
Python
3,236
111
r""" Bulk omics analysis utilities. This module provides comprehensive tools for bulk RNA-seq analysis including: - Differential expression analysis with DESeq2 - Gene co-expression network analysis (WGCNA) - Pathway enrichment analysis (GSEA) - Protein-protein interaction networks - Batch effect correction - Multi-om...
399a58cec9002b1a175f6868ea1614285e76285b70c3c976c2aad59be44a730c
Python
3,238
93
# -*- 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 8: simple network with one layer using Tiki-taka learning rule. Simple network that consist of one analog layer. The network aims to learn to...
945593c15dc3cc53eacc98c2096b01a3fd193cdb1bf3e70a0ea78f3650efda9c
Python
3,238
125
import math import pdb from typing import Any, Mapping import torch import torch.nn as nn from latent_time_stepping.time_stepping_models.parameter_encoder import ParameterEncoder #from torchdiffeq import odeint_adjoint as odeint from torchdiffeq import odeint as odeint class NODE(nn.Module): def __init__( ...
cf091e23db7da29471dd405951fa96e38a204254ce6bd08505e2884fac882f18
Python
3,238
80
import torch import torch.nn as nn from ..utils import create_norm import torch.nn.functional as F class ResMLPDecoder(nn.Module): def __init__(self, in_dim, hidden_dim, out_dim, num_layers, dropout, norm, batch_num): super().__init__() self.layers = nn.ModuleList() assert num_layers > 1, '...
196810b71a9f1fbf28cc1249f40cee50d1e719e93abd252ed306a9cee18d7cb6
Python
3,240
124
# -*- coding: utf-8 -*- # """ std_depth.py Standardize a depth record from Dragen CNV. """ from svtk.utils import is_smaller_chrom from .standardize import VCFStandardizer, NULL_GT @VCFStandardizer.register('dragen_cnv') class DragenCnvStandardizer(VCFStandardizer): # Dragen CNV is a depth-based caller; tag ca...
06a71a3ea47586fae5ca7dd30eabac4b0dc86770b4d92533f3402453e87c4246
Python
3,241
79
import os import numpy as np import matplotlib.pyplot as plt import nibabel as nib tissues = {'WM':3,'CGM':2,'DGM':4} titles = {'WM':'White matter','CGM':'Cortical gray matter','DGM':'Deep gray matter'} pars = ['D','f','vd'] plot_par = {'D':'$D$','f':'$f$','vd':'$v_d$'} units = {'D':'µm$^2$/ms','f':'%','vd':'mm/s'} sc...
3e46af064c613bdd5835cf400215a811f90316e5eff4349f49175af82c3f505c
Python
3,242
95
import numpy as np import torch def to_batched(x): """Return x as a (B, C, T) tensor and a function restoring the input format.""" is_numpy = isinstance(x, np.ndarray) x = torch.as_tensor(x) if not x.is_floating_point(): raise TypeError(f"expected a floating-point signal, got {x.dtype}") i...
edad0850cf576e72629e341a369cf53d552ea733882d02825064beb5d8978b75
Python
3,242
85
import numpy as np import nibabel as nib from scipy.interpolate import RegularGridInterpolator from nibabel.orientations import axcodes2ornt, ornt_transform def find_corners(img, aff, margin): coord = np.argwhere(img>0) coord_h=np.concatenate((coord, np.ones((coord.shape[0],1))),axis=1).T RAS = aff@coord_h...
16cc9d69db3c821a24b316cb80c28773ef18fcf909a8b68c02bcf93495de4723
Python
3,243
77
"""CytoSignal ligand-receptor database (exported from the R package data).""" from __future__ import annotations from dataclasses import dataclass from functools import lru_cache from pathlib import Path import numpy as np import pandas as pd _DATA = Path(__file__).with_name("data") TYPES = ("diffusion", "contact") ...
548a3b73450cbad7a6705f93b763158cc64e31d8a415b2dda4fd3f443debe3bc
Python
3,243
99
import torch import torch.nn as nn import torch.nn.functional as nnf class SpatialTransformer(nn.Module): """ N-D Spatial Transformer """ def __init__(self, size, mode='bilinear'): super().__init__() self.mode = mode self.size = size # create sampling grid ve...
6d630c9173e0e09bba208be8bf4fc5e02998b07c3077411281aa00f2051ec671
Python
3,243
97
import logging import time import aiohttp.web import ray.dashboard.modules.tests.test_consts as test_consts import ray.dashboard.modules.tests.test_utils as test_utils import ray.dashboard.optional_utils as dashboard_optional_utils import ray.dashboard.utils as dashboard_utils from ray._private.ray_constants import e...
afb0942801e0ff8a8758b759dc1576e0708319ce3d9fd349dee49b16d9d05f48
Python
3,243
90
import argparse import datetime import logging import apache_beam as beam from apache_beam.options.pipeline_options import PipelineOptions, GoogleCloudOptions, StandardOptions from ml4h.defines import GCS_BUCKET from ml4h.tensorize.dataflow import bigquery_ukb_queries def parse_args(): now_string = datetime.dat...
cc37669003e1d083846e62f576bd7f5424af94c82416921bd40c19e1f065a837
Python
3,244
76
from delete_row_expriment import * from model import * import warnings from param import * def train(args): similarity_feature = loading_similarity_feature(args) edge_idx_dict, g = data_preprocess(args) print("*************************starting the train*****************************") metri...
fa1eb1e0c95453c2154663e8a7ec0ac8fb97dce407e98e0cb5830c3f6b248a29
Python
3,244
69
#Imports relevant modules. import os import nibabel as nb import numpy as np #Defines the pipeline that we want to generate the activation count map for. This will need to be updated each time. pipeline = '0' #Based on the above variable, finds the directory corresponding to this pipeline which contains FEAT output. ...
12f25c8c3537bb3db11b6dbd7cd22d73b5f569e1242f378885271c131c04977c
Python
3,245
71
import os import pandas as pd import matplotlib.pyplot as plt annotations = ["chess", "gencode", "refseq_ucsc"] colors = ['blue', 'red', 'green', 'cyan', 'magenta', 'olive', 'black', 'gray', 'orange', 'purple'] os.makedirs("intron_sensitivity_precision", exist_ok=True) for library in ["polyA", "ribozero"]: for a...
55052f50f231fe94f5e4d623e565d61da2853f57bb38863ae0d0ca4aad13b279
Python
3,245
82
""" Module for managing version naming scheme and supplying version information. We use setuptools_scm to get version information from git. The version naming scheme is specified by defining functions ``version_scheme()`` and ``local_scheme()`` in this module. We have written these so that they mimic versioneer's "pep...
98fc7655edcb7072d7384f145c17543c165c7f2a9b92c7e9d32cce4ba90f8f8d
Python
3,245
82
import pathlib path = pathlib.Path.cwd() if path.stem == 'tmb_survival': cwd = path else: cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')] import sys sys.path.append(str(cwd)) from model import utils from matplotlib import pyplot as plt from lifelines import CoxPHFitter import numpy as np import...
ae5b8569fd24a89e6c40bf3cb6c1567a0576f594a172bc5419b2b6ec26dfb658
Python
3,245
72
from utils import * from sklearn.metrics.pairwise import cosine_similarity if __name__ == "__main__": SHOW = 0 # Declare the datadir and paramfile datadir = "/cfs/klemming/scratch/n/nbrav/logs/sparsespk-full/2024-04-21_14:40:38:083781" paramfilename = f"{datadir}/net.par" param = parsepa...
5ce427f9a7dfe419bdf13684041bd4acde65899dd38880e4f87101a6eead534e
Python
3,246
88
import numpy as np from scipy.stats import norm import matplotlib.pyplot as plt import matplotlib as mpl from tueplots import bundles from matplotlib import cm from tueplots import figsizes, fontsizes, fonts from matplotlib import rcParams accs_arr = np.load('data-fig2and3/accs_arr.npy') loss_arr = np.load('data-fig2a...
703a1740e13314f6c51979734133f3690cd6c4c1983f31fdcad9f95151b8028f
Python
3,246
121
#!/usr/bin/env python import inspect import ray from ray.util.annotations import _is_annotated IGNORE_PATHS = { ".impl.", ".backend.", ".experimental.", ".internal.", ".generated.", ".test_utils.", ".annotations.", ".deprecation.", ".protobuf.", ".cloudpickle.", } def _fulln...
cdfe35e6edf137f3f7f552663f2d5d6b818bf06c5f15fe0232c7488617b30b4d
Python
3,246
105
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Sep 24 09:37:30 2022 @author: pbolan """ import numpy as np import matplotlib.pyplot as plt from os import path, getcwd, makedirs import glob from skimage import io import cv2 as cv # Note some issues with opencv-python versions. U import nibabel as ni...
ebfffde5472ebae30e9e24ea7e3d23882a1fc57b8bce3dded68da35abc06049c
Python
3,246
76
from delete_col_expriment import * from model import * import warnings from param import * def train(args): similarity_feature = loading_similarity_feature(args) edge_idx_dict, g = data_preprocess(args) print("*************************starting the train*****************************") metri...
053821016f2b8603269bd0984fa4f0fb62e4d313d0bd27ec0eea5dd61af97f8b
Python
3,248
99
import pandas as pd import numpy as np import argparse from sklearn.model_selection import KFold import json import os def get_parser(): parser = argparse.ArgumentParser( description="Generate 5-fold CV splits (subject-based, expanded to contrasts). " "JSON contains train/val only, CSV...
1a52077b29d0df214bab8f7769398dbe32387f7af72260025f7c85fa64ea7355
Python
3,248
73
r"""Vendored PDBFixer — structure repair for molecular-dynamics preparation. `PDBFixer <https://github.com/openmm/pdbfixer>`_ (Peter Eastman, Stanford / Simbios) repairs experimental and predicted structures so they can actually be simulated: it builds missing residues and heavy atoms from residue templates, replaces ...
a15ce861edbd35f6ddf2b7257522f47caea2d943fb098dacb84f2e4db5713652
Python
3,248
93
import warnings from typing import Any, Iterable import numpy as np import pandas as pd from siapy.core.exceptions import InvalidInputError with warnings.catch_warnings(): warnings.filterwarnings( "ignore", category=DeprecationWarning, message="pkg_resources is deprecated as an API", ...
b26de9326351fd6987edbc112ad8ae5d200964b058b0b4c659b9968686e2f700
Python
3,248
99
""" 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 pytest from fairchem.applications.cattsunami.core.autoframe import ( AutoFrameTransfer, ...
b43049a3312d63747f079f5ad5e8fea2761a843553545b6e5ec4614d9e94c366
Python
3,248
91
import torch import torch.nn as nn import torch.nn.functional as F from timm.models.layers import DropPath, to_2tuple, trunc_normal_ class BlockV2(nn.Module): expansion = 1 def __init__(self, input_channels, output_channels, stride = 1, downsample = None): super(BlockV2, self).__init__() ...
52bbe2b76517f5df8ac9a25fff3763c4236c535d06663e379f4c7f460bf9d57d
Python
3,250
97
# -*- coding: utf-8 -*- """ Created on Thu Nov 4 14:04:15 2021 @author: Nikhil """ startTime = datetime.now() filename_raw = input("Enter filename without extention(.tif):") filename_full = str(filename_raw) + str(file_extention) sampling_interval_mins = input("Enter sampling interval (time in MINS bet...
87d66e510f43dc3a9ad3736c3ace910ea589c445a97790b5d3787b177fab01a7
Python
3,250
76
import math import torch import torch.nn.functional as F from mmengine.model.utils import stack_batch as mmengine_stack_batch from mmengine.utils import is_list_of def stack_batch(tensor_list, pad_size_divisor=1, pad_value=0, channel_conversion=False, m...
552f3ee725a6e31024eb15c6ff27aaf4c3aab0b6c741b49e6e124787f3333891
Python
3,251
102
from typing import Callable, Iterable from PyQt5.QtWidgets import QMessageBox, QFileDialog def notify_error(msg: str, title: str = "Error"): """Notify user of some error""" QMessageBox.critical(None, title, msg) def notify_warning(msg: str, title: str = "Warning"): """Notify user of some warning""" Q...
3ae66710d3fd6d59f16f6207558914ef1e02ac8bdda1d75dc75e7e2ad23ef154
Python
3,252
56
def identify_constitutive_alternative_exon(gene): ''' Aim: Define the exons as either constitutive (in majority/all of the isoforms) or alternative Constitutive here is defined as exons that are in the majority of the isoforms unless also specified in the UCSC genome browser basic annotation (i.e....
6cc3db01abc713cfb1427c8f4aa3052a6619fae565e9c01bfe8bb54c9607a0f4
Python
3,252
70
import os import pandas as pd import matplotlib.pyplot as plt annotations = ["refseq_ucsc"]#["chess", "gencode", "refseq_ucsc"] colors = ['blue', 'red', 'green', 'cyan', 'magenta', 'olive', 'black', 'gray', 'orange', 'purple'] os.makedirs("intron_sensitivity_precision", exist_ok=True) for library in ["polyA_STAR", "...
7252d1839bbc513c7e476f745b2e12a397e7c2a228579c5e396042bbd5a05d9e
Python
3,252
73
from get_Data import * from model import * import warnings from param import * def train(args): similarity_feature = similarity_feature_process(args) edge_idx_dict, g = load_fold_data(args) print("*************************starting the train*****************************") print("***************...
aafabcbe282f9b595b2f1c879182a6c6a7adbe35a15acf146f58bbbb51dd56f0
Python
3,252
41
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: user_defined_protos.proto # Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google...
cabd1ab8c8da43e9f547fe4755cd5d678becd5e44231bfbcedf1a22ddaf9a415
Python
3,252
101
import mdtraj import pytest from importlib_resources import files import endstate_correction from endstate_correction.protocol import BSSProtocol, AllResults from endstate_correction.protocol import ( perform_endstate_correction, NEQProtocol, ) from endstate_correction.simulation import ( EndstateCorrectio...
b9aeb31e63e1f17f5a429b60d1fea4cae125e2a7a406664773503e446d215c8e
Python
3,253
100
#!/usr/bin/env python3 """Utility functions for calculating / estimating correlation.""" import logging import numpy as np def calculate_margin_genes(X): from scipy.sparse import issparse margin = np.mean(X > 0, axis=0).copy() if issparse(X): margin = np.array(margin)[0] return(margin) def t...
68ee8f64903ba7552fbac8ee5b7aff5c1f85da45088381cde8e31a0dab18877a
Python
3,254
88
import numpy as np import pickle import argparse import tqdm from fastconv.corr1d import single_filter_multiple_data_correlate1D from jitter_stimulus_variance_fit_quality import construct_PSTH_gaussian_kernel def compute_flashed_repeats_psth(spike_trains: np.ndarray, psth_kernel: ...
d4a39b2535abeb52d55d6351c2d9a2c256514caee433853b3d612e979fe90f20
Python
3,254
55
"""Tensor-free, pickle-free inference for the bundled binary ExtraTrees model.""" from pathlib import Path import numpy as np class ToxicityPredictor: def __init__(self, path=None): path = Path(path) if path is not None else Path(__file__).with_name('etoxpred_model.npz') with np.load(path, allow_p...
7e51be438ba07cfc21693529e1f6147cf1e95f33e14d0ec0f8958ab846924436
Python
3,255
72
# -*- coding: utf-8 -*- """ Created on Fri Aug 20 11:37:52 2023 @author: xzhou """ import torch import torch.nn.functional as F def multi_contrastive_loss(embP, embM, embF,PP_adj,MM_adj,PM_adj,PF_adj,MF_adj,tau): loss = torch.tensor(0, dtype=float, requires_grad=True) loss = loss + P_con_loss(e...
444ca94973491f338cf434a12b2b84a4d5a76bfa5c5fc8acc10c04ac67af1605
Python
3,258
113
# ruff: noqa import packaging.version # Pydantic is a dependency of `ray["default"]` but not the minimal installation, # so handle the case where it isn't installed. try: import pydantic PYDANTIC_INSTALLED = True except ImportError: pydantic = None PYDANTIC_INSTALLED = False if not PYDANTIC_INSTALLE...
98b3f2c403d1f38de72f5aa242d2186106ec32b76edffb5a3c0f818798e1c45d
Python
3,258
106
import os import urllib.parse from pathlib import Path from typing import Union class URI: """Represents a URI, supporting path appending and retrieving parent URIs. Example Usage: >>> s3_uri = URI("s3://bucket/a?scheme=http&param=1") >>> s3_uri URI<s3://bucket/a?scheme=http&param=1>...
879ec131a8a83fadf3b8327b6e8643512c1f3aaf7c4a994da357c9d1bc3ee52b
Python
3,259
48
import numpy import mozaik import pylab from mozaik.visualization.plotting import * from mozaik.analysis.technical import NeuronAnnotationsToPerNeuronValues from mozaik.analysis.analysis import * from mozaik.analysis.vision import * from mozaik.storage.queries import * from mozaik.storage.datastore import PickledDataSt...
67ecf1db935cbe9390b79b62be49322b3401e30aa1cc3a5bae1508f5ff3e3a30
Python
3,260
115
import sys import re import numpy as np from utils import save_pickle, read_lines, write_lines, load_tsv from visual import plot_matrix, plot_labels, plot_label_masks from marker_score import get_marker_score def adjust_temperature(probs, temperature): logits = np.log(probs) logits /= temperature probs ...
53dfa4dd6feb06c33552565f36b2bfc8c4ae7416f0a70f94f4ca98fdb0e68eb5
Python
3,261
80
import pathlib path = pathlib.Path.cwd() if path.stem == 'tmb_survival': cwd = path else: cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')] import sys sys.path.append(str(cwd)) import numpy as np from model.model import Encoders, NN from model.layers import Losses import tensorflow as tf from skl...
c110f7818f3ddc0efb00daf263fc54413cfe39b2fabca189e8cc3e0aa6f9acc1
Python
3,261
80
import pathlib path = pathlib.Path.cwd() if path.stem == 'tmb_survival': cwd = path else: cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')] import sys sys.path.append(str(cwd)) import numpy as np from model.model import Encoders, NN from model.layers import Losses import tensorflow as tf from skl...
e657360c58dcd735e0b4d2580ef17f9aaa8a89a820476b6550f462ee0ec954e4
Python
3,264
105
"""Tools for manipulating dense matrices.""" import itertools import numpy as np import numpy.typing as npt #import utils_find_1st as utf1st from skimage import morphology def _get_pad(shift: int) -> tuple[int, int]: return (0, -shift) if shift < 0 else (shift, 0) def _get_slice(shift: int) -> slice: if sh...
0f551f024912510744875857dbc7c40b45558ac9cd6e6e273353f139e5f61083
Python
3,265
99
import numpy as np import matplotlib.pyplot as plt import os import struct import gzip def download(): ''' Download files from url ''' os.makedirs(f"{DownloadDir}", exist_ok=True) os.system(f"wget -nc -P {DownloadDir} {url}") os.system(f"unzip {DownloadDir}/gzip.zip") os.system(f"mv gzip/* ...
15c49c6960d2e5c7a8518d2844fce9dbc153be5955565978cf1bf41607633979
Python
3,265
99
# Copyright (c) 2017-present, Facebook, 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...
1aa777ff89a519abcbf68c28cc6fae011198604cfb68c3881421aacc902f9be1
Python
3,265
109
import numpy as np from torch.utils.data import DataLoader, Dataset import scanpy as sc import pandas as pd import torch import sys sys.path.append('..') from ..VAE.VAE_model import VAE from sklearn.preprocessing import LabelEncoder def load_VAE(vae_path, num_gene, hidden_dim): autoencoder = VAE( num_gen...
2cfcf8ca339297f28af32b0ba043ddaea5bb0978ffa72abf3c3732d3cb85a889
Python
3,265
73
from delete_row_expriment import * from model import * import warnings from param import * def train(args): similarity_feature = loading_similarity_feature(args) edge_idx_dict, g = data_preprocess(args) print("*************************starting the train*****************************") print("**...
732ca499f2a3a0ae6d3657779082df4285a84c2dddbfbe052ab11ef0b9568f15
Python
3,265
116
import numpy as np import tonic import torch import torch.nn as nn from sinabs import layers, set_batch_size from sinabs.backend.dynapcnn import DynapcnnNetwork from sinabs.backend.dynapcnn.chip_factory import ChipFactory from sinabs.nir import from_nir import nir def xytp_collate(batch): samples = [] target...
99c51e7da10e0a87d601852654079f62c4acd2a6ba2ef4a08e61541db4a86f9d
Python
3,266
71
#!/usr/bin/python import sys sys.path.insert(0,'../') import nibabel as nib from mdgru.helper import argget import shutil import os.path import numpy as np def create_example_nifti_data(**kw): shape = argget(kw, "shape", (100, 100, 40)) border_edges = argget(kw, "border_edges", [[30, 70], [30, 70], [10, 30]])...
dab6f8d1afc4d045105359863fb53438499fd3ad491d2580f17ce28b0de93213
Python
3,266
73
from delete_col_expriment import * from model import * import warnings from param import * def train(args): similarity_feature = loading_similarity_feature(args) edge_idx_dict, g = data_preprocess(args) print("*************************starting the train*****************************") print("**...
6debb863af96458ac26659f53cd881c10265a236721a812efea7826055c3969e
Python
3,267
99
# -*- coding: utf-8 -*- import copy import numpy as np import pytest from nilearn.image import new_img_like from nilearn.maskers import NiftiMasker from fmralign.pairwise_alignment import PairwiseAlignment from fmralign.tests.utils import ( assert_algo_transform_almost_exactly, random_niimg, zero_mean_coe...
75c5cdbec4592a6812f3f373f7eda91813c67b042d3e798e271784ce8dd7c9e6
Python
3,267
41
import numpy import mozaik from mozaik.visualization.plotting import * from mozaik.analysis.technical import NeuronAnnotationsToPerNeuronValues from mozaik.analysis.analysis import * from mozaik.storage.queries import * from mozaik.storage.datastore import PickledDataStore def perform_analysis_and_visualization(data_...
a90ad3357a7a93d9f5d1224bfad0dbd1bbdd130938d5c50b3959e4c3b5ad22de
Python
3,267
105
""" 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 numpy as np import pytest import torch from fairchem.core.datasets import data_list_collater fr...
cbf165850c0650fb1c3ad065ea63a1e9776279c2929dc31d5b64ab624c0e4e41
Python
3,268
104
# 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 -------------------------------------------------------------- import o...
e7ede91e7b33b5b830103f3bcda0874092cc405a3081334f1d71ad113e89db86
Python
3,268
46
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: i_common.proto """Generated protocol buffer code.""" from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool...
ba13916fcbd07247225d62edf2cb3efc35b80646017d3ac0daa4c65cec620283
Python
3,270
105
import time import numpy as np import networkx as nx import matplotlib.pyplot as plt from .forceatlas2 import ForceAtlas2 def test_multithreading(): """Test and benchmark the multithreaded implementation of ForceAtlas2""" # Create a random graph n_nodes = 500 n_edges = 2000 G = nx.gnm_random_graph(...
1f3034b374637f34d8f87efd930fc0e8d54f3f6038dfbf74a8464faadbeae6fe
Python
3,272
95
from functools import wraps from typing import Any, Callable, TypeVar T = TypeVar("T") def context_aware_cache( func: Callable[..., T] = None, context: Callable[[Any], Any] = lambda self: None ) -> Callable[..., T]: """ Decorator to cache the result of a method based on its arguments and context. Ar...
a07ee91e6b57c1b13f3a57c081a150501d3eca61afedcdd63b62fb35f009645c
Python
3,273
80
import pathlib path = pathlib.Path.cwd() if path.stem == 'tmb_survival': cwd = path else: cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')] import sys sys.path.append(str(cwd)) import numpy as np from model.model import Encoders, NN from model.layers import Losses import tensorflow as tf from skl...
ba629a0f6e57cf2cd224063dc8a281f1c43616f29216b676d788e0fb8fc1eb61
Python
3,273
80
import pathlib path = pathlib.Path.cwd() if path.stem == 'tmb_survival': cwd = path else: cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')] import sys sys.path.append(str(cwd)) import numpy as np from model.model import Encoders, NN from model.layers import Losses import tensorflow as tf from skl...
71c884e837acb96cf7105a7857ec01f78ac64b23c7af5304dabfeb2e4940d3ce
Python
3,274
106
"""K-means backend — trivial baseline. Each k-means cluster is treated as one metacell; the cluster centroid is the codebook entry, which gives free out-of-sample assignment via ``predict()``. """ from __future__ import annotations import time from typing import Optional import numpy as np from .base import FitRes...
34708f39ca462b9f8f8461e369672b2b98cf5d50f2213cbe58e05d116f40c7c6
Python
3,275
74
import argparse import os import torch import numpy as np import torchvision.transforms.functional as tvf import matplotlib.pyplot as plt import kornia import cv2 import imageio from wave_optics import * from holograms import * import warnings import pandas as pd warnings.filterwarnings("ignore") def apply_clip_and_no...
546cea1f55c48725ebb7f6ab704cf2f388eb579ef87723da06956f2dbf639b53
Python
3,275
92
import torch from ..distances import CosineSimilarity from ..reducers import DivisorReducer from ..utils import common_functions as c_f from ..utils import loss_and_miner_utils as lmu from ..losses.base_metric_loss_function import BaseMetricLossFunction from ..losses.mixins import WeightRegularizerMixin # adapted fr...
70c3779bf80cd777f6fed7ee5c5f018bf2c678f2f44c40294235119866a9135f
Python
3,275
113
""" Minimal working example for shotgun VAE using unwarped birdsong. 0) Define directories and parameters. 1) Tune preprocessing parameters. 2) Train the VAE. 3) Plot. 4) The world is your oyster. """ from itertools import repeat from joblib import Parallel, delayed import numpy as np import os from ava.data.data_c...
729136f018c8da79e805f75e6be72720df0257f08274c83bc585bbe1c8d3700e
Python
3,275
110
import numpy as np from torch.utils.data import DataLoader, Dataset import scanpy as sc import torch import sys sys.path.append('..') from ..VAE.VAE_model import VAE from sklearn.preprocessing import LabelEncoder def load_VAE(vae_path, num_gene, hidden_dim): autoencoder = VAE( num_genes=num_gene, ...
9768adca8a8e048e4f031a114a5c556b596b3b6a948e350d0bfca45ac679ddce
Python
3,275
98
# Copyright 2023 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, ...
9a3b1ad9e5c0046519388f1215899611560b90fbd2b250feb255569b4a381524
Python
3,278
80
import sys import scipy.io as sio import os import numpy as np from scipy import special import h5py if __name__ == "__main__": data_ind = int(sys.argv[1]) # 3 # list_data_names = ['blood_vessel_10Hz', 'PFC4_15Hz', 'bma22_epm', 'CaMKII_120_TMT Exposure_5fps'] list_ID_part = ['_part11', '_part12', '_part...
fd5a2d776d753904ce20d39fb14c0438eebf636b0e6e4894dc526ff891487204
Python
3,278
102
# built-in dependencies from typing import Any, Union, List, Tuple # 3rd party dependencies import cv2 from numpy.typing import NDArray # project dependencies from deepface.models.Detector import Detector, FacialAreaRegion class FastMtCnnClient(Detector): """ Fast MtCnn Detector from github.com/timesler/fac...
5784dea1ce1ac7efcdf19e230b0b52490299ded41bcc099507a1f694cf6d9fc3
Python
3,279
86
import torch from ..utils import common_functions as c_f from ..utils.module_with_records_and_reducer import ModuleWithRecordsAndDistance class BaseMiner(ModuleWithRecordsAndDistance): def mine(self, embeddings, labels, ref_emb, ref_labels, species, mnn, setting): raise NotImplementedError def outpu...