sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
58591e8dff9db78fa3fca1132d96a080fab0a7bdb16e35f4c2d963931cc11f25 | Python | 3,307 | 94 | import torch
from torch.utils.data import Dataset
from collections import OrderedDict
import numpy as np
from scipy.integrate import solve_ivp
import os, shelve
MAX = np.iinfo(np.int32).max
from CEL.utils.register import register
from .meta_dataset import DatasetRegistry
@register.dataset_register
class ReactionDiffu... |
8d7479f99fcbfbd3e923f0103f008efc9b5a8630e712aa55e74cdaf1336a9eac | Python | 3,307 | 76 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2023/9/28 9:58
# @Author : zhangchao
# @File : spatial.py
# @Software: PyCharm
# @Email : zhangchao5@genomics.cn
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GCNConv, VGAE
from torch_geometric.utils imp... |
e5f9ec2e0caa146e59edfb2944805b5274b88167ed59df025acc2d5845867bf5 | Python | 3,307 | 92 | import torch
from torch import nn
from utils import RBFExpansion
from transformer import ComformerConv, ComformerConvEqui, Gradient_block, Piezo_block, Elastic_block
from torch_scatter import scatter
def bond_cosine(r1, r2):
bond_cosine = torch.sum(r1 * r2, dim=-1) / (
torch.norm(r1, dim=-1) * torch.norm... |
e720251addc39943e71afac3108433f256f7d793c19ff05968699c813427d085 | Python | 3,307 | 72 | # -*- coding: utf-8 -*-
#########################################################################
# File Name: susie_finemap.py
# Author: Ruo-Han Hao and Feng Jiang
# Last Modified: 2023-01-08
# Description: perform finemapping using susieR
# Usage: python susie_finemap.py -o [outdir] -d [gwas_dict] -c [coverage] -j [t... |
bdfe574dfc09ce15e47a09a5953a74baaa3867625aed1b6ec7a9b5118703505e | Python | 3,313 | 86 | # Raktim Mitra (timkartar7879@gmail.com, raktimmi@usc.edu)
# Contributions by Jared Sagendorf
# third-party modules
import numpy as np
class Graph: #store a graph in adjacency list form
def __init__(self, vertices):
self.V = vertices
self.adj_list = [[] for i in range(self.V.shape[0])]
... |
7f47da0efc40927162c15a0840bc6b93cb4352d53f5798523fb2627677473d9f | Python | 3,314 | 88 | # Written by Xi Cheng (xicheng@simm.ac.cn)
import os
import sys
import numpy as np
import MDAnalysis as mda
from MDAnalysis.analysis import distances
import pymol2
from pymol import cmd
from src.glycan import get_glycans
from src.glycan import get_bound_ligands
from src.glycan import get_full_glycan_mol_list
... |
800329db5264ffdb46e385d52457a4b90185274d15de25f28396a6fb44ea3641 | Python | 3,316 | 119 | import datetime
import logging
import os
import ssl
import hydra
import pytorch_lightning as pl
import wandb
from omegaconf import DictConfig, OmegaConf
from pytorch_lightning import loggers as pl_loggers
from pytorch_lightning.callbacks import LearningRateMonitor, ModelCheckpoint
from src import PROJECT_DIR
from src... |
51b55618fb209bce1e69f2911b367963da549d930f5eef1b1125cd19a26586ae | Python | 3,317 | 100 | """Entrypoint to using [middleware](https://docs.langchain.com/oss/python/langchain/middleware) plugins with [Agents](https://docs.langchain.com/oss/python/langchain/agents).""" # noqa: E501
from langgraph.runtime import Runtime
from langchain.agents.middleware._trace_policy import configure_trace_policy
from langch... |
155b42050d22b58726b42c90e1ce6eaee2bd0f5055eb7351595d1a2298a2634d | Python | 3,319 | 90 | """
Density synthesis: map GTO values and per-orbital coefficients to probe density.
``linear`` (default):
Basis psi_j = phi_j, coefficient c_j, rho = sum_j c_j psi_j(r)
``squared``:
Basis psi_j = phi_j^2, coefficient d_j (d >= 0), rho = sum_j d_j psi_j(r)
Underlying GTO exponents are scaled by ``SQUARED... |
195d450d36a7fdde8078a3ee8a48fc3577b602d48d58d4effbfb68ae55cd7a27 | Python | 3,319 | 96 | import os
from tqdm import tqdm
from natsort import natsorted
import subprocess
import json
import argparse
def parsing_data():
parser = argparse.ArgumentParser(
description='Conversion NRRD SEG into DICOM SEG')
parser.add_argument('--path_nrrd',
type=str,
... |
9cf4ca18a73970d579907a80833433236e90a9ca8728642c68d5c0a707c0adeb | Python | 3,319 | 72 | import sys
import os
import argparse
from get_predictions import predict, load_model, parse_args
import time
parser = argparse.ArgumentParser()
parser.add_argument('--task_index', type=int, default=0)
parser.add_argument('--pymol_exe', type=str, default="/Applications/PyMOL.app/Contents/MacOS/PyMOL")
parser.add_argume... |
c0cf96d08c678d162dc351cc7ff89181a8e2c1482ea737582634076aa4ab9c6d | Python | 3,319 | 85 | # this script count the result based on detectron2 inference
#
import argparse
import os
import random
import time
import warnings
import pickle
import numpy as np
import math
import sys
import copy
import re
import pandas as pd
import json
#
datapath='./'#./
restab=pd.read_csv(datapath+"segmentation.txt",delimiter=","... |
32a9681286481c36dc9f24f77e38031f3f67a1ae10ad4f9462300ffe7b1d8530 | Python | 3,324 | 95 | import numpy as np
import pandas as pd
from scipy import stats
from sklearn.linear_model import LinearRegression
from pgmpy.utils import preprocess_data
from ._base import BaseCITest, _CITestResult, _ResidualMixin
class GCM(_ResidualMixin, BaseCITest):
r"""
Generalized Covariance Measure (GCM) [1] test for ... |
d4a30eee1477216f52393b9d2e9b37bf59ce12fede02de1220f3b6bd626bee0c | Python | 3,324 | 91 |
import argparse
import os
import csv
import torch
import torchvision.datasets as datasets
import torchvision.transforms as transforms
import torch.utils.data
import numpy as np
from sklearn.metrics import average_precision_score, precision_recall_curve, accuracy_score
from networks.resnet import resnet50
from tqdm i... |
15fd05a7475212406f3a88c08ca52d5900c76dd55444329f56a587afc3c143c7 | Python | 3,325 | 94 |
"""
Test Cython and weave mixing code.
"""
import copy
import numpy as np
import scipy.stats as stats
def mix_replicas(n_swaps=100, n_states=16, u_kl=None, nswap_attempts=None):
"""
Utility function to generate replicas and call the mixing function a certain number of times
Arguments
---------
... |
6c60fc3d0b4dcf0c46e4ee3f7744d0e0d30ae100dc43514470a9b0d6077bccd9 | Python | 3,325 | 84 | # Loads in weights and evaluates model (ECE, MCE, error rate) and saves logits.
import keras
import numpy as np
from keras import optimizers
from keras.datasets import cifar10, cifar100
from keras.models import Sequential
from keras.layers import Conv2D, Dense, Flatten, MaxPooling2D
from keras.callbacks import Learnin... |
745139db3fe05a3050a5379f327e6c743848beef55cab8955e5dbb3d10cd0e42 | Python | 3,325 | 99 | import re
from langchain_core.agents import AgentAction, AgentFinish
from langchain_core.exceptions import OutputParserException
from typing_extensions import override
from langchain_classic.agents.agent import AgentOutputParser
from langchain_classic.agents.mrkl.prompt import FORMAT_INSTRUCTIONS
FINAL_ANSWER_ACTION... |
7ac3924b91d9b06971d538cada68372569b5dd616393279ac00f021b82d01bfc | Python | 3,328 | 97 | # MLP model
import tensorflow.keras as keras
import tensorflow as tf
import numpy as np
import time
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
from utils.utils import save_logs
from utils.utils import calculate_metrics
class Classifier_MLP:
def __init__(self, output_directory, input... |
c505bdd224c687801cebc79d1eb3362a9cd48d44285dd83c405b5a334ba80678 | Python | 3,328 | 67 | import gzip
import pickle
import argparse
from sklearn.model_selection import train_test_split
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Split CIF data into train, validation, and test sets.")
parser.add_argument("name", type=str,
help="Path to the file w... |
296394fcb0caeac7cab1d86abe191cfeb2279b141b00e8c6bda68521be107614 | Python | 3,331 | 117 | import json
import pickle
import sys
import numpy as np
import torch
import utils # noqa: E402
from dopp import DynamicFeedForwardCell # noqa: E402
from sim import (_compute_input_potentials, _compute_input_rates, # noqa: E402
_compute_preferred_angles)
sys.path.insert(0, "../fig5_orientation_est... |
b2efb7522194557a42f97afa8db02a2677736f0deb102c1956944a5d5de74a50 | Python | 3,333 | 85 | from typing import Any
from langchain_core.language_models import BaseLanguageModel
from langchain_core.messages import SystemMessage
from langchain_core.prompts.chat import MessagesPlaceholder
from langchain_core.tools import BaseTool
from langchain_classic.agents.agent import AgentExecutor
from langchain_classic.ag... |
86f57f2c0a2a77d74ad795fa44f3b09a8b6682087cb92c1334945e053a7b6092 | Python | 3,336 | 106 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
a2bd5a9f08089c0cd7334a023414032de9a7ac979f2ff819dbace9a52d88737a | Python | 3,336 | 98 | import pyqtgraph as pg
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import pyqtSignal, QThread
from pyqtgraph import PlotWidget, plot
import pyqtgraph as pg
import sys
import socket,os
NB_NRN = 512
DATAWIDTH_BIT = 32
DATAWIDTH_BYTE = int(DATAWIDTH_BIT/8)
NB_REGS_SPK ... |
0ff17390c601ff6f98ef62b1074d94e4f0f32eba077bf52cc481d331e1837a92 | Python | 3,337 | 87 | import tensorflow as tf
class RegressionMetrics:
"""
Note: A significant portion of the code is adapted from dimenet (https://github.com/gasteigerjo/dimenet).
"""
def __init__(self, tag, targets, ex=None):
self.tag = tag
self.targets = targets
self.ex = ex
self.loss_me... |
f043857b03afb5f7e7d652e281d9b8be0b782389cc9959156b56f569146cfda1 | Python | 3,337 | 89 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
0bba7e1729756cff908cf2fd0525f30f13d536736d018207a74734db63ec941b | Python | 3,338 | 94 | """
Author: Anna M. Puszkarska
SPDX-License-Identifier: Apache-2.0
"""
import time
from pathlib import Path
import numpy as np
import pandas as pd
from peptide_models.aminoacids import AMINOACIDS
from peptide_models.utils_data import fasta2df, get_peptides, reformat_frame
from peptide_models.utils_models import get_... |
289a16732b96abc610dc05d3243d9a5edb23d74907eec524258afd6d5362a973 | Python | 3,338 | 113 | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from torch import nn
import torch.nn.functional as F
class GHM_Loss(nn.Module):
def __init__(self, bins=10, alpha=0.5):
'''
bins: ... |
42564ced4a6c80eaa725f02f3127083058ef0c7b8ece4e96e0b29ee6a2890937 | Python | 3,339 | 100 | # 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... |
0c8f4b5130ea6f8d23923f7f8b1e0394fc6edf20ec85d46b661f23b20b90088b | Python | 3,341 | 105 | """
##############################################################################
#
# Split the ID index field into two additional columns: motif | region
#
# AUTHOR: Maciej_Bak
# AFFILIATION: University_of_Basel
# AFFILIATION: Swiss_Institute_of_Bioinformatics
# CONTACT: wsciekly.maciek@gmail.com
# CREATE... |
4061a6f7f82da69df15f934f4140b1fc14c3b596f356890a91a97e126131626b | Python | 3,341 | 46 | """Figure 10: GBDT ablations. (a) anchoring reference length K0 (0 = cycle index only) under P3 and P4;
(b) number of source datasets under P4 (all subsets, mean over held-out sets); (c) learning curve over source cells under P4."""
from __future__ import annotations
import os, sys
import numpy as np, pandas as pd, mat... |
0a81c162bb906ce0a6acae530ba5bcda33a51aa0fe8ab21a6fdd7d30f929b686 | Python | 3,342 | 89 | # This file is a part of the `allegro` package. Please see LICENSE and README at the root for information on using it.
from math import pi
import torch
from e3nn.util.jit import compile_mode
from nequip.utils.global_dtype import _GLOBAL_DTYPE
@compile_mode("script")
class PerClassSpline(torch.nn.Module):
"""Modul... |
095e8464f390c796b306e4c976e248c611e704e609edd6546637ddc2fc86eb4a | Python | 3,343 | 94 | # convert atomistic model to image
import time
import numpy as np
import pandas as pd
from scipy import spatial
class convert_image():
def __init__(self, number_of_cpus):
self.number_of_cpus = number_of_cpus
pass
def crop_ball_data(self, vacancy_id, vacancy_coordinates,... |
f808f7592fae5b7e0551726f2fe9a8725493d8abc2d2709c1aa758620abab238 | Python | 3,345 | 63 | import os
import random
import tensorflow as tf
import tensorflow.keras.backend as K
import tensorflow.keras as keras
from sklearn.metrics import f1_score, precision_score,recall_score,accuracy_score
from tensorflow.keras.applications import VGG16,VGG19, ResNet50,InceptionV3,Xception,ResNet50V2,DenseNet121,EfficientNet... |
8cff1b276e2b1ed15d5e830ceb988f50b44beb6f7374afc9fd67fbef3417b2cf | Python | 3,347 | 105 | ###########################
# Latent ODEs for Irregularly-Sampled Time Series
# Author: Yulia Rubanova
###########################
import os
import numpy as np
import torch
import torch.nn as nn
from torch.nn.functional import relu
import lib.utils as utils
from lib.latent_ode import LatentODE
from lib.encoder_decod... |
767ada0e84fc7e113b39d8c6d46dbe99ebd00e633932938ad98aa3e4624b2979 | Python | 3,348 | 116 | import os
import pytest
import yaml
from click.testing import CliRunner
from pkg_resources import resource_filename
from perses.app.cli import cli
@pytest.fixture
def default_input_yaml_template_cli():
test_yaml = """
protein_pdb: Tyk2_protein.pdb
ligand_file: Tyk2_ligands_shifted.sdf
old_ligand_ind... |
864c9b38fa322272a6469f85e8b28b417565ef388231412bf3a7e63fd9d398ea | Python | 3,348 | 74 | """ Module for Functional Enrichment Analysis.
This OmicScope module is totally dedicated to Functional Enrichment
Analysis of Omics Experiment.
In this workflow we used GSEApy algorithm to
get two main analysis: Over-Representation Analysis and Gene-Set Enrichment
Analysis. For both cases, GSEApy runs the analysis a... |
eda27293e8383de831504b7afe41dac58f049c379b3539909c0e15057e27f505 | Python | 3,349 | 109 | import logging
import os
import socket
import sys
import matplotlib.pyplot as plt
import matplotlib.colors
import pandas as pd
import seaborn as sns
from configs.configs import get_config_dict
from helpers.figures import get_palette
def plot_i2c2_bar(
config_dict: dict,
metric: str = 'correlation',
figu... |
4463152900ed1b7d0d472f30a9d2c1fb6cbcee2edde95b67822aa410d48715b6 | Python | 3,354 | 137 | import h5py
import numpy as np
from tempfile import TemporaryFile
import os
import tensorflow as tf
#import pickle
import random
from pathlib import Path
import matplotlib.pyplot as plt
from tqdm import tqdm
gh = []
l = []
labels = []
label = []
k = []
la = []
masks = []
images = []
f = []
pa = Path("D:/ICAD_Projekt/AI... |
08769495437379eb33be0b3eb35115a91138372b74fac4141cebe50e87d543bf | Python | 3,357 | 88 | from collections.abc import Hashable
from math import lgamma
import numpy as np
from scipy.special import gammaln
from pgmpy.structure_score._base import BaseStructureScore
from pgmpy.utils import encode_columns, get_state_counts_array
class K2(BaseStructureScore):
r"""
K2 structure score for discrete Bayes... |
2965af927c489af0957c8990f3ab42fa6eb206dd5bdb5030cce74aa9afa8f096 | Python | 3,359 | 119 | import csv
import os
class OptimizationLogger:
"""
A class for logging optimization iteration information and generating reports.
Attributes
----------
path : str
File path to the directory where log files and reports are saved.
verbose : boolean
Flag to print logs to standard... |
171877fa9237045832b534bc3209349c2016e31d06e4bca000cb6802987ed01c | Python | 3,360 | 53 | #TO BE UPDATED
import numpy as np
import scipy
from WeightModel.WeightClass import weightClass
from InitFunctions import gaussian
class lebastard(weightClass) :
parameters = {'save' : False,
'Cpre': 1., 'Cpost' : 2., 'tCa' : 20.,
'gammap' : 110., 'gammad' : 321.,'tau_rho' : 30.... |
796286017a8f1142928787b10c42b661c05dbbece60da9c8e2921cab3e2a7b09 | Python | 3,360 | 130 | import numpy as np
import scipy.sparse as sp
import pickle
####################################################
# This tool is to generate meta-path based adjacency
# matrix given original links.
####################################################
path_datapiar = '../../../CAME/brain_mouse_human_no_threshold/datapai... |
044c030e0b0180ebb957a9f7b2718fafd2e3a3ba1c82d3e5d4b50341e7f308de | Python | 3,363 | 97 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Visualization tooling."""
def plot_registration(anat_nii, div_id, plot_params=None,
order=('z', 'x', 'y'), cuts=None,
estimate_brightness=False, label=None, ... |
a4466c8657e1ed05cad1c512cdac73a1a051e0c0d683ab3c34eab4e49849cc4e | Python | 3,367 | 89 | # Take 1 cell-type, say inkt
# Take its metadata for everything: training, testing, dev
# Make a pandas df with gene and category
# Then for each of the other samples, join gene and category.
# merge by gene
# Sconda conda activate TensorFlow_CPU_01
# cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/Fo... |
adcbaea2045fade8d9a73f2a27f2f34e419af6c093ea82132e27e9ed44ccffc3 | Python | 3,369 | 91 | import sys
sys.path.append(".")
import os
import argparse
import tarfile
import pickle
import torch
from pymatgen.core import Element
from crystallm import (
CIFTokenizer,
GPTConfig,
GPT,
)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Extract learned embeddings.")
par... |
b828fe7c339c38e1761a3bbeae30709eaa7892f3c94bf15aaba6eb32940ddc9d | Python | 3,370 | 85 | from __future__ import annotations
from typing import TYPE_CHECKING
from langchain_core.callbacks.base import BaseCallbackHandler
if TYPE_CHECKING:
from langchain_community.callbacks import LLMThoughtLabeler
from streamlit.delta_generator import DeltaGenerator
def StreamlitCallbackHandler( # noqa: N802
... |
335b2c80ca883482d4340c321d130452170ec45869f06b90a5d22f700d844385 | Python | 3,372 | 88 | import pandas as pd
from itertools import product
hand_landmarks = {0:'wrist',
1:'thumb_cmc',
2:'thumb_mcp',
3:'thumb_ip',
4:'thumb_tip',
5:'index_finger_mcp',
6:'index_finger_pip',
7:'... |
1afce48d33df096fa2cba608bf016fbe45ab0b7d978078b2f66bad731f71af84 | Python | 3,373 | 108 | from typing import Iterable, Optional, Tuple, Union
import torch
import torch.nn.functional as F
from bindsnet.network import nodes, topology
class PermuteConnection(topology.AbstractConnection):
# language=rst
"""
Special-purpose connection for emulating the custom ``Permute`` module in
spiking neu... |
44886d558854e78103b91199197788433216bce42aaa4714ba3f8abfb082ff0b | Python | 3,373 | 96 | from unittest.mock import patch, mock_open
import pytest
from animalai.envs.environment import AnimalAIEnvironment
from animalai.envs.arena_config import ArenaConfig
from mlagents_envs.mock_communicator import MockCommunicator
from mlagents_envs.base_env import BatchedStepResult
arena_config_yaml = """
!ArenaConfig
a... |
564c87a960de2c889cf54f38d7814615561b20559a34c7338266b0f1bf467b4b | Python | 3,373 | 86 | import numpy as np
from tqdm import tqdm
import torch
import torch.nn as nn
import torch.nn.functional as F
from engine import utils
from engine.arg_handler import get_combined_args
from engine.base_classifier import SupervisedClassifier
class ExperimentRunner(SupervisedClassifier):
def __init__(self, args):
... |
dcea8d1ac1b8d4d6f8601bfb85562ca464a785820c4b50290f89d50889cf0623 | Python | 3,373 | 85 | import torch
class ExponentialMovingAverage:
"""
Maintains (exponential) moving average of a set of parameters.
"""
def __init__(self, parameters, decay, use_num_updates=True):
"""
Args:
parameters: Iterable of `torch.nn.Parameter`; usually the result of `model.parameters(... |
1e5a9509c04dcfb99a4ae97339547da19b2d2332482900d65534fa690bbeabbd | Python | 3,374 | 86 | # Dont forget the / at the end of the paths
# unzip data to these folders
CHEXPERT_DIR = '/cluster/projects/mcintoshgroup/CheXpert-v1.0-small/'
MIMIC_DIR = '/cluster/projects/mcintoshgroup/MIMIC-CXR/MIMIC-CXR/physionet.org/files/mimic-cxr/2.0.0/files/'
NIH_DIR = '/cluster/projects/mcintoshgroup/NIH-14/'
CXRAY_SZ = 320... |
3df71dead47205569a0012c10ae5637fc0dbe4bf1b82411988043e24a77a7f83 | Python | 3,375 | 93 | from unittest import TestCase
import torch
from chroma.layers.norm import MaskedBatchNorm1d
class TestBatchNorm(TestCase):
def test_norm(self):
device = (
torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
)
B, C, L = (3, 5, 7)
x1 = torch.randn... |
4149f53fe869f2c1a48010ad920fa1881360ced521d2947a75ab2fcc1f15bb1a | Python | 3,375 | 66 | """Transform scanner-RAS atlas meshes to native RAS using the registration pull map."""
from __future__ import annotations
import argparse
import shutil
from pathlib import Path
import sys
if __package__ in (None, ''):
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
import numpy as np
import SimpleI... |
7d2c704156ce180dabe275cb8495411937e0402be24ff17b6119ae199ffaf9b9 | Python | 3,375 | 97 | # Copyright (c) MONAI Consortium
# 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, so... |
a624de684a195b129568ef33279cfd0ba389e181fb6a4a06a27da5f096c394a3 | Python | 3,376 | 114 | #!/usr/bin/env python3
import numpy as np
import voxcell as vc
import sys
def bbox(dat, bbmin, bbmax):
bbox = dat
bbox = bbox[:, :, range(bbmin[2], bbmax[2] + 1)]
bbox = bbox[:, range(bbmin[1], bbmax[1] + 1), :]
bbox = bbox[range(bbmin[0], bbmax[0] + 1), :, :]
return bbox
atlas_hierarchy = sys.... |
7ea040b6e146a984ec1ee8f77e98cedce914046b820425a37ed9f0c16b20d4a1 | Python | 3,377 | 82 | # Sconda conda activate TensorFlow_CPU_01; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/FCDNN/results/genes_per_category; python
# Check total genes per category for the three classes:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import os
C=2
split = 'Balanced'... |
97e6925d584201e9abd0ee4f06c0d30e12722d9aded406b3089142a36916aea0 | Python | 3,378 | 107 | # Copyright 2020 DeepMind Technologies Limited.
#
# 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... |
9ee0952265f9dccbf04a20998d5abd4eb86e32c856ff90a139178dc22a62cb87 | Python | 3,379 | 104 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
03ad3c52271b2c7aeaf3d9be49d6bf6c55a657baa9b9af63a60411bbaeb6d9e7 | Python | 3,380 | 82 | """ Module for Functional Enrichment Analysis.
This OmicScope module is totally dedicated to Functional Enrichment
Analysis of Omics Experiment.
In this workflow we used GSEApy algorithm to
get two main analysis: Over-Representation Analysis and Gene-Set Enrichment
Analysis. For both cases, GSEApy runs the analysis a... |
2c1c03fce755b026195e8bffb7d27e2e84fccd3ccc9073e52049b0d43a056ad7 | Python | 3,381 | 79 | import argparse
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import scipy as sp
import scipy.stats
import pyemma
from pyemma.util.contexts import settings
import MDAnalysis as mda
# My own functions
from pensa import *
# -------------#
# --- MAIN --- #
# -------------#
if __name__ =... |
e7ec7632d858f70a9def24435753cdbbb0c4cb921b13e0ed6ae5f363bc34200a | Python | 3,382 | 91 | import os
import pandas as pd
import random
import cv2
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import yaml
from PIL import Image, ImageDraw, ImageFont
from scipy.signal import butter, filtfilt
def xywhn2xyxy(x, w=640, h=640, padw=0, padh=0):
... |
061dd85651f2dad3a93447c44580a94921a1d6bb9fe29ed2c962e703231fa852 | Python | 3,383 | 89 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
6c6e076f4fb431d6935e63f0d1b1023d04d8e510086d858770bca29a548ea15f | Python | 3,385 | 105 | import matplotlib.pyplot as plt
from prettyplot import *
import h5py
import os
import numpy as np
# TYPE CHOICE
'''
type choice = 'sol' : solution (Number of ions, Gating variables, Volumes)
'phi' : membrane potentials
'E' : reversal potentials
'''
# VAR CHOICE
'''
for type =... |
8d4dec858d728307210b689511308cddfe9da93e62388c4646374976581e06dd | Python | 3,386 | 103 | import multiprocessing
import platform
import tempfile
import time
from pathlib import Path
import pytest
import requests
from astrocast.app_analysis import ExploratoryAnalysis
from astrocast.app_preparation import Explorer
from astrocast.detection import Detector
from astrocast.helper import EventSim
from astrocast.... |
3c79889e91c93ccb1200b1818c5675bcd10b59673e904722f42703b2ed35c326 | Python | 3,387 | 82 |
# pnabind packages
from .data import data
from .get_atom_kdtree import getAtomKDTree
def getSAP(structure, distance=5.0, ns=None,
bonds=None, residue_hydrophobicity=None, standard_area=None, side_chain_atoms=None,
area_key='sesa', impute_hydrogens=False, feature_name='sap'
):
# Reads in the ... |
8e1bfc58c28eb955c4b17570ec5402d62060ba37543923c023289667dcb6600b | Python | 3,387 | 115 | import numpy as np
from tensorflow.keras import Model
from tensorflow.keras.layers import Dense, Input
from explainability import LRP
from explainability.model.utils import remove_activation, remove_sigmoid, \
remove_softmax
def test_remove_softmax():
input = Input((10,))
... |
6789294b21a2159e98d9a6062509030032029c8debd769e1c5096782f2099af9 | Python | 3,389 | 105 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp,... |
bf7ca0622d33a6e12cbd61351c68e9cde3655043e7c7a272e02ef810f8a9afcc | Python | 3,389 | 95 | from keras.models import Model
from keras.layers import Input, Dense, LSTM, Masking, Dropout
from keras.layers.wrappers import Bidirectional, TimeDistributed
from mimic3models.keras_utils import LastTimestep
from mimic3models.keras_utils import ExtendMask
class Network(Model):
def __init__(self, dim, batch_norm,... |
071fdd62303def1e0c0fee9e1538b3ad113c76edc63199ea659b9fa30c34c153 | Python | 3,390 | 109 | import pytest
from pathlib import Path
from src.models.results import PredictionResult
from src.prediction_result_file import PredictionResultsFile
from src import errors
@pytest.fixture
def create_n_mock_results():
"""
Returns a fixture that creates n mock results
"""
def _create_n_mock_results(n):
... |
c6faf41550bfbf60b0f2e7b91be88c6cd08ba469091ade0ab448aed8a6d84e1e | Python | 3,390 | 105 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp,... |
7f77c787b69c4cef0184a4d3900764ed84cb7b475888b11d4f9fee63ae53d76b | Python | 3,392 | 117 | import seaborn as sns
def set_size(width: float = 360., fraction: float = 1, subplots=(1, 1)) -> tuple:
"""
Set figure dimensions to avoid scaling in LaTeX.
Source: https://jwalton.info/Embed-Publication-Matplotlib-Latex/
Parameters
----------
width: float or string
Document widt... |
e50a8369eb44ad0954394754ae21fe6c3fb5bb4375f87fc9e3c053c446813931 | Python | 3,393 | 120 | """
Split up data into progress vs non-progress; get stats for the following:
1. sex
2. mmse
3. age
4. apoe #
5. educ (# years)
"""
from typing import Literal
import numpy as np
import pandas as pd
from dataloader import Dataset, ParcellationDataBinary
DatasetName = Literal["ADNI", "NACC"]
def load_dataset(data... |
6830953310db0329b251a35ee0f9201acad4b35ad89b38f7a771706ea5fcc430 | Python | 3,395 | 52 | import pandas as pd
import numpy as np
import argparse
def get_label(stage_label_path,save_path):
data=pd.read_csv(stage_label_path,sep='\t')
sample_mRNA_data=pd.read_csv(save_path+'/sample_mRNA_data_2.txt',sep='\t')
sample_mRNA_data['sampleID']=sample_mRNA_data['sample_old'].map(lambda x:x.split('-')[0]+... |
c6292262e2efa6d070146d134c3f6ae4665fae2e373a46bf54857fbe84e0b254 | Python | 3,395 | 113 | """Test configuration loading"""
import logging
import pytest
import yaml
from casanovo.config import Config
def test_default(monkeypatch):
"""Test that loading the default works"""
with monkeypatch.context() as ctx:
ctx.setattr("platform.machine", lambda: "x86-64")
config = Config()
a... |
8be31a3dddf39bcf418f41cc4176eb2ee3fd3d5e050ac5604d810da6b9318733 | Python | 3,398 | 32 | OPEN_METEO_DOCS = """BASE URL: https://api.open-meteo.com/
API Documentation
The API endpoint /v1/forecast accepts a geographical coordinate, a list of weather variables and responds with a JSON hourly weather forecast for 7 days. Time always starts at 0:00 today and contains 168 hours. All URL parameters are listed b... |
845470ce266bf7d9443fcc05a7357fc0b9ed435671fca419483a0a076b662b76 | Python | 3,399 | 74 | # Sconda conda activate plot_gc; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/FCDNN/results/cpg_composition_as_expression_predictor; python
import pybedtools
import pyfaidx
import pandas as pd
def convert_tpm_to_labels(df, balanced_split=False):
# Calculate mean per column, excludin... |
7a3859834113c561903a4f7369dc5c47f88d6c8e8e23b9746c4c806d172a2a86 | Python | 3,400 | 113 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 23 15:12:20 2019
@author: shni2598
"""
import numpy as np
#%%
def makelattice(n, width, centre):
'''
generate the coordination of a lattice
n: number of neurons on each side of the grid
width: the length of width of each side of ... |
881fe5dcd0c3345305fb8364b81d146d17a00bfb9f48fe56c4ac2806d3b10e5e | Python | 3,400 | 90 | import torch
def compute_mean_mad(dataloaders, properties, dataset_name):
if dataset_name == 'qm9':
return compute_mean_mad_from_dataloader(dataloaders['train'], properties)
elif dataset_name == 'qm9_second_half' or dataset_name == 'qm9_second_half':
return compute_mean_mad_from_dataloader(dat... |
c7e7bf3670ebf94cb1715359b15e9b4ba9006632c9befa72bf4a704a5c891cda | Python | 3,402 | 108 |
# Examine enrichment in psychiatric disorders TWAS and DEGs
import pandas as pd
import session_info
from os import environ
from pyhere import here
from functools import lru_cache
from scipy.stats import fisher_exact
from statsmodels.stats.multitest import multipletests
environ['NUMEXPR_MAX_THREADS'] = '10'
@lru_cach... |
32e3c2145d5b5d2d33467a0d7e5edae474c535133b35bdd50c2b2890dda39546 | Python | 3,403 | 105 | """
:AUTHORS: Martin M. Müller
:ORGANIZATION: Department of Neurobiology, Bielefeld University
:CONTACT: martin.mueller@uni-bielefeld.de
:SINCE: Wed Dec 15 14:17:14 2021
"""
import numpy as np
import pandas as pd
from utilities import error_measures as measures
def analyse_dataset(df, convertToDegrees=True):
""... |
33ca7f5cbc8cf5b5751692fe4a151cce8b0007a03ce10248c533b5ef66771a0d | Python | 3,403 | 113 | """Functions for compressing collections of sequence indices.
Many other methods work on collections of sequence indices (represented by
integers) that are mostly contiguous -- i.e., span the full set of sequences
with some breaks throughout. This module contains some functions to help
represent these more efficiently... |
a21f892dd32656b07a6bde0d744f1605629a347c0b88b3a036b4908efc5af388 | Python | 3,403 | 104 | from __future__ import annotations
import numpy as np
from libs.function.cluster import binning, ts_kmean
from libs.function.function import log
def tile(data, roll):
result = np.zeros((roll, len(data)))
for i in range(roll):
result[i] = np.roll(data, -i)
return result
def TE(input: np.ndarray... |
babdd00193ef384447a64b7119ea015e4e4a7963ec336419d4fb51942cbb459c | Python | 3,403 | 102 | # Copyright (c) MONAI Consortium
# 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, so... |
06a2507edccb4f0f39f19540634fe7ac31b60751326e7f3b58d1a5b61aa0c125 | Python | 3,404 | 95 | import torch
from torch import nn, Tensor
from torch import distributions as D
from torch.nn import init
from typing import Union
from sys import stderr
class BiAffine(nn.Module):
def __init__(self, in_dim: int, mid_dim: int = None, classes: int = 1, with_left_edge_bias: bool = True, with_right_edge_bias: bool =... |
6dc670efe1aacf694bf167db52776a7f346377bf38ea16754773782ff462f1cb | Python | 3,404 | 69 | import os
import caffe
import argparse
import numpy as np
import scipy.misc
from PIL import Image
from util import segrun, fast_hist, get_scores
from cityscapes import cityscapes
parser = argparse.ArgumentParser()
parser.add_argument("--cityscapes_dir", type=str, required=True, help="Path to the original cityscapes da... |
d50fc0bfa10aa94b41fa9241fb933212717af20f7aea65e312d84c19cb907ef2 | Python | 3,404 | 122 | import argparse
import os
from time import time as t
import torch
from torchvision import transforms
from tqdm import tqdm
import bindsnet.datasets
from bindsnet.analysis.pipeline_analysis import MatplotlibAnalyzer, TensorboardAnalyzer
from bindsnet.encoding import NullEncoder, PoissonEncoder
from bindsnet.learning i... |
72b2ec135fc85f5281e8ec858474c0b4fe75bf988a4287e2c5ae7e5577e4c17b | Python | 3,405 | 97 | import time
import zmq
import random
import matplotlib.pyplot as plt
import pyqtgraph as pg
import numpy as np
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import pyqtSignal, QThread
from pyqtgraph import PlotWidget, plot
import pyqtgraph as pg
import sys
NB_NRN = 1024
NB_REGS_SPK ... |
4ba7bfe53186357ade4b2a90f9aa5a12a3e12e2a15586ba646909c7cd3d1671a | Python | 3,408 | 73 | """All-ncRNA gene chord on GSE99254 (full-length SMART-seq2 T cells).
Tests the claim that a gene chord can be entirely non-coding: for each T-cell state, no single lncRNA is
a strong marker, yet the LINEAR COMBINATION of lncRNAs (an all-ncRNA chord) separates that state well
above the best single lncRNA. lncRNA-only ... |
59de82045e8bcafbba2013027fc15783baff1bb017c072520d78763723d98542 | Python | 3,409 | 85 | from collections.abc import Hashable
import numpy as np
from pgmpy.structure_score._base import BaseStructureScore
from pgmpy.utils import encode_columns, get_state_counts_array
class LogLikelihood(BaseStructureScore):
r"""
Log-likelihood structure score for discrete Bayesian networks.
This score evalu... |
661fab2140e377a56a37d8f770fdaf1c9f733d03448b3bdd27fee00fc15a698c | Python | 3,411 | 93 | import numpy as np
import pandas as pd
import os, tqdm
from skimage.io import imread
from itertools import repeat
import multiprocessing
if __name__ == '__main__':
import sys
sys.path.append(os.path.join('..','..'))
from morgana.DatasetTools import io
from morgana.ImageTools.morphology import computemorpholog... |
b895e8eb93bfa1b6f88ff5089135f5450ea084b8d3e72f2d103fcfc965890f67 | Python | 3,413 | 102 | # /// script
# requires-python = ">=3.12"
# dependencies = ["iohub"]
# ///
"""Crop an OME-Zarr position to a small ROI for fast iteration.
Reads one position of an HCS OME-Zarr, slices the TCZYX array with the given
voxel ranges, and writes a new single-position HCS OME-Zarr that preserves
channel names and pixel scal... |
e92d1aa3a35306021db52adb4faef9fabba765a53574a1f90618922f2d448fd3 | Python | 3,413 | 93 | ###########################################################################################
# Adapted from MACE
###########################################################################################
import torch
from e3nn import o3
def get_feasible_irrep(irreps1, irreps2, target_irreps, mode="uvu", trainable=Tru... |
f505497870c6a31c405945e8239d6cd0386a2ec911314efa8ba0058f0991329e | Python | 3,413 | 58 | #!/usr/bin/env python3
import os
import sys
from chrombpnet.data import DefaultDataFile, get_default_data_path
from argparse import Namespace
import chrombpnet.helpers.generate_reports.make_html_bias as make_html_bias
import chrombpnet.helpers.generate_reports.make_html as make_html
def bias_modisco(file_prefix, bia... |
79731702a3086b087f06da6089503230e9a64cbfc9284ea93466f60678e17f55 | Python | 3,415 | 96 | # third party modules
import numpy as np
# pnabind modules
from pnabind.utils import generateUniformSpherePoints
from pnabind.utils import clipOutliers
from .laplacian_smoothing import laplacianSmoothing
PHI_COEF = [0.1421438807766923, 1.6245703034444483] # linear coefficients to scale phi
DPH_COEF = [1.4502167585912... |
d34ddc7ef653177d53ee946aedeca1090d029f00b6e2598507254b3a7c0fc7e1 | Python | 3,415 | 71 | from animalai.envs.actions import AAIActions, AAIAction
from animalai.envs.raycastparser import RayCastParser
from animalai.envs.raycastparser import RayCastObjects
class Braitenberg():
"""Implements a simple Braitenberg vehicle agent that heads towards food
Can change the number of rays but only responds to G... |
adb06a4dca3ea8bfe7be3c928e6ee25ed732f362a4def0dc459f79d3e577eb59 | Python | 3,420 | 90 | import time
import matplotlib.pyplot as plt
import numpy as np
import os
from skimage.measure import regionprops
import torch
from torch.utils.data import DataLoader
from skimage.io import imread, imsave
from src.napari_svetlana.Prediction3DDataset import Prediction3DDataset
from joblib import Parallel, delayed
from ... |
e4066938019cbcc968feaae5f32b211d217cd2b41d390f62666faa3eeb0d958e | Python | 3,420 | 90 | import datetime
import os
import shutil
import torch
import torch.distributed as dist
from ruamel import yaml as ryaml
from torch.utils.tensorboard import SummaryWriter
from submiter.basic_submiter import BasicSubmiter
from utils.config import ConfigConstructor
from utils.distribution import is_single_process, sync_b... |
24ebe650f31ad4807ec5256a5c8436e06057750880d97e8fbfcffc6868f0ebd1 | Python | 3,422 | 103 | targetMean = 8
targetStd = 1.5
initStep = 0
import pandas as pd
resultsMean = []
resultsStd = []
for i in range(40):
base_name = 'R:/Temp/Threads16/Thread'+str(i)+'/Simulation/output/Data.csv'
df = pd.read_csv(base_name)
if df.iloc[0,0]>1000:
resultsMean.append(0)
else:
resultsMean.app... |
e1c1f2ddc91948558fff03efbc9d7e2c9ad48d4dc8963fa575a6788c9f2c94a5 | Python | 3,423 | 94 | import logging
import settings
from mlflow.projects import utils
from mlflow.tracking.context import registry
from mlflow.utils.mlflow_tags import (MLFLOW_GIT_COMMIT, MLFLOW_PARENT_RUN_ID,
MLFLOW_SOURCE_NAME)
from pytorch_lightning.loggers import MLFlowLogger
import optuna
def get... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.