sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
8e6f51b47b459225e83354750d333b4875f33a92b25c5b1438f1f0c6e02e6352
Python
305
14
from typing import List, TypeVar import torch T = TypeVar("T") def one_hot_encode(value: T, categories: List[T]) -> torch.tensor: """ One-hot encode a value. """ tensor = torch.zeros((1, len(categories)), dtype=torch.int64) tensor[0, categories.index(value)] = 1 return tensor
17cfee701711d0cff792ceaed394ceb3145af6b3a8056050c4840e9b8898b620
Python
306
14
"""Hi-Compass commands.""" from . import preprocess_atac from . import preprocess_hic_norm from . import preprocess_hic_to_npz from . import training from . import predicting __all__ = [ 'preprocess_atac', 'preprocess_hic_norm', 'preprocess_hic_to_npz', 'init_training', 'predicting' ]
59cffe7ffd1ec60295dd04fdd2a7fa137b9a0434c0f04d371cc5344c270c3fd8
Python
314
10
import numpy as np def resample_signal(signal, source_rate, target_rate): if source_rate > target_rate: return signal[::int(source_rate / target_rate)] else: return np.repeat(signal, int(target_rate / source_rate)) def get_time_points(signal): return np.where(np.diff(signal) > 0)[0]
7cc85e19790b14e7074677a8e0d93fe7eff1a701120ce131f55928fad8b154dd
Python
316
12
import gl gl.resetdefaults() gl.azimuthelevation(70, 15) gl.meshload('BrainMesh_ICBM152Right.mz3') gl.overlayload('motor_4t95vol.nii.gz') gl.overlayminmax(1,2,12) gl.overlayload('motor_4t95vol.nii.gz') gl.overlayminmax(2,-1,-2) gl.colorbarvisible(1) gl.overlaytransparencyonbackground(25) gl.meshcurv()
70cae085ed6ce9efbd5c42bad78106f9c41160b24ba0e35bdf9a27f9a0121557
Python
321
11
""" src/sweep — Sweep Engine ============================= Orchestrates the large-scale degradation sweep: 25 datasets × 84 conditions × 11 methods × 30 repeats. """ from .engine import SweepEngine, SweepResult from .surface import aggregate_surfaces __all__ = ["SweepEngine", "SweepResult", "aggregate_surfaces"]
4001a38b25331334c3d1831881c60c09541847270aa5f8c0c4fc2a80cc0cae2e
Python
323
15
""" The `py/` submodule contains python (non-pytorch) implementations of various helper functions. Modules ------- generators Data generators for medical image registration. utils General-purpuse python utilities for VoxelMorph. """ from . import utils from . import generators __all__ = ['utils', 'generators...
2c3763c00e42380c95adf5134a3679a961a78cf77674ad1e3834b0a2a45d1181
Python
325
17
"""Hi-Compass training module.""" from .HicompassDataset import ChromosomeDataset from .HicompassModel import ConvTransModel from .HicompassTrain import TrainModule, init_training __all__ = [ # Dataset 'ChromosomeDataset', # Model 'ConvTransModel', # Training 'TrainModule', 'init_trainin...
bedaa2b9108cdaa589f1a1a74d39bc70e0ef066521e2dfef21974d3a837a9f78
Python
327
6
import pandas as pd df = pd.read_csv(snakemake.input[0], sep="\t") df.loc[df["probability"] >= float(snakemake.config["ashleys_threshold"]), "prediction"] = 1 df.loc[df["probability"] < float(snakemake.config["ashleys_threshold"]), "prediction"] = 0 df.sort_values(by="cell").to_csv(snakemake.output[0], sep="\t", index...
28a1893b303d5e5249a158c598cdc2606beeb6d84b5fd6cb016c5aab60d130dd
Python
329
15
from setuptools import setup, find_packages setup( name="rd_filters", version="0.1", packages=find_packages(), entry_points={ 'console_scripts': [ 'rd_filters=rd_filters.rd_filters:main', ], }, install_requires=['pandas', 'docopt', 'rdkit'], include_package_data...
adf6bcfd43d32d02b5b821084f9e2b589df5448eaebb9a462956508ac5d62c3a
Python
329
13
import os input_folder = '..//0_used_data//t1_fse_flair_tra' os.system('python main.py --ni --config imagenet_256.yml --output_path results_5T \ --path_y celeba_hq --eta 0.85 --deg "denoising" --output_folder t1_fse_flair_tra_v2 \ --deg_scale 1.0 --noise_rate 0 --add_noise \ --lambda_t 100 --input_folder '+input_...
d84222b29e6cba532bc5a144fffcd08d485dfa88b63719de6e49d893e22bbec7
Python
329
12
import pytest @pytest.fixture(scope='module', params=["classifier", "regressor"]) def boosting_alg_type(request): return request.param @pytest.fixture(scope='module', params=["AdaBoost", "GBoost", "LR", "NGBoost", "RF", "SGBoost", "SVM_RBF", "SVML", "XGBoost"]) def boosting_method(request): return reque...
20aecede9b1bec24b2ab6d0bef07b5bba9c6ff8c32a3ef5a651a82845fc9d6d4
Python
332
27
""" Library of useful routines for virtual epileptic patient workflows. """ from .io.stan import ( cmdstan_path, compile_model, parse_csv, rdump ) from .plots.stan import ( pair_plots, trace_nuts ) from .plots.network import ( phase_space ) from .plots.seeg import ( ppc_seeg, ...
16f436c7e43664f304990257c17d2f29a28c58b9bd3a717b9cddd4b12122f9b0
Python
334
12
import numpy import pytest shapely20_todo = pytest.mark.xfail( strict=True, reason="Not yet implemented for Shapely 2.0" ) shapely20_wontfix = pytest.mark.xfail(strict=True, reason="Will fail for Shapely 2.0") def pytest_report_header(config): """Header for pytest.""" return f"dependencies: numpy-{numpy....
2cf4f745c9108fd310d85f891300dfe5c95822d09b41df4aa05c0513671e7337
Python
334
16
__all__ = [] from ._pathing import * from . import _pathing from ._retrieval import * from . import _retrieval from ._processing import * from . import _processing from ._analysis import * from . import _analysis __all__ += _pathing.__all__ __all__ += _retrieval.__all__ __all__ += _processing.__all__ __all__ += _anal...
a931339208d99ebf9de82d3cc7c919a0dc8fc4e0be037927c067ff9a2c89d7f7
Python
334
15
__all__ = [] # Treat entire folder as a single modlue from . import _graphs from ._graphs import * from . import _edge_processing from ._edge_processing import * from . import _metapaths from ._metapaths import * # Add the imported items __all__ += _graphs.__all__ __all__ += _edge_processing.__all__ __all__ += _metap...
23193dbd69f3e122791df19fd16ddb2fd4a58be348c057a81ac247c78478ac1a
Python
335
9
""" This file is used to run the experiment. Note that it should always be run from within the main project directory, since the structure of the package is designed with that expectation. """ if __name__ == '__main__': from expts.controllers import Controller Controller() #import profile #profile.run('...
9e2a015b846652dbb457126934aac47df425f9899c778c57a2e914906463626a
Python
338
11
import unittest import caffe class TestLayerTypeList(unittest.TestCase): def test_standard_types(self): #removing 'Data' from list for type_name in ['Data', 'Convolution', 'InnerProduct']: self.assertIn(type_name, caffe.layer_type_list(), '%s not in layer_type_lis...
7b3072887265f6f0e42c4de89ab2d5772437e4ae2addd7b700d28a95ca8b0798
Python
339
15
""" Unit and regression test for the proteinbenchmark package. """ # Import package, test suite, and other packages as needed import sys import pytest import proteinbenchmark def test_proteinbenchmark_imported(): """Sample test, will always pass so long as import statement worked.""" assert "proteinbenchma...
cafab7300073dde4ef2dd441e7f5105ef268322d0385081a2810ac091954ebf5
Python
339
11
""" :mod:`alchemiscale.strategist` --- strategist service ==================================================== The strategist service coordinates the execution of strategies on alchemical networks. """ from .service import StrategistService from .settings import StrategistSettings __all__ = ["StrategistService", "St...
c3621bb110e072346c7c60c820684c4ad32311a511b10f4add6649348c5b0e1a
Python
340
9
from openff.nagl.features import atoms def test_atom_hybridization_categories_validation(): assert atoms.AtomHybridization(categories=['OTHER', 'SP', 'SP2', 'SP3']).categories == [ atoms.HybridizationType.OTHER, atoms.HybridizationType.SP, atoms.HybridizationType.SP2, atoms.Hybridiz...
eb41efad5bd5d8275ce0e7ec5abc639aa98b7a545c9786ef9406cb484306a60e
Python
340
8
from PyInstaller.utils.hooks import collect_submodules from PyInstaller.utils.hooks import collect_data_files hiddenimports = collect_submodules("ants") datas = collect_data_files("ants") #pyinstaller --noconfirm --clean --onefile --paths=/home/andrep/workspace/neuro_rads_prototype/venv/lib/python3.6/site-packages/a...
8848e846b863d50423d1f8066d4098141065e89dbd4289b3a62cb1994d22beb7
Python
346
12
import warnings # noinspection PyUnresolvedReferences from multiqc.report import * # noqa: F403 # Issue a deprecation warning warnings.warn( "Importing 'report' from 'multiqc.utils' is deprecated and will be removed in a future release. " "Please use 'from multiqc import report' instead.", DeprecationWar...
e16a4fd97f31be02f69d3dcdd5da9ad2a3c4efbe0b3d17c2c6808fdf0d539582
Python
346
12
import warnings # noinspection PyUnresolvedReferences from multiqc.config import * # noqa: F403 # Issue a deprecation warning warnings.warn( "Importing 'config' from 'multiqc.utils' is deprecated and will be removed in a future release. " "Please use 'from multiqc import config' instead.", DeprecationWar...
8c933900fb00daef3f71d6ee04b331375f44c6c74bbc8fc5b5e5aca08787c29a
Python
349
16
class MissingUnitError(ValueError): """ Exception for data missing a unit tag. """ class UnitValidationError(ValueError): """ Exception for bad behavior when validating unit-tagged data. """ class UnsupportedExportError(BaseException): """ Exception for attempting to write to an unsu...
0fdb761f97d79f46495e8b44c6cede62c10fdf6eb20fb79ec39729975ea00b3b
Python
352
15
"""Hi-Compass preprocessing module.""" from .atac import ATACPreprocessor from .hic_norm import HiCNormalizer, HG38_CHROM_SIZES, MM10_CHROM_SIZES from .hic_to_npz import HiCToNPZConverter, hic_to_npz __all__ = [ 'ATACPreprocessor', 'HiCNormalizer', 'HiCToNPZConverter', 'hic_to_npz', 'HG38_CHROM_S...
d86689179ed7720bcb331db9a6f50cd046bccef49089835cb6202a6794f473bc
Python
352
16
import datajoint as dj from ethopy.core.behavior import Behavior from ethopy.core.logger import behavior @behavior.schema class HeadFixed(Behavior, dj.Manual): definition = """ # This class handles the behavior variables for RP ->behavior.BehCondition """ def exit(self): super().exit() ...
c35dde2a2a89be2a0c87a5a54130ee4becdb155734a1f2523a604c5b867cd01a
Python
353
14
import pytest import networkx as nx try: from pathtester import PathTester except ModuleNotFoundError: from utils.pathtester import PathTester indications = nx.read_yaml('indication_paths.yaml') @pytest.mark.parametrize('path', indications) def test_paths(path): test_path = PathTester(path) test_path...
65a5867f239c92c1d46f424b307b18c188f1a68c38292a5dc7a8ed55ed8dc9db
Python
354
15
#!/usr/bin/env python # Very simple file format conversion script, works in 90% of situations # and good for saving keystrokes. from forcebalance.molecule import Molecule from sys import argv def main(): topfnm = argv[3] if len(argv) >= 4 else None M = Molecule(argv[1], top=topfnm) M.write(argv[2]) if _...
7e6d3cb72c6d53c1f2e5e6d449a7138b9549c8b54b660fb8863ad3053af68c21
Python
355
22
import pytest from multiqc import report, config, validation from multiqc.utils import testing @pytest.fixture def data_dir(): return testing.data_dir() @pytest.fixture(autouse=True) def reset(): """ Reset MultiQC session after use: reset config and report """ yield report.reset() con...
9d36bb9b44b57657c5e52ca3b57f39b222e6d42553f722cd293fd8afac1afc68
Python
355
16
""" Classes that define configuration options for training or using a GNN Model. """ from .data import DataConfig, DatasetConfig from .model import ModelConfig from .optimizer import OptimizerConfig from .training import TrainingConfig __all__ = [ "DataConfig", "DatasetConfig", "ModelConfig", "Optimiz...
1c3a87bff152be060f97a23bdd344c0135506eb6ac58b6700ae81554db6d4e3b
Python
356
10
from typing import ClassVar from beyond_backprop.algorithms.image_classification_test import ImageClassificationAlgorithmTests from .backprop import Backprop class TestBackprop(ImageClassificationAlgorithmTests[Backprop]): algorithm_type = Backprop algorithm_name: str = "backprop" unsupported_datamodule_...
3f389b5da0cb566fe1e3f191b12cebf036539dbd2149213cac63980cd51a394c
Python
358
15
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from openfe.utils import requires_package import pytest @requires_package('no_such_package_hopefully') def the_answer(): return 42 def test_requires_decorator(): with pytest.rais...
69ed7afb08d24051def9705ba9ee2da3c58538683002ebc9e5446cc6577c642c
Python
361
8
from .abstract_loss import AbstractLoss from .abstract_fitting import AbstractFitting from .abstract_measurement_model import AbstractMeasurementModel from .abstract_neural_model import AbstractNeuralModel from .abstract_params import AbstractParams from .parameter import Parameter from .timeseries import Timeser...
f06ffffa394bf3b5db99210372875a04c01d92568f9f5f03b603df95b1b1b7ff
Python
362
18
"""The module 'pyleida.signal_tools' provides functions to compute relevant information from BOLD time series.""" from ._signal_tools import ( hilbert_phase, clean_signals, phase_coherence, get_eigenvectors, txt_matrix ) __all__ = [ "hilbert_phase", "clean_signals", "phase_coherence", ...
361d84720803a44dc8ad0c987bab3fad9f421435bd71e1758c9f354ed36f9b47
Python
363
13
"""Shared core components for TimeFlies projects.""" from .active_config import get_active_project, get_config_for_active_project from .config_manager import Config, ConfigManager from .pipeline_manager import PipelineManager __all__ = [ "PipelineManager", "Config", "ConfigManager", "get_config_for_ac...
a4b156f1721ce20dd5c687302f80fadb4ceab33fd96a67585300ff22cb0042bc
Python
363
6
from .cifar10_datamodule import CIFAR10DataModule, cifar10_normalization from .fashion_mnist_datamodule import FashionMNISTDataModule from .image_classification import ImageClassificationDataModule from .imagenet32 import ImageNet32DataModule, imagenet32_normalization from .mnist_datamodule import MNISTDataModule from ...
f0b422d1ba5e271cf29915c568e010d9a3c0f55c59850dbd35225cb635d26296
Python
363
12
import argparse import marshall_intrinsic_units parser = argparse.ArgumentParser() parser.add_argument("size", help="Subsystem size", type=int) parser.add_argument("--isel", help="Subsystem index", type=int, default=None) args = parser.parse_args() marshall_intrinsic_units.run_blackbox_micro_example( subsystem_s...
2d4c072241e53094ea57f419e0e7a2eda679abb58e00ab2b1c39e2d156a50e02
Python
365
10
import re import gzip # open gzipped or regular text vcf files def open_file_for_reading(filename): if re.search("\.gz$", filename): return gzip.open(filename, 'rt', encoding="utf-8", errors='ignore') # t needed for python3 to look like regular text else: return open(filename, 'rt', encoding="...
c7050b0569de50802fb8f17fc793b7c44327c97375eee2a92a6b419be2b0ab6f
Python
365
18
""" MultiQC lint helpers. Simple additional tests to run when --strict is specified (outside scope of normal functions) """ import logging from multiqc import config, report logger = logging.getLogger(__name__) def lint_error(msg: str): if config.strict: logger.error(msg) report.lint_errors.app...
10a2ede2d5db67b6c769b234c8297bbfc1e4ba90b0121823b3fa96711b66796e
Python
367
12
import os from dotenv import load_dotenv load_dotenv(override=True) OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "") HF_TOKEN = os.getenv("HF_TOKEN", "") HF_USER_ID = os.getenv("HF_USER_ID", "") VLLM_N_GPUS = int(os.getenv("VLLM_N_GPUS", 0)) VLLM_MAX_LORA_RANK = int(os.getenv("VLLM_MAX_LORA_RANK", 8)) VLLM_MAX_NUM_S...
05f6a8a21ec8f9e24214380ea8444bdd56f387d9384f19b8cd19ebf6ea1164da
Python
368
9
import pandas as pd df = pd.read_csv(snakemake.input[0], sep=",", compression="gzip") df = df[["chrom", "start", "end", "sample", "cell", "c", "w", "class"]] df["w"] = df["w"].fillna(0) df["c"] = df["c"].fillna(0) df["class"] = df["class"].fillna("None") df["class"] = df["class"].astype(str) df.to_csv(snakemake.output...
c65eaf2564e7eec07bbf987ba8f8fe0ad4f37d7bdb05ecd8d45c5ef529a37752
Python
368
14
from typing import List, Optional __version__ = "21.1.2" def main(args=None): # type: (Optional[List[str]]) -> int """This is an internal API only meant for use by pip's own console scripts. For additional details, see https://github.com/pypa/pip/issues/7498. """ from pip._internal.utils.entrypo...
175c27c6afd9822e04c1ac87a3fea69af9db1b03b8cc906d97e6f18c75e5c24f
Python
369
11
"Extensions of the OpenFF Toolkit ToolkitWrappers for use with NAGL." from openff.nagl.toolkits.openeye import NAGLOpenEyeToolkitWrapper from openff.nagl.toolkits.rdkit import NAGLRDKitToolkitWrapper from openff.nagl.toolkits.registry import NAGLToolkitRegistry __all__ = [ "NAGLOpenEyeToolkitWrapper", "NAGLRD...
23add2131fe56e23df555dc82182ca98f4917027114f9b090c11b9dc96e71566
Python
369
15
from pathlib import Path import json def ensure_dir(path: str | Path) -> Path: path = Path(path) path.mkdir(parents=True, exist_ok=True) return path def save_json(obj, path: str | Path) -> None: path = Path(path) path.parent.mkdir(parents=True, exist_ok=True) with open(path, "w", encoding="u...
56c7b51594374aeb39d7000163822b7ff2678d893b109992b3d6fe128790a42c
Python
373
10
from beyond_backprop.networks.conv_architecture import ConvBlock from beyond_backprop.networks.conv_architecture_test import ConvArchitectureTests from .lenet import LeNet, LeNetBlock from .network_test import NetworkTests class TestLeNet(ConvArchitectureTests[LeNet], NetworkTests[LeNet]): net_type: type[LeNet] ...
f6068cf4a28f01378efb5b48a68ecc8b51de3481275004f197d7262fa80e3efb
Python
375
16
#!/home/leeping/local/bin/python from __future__ import print_function from forcebalance.molecule import Molecule from sys import argv def main(): M = Molecule(argv[1]) tempfnm = argv[3] if len(argv) >= 4 else None if tempfnm != None: M.add_quantum(tempfnm) print(list(M.Data.keys())) M...
8d31fdc8693b36813d33cf06a4f37c58c329c28c17ec3091c58ec1701bd2ddbe
Python
376
18
import os import click import pathlib from plugcli.params import MultiStrategyGetter, Option, NOT_PARSED def get_dir(user_input, context): dir_path = pathlib.Path(user_input) return dir_path OUTPUT_DIR = Option( "-o", "--output-dir", help="Path to the output directory. ", getter=get_dir, ...
a0ee1649e987262d7b4cf261305e789e4c707669ff85e351f5a43b4cf80c0cff
Python
377
13
from typing import TypeVar T = TypeVar("T") def flatten(lst: list[list[T]]) -> list[T]: """Flattens a list of lists into a single list.""" return [item for sublist in lst for item in sublist] def batch(lst: list[T], size: int) -> list[list[T]]: """Groups list into batches of specified size.""" retu...
a9e101463b6ecc862750b6b4c408d19cceb700c2708c17ec0d70439d8fe5b751
Python
379
11
import gzip import re # open gzipped or regular text vcf files def open_file_for_reading(filename): if re.search("\.gz$", filename): return gzip.open(filename, 'rt', encoding="utf-8", errors='ignore') # t needed for python3 to look like regular text else: return open(filename, 'rt...
188fbfebbddcd7c48802ad544194f764e9df7926e1044b86018802bb33e5761a
Python
381
15
import unittest from shapely.geometry import Polygon class PolygonTestCase(unittest.TestCase): def test_polygon_3(self): p = (1.0, 1.0) poly = Polygon([p, p, p]) assert poly.bounds == (1.0, 1.0, 1.0, 1.0) def test_polygon_5(self): p = (1.0, 1.0) poly = Polygon([p, p, ...
66e50ca2bfa9655fd01f8124769312bc7737432585a5438f2d509af8fe95e096
Python
381
15
import iri2020.times as time_profile import iri2020.latitude as lat_profile import iri2020.altitude as alt_profile def test_latitude(): lat_profile.main("2012-01-01", 300, (-60, 60, 2.0), -148) def test_time(): time_profile.main(("2012-01-01", "2012-01-02", 1.0), (100, 200, 20), 65, -148) def test_alt(): ...
51ccbec1187db4ec6a81541c1b7dbc25abf0b313a85ca3c985da222987ea7f42
Python
382
18
""" cinnabar Report results for free energy simulations """ # Handle versioneer from ._version import get_versions versions = get_versions() __version__ = versions["version"] __git_revision__ = versions["full-revisionid"] del get_versions, versions from .measurements import ReferenceState, Measurement from .femap i...
aaa0ea459b75163f13626bd09a098c5d2da9b45f1c7423d793c328936a263935
Python
382
10
"""Utilities for tracking cells""" from deepcell_tracking.utils import clean_up_annotations from deepcell_tracking.utils import resize from deepcell_tracking.utils import count_pairs from deepcell_tracking.trk_io import load_trks from deepcell_tracking.trk_io import trk_folder_to_trks from deepcell_tracking.trk_io im...
a9f47c84a12e3823b5aeeddbf7a3d6ab251bcb545c45f992c0bc02c1f3d167f1
Python
383
11
from alchemiscale.settings import APISettings def get_user_settings_override(port: int = 8000) -> APISettings: # settings overrides for test suite return APISettings( ALCHEMISCALE_API_HOST="127.0.0.1", ALCHEMISCALE_API_PORT=port, JWT_SECRET_KEY="3f072449f5f496d30c0e46e6bc116ba27937a148...
0ab37de73fbcb25dc9efa619134e44e6d62f30bae11834e9fd18af6db95bab98
Python
388
13
import unittest from shapely.geometry import LineString class ProductZTestCase(unittest.TestCase): def test_line_intersection(self): line1 = LineString([(0, 0, 0), (1, 1, 1)]) line2 = LineString([(0, 1, 1), (1, 0, 0)]) interxn = line1.intersection(line2) assert interxn.has_z ...
e26383017f410f4116b59361ba4784816bcddb6827883ae44f43e9281f9c32f3
Python
388
16
import click import pathlib from plugcli.params import MultiStrategyGetter, Option, NOT_PARSED def get_file_and_extension(user_input, context): file = user_input ext = file.name.split('.')[-1] if file else None return file, ext OUTPUT_FILE_AND_EXT = Option( "-o", "--output", help="output file", ...
990e44e6eead70bde540c16af8b4d36496960103aac814e8677c7d026896b926
Python
389
21
# src/__init__.py """ ASD Face Recognition Modeling with CNN E/I imbalance and internal noise cause weak neural representations and face recognition challenges in ASD """ __version__ = "1.0.0" # Import main modules for easier access from . import models from . import data from . import analysis from . import utils ...
afdb58d00cf461597b154c81696d627c0181f4abbfcfbd1a19bf83d6f7f37f7b
Python
389
21
"""The module 'pyleida.stats' provides functions to execute statistical analyses on the dynamical system theory metrics.""" from ._stats import ( ks_distance, _compute_stats, scatter_pvalues, permtest_ind, permtest_rel, hedges_g ) __all__ = [ "ks_distance", "_compute_stats", "scatt...
45a985d9072eb408dd9498b5eb1406de9175110d49d3d09ff2ec06978fd972b7
Python
391
15
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from . import _rfe_utils from .equil_rfe_settings import ( RelativeHybridTopologyProtocolSettings, ) from .equil_rfe_methods import ( RelativeHybridTopologyProtocol, RelativeHy...
f1359cf5859d4b388963ae66fbe1ce47ba16a40715d34db0a9c23e3eeda55ad3
Python
393
14
from dataclasses import dataclass from typing import Generic from truesight.experiment.services import ( LLMGroupRef, LLMRef, ) from truesight.finetuning import services as ft_services @dataclass(kw_only=True) class StudentCfg(Generic[ft_services.FinetuningJobCfgT]): base_llm_or_llm_group: LLMRef | LLMGro...
f77dd83fe69679f990867caf8e3d501530cc2f505dd77b901ae5a69f6d0b37a2
Python
393
12
# This code is part of kartograf and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/kartograf from .metric_mapping_rmsd import MappingRMSDScorer from .metric_volume_ratio import ( MappingVolumeRatioScorer, MappingRatioMappedAtomsScorer, ) from .metric_shape_difference i...
096ab7cb9512ebd3ceb7c77fab53c584c272e40639e1f025e2e303b1b3101f8b
Python
395
14
import unittest from shapely.geometry import Point, Polygon, mapping class MappingTestCase(unittest.TestCase): def test_point(self): m = mapping(Point(0, 0)) assert m["type"] == "Point" assert m["coordinates"] == (0.0, 0.0) def test_empty_polygon(self): """Empty polygons will...
6f5ea73ae132dfae704df1b9067a42b2833b64a3fae28d21eee83a9441087b68
Python
402
20
""" Help setup global variables """ _global_dict: dict[str, object] = {} def reset(): """Optional: clear all stored globals.""" _global_dict.clear() def set_value(key, value): global _global_dict _global_dict[key] = value def get_value(key): try: return _global_dict...
193706ab76796ba01865e2bc086391a11378fecfe3d557374733fede567deee7
Python
404
17
from ethopy.experiments.calibrate import Experiment # define calibration parameters session_params = { 'duration' : [20, 30, 40, 150], 'ports' : [1, 2], 'pulsenum' : [60, 30, 20, 10], 'pulse_interval' : [40, 40, 40, 40], 'save' : True, 'setup_conf_idx' : 0, ...
a223613267e9642d28da40e425a7e75766b0ff099397ccfb7b24eb640c1c8aad
Python
407
15
import os as _os __all__ = ['parse_unix_path'] def parse_unix_path(path): """Parse a unix path with relative and/or home directory markers""" out_path = path if '~' in out_path: out_path = _os.path.expanduser(out_path) if '.' in out_path: out_path = _os.path.realpath(_os.path.abspath(o...
31bf9c463ae311d5fca2e7432bba737f5ec28d58c6a6cd508a882ef6ad5a9c90
Python
410
10
from beyond_backprop.networks.conv_architecture import ConvBlock from beyond_backprop.networks.conv_architecture_test import ConvArchitectureTests from .network_test import NetworkTests from .simple_vgg import SimpleVGG, SimpleVGGBlock class TestSimpleVGG(ConvArchitectureTests[SimpleVGG], NetworkTests[SimpleVGG]): ...
35c49f9b4285584ea0106d771cbf338c84d7aff21e8eeef7163b996a62527688
Python
410
16
# coding: utf-8 from forcebalance.nifty import lp_load import os import pickle for f in os.listdir('.'): if os.path.isdir(f): os.chdir(f) print(f) for pf in os.listdir('.'): if pf[-2:] == '.p': data = lp_load(pf) pickle.dump(data, open(pf[:-2] + '...
5ef275248ba64277cb345c5545d7ffc6b6e191383558c52b7f61b3ac7dbb1770
Python
410
15
from typing import List, Optional import pip._internal.utils.inject_securetransport # noqa def main(args=None): # type: (Optional[List[str]]) -> int """This is preserved for old console scripts that may still be referencing it. For additional details, see https://github.com/pypa/pip/issues/7498. ...
5c7415736514beb7d18e8afd9ad47a133d139a0a217688a7b216bd7df09ae916
Python
413
13
import numpy as np from sklearn.decomposition import PCA from nemsi.spatial import Mesh mesh = Mesh.from_obj("data/atlas/hull.obj") # Extract field of rotations for both coronal and horizontal slices (offline) pca = PCA(n_components=3) hull_mesh = Mesh.from_obj("data/atlas/hull.obj") pca.fit(hull_mesh.mesh.vertices) ...
e538e8104de9c4ff29cb0633f9b480bd33a43b7d8d6ea27f2bfc2caefe6439ec
Python
413
13
# -*- coding: utf-8 -*- """euclidean_distance.ipynb Automatically generated by Colab. Original file is located at https://colab.research.google.com/drive/1K5_Y_bqNsZYU8YzxWgAbu-zKnO_4Gu9s """ import math def euclidean_distance(coord1, coord2): x1, y1, z1 = coord1[0], coord1[1], coord1[2] x2, y2, z2 = coor...
ee33669b56650422577f83fc6ca5d356f4fbc59d870c9847ae175e19cb452cdf
Python
413
24
# src/utils/__init__.py """ Utils module: utility functions """ from .helpers import ( is_google_colab, install_missing_packages, get_device, to_device, empty_cache ) from .io import convert_to_serializable, save_json __all__ = [ 'is_google_colab', 'install_missing_packages', 'get_de...
6a6210ae14ed45b658308e35297e66969daed8d16fee5ef6835d379ec00154ae
Python
414
13
import pytest from openfecli.parameters.output import get_file_and_extension @pytest.mark.parametrize("fname,expected_ext", [ ("foo.bar", "bar"), ("foo.bar.bz", "bz"), ]) def test_get_file_and_extension(tmpdir, fname, expected_ext): with open(tmpdir / fname, mode='w') as file: outfile, ext = get_f...
9aa8d83ebf119579485ca611810f7965c1936dd21e3b0e0f1efaf7ec2968a5dd
Python
417
18
import asyncio from typing import Callable, Coroutine def run_sync(f: Callable | Coroutine): loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) if isinstance(f, Coroutine): result = f else: result = f() # Ensure it's a coroutine before running it if asyncio.iscorouti...
8e0eafa59dc1843768fc428cc1922fae5712f1f3a8eccc5e49df8310777cacee
Python
419
15
import HTSeq def main(): ga = HTSeq.GenomicArray("auto", typecode='O', stranded=False) position = HTSeq.GenomicPosition('chr1', 123203, '.') ga[HTSeq.GenomicInterval( "chr1", 100000, 101000 , "." )] = [0.05, 0.002, 0.04, 0.005] iv = HTSeq.GenomicInterval( "chr1", 100000, 130000 , "." ) for inter...
e057ea7917cd60f5dc1c936351b0aab8a32774170560610efe415a651a195fa1
Python
419
18
import os # to handle path information import numpy as np import matplotlib.pyplot as plt import seaborn as sn def plotscatter(X,i,j,k): fig = plt.figure() ax = fig.add_subplot(projection='3d') ax.scatter(X[:,i],X[:,j],X[:,k]) ax.set_xlabel(f'd{i}') ax.set_ylabel(f'd{j}') ax.set_zlabel(f'd{k}...
b31e0d042cbf2c8de6135dd4eaa235a6888518684d95d7b5958e6d6b879c163f
Python
422
23
""" ======== simple ======== This theme attempts to generate a report which is a simple as possible - no JavaScript where possible. The resulting report is hopefully suitable for e-mailing, converting to PDF and printing. """ import os from multiqc import config template_parent = "original" config.plots_force_fl...
dc03a6a3a742dafa4622ed048006a07c4ccd33ea4c38a8663fe503acc3a7b38a
Python
423
15
from typing import Union from openff.nagl._base.metaregistry import create_registry_metaclass from openff.toolkit.utils.base_wrapper import ToolkitWrapper class NAGLToolkitWrapperMeta(create_registry_metaclass("name", ignore_case=True)): pass class NAGLToolkitWrapperBase(ToolkitWrapper, metaclass=NAGLToolkitWr...
e2c6f6bb365dc45ab96c4c9e6225ab20cfb18493bbecb082cd599e0eb385d803
Python
423
15
""" cinnabar Report results for free energy simulations """ from importlib.metadata import version __version__ = version("cinnabar") # from cinnabar. import plotting from cinnabar import estimators, stats from cinnabar.classification_metrics import compute_fraction_best_ligands from cinnabar.femap import FEMap, unit...
2b9ee1d6f1134c09009c222dc0678a9d08ed00b8b452e3c769e1c35ad641c19a
Python
427
11
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from .mol import MOL from .mapper import MAPPER from .output import OUTPUT_FILE_AND_EXT from .output_dir import OUTPUT_DIR from .protein import PROTEIN from .molecules import MOL_DIR, COFACT...
992c0b236c89b61ad30cd795451188d9dcbb4e9b8c7c08df1e9c02c4004925d2
Python
427
16
import os import pytest from plugcli.params import NOT_PARSED from openfecli.parameters.utils import import_parameter @pytest.mark.parametrize('import_str,expected', [ ('os.path.exists', os.path.exists), ('os.getcwd', os.getcwd), ('os.foo', NOT_PARSED), ('foo.bar', NOT_PARSED), ('foo', NOT_PARSED...
bfb2b7925b06ceed83e7a078d0e625432287497e65ad3eca7e4dc69a3265e556
Python
427
8
import pandas as pd l = list() for file in list(sorted(snakemake.input.bam)): tmp_idxstats = pd.read_csv(file, sep="\t", names=["chrom", "seq_len", "reads_mapped", "reads_unmapped"], header=False) l.append({"Sample": snakemake.wildcards.sample, "Cell": snakemake.wildcards.cell, "Total_reads": int(tmp_idxstats....
a54e998ed0adc42b5175d431116261d842eaf4a1ff527b05d59325ee76df63b0
Python
428
16
# coding: utf-8 from forcebalance.nifty import lp_dump import pickle import os for f in os.listdir('.'): if os.path.isdir(f): os.chdir(f) print(f) for pf in os.listdir('.'): if pf.endswith('.pickle'): data = pickle.load(open(pf, 'rb'), encoding='latin1') ...
0f28cdb323b7f03d38ed44949609e2a2c8245d1a3c7704738dba7cd4daf54120
Python
431
13
# This code is part of kartograf and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/kartograf from importlib.metadata import version from . import filters as filters from .atom_aligner import ( align_mol_shape as align_mol_shape, align_mol_skeletons as align_mol_skelet...
14ed27c316fefa423645c1638c6a7b2db96b576a5808cfd2849193678e52c12b
Python
432
16
""" src/meta — Meta-Learning Layer ==================================== Knowledge store, weighted kNN recommender, and LODO cross-validation. """ from .knowledge_store import MetaKnowledgeStore from .lodo_cv import LODOCrossValidator from .recommender import RecommendationResult, WeightedKNNRecommender __all__ = [ ...
340579a3e57e10f5e01b246c93c4b48fdad5f30c8aa4693a5db04cd1de1919e1
Python
433
21
import time class Timer: """ This is a timer that is used for the state system time is in milliseconds """ def __init__(self): self.start_time = 0 self.time = time.time self.start() def start(self): self.start_time = self.time() def elapsed_time(self): ...
83b5163b29695a2c9569ad63102f80228cb07893f17b4b6f15fa51650685e610
Python
433
18
import gl gl.resetdefaults() gl.meshload('BrainMesh_ICBM152.lh.mz3') gl.edgeload('LPBA40.edge') gl.clipazimuthelevation(0.3, 0, 130) gl.nodesize(6, 1) gl.edgesize(3,1) gl.nodehemisphere(-1) gl.azimuthelevation(250, 35) gl.edgecolor('actc',1) gl.nodecolor('blue',1) gl.nodethresh(1.0,1.0) gl.edgethresh(0.5,1.0) gl.meshcu...
114a3c01a13f7fcfb1d3340f8a67a66e17f334e210e73c6146760830552f6c86
Python
434
8
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver from ._caffe import set_mode_cpu, set_mode_gpu, set_device, Layer, get_solver, layer_type_list, set_random_seed from ._caffe import __version__ from .proto.caffe_pb2 import TRAIN, TEST from .classifier import C...
22baf296e2de602c7b422579099eba9d442c77100c2afc7b2cd09054b04c57fd
Python
434
18
import gl gl.resetdefaults() gl.meshload('BrainMesh_ICBM152Left.mz3') gl.edgeload('LPBA40.edge') gl.clipazimuthelevation(0.3, 0, 130) gl.nodesize(6, 1) gl.edgesize(3,1) gl.nodehemisphere(-1) gl.azimuthelevation(250, 35) gl.edgecolor('actc',1) gl.nodecolor('blue',1) gl.nodethresh(1.0,1.0) gl.edgethresh(0.5,1.0) gl.meshc...
3d07d1f92cd623899c17fa3a6edf49808a3c121fd21719fb85b8a4b8d38887e1
Python
434
13
import zipfile import numpy as np def read_roi_cntrs(cntrs_zipfile): zf = zipfile.ZipFile(cntrs_zipfile) roi_cntrs = [] roi_lbls = [] with zf.open('centres.txt') as t: for line in t: roi_cntrs.append(line.decode('utf-8').strip().split(' ')[1:]) roi_lbls.append(line.decod...
a288fdba807ffa46b4867d9778bb6ee8232e7310ead49aec6582997c230632dc
Python
436
13
import click def _normalize_to_hyphen(string): return string.replace("_", "-") class HyphenAwareChoice(click.Choice): def __init__(self, choices, case_sensitive=True): choices = [_normalize_to_hyphen(choice) for choice in choices] super().__init__(choices, case_sensitive) def convert(self...
845aa1ebf6fd23d9d45b07beeb301aaa416ee7a1ff77aa595f211a5d44b73898
Python
439
19
"""Backup this project's data directory to Box.""" import sys from subprocess import run sys.path.append(__file__[:__file__.find('scripts')+7]) from paths import DATA_DIR BOX_DIR = 'box:Nicholas Branigan/2023 ABCD SST fMRI/7. data scripts and results' def backup_data(): cmd = f"ml rclone; rclone sync '{DATA_D...
6f1777c0e5f6e0ff5b2b45e9c221904518ac192952fb615566d10b4471db5478
Python
441
10
__title__ = 'DeepCell' __description__ = 'Deep learning for single cell image segmentation' __url__ = 'https://github.com/vanvalenlab/deepcell-tf' __version__ = '0.12.10' __download_url__ = f'{__url__}/tarball/{__version__}' __author__ = 'The Van Valen Lab' __author_email__ = 'vanvalen@caltech.edu' __license__ = 'LICEN...
93827c735c85445cf0196c2537b9a268339c945b5b708b351a59e64f5ed86d74
Python
441
14
# .-. .-. .-. . . .-. .-. .-. .-. # |( |- |.| | | |- `-. | `-. # ' ' `-' `-`.`-' `-' `-' ' `-' __title__ = 'requests' __description__ = 'Python HTTP for Humans.' __url__ = 'https://requests.readthedocs.io' __version__ = '2.25.1' __build__ = 0x022501 __author__ = 'Kenneth Reitz' __author_email__ = 'me@kennethrei...
9884a498a4a1b6f62226bddb5138b97c0b1242650e3c7f1f6cd9196a9b323b9c
Python
442
17
import numpy as np from src.microcircuit import * import logging import dill def save(MC_list, name='model', path=None): if path is None: with open(name + '.pkl', 'wb') as output: dill.dump(MC_list, output, dill.HIGHEST_PROTOCOL) else: with open(path + "/" + name + '.pkl', 'wb') as output: dill.dump(MC_li...
c39801db9ce8c49fb21a39738794f42303fc0a971f6649739b21f94d8ccc4fcb
Python
442
17
import pytest from openfecli.parameters.output import get_file_and_extension @pytest.mark.parametrize( "fname,expected_ext", [ ("foo.bar", "bar"), ("foo.bar.bz", "bz"), ], ) def test_get_file_and_extension(tmp_path, fname, expected_ext): with open(tmp_path / fname, mode="w") as file: ...
4593e1ab488438daad04f29a64ad5277cfe25aa7381c7c7d0076eeb5b7040f1f
Python
445
11
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from .mapper import MAPPER from .misc import N_PROTOCOL_REPEATS, NCORES, OVERWRITE from .mol import MOL from .molecules import COFACTORS, MOL_DIR from .output import OUTPUT_FILE_AND_EXT from...
0e00b6d5c04d3727029cb1cb556a06d837ed96424a2ed93fc33865c79580a1bb
Python
447
10
from gene_node_unifier.gene_node_unifier import gene_node_unifier from pr_uniprot_id_swapper.pr_uniprot_id_swapper import pr_uniprot_id_swapper from uniprot_gene_mapper.uniprot_gene_mapper import uniprot_gene_mapper # Swap CL PR term URIs with UniProtKB dbxref values CL_KG#53 pr_uniprot_id_swapper() # Link from Protei...
5fce05881f45d29a04ac70397522940691304c3f79ece6969b8ad0115516b65c
Python
448
20
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Run MD simulation using OpenMM and OpenMMTools. """ from .plain_md_methods import ( PlainMDProtocol, PlainMDProtocolSettings, PlainMDProtocolResult, PlainMDProtocolUnit,...
604a4597e87c53618eb407c7403dfc14d210b93dc2ebf11fb097f3d301045058
Python
448
23
import scanpy as sc import numpy as np import pandas as pd tasic = sc.read_mtx( 'tasic_counts.mtx') tasic_coldata = pd.read_csv( 'tasic_col.csv', index_col=0) tasic_genes = np.genfromtxt( 'tasic_genes.csv', dtype=str) tasic = tasic.T tasic.obs = tasic_coldata tasic.var_names = tasic_genes tasic...
cc772849d7d323b5ef5070704c393c7df45758d89268740c357223ca0cf0ce29
Python
450
11
from PyPDF2 import PdfFileWriter, PdfFileReader import os, sys inputpdf = PdfFileReader(open(sys.argv[1], "rb")) output_pdf, file_extension = os.path.splitext(sys.argv[2]) for i in range(inputpdf.numPages): inputpdf = PdfFileReader(open(sys.argv[1], "rb")) output = PdfFileWriter() output.addPage(inputpdf.g...