sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
ef8c79a203b2a0adcdfac7068b12e0f780f6113d65800208fd15d2079c8a3c71
Python
982
24
#python plotVenn.py comb-mntzDownloadMQ-mntzDownloadtesorAI-ProteinIDs-proteingroupid-iBAQ-intensityIBAQ.csv #python plotVenn.py comb-mntzDownloadMQ-mntzDownloadtesorAI-ProteinIDs-proteingroupid-Top3-intensitytop3.csv import sys import pandas as pd import numpy as np from supervenn import supervenn from matplotlib impo...
66a9859873ed3b37ff2c668c379d595b3c20e3ba635db5b8ef87b2eecd4264b7
Python
987
31
from fvcore.common.param_scheduler import MultiStepParamScheduler from detectron2.config import LazyCall as L from detectron2.solver import WarmupParamScheduler from .cascade_mask_rcnn_mvitv2_b_3x import model, optimizer, train from .common.coco_loader_lsj import dataloader model.backbone.bottom_up.embed_dim = 144 ...
55afe294be8b1d8774c0a3f22f3bc893ea9d16302520939205ba588a07af24ca
Python
988
28
"""Plugins for the ``fetch`` command""" from openfecli.fetching import PkgResourceFetcher, URLFetcher _EXAMPLE_NB_BASE = "https://raw.githubusercontent.com/OpenFreeEnergy/ExampleNotebooks/main/" RBFE_TUTORIAL = URLFetcher( resources=[ (_EXAMPLE_NB_BASE + "rbfe_tutorial/", "tyk2_ligands.sdf"), (_E...
69c305171ae2fce514966f075959c8f77fce891e6a8b2603638789bbdea22b58
Python
988
26
from __future__ import annotations from rdkit import Chem from src.protonation.openbabel_adapter import OpenBabelProtonator def _formal_charge(smiles: str) -> int: molecule = Chem.MolFromSmiles(smiles) assert molecule is not None return sum(atom.GetFormalCharge() for atom in molecule.GetAtoms()) def t...
0d4d7ef7a717342b48c1730c95dde7c428bf1bd66303f351e8581e6a1b6db348
Python
990
25
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
a551863b9aeb475a4588d38d6f6687ffaa4f889af7b1409e88b12f17437ef6b2
Python
991
25
from typing import Optional import numpy.typing as npt import numpy as np from scipy import stats def uniform(points: npt.NDArray[np.float_], p_conn: float = 1, num_conn: Optional[int] = None) -> npt.NDArray[np.int_]: if num_conn is None: return np.flatnonzero(np.random.rand(len(points)) < p_...
aff3bbec36d5f7b0ccac097b27dcd0709befe2fc0e1a2aa260a911054b8c2098
Python
991
31
import sys from pathlib import Path import numpy as np SCRIPTS = Path(__file__).resolve().parents[1] / "scripts" sys.path.insert(0, str(SCRIPTS)) from run_xgboost_shap import summarize_outer_test_tree_shap class FakeExplainer: def shap_values(self, features): return np.asarray([[1.0, -2.0], [3.0, -4.0...
467fdec5ac948edf1cac979b4681f45c92a164c88b1c47e52e56e9b81224bd4f
Python
992
39
from fvcore.common.param_scheduler import MultiStepParamScheduler from detectron2.config import LazyCall as L from detectron2.solver import WarmupParamScheduler from .cascade_mask_rcnn_mvitv2_b_in21k_100ep import ( dataloader, lr_multiplier, model, train, optimizer, ) model.backbone.bottom_up.emb...
b5b3e4bf165f77d61497f7af01b0c76607f0a2a7adcb11f98cc66374cdb7549d
Python
992
25
"""Session loader dispatch for the stim cohort. Mouse 1-5 (ICMS92/93/98/100/101) use the standard DataLoader. Mouse 6 (ICMS83) was acquired on a different rig with a different on-disk layout (separate key-file format, E:/ drive) so it needs its own loader; both return the same DataLoader interface (recording, trial_df...
cb6b2b5f27646253e694295d4c6bd57e75bedd93d308c901e1168f9430c0692e
Python
992
42
# -*- coding: utf-8 -*- import pandas as pd from pyNBS.pyNBS_stability import full_stability_report from pyNBS.pyNBS_stability import save_all_stability_plots cc_file = "pynbs_results/YOUR_CC_MATRIX.csv" cluster_file = "pynbs_results/YOUR_CLUSTER_ASSIGNMENTS.csv" prefix = "YOUR_PREFIX" cc_table = pd.read_csv(cc_file...
cf866d118eb12fbd4cc382232213008de4982cec8a915f060541e9a87cfecd89
Python
993
34
# -*- coding: utf-8 -*- """ Created on Sun Aug 21 13:34:26 2022 @author: walte """ import os import scipy basename = os.path.join("C:\Denoising","DCCR-Net","variable_maps") def get_var_map_conf(im): shape = im.shape conf_shape = shape[0] name = os.path.join(basename,str(conf_shape)+'_map'...
b15d8c55c0b7427ac81160d13774034122fe7d55455a440982f59d21b1a12f3d
Python
994
36
import nibabel as nib import pandas as pd import numpy as np lookup_df = pd.read_table(snakemake.params.lookup_tsv, index_col="index") # get indices and names from lookup table indices = lookup_df.index.to_list() names = lookup_df.abbreviation.to_list() hemis = ["L", "R"] # create the output dataframe df = pd.DataF...
1147310b08f85b659f13ac7a752aaaa0997026444a557f0e1fb72ea94002bf9d
Python
995
35
import pysam import argparse def extract_tags(bam_file, output_tsv): with pysam.AlignmentFile(bam_file, "rb") as bam, open(output_tsv, "w") as out: out.write("#read_id\tCarcode\tUMI\tscore\tUMI_trusted\n") for read in bam: tags = dict(read.tags) CB = tags.get("CB", "*") ...
ffa69525f777d6c21de857949f3be1990bb117a1e82babe08cb3319b73e31ad6
Python
995
31
# Python02.py # IJ BAR: https://github.com/tferr/Scripts#scripts #################################################### # 2. If statements and for loops #################################################### a,b = 10,20 my_list = [1, 2, 3, 4] # An if statement: Indentation is critical in python! if a in my_list: print "...
e3ecd94b15c1600ecf79288e9db6d61fbaa13e0bc2360ffde0b089cf087cc694
Python
998
38
import os import numpy as np import albumentations from torch.utils.data import Dataset from taming.data.base import ImagePaths, NumpyPaths, ConcatDatasetWithIndex class CustomBase(Dataset): def __init__(self, *args, **kwargs): super().__init__() self.data = None def __len__(self): r...
cf9ae05e830580e1a9f1cc3ae968d52181edf1583316d0d38b137fd993fddd43
Python
1,004
29
from setuptools import setup, find_packages def read_requirements(file_name): with open(file_name, "r") as file: return [line.strip() for line in file if line.strip()] setup( name='hsnn', version='1.0.0', author='Brian Gardner', author_email="b.gardner@surrey.ac.uk", description='Hier...
2a11f40c186dc6590364b332a81c1c2a512b3880defdd74e2a06f939ed59e514
Python
1,005
28
from __future__ import annotations import os import sys from pathlib import Path def _bundle_root() -> Path: return Path(getattr(sys, "_MEIPASS", Path(sys.executable).resolve().parent)) bundle_root = _bundle_root() pyside_root = bundle_root / "PySide6" plugin_root = pyside_root / "plugins" bundled_platforms_di...
fc0a720a8013ae6a1baa8da041fd2e967a2ffe1c67c7787ac60fd392ea31b87d
Python
1,008
34
from setuptools import setup, find_packages with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup( name="fwi-msnet", version="1.0.0", author="CBJ", author_email="2023080024@yibinu.edu.cn", description="Forest Fire Risk Prediction Framework", long_descripti...
760c259d8764efe536758244c7ee9ffc5dabf2802e45822f801e86f07b0083f0
Python
1,009
30
# -*- coding: utf-8 -*- """ Created on Tue Jul 19 14:19:52 2022 @author: Joseph Vermeil GlobalConstants.py - state the global constant of CortExplore programs, to be imported with "import GlobalConstants as gc" and call the constants with "gc.my_constant_name". Joseph Vermeil, 2022 This program is free software: yo...
87af72a57cb16f05278f37ba39ee788fc2a2b7cbbd7ff84c03d0a84271f68741
Python
1,009
22
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
47bbb07abdffff5321b385b90a1aabec58983a2d0a6d4591cc2326fcaddab4a3
Python
1,012
43
# -*- coding: utf-8 -*- """For testing neuromaps.datasets.annotations functionality.""" import pytest from neuromaps.datasets import annotations @pytest.mark.xfail def test__groupby_match(): """Test grouping by matching values.""" assert False @pytest.mark.xfail def test__match_annot(): """Test matchi...
c78f71fc7a5eec24688b3fbf627554cd69cfbed9e9ed8770368a8d1925d36c20
Python
1,012
31
from __future__ import annotations import logging from pathlib import Path from typing import Any def resolve_log_path(settings: dict[str, Any]) -> Path: log_dir = Path(settings["logging"]["log_dir"]) log_dir.mkdir(parents=True, exist_ok=True) file_name = settings["logging"].get("file_name", "workflow.lo...
4ad2c16775e5954331c4ba96b7127e25054f422ed45fa4bae16fa13f6c7c5901
Python
1,014
36
from pathlib import Path import numpy as np from steinbock import io from steinbock.utils import matching class TestMatchingUtils: def test_match_masks(self): mask1 = np.array( [ [1, 1, 0], [0, 0, 0], [0, 2, 2], ], dtype...
766f95b8321ce37ad9b8ee660d73f380c6e2b09873d7fdaa41170404bd3bb85f
Python
1,015
33
# Copyright (c) Facebook, Inc. and its affiliates. from detectron2.layers import ShapeSpec from detectron2.utils.registry import Registry from .backbone import Backbone BACKBONE_REGISTRY = Registry("BACKBONE") BACKBONE_REGISTRY.__doc__ = """ Registry for backbones, which extract feature maps from images The register...
debf1e7c0157c3318ef11a0f4089b694dfd77a1a28f2b7a0bea1e527b80d9e5e
Python
1,015
32
#! /usr/bin/env python """ Convert empty IPython notebook to a sphinx doc page. """ import sys from subprocess import check_call as sh def convert_nb(nbname, execute=False): if execute: # Execute the notebook sh(["jupyter", "nbconvert", "--to", "notebook", "--execute", "--inplace", nbname]...
f8ae4b5c502278fdbb68c61d870ae191402354a87f38a4814e23d2954f6eaf61
Python
1,015
33
from functools import partial from .mask_rcnn_vitdet_b_100ep import ( dataloader, lr_multiplier, model, train, optimizer, get_vit_lr_decay_rate, ) train.init_checkpoint = ( "detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_huge_p14to16.pth?matching_heuristics=True" ) model.backbone.ne...
dfea7d3d313a3ce0274bf18532ec18a4bb0e15a3bd964e11204b917e822984aa
Python
1,021
31
from glob import glob from pathlib import Path import subprocess def calc_distances(genus: str, out_parent: str | Path) -> None: """ Parent method for RAxML distance calculation Args: genus: The current genus out_parent: Parent data directory """ out_dir = f"{out_parent}/no_interp...
4280c4a11192bac6d424e1a765832baa9c7abd1f966141476958e89255507d4b
Python
1,023
33
from functools import partial from .cascade_mask_rcnn_vitdet_b_100ep import ( dataloader, lr_multiplier, model, train, optimizer, get_vit_lr_decay_rate, ) train.init_checkpoint = ( "detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_huge_p14to16.pth?matching_heuristics=True" ) model.bac...
a1e1be9445c27052bcec3eca739ee284ace113db555ebac612c2033f47130b41
Python
1,024
33
import collections from collections import OrderedDict from pathlib import Path, PosixPath, WindowsPath from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from ruamel.yaml import YAML, Dumper else: try: from ruamel.yaml import YAML, Dumper except ImportError: # pragma: no cover from r...
b86f8c590b0749e3d0ea5747419ef1a6bbeb11af4d89975fcbcf171e96546ec7
Python
1,027
26
#https://www.mcponline.org/content/13/12/3497.long#sec-1 from pathlib import Path pathFiles = Path("L:/promec/Qexactive/LARS/2019/oktober/Kristine Sonja/txt") fileName='proteinGroups.txt' trainList=list(pathFiles.rglob(fileName)) import pandas as pd df=pd.read_csv(trainList[0],low_memory=False,sep='\t') print(df.head(...
2dc5d09af8ff343b1698d6a07f946dd3956e7a12268dd6766c1d3fce792af11f
Python
1,028
31
import shutil from pathlib import Path from typing import Generator import pytest import requests _imc_test_data_steinbock_url = ( "https://github.com/BodenmillerGroup/TestData" "/releases/download/v1.0.7/210308_ImcTestData_steinbock.tar.gz" ) _imc_test_data_steinbock_dir = "datasets/210308_ImcTestData/steinb...
f5f460d4d757c1ad12fc195cba898e709378491d701da1bbc569b1315dfd8050
Python
1,031
25
from mesa.examples.advanced.alliance_formation.model import MultiLevelAllianceModel from mesa.examples.advanced.epstein_civil_violence.model import EpsteinCivilViolence from mesa.examples.advanced.pd_grid.model import PdGrid from mesa.examples.advanced.sugarscape_g1mt.model import SugarscapeG1mt from mesa.examples.adva...
2737125886e0605d7e23901e5cfa9a8e7d34814f11385a4e6e30987893463960
Python
1,033
36
# Copyright (c) Facebook, Inc. and its affiliates. import unittest from .common import ( get_config_files, get_evolution_config_files, get_hrnet_config_files, get_quick_schedules_config_files, setup, ) class TestSetup(unittest.TestCase): def _test_setup(self, config_file): setup(conf...
9a8b277e49c577209ee40461d84ff6d2c57df4e45adb7231ed7619f37b96ea08
Python
1,036
47
import math def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) def kaiming_uniform(tensor, fan, a): if tensor is not None: bound = math.sqrt(6 / ((1 + a**2) * fan)) tensor.data.uniform_(-bound, bound) def glorot(t...
e716af4ff1a9bf4d1fb45a7cdbc68b50da785e2fbef0d128a6dc3ca230eb6bfd
Python
1,039
39
# # Copyright (c) 2024 10X Genomics, Inc. All rights reserved. # """Disable reporter stages based on cell annotation outs.""" import csv from cellranger.cell_typing.common_cell_typing import ( BARCODE_KEY, COARSE_CELL_TYPES_KEY, ) __MRO__ = """ stage DISABLE_CAS_REPORTER_STAGES( in csv cell_types, ...
316a283d4bf70b5fcd7d167b9e6ea430dadee1cdde1a4d96c9d6d3ed507609cf
Python
1,045
37
""" Spyne - A Python package for analyzing calcium imaging data from dendrites and spines. """ __version__ = "0.1.0" from .core.imaging.imagingdataset import ImagingDataset from .core.electrophysiology.ephydataset import EphyDataset from .core.spines.spinedataset import SpineDataset # Import plot submodule from . imp...
fa24985c4fd66ced9410fad15f2998a056563dbc4b5777fd74cb0dddb81e978c
Python
1,045
37
from ._ilastik import ( SteinbockIlastikClassificationException, create_and_save_ilastik_project, create_ilastik_crop, create_ilastik_image, fix_ilastik_project_file_inplace, list_ilastik_crop_files, list_ilastik_image_files, logger, read_ilastik_crop, read_ilastik_image, run...
7a685d125549ea0f43c1879f01fe6beca01f0ac111c718076d758dc3dd12078a
Python
1,048
32
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. import unittest import torch from torch.autograd import gradcheck from tensormask.layers.swap_align2nat import SwapAlign2Nat class SwapAlign2NatTest(unittest.TestCase): @unittest.skipIf(not torch.cuda.is_available(), "CUDA not available")...
775b99639c717b1df8daf9d9f728e73bb202b8fd6510d3d0f8188372e468d7d2
Python
1,053
40
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe import os from typing import Dict, Optional from detectron2.config import CfgNode def is_relative_local_path(path: str) -> bool: path_str = os.fsdecode(path) return ("://" not in path_str) and not os.path.isabs(path) def maybe_prepend_base_...
29f22f59ec7637b8c288cef813175f760b29133b31165b3b858987234331d62c
Python
1,054
32
import shutil from pathlib import Path import pytest from steinbock.segmentation import cellprofiler cellprofiler_binary = "cellprofiler" cellprofiler_plugin_dir = "/opt/cellprofiler_plugins" class TestCellprofilerSegmentation: def test_create_and_save_segmentation_pipeline(self, tmp_path: Path): cellp...
ffc0d0faa341351a1537d70486b4cb10a250cd25e794421cf7667ba5cbd9063c
Python
1,054
64
# -*- coding: utf-8 -*- """For testing neuromaps.nulls.nulls functionality.""" import pytest @pytest.mark.xfail def test_alexander_bloch(): """Test alexander-bloch null model.""" assert False @pytest.mark.xfail def test_vasa(): """Test vasa null model.""" assert False @pytest.mark.xfail def test_...
c12d49f874a1c9b1af61350cd1a9e27fa19a16593be70a133716178423d178fb
Python
1,056
32
# Copyright (c) Facebook, Inc. and its affiliates. import cloudpickle class PicklableWrapper: """ Wrap an object to make it more picklable, note that it uses heavy weight serialization libraries that are slower than pickle. It's best to use it only on closures (which are usually not picklable). T...
62c959c49b7b2b6ff1d17ca2e716138e07e5d8fcc22f35d8e9c364fd66b0c1ef
Python
1,057
29
############################################################################ # Copyright (c) 2023-2026 University of Helsinki # # All Rights Reserved # See file LICENSE for details. ############################################################################ """ K-mer indexers for fast approximate string matching in b...
1cae8cfadb9b37f1acd7a8401f513cb38e5ac5c0ab3d3e09a079ff4d27e8649c
Python
1,059
35
""" Setup module adapted from setuptools code. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from setuptools import setup, find_packages setup( name='pyNBS', version='0.2.0', description='Python package to perform n...
3fff008ef5bfbe4861f830af8f62a222562fce6be7461035b11af6d6f767d7ff
Python
1,059
26
#https://www.tensorflow.org/neural_structured_learning import tensorflow as tf import neural_structured_learning as nsl # Prepare data. (x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data() x_train, x_test = x_train / 255.0, x_test / 255.0 # Create a base model -- sequential, functional, or subcl...
9350a15d6c26ec8fb5c72767cdb9dcc466cc588e8d3a98ed45d8963e221c5eeb
Python
1,059
21
import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.decomposition import LatentDirichletAllocation from sklearn.cluster import KMeans from sklearn.metrics import normalized_mutual_info_score, adjusted_rand_score def run_topic_pipeline(csv_path, seed=42, n_topics=8, max_features...
1f37ce3ff87805f29edee384bcffd8fde9c2a02695b0adddd489c1537c9940bd
Python
1,060
49
import numpy as np import scipy import matplotlib.pyplot as plt from scipy.spatial import Delaunay import matplotlib matplotlib.use('Agg') multires_points = list() N=128 print(f'N for gridding is: {N}') nx, ny = (2*N,N) print(f'nx: {nx}') print(f'ny: {ny}') x = np.linspace(0,40, nx) y = np.linspace(0,20, ny) print(...
0fd5689220621dca705fd07d42553ae31a8539e8278bb6a3fa3d7c127b8c0056
Python
1,061
32
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # All Rights Reserved # See file LICENSE for details. ############################################################################ from isoquant_lib.common import junctions_from_blocks def ...
60cbf34994ca460e25f65bd226764374af05bf555aea6423beee47f0e1d9f465
Python
1,062
32
import shutil from pathlib import Path import pytest from steinbock.measurement import cellprofiler cellprofiler_binary = "cellprofiler" cellprofiler_plugin_dir = "/opt/cellprofiler_plugins" class TestCellprofilerMeasurement: def test_create_and_save_measurement_pipeline(self, tmp_path: Path): cellprof...
7191746b68ec57482875af21cd3176a1c73cb1dbc5234ac8c8747d9c74c97cd0
Python
1,064
45
from typing import Any import numpy as np __all__ = ["pop_attr"] def pop_attr(o: object, attr: str, *args) -> Any | None: """like ``pop()`` but for attribute maps""" match len(args): case 0: return _pop_attr(o, attr) case 1: return _pop_attr_d(o, attr, args[0]) ...
b45af4b3e292664118a1773d8adc09a2fdcab10ee856bfe55dd666c492489a80
Python
1,066
30
from __future__ import annotations from src.utils.config import ( load_settings, merge_settings, resolve_project_path, resolve_settings_paths, ) def test_default_settings_keep_mopac_disabled() -> None: settings = load_settings() assert settings["pm7"]["enabled"] is False def test_output_di...
0eb7ba95e322dae74b12090a6b624eed0e4f35309d1605130890ac8fdc6365a4
Python
1,067
36
''' This package provides tools for analyzing and classifying calcium imaging data. It includes modules for data preprocessing, model training, and inference. ''' from .core.dffdataset import DffDataset from .core.classifier_dff import CalciumEventClassifierDff from .core.inference import is_calcium_event, load_classif...
2318caeda798ec8cc56097fbe4b22402454c333a5aa6544a3f0e553cfbab78e3
Python
1,069
36
# # Copyright (c) 2020 10X Genomics, Inc. All rights reserved. # """Utility for getting the version of the pipeline.""" from __future__ import annotations import os.path import tenkit.log_subprocess as tk_subproc def get_version(): """Get the version for the pipeline. Normally it will read this from the...
3dd0ee793a50e324e7058223211dbcbc12d57a939bd4848b9ddc1e02003fcbd7
Python
1,070
28
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from contextlib import contextmanager from openff.toolkit import GLOBAL_TOOLKIT_REGISTRY, OpenEyeToolkitWrapper from openff.toolkit.utils.toolkit_registry import ToolkitUnavailableException ...
875d2d0654ccd8014911d416241ba9f6c53701b72a8010fd703eb50d33f20c7f
Python
1,074
44
''' Created on 08.04.2019 @author: Niklas Pallast process all DTI data ''' import glob import os import numpy as np def findData(path): regAtlas_list = [] fileALL = glob.iglob(path + '/P*/S*/DTI/DSI_studio/*_rsfMRISplit_scaled.nii.gz', recursive=True) for filename in fileALL: regAtlas_list.ap...
85f02f966fde7ebd7c23fbbb57aa7ad39728cb6e01612f2b9e63c639be70da37
Python
1,077
47
""" Created on May 14, 2025. @author: voodoocode """ import pyvista import numpy as np import sklearn.cluster import scipy.ndimage import shutil import finnpy.src_rec.utils import os np.random.seed(0) STRUCT_PATH = "/mnt/data/Professional/projects/finnpy/DISTAL (Ewert 2017)/lh/Subthalamic Nucleus.obj" STRUCT_NAME =...
6741bb9eae66387678a2ef50f13b0874cff6907ebd305d139e61d4ee3faabde1
Python
1,083
38
# # Copyright (c) 2025 10X Genomics, Inc. All rights reserved. # """Get legacy cell type outs.""" import json import martian __MRO__ = """ stage MERGE_ALL_CELL_TYPE_METRICS( in json cell_annotation_primary_metrics, in json cell_annotation_analysis_metrics, out json merged_cell_annotation_metrics, s...
27e0c7f22a10d595e6edd75acc9d665f3eec3d49ec862ba7acee1366fe896bf9
Python
1,084
33
from pathlib import Path import scipy.io from . import config VAL_ROOT = Path(config["paths"]["val_root"]) VAL_ROOT.parent.mkdir(parents=True, exist_ok=True) META_PATH = Path(config["paths"]["meta_path"]) META_PATH.parent.mkdir(parents=True, exist_ok=True) LABEL_FILE = Path(config["paths"]["label_file"]) LABEL_FILE...
0d8ed4c1c97876b853e8c231786fa24e99a5d3df1679c42c4673012cf7470249
Python
1,085
35
import sys from pathlib import Path import pandas as pd SCRIPTS = Path(__file__).resolve().parents[1] / "scripts" sys.path.insert(0, str(SCRIPTS)) from run_missing_data_sensitivity import compare_screens, select_top def test_screen_comparison_reports_set_based_top_k_overlap_and_rank_agreement(): left = pd.Dat...
425ad3577d58a659260c9bbef555a8ae19a638b5905dedb1d6f8632a2ae654e5
Python
1,085
27
import shutil from batchgenerators.utilities.file_and_folder_operations import isdir, join from nnunetv2.utilities.dataset_name_id_conversion import maybe_convert_to_dataset_name from nnunetv2.paths import nnUNet_raw if __name__ == '__main__': dataset_name = 'IntegrationTest_Hippocampus' dataset_id = 999 ...
743af165c77e20e869191039718724e63b609933bf464941555f0afcdf47b2d8
Python
1,086
30
#%% imports import sys sys.path.append('/mnt/obob/staff/fschmidt/neurogram/cluster_jobs') from cluster_jobs.stats_across_eog import StatsAcross from plus_slurm import SingularityJobCluster, PermuteArgument #% get jobcluster job_cluster = SingularityJobCluster(required_ram='4G', request_time=6...
246b869be24d3c52c5a14fd79695c93c2508a23aa03841726a3d4c774b430590
Python
1,088
32
from __future__ import annotations import importlib.metadata as impm import re import jinja2 import requests from jinja2.ext import Extension class SnakebidsVersionExtension(Extension): """Retrieve the latest snakebids version from pypi. Stores value in the ``snakebids_version`` global variable. """ ...
5e666042d2d45494e4bff780f35312367e6feca795863c54834dca09a4fa1fb1
Python
1,089
54
''' Created on Oct 9, 2025 @author: voodoocode ''' import numpy as np def rigid_transform_3D(A, B): centroid_A = np.mean(A, axis=0) centroid_B = np.mean(B, axis=0) AA = A - centroid_A BB = B - centroid_B H = AA.T @ BB # SVD decomposition U, S, Vt = np.linalg.svd(H) R = Vt.T @ U.T ...
33d7f004d9aff5803cddb0395e760848e3f059bf0ae0a933312b7ab74fdf3fb3
Python
1,092
38
from collections import OrderedDict import yaml from pathlib import Path import torch from torchvision import models from .. import config def load_model(device): model_path = Path(config["model_path"]) model = models.resnet50(weights=None).to(device) checkpoint = torch.load(model_path, map_location=de...
40cdb8b761afe9847f838c875fbd5e572270b1780dc65718bc030beb8b810975
Python
1,095
32
# eeg_visual_classification/models/registry.py from .EEGNET import Model as EEGNet from .blstm import Model as blstm from .BrainDecoder import Model as BrainDecoder from .NeuroStream import Model as NeuroStream from .lstm import Model as lstm from .SleepingPower import Model as SleepingPower from .EEGChannelNet import ...
538f8ced9697500ae8bcc2efeada2b1a1298031db655013099cf3aca8231e0aa
Python
1,099
30
from __future__ import annotations from typing import Any from src.tautomer.base import TautomerError, Tautomerizer def build_tautomerizer(settings: dict[str, Any] | None) -> Tautomerizer | None: """Return a tautomer backend, or ``None`` when the step is disabled. The tautomer step is opt-in (``tautomer.en...
404b3dfc783f9410acec36a0c22c06efb2e4b65c28a803addc1f8aa04e726704
Python
1,100
38
import scanpy as sc import pandas as pd import numpy as np csv_path = "PATH_TO_INPUT_CSV/samap_leiden_clusters.csv" h5ad_path = "PATH_TO_OUTPUT_DIR/yours.h5ad" df = pd.read_csv(csv_path) required_cols = ["X", "leiden", "celltype", "batch"] for col in required_cols: if col not in df.columns: raise ValueEr...
d93a379ceac94ba6e90c221c34ebedd7c896ef354a994cf83a46f57925100560
Python
1,100
37
import os import pickle import pandas as pd import scanpy as sc pkl_path = "PATH_TO_INPUT/SAMAP_processed.pkl" output_dir = "PATH_TO_OUTPUT_DIR/SAMap/" os.makedirs(output_dir, exist_ok=True) with open(pkl_path, "rb") as f: sm = pickle.load(f) adata = sm.samap.adata adata.obs["batch"] = adata.obs["species"].as...
a13d5aea2c4dd78acdf61ff4a0dcd4c01833d634d1c8c0d80484c627c0d71b7d
Python
1,103
42
from typing import Dict, Optional, Sequence import numpy as np def view( img: np.ndarray, masks: Optional[Dict[str, np.ndarray]] = None, channel_names: Optional[Sequence[str]] = None, pixel_size_um: float = 1.0, run: bool = True, **viewer_kwargs, ) -> Optional["napari.Viewer"]: import nap...
d0b1a0e50eeee2b59244fd4258f458cbd594a4ce886717eca0f6981595f0b348
Python
1,103
38
# # Copyright (c) 2023 10X Genomics, Inc. All rights reserved. # from __future__ import annotations import base64 import struct def array_to_float32_base64(vals): """Convert an array of doubles to a little endian base64 encoded ASCII string. Args: vals: a list of float values Returns: A...
5c746ec931cebb509810a961235dc5e312791a07b2d8c06b05e03cbc7dac6bd2
Python
1,106
40
#!/usr/bin/env python3 import numpy as np from typing import List from detectron2.structures import Instances def create_prediction_pairs( instances: Instances, prev_instances: Instances, iou_all: np.ndarray, threshold: float = 0.5, ) -> List: """ Args: instances: predictions from cur...
8ad018155ba890d782a943cc687099d5796ebfc30fb7bc2d117603d95cc0807f
Python
1,106
54
""" ROIpy is a package for region of interest (ROI) creation compatible with ScanImage. """ __version__ = "0.1.0" from .core.structures import Stack, Morphology, Scanfields from .GUIv2.main import run_app # Import plot submodule from .plot.plot import plot, animate from .analysis import stats import sys from pathl...
4375a6c192a167995c4bc11598f61b4f25f4d3d557d15ffc90353e395943231f
Python
1,108
35
"""Test validation for HexGrid torus configurations.""" import random import pytest from mesa.discrete_space import HexGrid def test_hexgrid_torus_odd_dimensions_error(): """Test that HexGrid raises ValueError when torus=True and dimensions are odd.""" # Helper to assert error with pytest.raises( ...
663da1028ca55a746d68e3291ca95637ef614dbadb2974795bbba3b2489e6a42
Python
1,108
38
import scipy.io import numpy as np from scipy.spatial import Voronoi import math data = scipy.io.loadmat('temp_file.mat') points = data['points'] def PolyArea(x,y): return 0.5*np.abs(np.dot(x,np.roll(y,1))-np.dot(y,np.roll(x,1))) vor = Voronoi(points) point_to_cell_index = list(vor.point_region) reg...
b91e6ef9eed1369b170d52ea8cb5e20b917a0eaa4a6c04e0108400f770642ff4
Python
1,108
40
import importlib import platform import sys REQUIRED_RUNTIME = { "numpy": "numpy", "pandas": "pandas", "sklearn": "scikit-learn", "yaml": "PyYAML", "joblib": "joblib", } OPTIONAL_FULL = { "torch": "torch", "transformers": "transformers", "jieba": "jieba", } print("Platform:", platform....
5db6fa9b67dd11bc1bbfbd433f0b9552a5832388d012105ad0824556a7a985e7
Python
1,110
38
from dataclasses import dataclass, field from pathlib import Path from typing import Any from .. import io from ._checkpoint import CheckpointView __all__ = ['TrialView'] @dataclass class TrialView: path: Path = field(repr=False) name: str = field(init=False) def __post_init__(self): self.path...
8c4106c4cf4129d849e55dc6fd37a42f4f1c3521f3f49c79ba513cc08a03aa6a
Python
1,110
34
import shutil import uuid from src.utils.config import PROJECT_ROOT from src.utils.models import ProtonatedLigandRecord from src.visualization.structure_panels import StructurePanelGenerator def test_generate_structure_panel_pdf() -> None: output_dir = PROJECT_ROOT / "data" / "intermediate" / "test_tmp" / str(uu...
a3da905c15e75c7b184caa9dd99380114e6b232e9838319e70abb6b33c0b7a25
Python
1,110
35
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
e36b5342549901af664e6f0a61edeb9aa26be47bfb101ff742c701c599a51166
Python
1,110
33
import pathlib import pytest from click.testing import CliRunner from openfecli.fetchables import RBFE_TUTORIAL, RBFE_TUTORIAL_RESULTS from openfecli.fetching import FetchablePlugin from .conftest import HAS_INTERNET def fetchable_test(fetchable): """Unit test to ensure that a given FetchablePlugin works""" ...
6ddd4ad7068b4dd9ba31cabefb674a06a3b140f32776a7109119e6a9448ca037
Python
1,117
23
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
f1fcb9efb6a31ee7f0d77998d66631928dc78264018bfc5b71d05c5bd1921b00
Python
1,117
37
"""Mesa Signals (Observables) package that provides reactive programming capabilities. This package enables tracking changes to properties and state in Mesa models through a reactive programming paradigm. It enables building models where components can observe and react to changes in other components' state. The pack...
216adb98dc0721fa8c334c89132ee2b2a8cd141c25173eebb7e74aee7b5b5f5a
Python
1,118
51
from features import * from reduceData import * from joblib import Parallel, delayed import multiprocessing #from runClassifiers import * import time def mainRun(indexRun) : numberOfFolds=10 run=indexRun start_time = time.time() globalAnt=0.0 globalIndex=0 globalAccuracy=0.0 X, y, biomarkerNames = loadDataset...
472d1afc834a00f2ffd48d08d208e537c507acaeec1f90c093f375a15b106339
Python
1,119
33
# Clipboard_to_Results.py # IJ BAR: https://github.com/tferr/Scripts#scripts # # Imports numeric values copied to the clipboard into the Results table. It is # now deprecated. It was of utility prior to BAR v1.1.7, when BARs that analyzed # tabular data could only read values from the main IJ "Results" table. It is # i...
b58b806e1f448ff3e01bb9562373300ab6e340c20b62f45c7c2734a68d2c4a3d
Python
1,119
37
#!/usr/bin/env python # # Copyright (c) 2021 10X Genomics, Inc. All rights reserved. # """Chain types used by the VDJ pipeline.""" from __future__ import annotations import cellranger.vdj.constants as vdj_constants # Chain types TR_CHAIN_TYPE = b"TR" TR_GD_CHAIN_TYPE = b"TR_GD" IG_CHAIN_TYPE = b"IG" VDJ_CHAIN_TYPES =...
4ef5c0e7a01a241731b3dd71efbc6aad7ebab554555a9cfa3f883bf3b4d9b5a0
Python
1,120
57
import scanpy as sc import anndata import numpy as np import scipy.sparse as sp import pandas as pd import time import scvi import os input_path = 'PATH_TO_INPUT/combined_adata.h5ad' combined_adata = sc.read_h5ad(input_path) start_time = time.time() scvi.model.SCVI.setup_anndata( combined_adata, batch_key="...
76581a5539ad7a48d6989975cdbcd8ab0b0720614c52799b2d16215dc069dcce
Python
1,120
41
from pathlib import Path import flammkuchen as fl def save_metadata( metadata: dict, save_path: str or Path, overwrite: bool = False ) -> None: """ Save the metadata to a .json file for fast loading and inspection. Parameters ---------- save_path : Path, optional Path where to...
20a99c6b5af449cb92adcba5424d4ee1f0a1318f5cd975096ddff761fae433bf
Python
1,122
37
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 7 13:33:47 2022 @author: schmidtfa """ #%% imports from cluster_jobs.preprocess_meg_sbg import Preprocessing from plus_slurm import JobCluster, PermuteArgument import pandas as pd #%% get jobcluster job_cluster = JobCluster(required_ram='4G', ...
37b3ee998ab45df94894b9b311fc70c2fb8a86eeeda952530109a6035796a5cc
Python
1,124
28
from typing import Dict, Sequence, Tuple import numpy.typing as npt from brian2.units import hertz from ._base import StimulusLayer from ..groups import GroupFactory from ...definitions import NeuronClass __all__ = ["PoissonLayer"] class PoissonLayer(StimulusLayer): def __init__(self, name: str, group_shapes: ...
23ac3b7ad3fd1c4797067948def0e4a5bcad1dbe6a564737d3bac3a777014618
Python
1,125
57
# -*- coding: utf-8 -*- """For testing neuromaps.nulls.spins functionality.""" import numpy as np import pytest from neuromaps.nulls import spins def test_load_spins(): """Test loading spins.""" rng = np.random.default_rng() out = rng.integers(1000, size=(100, 100), dtype='int32') assert out is spin...
7f13a4b69cb20e502c98aa060d65012b5f8f2ae055eac83f080be88fe37687d9
Python
1,125
29
import sys from pathlib import Path SCRIPTS = Path(__file__).resolve().parents[1] / "scripts" sys.path.insert(0, str(SCRIPTS)) from run_model_sensitivity_pipeline import build_task_commands def test_orchestration_builds_median_mode_and_shap_commands_for_one_split(tmp_path): commands = build_task_commands( ...
6f77e0e6e399e6f6c1c87fa3c53e836667401bccead885aa7bdff990a2933a5b
Python
1,127
45
from copy import deepcopy import numpy as np import pandas as pd import os import re from pathlib import Path def get_project_root() -> Path: """Returns project root folder.""" return Path(__file__).parent.parent.parent def get_folders(root_folder, pattern): folders_all = os.listdir(root_folder + '/') ...
ead2994cad205df94a6fa254a0077039f0b815296069964aded68b6bd653983e
Python
1,127
33
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe from ..structures import DensePoseChartPredictorOutput, DensePoseEmbeddingPredictorOutput from . import ( HFlipConverter, ToChartResultConverter, ToChartResultConverterWithConfidences, ToMaskConverter, densepose_chart_predictor_outpu...
0fc2802fb7ecf76cbf200307de173954c009e836edb97dc472899d6e856ca8f3
Python
1,129
33
# Copyright (c) 2023 10X Genomics, Inc. All rights reserved. """Clonotype related functions.""" from collections import Counter def extract_clonotype_id_from_name(clonotype_name: str): """Extract the clonotype id from a clonotype name string.""" return int(clonotype_name.split("clonotype")[1]) def count_c...
8b1b6e3d2dff659593471b2d2d6f604e4ae7e7fe67eb7d549abaa76db42b89ff
Python
1,132
38
# -*- coding: utf-8 -*- """ Created on Sun Aug 21 13:34:26 2022 @author: walte """ import os import scipy import platform if platform.system() == 'Windows': basename = os.path.join("C:\Denoising","DCCR-Net","variable_maps") else: basename = os.path.join("/mnt/c/Denoising/DCCR-Net/","variable_ma...
3abdf27559d9345550ad014c0432b185f2cd1b71374e99d9f94c2cf69850a7bc
Python
1,135
45
import scanpy as sc import anndata import numpy as np import scipy.sparse as sp import pandas as pd import time import scvi import os input_path = "PATH_TO_INPUT/combined_adata.h5ad" combined_adata = sc.read_h5ad(input_path) print("Available obs columns:", list(combined_adata.obs.columns)) start_time = time.time() s...
7ad8f60ffe525719552bcc446719f948bb75ed39249fb85203bc68ea65a5e696
Python
1,137
43
# Copyright (c) Facebook, Inc. and its affiliates. import unittest import torch from detectron2.structures import BitMasks, Boxes, Instances from .common import get_model # TODO(plabatut): Modularize detectron2 tests and re-use def make_model_inputs(image, instances=None): if instances is None: return ...
df0e5c110c1d5d14eb2073c0ffbc020e5878e6b72dfd54db7323708af048eba3
Python
1,138
47
from __future__ import annotations import textwrap import warnings from colorama import Fore, Style WARN_TEMPLATE = f"""\ {Fore.YELLOW}{Style.BRIGHT}[{{category}}]{Style.NORMAL} {{filename}}:{{lineno}} \ {Fore.RESET}{{line}} {{message}} """ def formatwarning( message: Warning | str, category: type[Warning...
cd3fc0dba636414ae4729296aa02fd364eb376b4f68a30280cd9163d254d10e3
Python
1,142
39
#@ImagePlus img #@Double(label="X radius",value=2.0) xradius #@Double(label="Y radius",value=2.0) yradius #@Double(label="Z radius",value=2.0) zradius # Python06.py # IJ BAR: https://github.com/tferr/Scripts#scripts #################################################### # 6. Further examples ############################...
e9dec95ba75105a478319aae452d676b88d834721d38df4019bd8063d1f21aa9
Python
1,143
26
""" Deprecated location. ResEncUNetPlanner moved to nnunetv2.experiment_planning.experiment_planners.residual_unets.residual_encoder_unet_planners, where it lives next to the nnUNetPlannerResEncM/L/XL presets that derive from it. This module used to hold a second, independently maintained copy of the class. Because `-...
37e34a0771ef72d6fcc1a6d84f2a05e7dadc2e0b220cd899ecce691f9a683d8d
Python
1,145
36
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe from typing import Any from .base import BaseConverter class HFlipConverter(BaseConverter): """ Converts various DensePose predictor outputs to DensePose results. Each DensePose predictor output type has to register its convertion strateg...