sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
60b893842fd7c27829b9b652afbfa6f39f0db6e7aca5ea7174f563548ae612f6 | Python | 15,788 | 465 | """featureCounts wrapper for RNA-seq quantification."""
from __future__ import annotations
import gzip
import os
import shutil
import subprocess
from pathlib import Path
from typing import Dict, List, Optional, Sequence, Tuple, Union, Mapping
import pandas as pd
from .._registry import register_function
from ._cli_u... |
440b75001c2afc1caae555371e61b2a1bdeb2da5c1ef9bb44c7af1f13b46bcc5 | Python | 15,789 | 512 | import pickle
import re
import sys
import time
from datetime import datetime
import config
import Efficient_Net_encoder
import efficientnet.tfkeras as efn
import matplotlib as mpl
import matplotlib.pyplot as plt
import tensorflow as tf
import Transformer_decoder
mpl.use("Agg")
# Set TPUs
tpu = tf.distribute.cluster... |
d2cada646c87a527b8b8a0e86166b246cb60e3c044f209a2f701a935908c0665 | Python | 15,789 | 385 | r"""Genetic-circuit design & simulation — the regulatory heart of synbio.
Build a gene-regulatory network from parts (genes + activation/repression
edges with Hill kinetics), then simulate it **deterministically** (ODEs, scipy)
or **stochastically** (Gillespie SSA, numpy — captures the molecular noise that
makes small... |
d8eb9a9a1b202aec1ff54d62f4de690eea63ff614002c43533c84e815b3034dd | Python | 15,789 | 348 | # 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 math
import torch
import torch.nn.functional as F
import pandas as pd
import numpy as np
from unicore import metrics
from unicore.losses import UnicoreLoss, ... |
114170c1e8fb9d1befd161d3fb87038e0d130cb3e1a97620333862b8ffc4e925 | Python | 15,792 | 406 | import importlib
import inspect
import json
import logging
import os
import sys
import warnings
from dataclasses import dataclass
from typing import Any, Dict, Optional, Tuple
import ray.util.client_connect
from ray._private.ray_constants import (
RAY_ADDRESS_ENVIRONMENT_VARIABLE,
RAY_NAMESPACE_ENVIRONMENT_VAR... |
7f1b5b084aab8809856ae5c8eb17dff31882c64be8ed3301d7f75c1ef1aba404 | Python | 15,799 | 415 | """Core computation functions for scMetabolism."""
import numpy as np
import pandas as pd
import logging
from typing import Union, Optional, Dict, List
import anndata
import pathlib
from . import methods
logger = logging.getLogger(__name__)
def read_gmt(filepath: Union[str, pathlib.Path]) -> Dict[str, List[str]]:
... |
18bcab38c707d20c7003497753a682a0632b42fb99f1480c10c481c37ea26d8a | Python | 15,801 | 313 | # Copyright 2023 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 required by applicabl... |
877f0dec0e4df70dbb9ea6841a73cb546d8292bb69ddc4f18f757408aa8c7ae2 | Python | 15,804 | 266 | from argparse import ArgumentParser
import numpy as np
import time
import os, sys, csv
from pathlib import Path
# import tracemalloc
#
# tracemalloc.start()
from ..bonsai.bonsai_helpers import Run_Configs, remove_tree_folders, find_latest_tree_folder_new, \
convert_dict_to_named_tuple, str2bool, get_latest_inter... |
78cc394e36571840114adf990236f0b72e92a27ee42e9b36b813b8c9a4cd5705 | Python | 15,807 | 454 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Compute semantic similarities between GO terms. Borrowed from book chapter from
Alex Warwick Vesztrocy and Christophe Dessimoz (thanks). For details, please
check out:
notebooks/semantic_similarity.ipynb
"""
import sys
from collections import Counter, defaultdict, dequ... |
30b56d83da080e21da56ba501774e52ccf358dcb115e9cce2cd722acb6e1ba7d | Python | 15,817 | 367 | #!/usr/bin/env python
# coding: utf-8
# author: Maruthi Mutnuri (maruthi2008@gmail.com)
# loading libraries
import pandas as pd
import numpy as np
import random
from sklearn.model_selection import train_test_split
import tensorflow as tf
from imblearn.over_sampling import SMOTE
from imblearn.under_sampling import Ran... |
2ddfe1eee898ef64c19b3e396079fbbadabe8c8eebcfec33d56185af45f65645 | Python | 15,820 | 446 | import os
import re
import subprocess
import sys
import tempfile
import time
from typing import IO, Any, List, Optional
from ray.autoscaler._private.cli_logger import cf, cli_logger
CONN_REFUSED_PATIENCE = 30 # how long to wait for sshd to run
_redirect_output = False # Whether to log command output to a temporary... |
06a0d3d5a83ee21d878571099930d4da514a8c68ad4f80f96dae061ad9d65edd | Python | 15,821 | 434 | r"""MS-specific quality control.
Untargeted LC-MS data without proper QC gives unreliable downstream
results — this module implements the three filters that every serious
metabolomics pipeline does:
1. **CV%-based feature filter** (``cv_filter``) — drop features whose
technical variation (measured on pooled QC sam... |
7a531c401e44877de1ad024121dda0225c9396b33e1f8f4dcbfe536bd7150ae6 | Python | 15,823 | 389 | # -*- coding: utf-8 -*-
import logging
from ctypes import c_uint32
from math import ceil
import os
from multiprocessing import cpu_count
from operator import attrgetter, mul
from typing import Sequence, Type
import numpy as np
import pandas as pd
from tqdm import tqdm
from scipy.sparse import csr_matrix
LOGGER = lo... |
07f6c8e354c95fa827a33a1237a0489b628f0eb07584b501156c8b55a0cecb37 | Python | 15,831 | 430 | from __future__ import annotations
import hashlib
import os
import re
import shutil
import sys
import tarfile
import tempfile
import zipfile
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Union
class... |
704227635fbf63cbdfbef059b97d5c3445c3c8993807958775c2abecf3e1bc6f | Python | 15,838 | 414 | r"""Module providing encapsulation of SpaceFlow for spatial flow analysis."""
import copy
import random
import numpy as np
import pandas as pd
import scanpy as sc
import torch
from tqdm import tqdm
import torch.nn as nn
import matplotlib.pyplot as plt
from scipy.spatial import distance_matrix
from torch_geometric.nn i... |
d8e938369d1ec52d3d64b473f4194af445d4f6920e7354043b0cb62ba1ce79b9 | Python | 15,848 | 513 | # flake8: noqa
import ray
ray.init()
# __begin_start_grpc_proxy__
from ray import serve
from ray.serve.config import gRPCOptions
grpc_port = 9000
grpc_servicer_functions = [
"user_defined_protos_pb2_grpc.add_UserDefinedServiceServicer_to_server",
"user_defined_protos_pb2_grpc.add_ImageClassificationService... |
5220f8312776884de12dc231fb968570ef6362170e895c26996661d8a512d0a2 | Python | 15,849 | 467 | # Vendored from `decoupler` (https://github.com/scverse/decoupler) by
# omicverse for in-tree GPU acceleration work. Original copyright by
# the decoupler authors, redistributed under decoupler's GPL-3.0
# license. Cross-module imports rewritten from `decoupler.*` to
# `omicverse.es.*` (see scripts/vendor_decoupler.py)... |
de469ceeb78fbfff95c8017d1acf0ed7d7164fc3c74ffdc33956b90c7fa2735c | Python | 15,850 | 358 | import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from tqdm import tqdm
import argparse
import yaml
import torch
from monai.networks.layers import Norm
from monai.utils import set_determinism
from monai.data import CacheDataset, DataLoader, decollate_batch
from monai.networks.nets impo... |
1e216ab5672d8e9e2538935a7842144a5bab6170a59174566b7de97663373868 | Python | 15,863 | 291 | import numpy as np
import cv2
from scipy import sparse
from skimage.segmentation import watershed
def watershed_CV(img):
'''Apply watershed from OpenCV to further segment the mask "img".
Adapted from [https://docs.opencv.org/master/d3/db4/tutorial_py_watershed.html]
Inputs:
img (2D numpy.nd... |
32144d690c66d978a330fe1996d5bc2785a03236fec8327b5f7694ee0be6cf21 | Python | 15,873 | 365 | '''
Module for fitting LNP encoding models, where spikes are binned according to
the stimulus monitor frame rate, approximately 120 Hz or so. In practice,
this means that the spike bin cutoff times are inferred from the stimulus
synchronization triggers rather than from the recording array sample rate.
The... |
97408cc009490d1b6afaefe12ec80f4f5e8af4891de4e48f8fc1711244fb8760 | Python | 15,882 | 451 | import json
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Iterable, Optional, Sequence, Union
from warnings import warn
import numpy as np
import numpy.typing as npt
import pandas as pd
import torch
import torch.nn.functional as F
from fastai.vision.learner import load_learner
fr... |
5cd5dabf3f0c072ab60c77033eb206e809313c573f9bcb124cca377ad760b743 | Python | 15,886 | 318 | #!/usr/bin/env python
# coding: utf-8
import config.config as config
import pandas as pd
from Environment import Env
import torch
import numpy as np
class Validation():
def __init__(self, task, agent_name, validation_size=300,
target_positions=None, perturbs_info=None,
enable... |
cb2c24aaf60bb8173848edaafd687abf0aa2bcfa627ed277647bae2e2dd1b579 | Python | 15,890 | 484 | """Unit tests for KubernetesEventProvider.
Tests verify that raw Kubernetes events are correctly parsed, translated,
and mapped to standardized RayEvent protobuf structures.
"""
from datetime import datetime, timezone
from unittest.mock import MagicMock
import pytest
from ray.core.generated.events_base_event_pb2 im... |
7ff964157d85db594511ce75e16744127d44fca943352914affa675a674edfb7 | Python | 15,901 | 436 | """
PCA and related signal decomposition methods for tedana
"""
import logging
from numbers import Number
import numpy as np
import pandas as pd
from mapca import MovingAveragePCA
from scipy import stats
from sklearn.decomposition import PCA
from tedana import io, metrics, utils
from tedana.reporting import pca_resul... |
524357414cbe237cb0e8eb36b03c29fa6e4c62ca17d0ff61d1fc6fffb6d14ffa | Python | 15,908 | 473 | """
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 copy
from typing import TYPE_CHECKING
import torch
import torch.nn as nn
from torch.profiler im... |
60730c5f4017c2837973f37967621f11d8fec40603ccd6fe4c4ec69b658efeea | Python | 15,916 | 444 | import abc
import gc
from typing import Callable, Dict, Tuple
import lightning.pytorch as pl
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchmetrics import MetricCollection
from torchmetrics.classification import MulticlassF1Score
from cellnet.tabnet.tab_network import ... |
bad0559d569c32a37bdc6520b3837cd71ad350374b83c8721d181fe7e858f08b | Python | 15,918 | 395 | import os
import stat
import re
import copy
import shutil
import exputils
from collections import OrderedDict
def generate_experiment_files(ods_filepath=None, directory=None, extra_files=None, extra_experiment_files=None, verbose=False):
'''
Generates experiment files and configurations based on entries in a O... |
f41bb5860439d5d451019baa7aac8e1524c8f2a00c1a2a0d5d34f789c445591f | Python | 15,932 | 351 | import sys
# for linux env.
sys.path.insert(0,'..')
import pandas as pd
import time
from collections import defaultdict
import re
import pickle
import argparse
import csv
from utils import *
import utils
import functools
print = functools.partial(print, flush=True)
def parse_args():
parser = argp... |
4a86ae2446b261434dd11dc5ea8567637b40b83508c03d426b312f8c621a6bb2 | Python | 15,939 | 454 | """
We partly used implementation of Transformer and other modules in
A. M. Rush, "The Annotated Transformer", Proceedings of Workshop for NLP Open Source Software, pp. 52-60, 2018.
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import pandas as pd
from torch.autograd import Variabl... |
c8e48fa3a06a0b9ffad60848f7b0527536f95ac91da940ecb4a1f6fee5df03af | Python | 15,940 | 426 | """RegulomeDB regulatory variant data collector."""
import logging
from typing import Any, Dict, List, Optional
from src.api.regulomedb import RegulomeDBClient
from src.models.genomic import Variant
from .base import BaseCollector
from config.config import settings
logger = logging.getLogger(__name__)
class Regul... |
f032ae674823fd6a00ee8f8674bb625dc1e2d1ca1725c022ec5005a921dd2cad | Python | 15,941 | 346 | # 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, sof... |
eac50e14971a30a12a07dd1f5377c3695afbc4bf8e93decc8c0d649095825b7c | Python | 15,951 | 293 | import unittest
from neuron_morphology.constants import *
from neuron_morphology.morphology import Morphology
from tests.objects import (test_node,
test_morphology_small,
test_morphology_small_branching,
test_morphology_small_multiple_tree... |
83863fc4eae663b5cf951a7ad9996398598ec35ecae47d54fa3fe4424a97bd86 | Python | 15,954 | 340 | # -*- coding: utf-8 -*-
import sys, os
env_path = os.path.dirname(os.path.abspath(__file__))
sys.path.append(env_path + "/../")
sys.path.append(env_path + "/seq2struct")
sys.path.append(env_path + "/seq2struct/esmfold_openfold")
import torch
import numpy as np
import pandas as pd
import re, time, random,... |
87882ff63bfc0fe796ba5ffc1f2c33e3335b9e1f8f4fd60656277d17e50477b5 | Python | 15,954 | 417 | # encoding: utf-8
r"""
Module containing the implementation of sheets - one of the basic building blocks of *mozaik* models.
"""
import numpy
import mozaik
from collections import OrderedDict
from mozaik.core import BaseComponent
from mozaik import load_component
from mozaik.tools.distribution_parametrization import P... |
27b18e874c88b4388ff26df2887827d9062738c975853ec7226da7d737d75ec5 | Python | 15,961 | 359 |
import numpy
import os
import time
import yaml
import platform
import skimage.io as skio
import copy
import datetime
import matplotlib
import h5py
matplotlib.use("tkagg")
from matplotlib import pyplot
from shutil import copyfile
import abberior
from banditopt import algorithms, objectives, user, utils
from banditop... |
bba6f3297a1d8541c32e2fd969435b0fc8688115fb443e10a11a2e49468a1336 | Python | 15,962 | 391 | from dataclasses import dataclass
from functools import reduce
from typing import Any, Dict, List, Optional, Union
from warnings import warn
import torch
from torch import nn
from sinabs.layers import SqueezeMixin, StatefulLayer
def _extract_single_input(input_data: List[Any]) -> Any:
"""Extract single element ... |
45769684f99312dcac2aa6da482eec3666349b5908421530fbb25f8312d83469 | Python | 15,966 | 419 | """
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 json
import logging
import time
from pathlib import Path
from typing import TYPE_CHECKING, Any, ... |
8fff37450b4ddc929740890b3a206423f0231d50ecc70e0708dcd2215efa4c1c | Python | 15,977 | 382 | #
# 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... |
0654c7eb4996caf0b0ab8a58c09d9e79bdf86a15244b49b8306b4dcb278ab651 | Python | 15,981 | 338 | import numpy as np
import rlexp.utils as utils
import exputils as eu
import exputils.data.logging as log
import warnings
class Barreto2018SFQL:
"""
Successor Feature Q-learning agent for continual reward transfer scenarios that uses a single linear layer to
approximate the Psi-function. Based on SF QL agen... |
788ed4e4d800e04ff26e8e84c04849332d5167c47c52abe86c83e077a9b3856a | Python | 15,984 | 430 | ####################################################################################################
# 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... |
1f4dd1755922ca1f0cc6db2a47950b8c6ec832f47aa96bf794df33776454bd50 | Python | 15,990 | 423 | import io
import pathlib
from typing import Any
import h5py
import numpy as np
import nir
def _read_metadata(node: Any) -> dict[str, Any]:
if "metadata" in node:
return {"metadata": {k: v[()] for k, v in node["metadata"].items()}}
else:
return {}
def try_byte_to_str(a: bytes | Any) -> str ... |
ca4255e48470b8ba0e164ccb00adf8c1f9a7fd3943e110e724de9ca412570ec2 | Python | 15,999 | 390 | import asyncio
import logging
import re
from concurrent.futures import ThreadPoolExecutor
from dataclasses import asdict
from datetime import datetime
from typing import Optional
import aiohttp.web
from aiohttp.web import Response
import ray
from ray import ActorID
from ray._common.usage.usage_lib import TagKey, reco... |
820ed2ac93b32003f864b50e3d32dc81c4d2ebe4bdde912d55c713e968fd1cb5 | Python | 16,002 | 361 |
import numpy
import os
import time
import yaml
import platform
import skimage.io as skio
import copy
import datetime
import matplotlib
import h5py
matplotlib.use("tkagg")
from matplotlib import pyplot
from shutil import copyfile
import abberior
from banditopt import algorithms, objectives, user, utils
from banditop... |
1675d2f6f53923a8b23a17a11023173b3d2c42c565e8282a7167c389f3bafb75 | Python | 16,012 | 447 | # 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... |
26dd8a673f804037f2a8d794f12bf272e45d43a91cb56379de6e74cadb4b97e3 | Python | 16,015 | 459 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 11 14:38:29 2022
Buidling on the spleen segmentation, this is my training loop
Modified train_synth_1 to scramble first and after
Actually I use this file to train both urand and imagenet cnns
@author: pbolan
"""
from monai.utils import first, se... |
31844a607ebf864b902d11b9cf601179d5d94f41d0e499fe6d5dcf533bdfb97d | Python | 16,018 | 357 | import dataclasses
from torch.utils.data.dataloader import DataLoader
from transformers.data.data_collator import DataCollator, InputDataClass, DefaultDataCollator
from torch.utils.data.distributed import DistributedSampler
from torch.utils.data.sampler import RandomSampler
from typing import List, Union, Dict
import n... |
d5b8c5b2bba2370542d9d63d5646f7a3aef32599b69d82f04a55f3cc94e445ed | Python | 16,023 | 279 | proj_dir = "/path/to/main_project_folder/" # edit this line
import numpy as np
import pandas as pd
import xarray as xr
import dask.array as da
import glob as glob
from functools import partial
import os
import matplotlib.pyplot as plt
import sys
sys.path.append(proj_dir)
from project_fxns import load_region
from proje... |
d230fafdb0c5e8c78b24a651d0e1c5d6c13233fbb0db5c260f7ceb81a6076d75 | Python | 16,027 | 583 | # These classes are copied from Minivision's Silent-Face-Anti-Spoofing Repo
# licensed under Apache License 2.0
# Ref: github.com/minivision-ai/Silent-Face-Anti-Spoofing/blob/master/src/model_lib/MiniFASNet.py
# built-in dependencies
from typing import Tuple, Any, List
# 3rd party dependencies
import torch
from torch... |
8cb873305f262e454878413b48e2d5dd6dd8a88137d981d7edbf6e551535f3c4 | Python | 16,028 | 402 | #!/usr/bin/env python
from __future__ import print_function
import argparse
import glob
import sys
import numpy as np
import pysam
import time
from contextlib import closing
import bam_stats
TAG_HAPLOTYPE = "ht"
TAG_CHUNK_ID = "mp"
PB_HAP1_READS = "pb_hap1"
PB_HAP2_READS = "pb_hap2"
PB_LENGTH = "pb_len"
PB_BLOCK_I... |
050bfa4cce6f3020cf0fa54f0fcb4f50272091b6b061a61bd0ae46add197c3db | Python | 16,039 | 398 | ####################################################################################################
# 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... |
e8c955beb2b5055142d9a44cf3359aefb9588affb06cfbd3d748f877a2bed1d8 | Python | 16,049 | 499 | """
Maximum Mean Discrepancy plots.
Note
----
* Because MMD^2 is the value that is directly estimated, this is the value that
is saved and passed between functions. In v0.3.0, variable names have been
changed to make this distinction clear.
Reference
---------
.. [1] Gretton, Arthur, et al. "A kernel two-sample t... |
a5e3e2b01d10a49ce41892a01ff7847de510dfa06013a5d03dca4bc5f687393d | Python | 16,050 | 386 | import shutil
import ants
import os
import numpy as np
# from matplotlib import pyplot as plt
# import umap
from IPython import display
import time
import pandas as pd
from sklearn.metrics import silhouette_score
from scipy.spatial.distance import pdist
from scipy.spatial.distance import squareform
# import seaborn as ... |
ff79a89beb4a4eccecc2fae8168ffd9a3697467e23d1e805a25d8262eeac3a65 | Python | 16,053 | 409 | import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from easydict import EasyDict as edict
import sys
sys.path.append('.')
from BioMime.utils.params import coeff_a, coeff_b
from NeuroMotion.MNPoollib.mn_params import DEPTH, ANGLE, MS_AREA, NUM_MUS, mn_default_settings
class MotoneuronPool:
def ... |
6c6178b87945287ce95f9f2d12af899a50262509f07779713bb0ff5780b63ed7 | Python | 16,060 | 452 | """
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.
1. Normalize features of shape (N, sphere_basis, C),
with sphere_basis = (lmax + 1) ** 2.
2. The difference from `layer_norm.py` is that all t... |
94a951baeb0058129ea7aa8e3cd9d9b791c99f7aab70c23e021b13475a0ca020 | Python | 16,061 | 491 | from math import sqrt
import torch
from torch.nn import Linear, BatchNorm1d, ReLU
from cellnet.tabnet import sparsemax
def initialize_non_glu(module, input_dim, output_dim):
gain_value = sqrt((input_dim + output_dim) / sqrt(4 * input_dim))
torch.nn.init.xavier_normal_(module.weight, gain=gain_value)
def i... |
cdf3b6550910fb38e133f3b79c022299096560e8a65e33eef82ffd6bb195e685 | Python | 16,071 | 453 | #!/usr/bin/env python3
"""Tests for build_image.py"""
import tempfile
import unittest
from pathlib import Path
from unittest import mock
from build_image import (
DEFAULT_ARCHITECTURE,
IMAGE_TYPE_CONFIG,
REGISTRY_PREFIX,
SUPPORTED_IMAGE_TYPES,
WANDA_SPEC_PATHS,
BuildError,
ImageBuildConfig... |
16c03b51eecb03647850759635c9c1a450fea062ef64659270b9ca2e7a8f6992 | Python | 16,074 | 436 | import asyncio
import json
import logging
from abc import ABC, abstractmethod
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass
from typing import List, Optional
import aiohttp
import ray.dashboard.utils as dashboard_utils
from ray._common.utils import get_or_create_event_loop
from r... |
50419a038d986cea6c34e47d799d56871af2a20a997d21b24061aa69938f1bce | Python | 16,079 | 386 | r"""What a cell actually does after a knockout — not what it would do if it
could re-optimise from scratch.
Plain FBA answers "given this deletion, what is the best the network could
possibly do", and a freshly-deleted cell is not that cell. It still has the
wild-type proteome, so it lands on the *nearest* feasible fl... |
b12e7a5cccc79bff2ef94531d7188184c208eec15e63ac9957dec1477b99985a | Python | 16,083 | 416 | """
TurbopufferDatasink - Ray Data datasink for Turbopuffer vector database
Implementation following the pattern of MongoDatasink and Daft's Turbopuffer sink.
This is based on [Turbopuffer Write API](https://turbopuffer.com/docs/write)
"""
import logging
import os
from typing import TYPE_CHECKING, Iterable, Literal,... |
28a4aa549173d46e098a5eec1ef13d4f9246ff0ef4904fa7c64df4a4439c8436 | Python | 16,086 | 458 | """Pure-Python port of mcRigor's double-permutation rigor test.
The R/Rcpp source ``src/mc_test_stats.cpp`` defines:
mc_indpd_stats_cpp(dat) = ||Σ̂ - I||_F / sqrt(p * (p - 0.5))
where dat is (cells × genes), centered & scaled per gene, and
Σ̂ = dat.T @ dat / (n - 1).
For each metacell we:
1. Fil... |
68b598458bc2e32d0ff8a2ad54708cafa3172e33509c41e9493358fc575c497f | Python | 16,088 | 293 | import matplotlib.pyplot as plt
import pickle
import numpy as np
import os
from util import *
from sklearn.metrics import accuracy_score, confusion_matrix, roc_auc_score, roc_curve, precision_recall_curve, PrecisionRecallDisplay
from scipy.stats import norm
from scipy.stats import gaussian_kde
def plot_scatter_plot(l... |
104510ec8c042a7baa0abda953c146db2e32e0ea2729a6ff967c57c39c62f286 | Python | 16,092 | 463 | # -*- 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.
#... |
8a566c799bb7e7330bc137249b7801f9fc5f95d57ee6dfc453b974431adb319f | Python | 16,100 | 502 | import time
import numpy as np
from scipy.stats import loguniform
from sklearn.model_selection import GridSearchCV, RandomizedSearchCV
import pickle
from utils.tools import save_test_duration, save_train_duration
class Regressor:
"""
This is a super class for general machine learning regressors.
It takes... |
33995f16b8c01eb3377f815cda8f33d2fe2c505b51c501b75ae1e239153b0d2c | Python | 16,101 | 419 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Base class for adding functionality to analog layers."""
from typing import Any, List, Optional, Tuple, NamedTuple, Union, Generator, Callable, TYPE_CHECKING
... |
87c9619e086b98f568cde09eae993d768e6989d0b38455068da87b9921ae2889 | Python | 16,112 | 362 | import tensorflow as tf
import numpy as np
import pandas as pd
from random import shuffle
import random
import os
import sys
from itertools import groupby
import argparse
import toxify
import toxify.fifteenmer as fm
import toxify.protfactor as pf
import toxify.seq2window as sw
model_dir = os.path.abspath(toxify.__fil... |
94759f769cb0d57e7cfe50788a0c7dd9e646ea357414de55f16c7f233c7aec10 | Python | 16,112 | 396 | import torch
from .preprocess import preprocess_adj, preprocess_adj_sparse, preprocess, construct_interaction, construct_interaction_KNN, add_contrastive_label, get_feature, permutation, fix_seed
import time
import random
import numpy as np
from .model import Encoder, Encoder_sparse, Encoder_map, Encoder_sc
from ... |
f39191fb1129b8ab59103ad773d05e185266ad186dce0b90d4692a3eab18d763 | Python | 16,117 | 482 | # Vendored from `decoupler` (https://github.com/scverse/decoupler) by
# omicverse for in-tree GPU acceleration work. Original copyright by
# the decoupler authors, redistributed under decoupler's GPL-3.0
# license. Cross-module imports rewritten from `decoupler.*` to
# `omicverse.es.*` (see scripts/vendor_decoupler.py)... |
fe420d0c4250653a29cf2de2ab2fced353f37f1393897729bf2cb42b4c5ddf94 | Python | 16,118 | 330 | # Copyright 2023 Microsoft 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 require... |
0cab59b771a795849e17df84d9bc2014c1fc0caecc7d943a9061c4e23df85779 | Python | 16,122 | 458 | """Lightweight diagnostic plots used by :mod:`omicverse.report`.
These helpers produce simple, publication-ready figures that cover a few
gaps in ``omicverse.pl``: a cluster-size bar chart, a doublet-score
histogram with the call threshold overlaid, and a neighbor-graph degree
distribution. They are intentionally gene... |
cb8e7ce8504668eaa88252f1cdc4333bb53d1c60808fbf6984c0964ac62cbb4b | Python | 16,128 | 416 | import asyncio
import logging
import multiprocessing
import os
from typing import Optional, Union
import multidict
import ray.dashboard.consts as dashboard_consts
from ray.dashboard.optional_deps import aiohttp
from ray.dashboard.subprocesses.module import (
SubprocessModule,
SubprocessModuleConfig,
run_m... |
102063299a7b9814306c11e4bf269b1903d8e474c34e16964473625ef9371c06 | Python | 16,134 | 523 | from functools import partial
import torch, random, scipy, math
import torch.nn as nn
import torch.nn.functional as F
import pandas as pd
import numpy as np
from timm.models.vision_transformer import LayerScale
import torch.utils.checkpoint as checkpoint
from timm.models.layers import DropPath
_NUM_ATOM_TYPES = 9
_e... |
75769598474a491bcfbcb9e1a41d04c1ff27e1282b99a1c23e7ef80bf8ef1950 | Python | 16,139 | 359 | import argparse
import itertools
import pickle
from collections import namedtuple
from typing import List, Callable, Sequence, Tuple, Iterator, Union
import numpy as np
import torch
import tqdm
import gaussian_denoiser.denoiser_wrappers as denoiser_wrappers
import lib.data_utils.data_util as du
import lib.data_utils.... |
df0904321a51212c447dd01d824252b3102d8d363f14094055e7b4de33754f2e | Python | 16,140 | 432 | r"""Biomarker discovery for metabolomics — ROC/AUC + nested-CV panels.
Clinical metabolomics studies typically end with a biomarker question:
*can a small panel of metabolites separate cases from controls?*
Two functions:
- :func:`roc_feature` — per-feature AUC with optional bootstrap CI. Use
for univariate screen... |
5a0890b861ed07a3e321f65762799e4870c4a780e8c2426f92f93daa7091d98f | Python | 16,142 | 395 | import os
import torch
import torch.nn as nn
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.utils.tensorboard import SummaryWriter
from pytorch3dunet.datasets.utils import get_train_loaders
from pytorch3dunet.unet3d.losses import get_loss_criterion
from pytorch3dunet.unet3d.metrics import get_evalu... |
74845e36ab5653855c8315d3b04e6bde513a8824fd8694d441dfea5bad4a6f42 | Python | 16,148 | 522 | '''
Runs standard 30s on/off block design with visual stimulation for piloting.
'''
# Import libraries
import pandas as pd
import contextlib
from psychopy import core, prefs, logging, event, visual, gui, monitors
from psychopy.hardware import keyboard
import numpy as np
import os
import time
# Load a keyboard in en... |
6907e7c6cdaf56bc03f039188dfc5e13d1041293ad95b47016176fca45afb2db | Python | 16,149 | 436 | from imports import *
from ngs_mapper import compat
class Base(common.BaseTester):
modulepath = 'ngs_mapper.tagreads'
def setUp( self ):
self.tempdir = tempfile.mkdtemp( prefix='testTagReads', dir=tdir )
this = dirname( __file__ )
self.fixturedir = join( this, 'fixtures', 'tagreads' )
... |
a5628db66d4bf73c77b6cf1c8460d8323b4915689069db247a21586ae6b605a7 | Python | 16,167 | 388 | # plot.py
# Copyright (c) 2010 Jes Frellsen
#
# This file is part of Muninn.
#
# Muninn is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# Muninn is distributed in the hope that it will be useful,
#... |
5e2427d9692c6fd85647c9a7c7d221ecacf192ff68f399bc7c754257912f8e0d | Python | 16,168 | 603 | r"""
Plotting utilities for omics data visualization.
This module provides comprehensive plotting functions for visualizing various types
of omics data including single-cell, bulk, spatial transcriptomics, multi-omics,
and network data. It offers publication-ready plots with customizable aesthetics.
Visualization cat... |
714ae24625fd4fcc6d6a71066dce1e3a08ebf9557b8531ce907d0690ea0035ea | Python | 16,189 | 329 | # Copyright (c) 2017-2021, 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
# ... |
ae789b7edf3a0911c9dc72fb634fcbc732f08c176bfaae54857b5c03fe91b6fc | Python | 16,193 | 368 | import torch
import torch.nn as nn
import torch.nn.functional as F
import einops
from GR_pKa.args import TrainArgs
from GR_pKa.nn_utils import get_activation_function
class MultiBondFastRetention(nn.Module):
"""
A :class:`MultiBondFastRetention` is the bond level self-retention block in the message passing p... |
74ac9a24df731b286e389bf5b15cf2f294467d341d9d62559a962c13e00a9fa4 | Python | 16,194 | 349 | # Copyright 2023 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 required by applicabl... |
b93cb8a48f6a81d4f4ed86685f746af9cb55e6f20397f24146d7682fc8de184d | Python | 16,194 | 452 | import os
try:
print('SlURM_JOB_ID',os.environ["SLURM_JOB_ID"])
except:
print("no slurm id")
import matplotlib
import matplotlib
matplotlib.use('agg')
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import tensorflow as tf
import tables
import tensorflow.keras as K
import gc
import Lo... |
3d546f9eff1b050df029b4fbf95c487101c672c34ce3ce31a8379b5aa943e31d | Python | 16,195 | 504 | #!/usr/bin/python
# file: mdoc.py
# author: Brian Fulkerson and Andrea Vedaldi
# description: MDoc main
# Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
# All rights reserved.
#
# This file is part of the VLFeat library and is made available under
# the terms of the BSD license (see the COPYING ... |
db44dfd1df7f75969535997a9fba8e51b2fb132202a988e682fdd4cad56d7f86 | Python | 16,196 | 391 | from typing import Callable, Optional, Union
import torch
import torch.nn as nn
from sinabs.activation import MembraneSubtract, SingleExponential, SingleSpike
from . import functional
from .reshape import SqueezeMixin
from .stateful_layer import StatefulLayer
class ALIF(StatefulLayer):
"""Adaptive Leaky Integr... |
8438d0d3b82d4299aa035a18ade992d7098f520995e3db5d42ee4c04e916e2ae | Python | 16,200 | 351 | import numpy as np
import matplotlib.pyplot as plt
plt.style.use('seaborn-colorblind')
import pickle as pkl
import torch
from utils import load_json_file
from pathlib import Path
import matplotlib.gridspec as gridspec
from glob import glob
from torch import load
import gc
# n_dim = 64**2
normal_t = [[1,0],[1,1],... |
e175d96754731fe2442e4ec4fe4b067bcedbbb4ec7037901798d6cdf55e1ea3f | Python | 16,215 | 521 | import numpy as np
from typing import Any, Callable, Hashable, Iterable, List, Mapping, Optional, Sequence, Set, Tuple, Union, Dict
import torch
import SimpleITK as sitk
from skimage import measure
from monai.config.type_definitions import NdarrayOrTensor, NdarrayTensor
from monai.config import KeysCollection
from mo... |
39da97fd9cda3f0590438d0449ac98e57e195a4d628bec0f6d7287589e00b6a6 | Python | 16,219 | 472 | import torch
import numpy as np
import os
import glob
import random
import matplotlib
import imageio
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from analysis.molecule_builder import get_bond_order
##############
### Files ####
###########-->
def save_xyz_file(path, one_hot, positions, dataset_info, id_f... |
0b46d53a070e0295561f045c140dcc7fa7c49b4c4cba64d411784eacc4ee521b | Python | 16,225 | 383 | # Copyright 2023 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 required by applicabl... |
c5879ff7688c371ac3004304bab3782be945f364096b3b3b7e9a165fa3c920a9 | Python | 16,229 | 358 | import matplotlib.pyplot as plt
import networkx as nx
import seaborn as sns
import scanpy as sc
import numpy as np
import pandas as pd
from typing import Union, Sequence
palette_network = list(sns.color_palette("tab20") \
+ sns.color_palette("tab20b") \
+ sns.color_palett... |
5e12f5668e7f611d67983d33cecd9e390c7589e149f7c001eb64d58481c6fadf | Python | 16,230 | 352 | ####################################################################################################
# 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... |
70134795530c7aefca91ad5ebda15096f278b059d0f12dfb2badccb7804ca190 | Python | 16,237 | 349 | import numpy as np
import glob
import h5py
import hdf5storage
import time
from skimage.segmentation import watershed
from skimage.filters import roberts
from sklearn.mixture import GaussianMixture
import matplotlib.pyplot as plt
from .mmutils import *
bmapcmap = gencmap()
def wshedTransform(zValues, min_regions, si... |
9468a58da7cb238a5282e9059805505ff34fe585c29d519ba6a3d81c6ae8eb82 | Python | 16,238 | 353 | #!/usr/bin/env python
# coding: utf-8
# author: Maruthi Mutnuri (maruthi2008@gmail.com)
# loading libraries
import pandas as pd
import numpy as np
import random
from sklearn.model_selection import train_test_split
import tensorflow as tf
from imblearn.over_sampling import SMOTE
from imblearn.under_sampling import Ran... |
400dd2acb0ff35277368e5a331666a2547cf054af1d393d76d56e0effcb82527 | Python | 16,241 | 355 | ####################################################################################################
# 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... |
470ea644b8da1bb237cdf286193eac4a2d74ee7d4b246910702f6384f6d81b53 | Python | 16,244 | 515 | #!usr/bin/python
# -------------------------------------------------------------
# Compute co-expression modules within python scanpy framework:
# Created: 06/16/21
# -------------------------------------------------------------
import glob
import h5py
import re
import gzip
import numpy as np
import pandas as pd
import... |
9a272826c487e2220eafbb49e294acf6b3f87ba3a9816f3b643a41cf5bb53da6 | Python | 16,244 | 343 | #!/usr/bin/env python3
################################################################################
# -- Preprocessing and analysis of the simulation results
################################################################################
import os
import sys
import pickle
import matplotlib.pyplot as plt
from sci... |
c95a18223aae94c2e408f5e3db5a98eed7b8452c6697b407cd6c3e43f1e8f4b2 | Python | 16,259 | 544 | """gnomAD API client."""
import logging
from typing import Any, Dict, List, Optional
import time
import requests
import json
from .base import BaseAPIClient
from ..config import settings
logger = logging.getLogger(__name__)
class GnomADClient(BaseAPIClient):
"""Client for gnomAD GraphQL API.
gnomAD (... |
768e81745e0d2b49dd60777f3d7cabfec8eb553d1a7d4fd6b2fac336a1720f09 | Python | 16,260 | 493 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# pylint: disable=broad-except
# pylint: disable=invalid-name
# pylint: disable=line-too-long
# pylint: disable=multiple-statements
# pylint: disable=too-many-lines
#-------------------------------------------------------------------------------
'''
This source contains ... |
f321fe8e9d9ba993de5a125650add6f62166ba0de4aea066d0613d8138222db6 | Python | 16,261 | 479 | # -*- coding: utf-8 -*-
# I would avoid looking in here - it's chaos.
import numpy as np
import operator
from vtkplotlib._get_vtk import (vtk, numpy_to_vtk, numpy_to_vtkIdTypeArray,
vtk_to_numpy, get_vtk_to_numpy_typemap)
ID_ARRAY_DTYPE = get_vtk_to_numpy_typemap()[vtk.VTK_ID_TYPE]
... |
74ef713ad8bf3ed1afcae84f93a237653c92acbf052d822cc308aa54456fb507 | Python | 16,269 | 299 | """CytoSignal backend for :func:`omicverse.single.run_ccc` / :func:`omicverse.space.run_ccc`.
CytoSignal (Liu et al., *Nat Genet* 2026) scores ligand-receptor signalling at
every cell of a spatial transcriptomics section and tests it with a spatial
permutation null and a density-weighted spatial FDR. The engine in
``o... |
784b34b0ea847882e14ca0060de6fe3ef9b7b38209182c534673cb3e2b9e15cd | Python | 16,289 | 472 | """
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.
Modified from MinDScAIP: Minimally biased Differentiable Scaled Attention Interatomic Potential
Credit: Ryan Liu
"""
from __future__ import an... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.