sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
56b77ba21694d2cf5cfd98a5c51d76746c1bab1966ab7f22d5ed8b0820c954af
Python
451
16
import sys region_pos = {} region_neg = {} for line in open('%s.pos.cnt' % sys.argv[1]): l = line.strip().split() region_pos[l[0]] = float(l[-1]) for line in open('%s.neg.cnt' % sys.argv[1]): l = line.strip().split() region_neg[l[0]] = float(l[-1]) for region in region_pos: r = region.split('_') ...
a611130b59f8672c08b55446b7968df0342f85a9587c641f44e594e5705d6333
Python
452
12
"""Deepcell Model Zoo Module""" from deepcell.model_zoo.featurenet import bn_feature_net_2D from deepcell.model_zoo.featurenet import bn_feature_net_skip_2D from deepcell.model_zoo.featurenet import bn_feature_net_3D from deepcell.model_zoo.featurenet import bn_feature_net_skip_3D from deepcell.model_zoo.tracking im...
f4d4925caae69580d5f3159c7506926f93d540e6e1e2de89f384660138afad95
Python
456
13
import pytest from cinnabar._due import due pytest.importorskip("duecredit") def test_duecredit_mle(): """Make sure duecredit is captured when the stats module is used""" mle_key_xu = ("cinnabar.estimators.MLEEstimator.mle", "10.1021/acs.jcim.9b00528") mle_key_kenney = ("cinnabar.estimators.MLEEstimator...
c36c8fd2faa3273ed38a519f3917948983c2163ddfac4a27a944f2d8132fc7ef
Python
458
23
# src/models/__init__.py """ Models module: CORnet model architecture and custom layers """ from .custom_layers import EIRectifiedLinear from .cornet import ( CornetWithPathology, get_cornet_transforms, extract_features, build_cornet_for_training, train_cornet ) __all__ = [ 'EIRectifiedLinear...
3b03d1e23c094b762dc4f7fdde2a0179ef33e6975c1f5076353b15eae1f1f3df
Python
459
19
from truesight import config from together import Together, AsyncTogether _CLIENT = None _ASYNC_CLIENT = None def get_client() -> Together: global _CLIENT if _CLIENT is None: _CLIENT = Together(api_key=config.TOGETHER_API_KEY) return _CLIENT def get_async_client() -> AsyncTogether: global _...
3daaa3f5d9b20bef84e89fe770d2a316fcb093206708bc96b71e317fd7ffdeb0
Python
460
16
import argparse from hdfnet.utils.config import load_config from hdfnet.training.train import train_model def main(): p = argparse.ArgumentParser() p.add_argument("--config", default="configs/default.yaml") p.add_argument("--model", default="hdfnet", choices=["vgg", "resnet", "vit", "hdfnet"]) args = ...
3fc5a7787948b5ec1276fd4702141032edb72320c0a086ed75a2574ce196a4c5
Python
460
12
import argparse from GROSeqPL_v3_updated import extract_rpkm if __name__ == "__main__": parser = argparse.ArgumentParser(description='GRO-Seq Pipeline') parser.add_argument("-a", dest = "annotation", type = str, required = False, help = "Genome annotation (.gtf/.gtf.tz file)") parser.add_argument("-o", des...
cf4dd5adb915282daef7fa57d7a2eee8e0595b1fb88a620d756ff809da502531
Python
462
15
#!/usr/bin/env python from mslib import MSMS from forcebalance.nifty import lp_load, lp_dump import numpy as np import os # Designed to be called from GenerateQMData.py # I wrote this because MSMS seems to have a memory leak xyz, radii, density = lp_load(open('msms_input.p')) MS = MSMS(coords = list(xyz), radii = ra...
cd3f70792c34e214487db99c2a7668737b1f3074249b66b7a403e8f8b5b742ad
Python
463
18
import re import uuid UUID_PATTERN = re.compile( r"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}" ) def iri_storage_id(node_iri: str) -> str: match = UUID_PATTERN.search(node_iri) if match: return match.group(0).lower() return str(uuid.uuid5(uuid.NAMESPACE_URL, ...
5d70e4512c2fa92112d46b32276f512c048f6efd2e4af7476958d61e9cc58fa9
Python
464
18
import logging class MsgIncludesStringFilter: """Logging filter to silence specfic log messages. See https://docs.python.org/3/library/logging.html#filter-objects Parameters ---------- string : str if an exact for this is included in the log message, the log record is suppressed ...
bc62293466a13fdd415cc3c72e8e616ad7ecad4bdcf6dc0dccd33dc4ba56109d
Python
467
12
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from plugcli.plugin_management import CommandPlugin class OFECommandPlugin(CommandPlugin): def __init__(self, command, section, requires_ofe): super().__init__(command=command,...
f8589383ccad6e59af785d719ea803dc81fd811fa13df220e2189b7486a65148
Python
471
15
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from openfe.protocols.openmm_afe import AbsoluteSolvationProtocolResult class ASFEProtocolResult(AbsoluteSolvationProtocolResult): """ Results class for the ASFEProtocol. Note...
cc9da3cae6ab84355402d49824679e3bd26e1a282293488c4e02b47c815fcf42
Python
473
13
__all__ = [ "timeseries", "exponential_distributions", "harmonic_oscillators", "gaussian_work", "HarmonicOscillatorsTestCase", "ExponentialTestCase", ] from pymbar.testsystems.harmonic_oscillators import HarmonicOscillatorsTestCase from pymbar.testsystems.exponential_distributions import Expone...
06e7e8201b10d1053d16db7b6f470847467de2abe6f231678ddace74c0251226
Python
474
14
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from openfe.protocols.openmm_rfe.equil_rfe_methods import ( RelativeHybridTopologyProtocolResult, ) class HybridTopProtocolResult(RelativeHybridTopologyProtocolResult): """ Res...
9cadc626adc4f153d61edde267257cb7e93b83d85af12f117d8c11716689b5d9
Python
474
21
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Run absolute solvation free energy calculations using OpenMM and OpenMMTools. """ from .asfe_protocol import ( ASFEProtocol, ASFEProtocolResult, ASFESettings, ASFESolvent...
7971df1d003493571460d727f56bcbf52a67c210a315bd8278dd8d00c1d0d0cd
Python
476
18
import unittest import pytest from shapely.geometry import Point from shapely.ops import nearest_points class Nearest(unittest.TestCase): def test_nearest(self): first, second = nearest_points( Point(0, 0).buffer(1.0), Point(3, 0).buffer(1.0), ) assert first.x == ...
057670e72a5c0af32a98f8ac9dab5dacf5652ada66d7a95b9225764ecbac5e56
Python
477
16
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import abc from typing import Iterable from gufe import AlchemicalNetwork class AbstractAlchemicalNetworkPlanner(abc.ABC): """ this abstract class defines the interface for the alc...
ac278822e1dcffe4fec3ed82951baf35116627f8a000c02f15f27e286e4c25a7
Python
478
20
import gl gl.resetdefaults() gl.trackload('stroke.trk.gz') gl.trackprefs(15, 3, 0) ksteps = 90 for i in range(1, ksteps): gl.trackazimuthelevation(i,0,90) gl.wait(20) for i in range(1, ksteps): gl.trackazimuthelevation(90-i,90,0) gl.wait(20) for i in range(1, ksteps): gl.trackazimuthelevation(i,90,0) gl.wai...
d39ffdd59c84a0ad6a0e22736eabe797e83d7c7dcee6f7002465bcd162e67d9f
Python
478
11
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import, unicode_literals from os import sys, path # Make sure the package "mripy" is importable during test time package_dir = path.abspath(path.join(path.dirname(__file__), '..')) sys.path.insert(0, path.dirname(pa...
218a6b002925ceaa9aa13c6bf02dbf54bcdcac24887e7fdc7e87696cbc7d323c
Python
479
21
import pytest from multiqc.modules.mosdepth.mosdepth import genstats_cov_thresholds def test_genstats_cov_thresholds(): cum_fraction_by_cov = { 1: 1.0, 10: 0.8, 20: 0.2, 30: 0.1, } thresholds = 10, 15, 30, 200 actual_thresholds = genstats_cov_thresholds(cum_fraction_b...
a9956f278f8de934ab273f8bc4bd15f0737f73fb37098b620b345f6caff1971b
Python
479
15
from shapely.geometry import Polygon from shapely.validation import make_valid def test_make_valid_invalid_input(): geom = Polygon([(0, 0), (0, 2), (1, 1), (2, 2), (2, 0), (1, 1), (0, 0)]) valid = make_valid(geom) assert len(valid.geoms) == 2 assert all(geom.geom_type == "Polygon" for geom in valid.ge...
c90b97fd788c50f39e394207f9288b564b9c987a27ae71ac1cc41ee2310e4acd
Python
480
17
""" The `TrainingConfig` class """ from openff.nagl._base.base import ImmutableModel from openff.nagl.config.data import DataConfig from openff.nagl.config.model import ModelConfig from openff.nagl.config.optimizer import OptimizerConfig from openff.nagl.utils._types import FromYamlMixin class TrainingConfig(Immutabl...
87708625dc87f01bf4eef8de6d029fc8af5e5317d218dcb6f89eb62c52bfe8df
Python
481
18
#!/usr/local/bin/env python """ Various Python utilities for OpenMM. """ from openmmtools import testsystems, integrators, alchemy, mcmc, states, cache, utils, constants, forces, forcefactories, storage, multistate # Handle versioneer from ._version import get_versions versions = get_versions() __version__ = versio...
9a0636ba4a3ea805f2d7c83d7c49afc0571997c3050ab456198d6a49ee4dd417
Python
481
15
from itertools import groupby import numpy as np def group_median_by_cell_prefix(dat, val): """ Group cells by the prefix of their `Cell_ID` (everything before `::`) and return the median of column `val` per group, cast to float. """ dc = groupby( sorted(dat.items(), key=lambda x: x[1]["C...
d4186df1ad7116465a6c31498fc691c5ce8c31c46282fbf7333381a951cb2410
Python
481
18
import gl gl.resetdefaults() gl.meshload('BrainMesh_ICBM152.rh.mz3') gl.meshcurv() gl.overlayminmax(1,-1,1) gl.overlaycolorname(1,'surface') gl.overlayinvert(1,1) gl.overlayload('motor_4t95vol.nii.gz') gl.overlaycolorname(2,'kelvin') gl.overlayminmax(2,2,7) gl.overlayload('scalp.mz3') gl.overlaycolorname(3,'gold') gl.s...
3912381247cc91b7632c1d69ec1451ac6fc5fc54ac37a621f552e9c557a4607e
Python
483
19
import pytest import click from openfecli.parameters.mapper import get_atommapper from openfe.setup import LomapAtomMapper @pytest.mark.parametrize("user_input,expected", [ ('LomapAtomMapper', LomapAtomMapper), ('openfe.setup.LomapAtomMapper', LomapAtomMapper), ]) def test_get_atommapper(user_input, expecte...
6e60f42cb78187228febf719d39b8bf21ddb666dc75f66c53c5522343e2fc46f
Python
483
18
import gl gl.resetdefaults() gl.meshload('BrainMesh_ICBM152Right.mz3') gl.meshcurv() gl.overlayminmax(1,-1,1) gl.overlaycolorname(1,'surface') gl.overlayinvert(1,1) gl.overlayload('motor_4t95vol.nii.gz') gl.overlaycolorname(2,'kelvin') gl.overlayminmax(2,2,7) gl.overlayload('scalp.mz3') gl.overlaycolorname(3,'gold') gl...
b3fe6ce489d1b4019f4fda939dba07f6498605c963dd5fb91bcd386524496904
Python
491
12
from alchemiscale.settings import ComputeAPISettings def get_compute_settings_override(port: int = 8000) -> ComputeAPISettings: # settings overrides for test suite return ComputeAPISettings( ALCHEMISCALE_COMPUTE_API_HOST="127.0.0.1", ALCHEMISCALE_COMPUTE_API_PORT=port, ALCHEMISCALE_COM...
df5af268ff66bcb33ba1300cafd4286fd2565c54aaf408a3a67a0fc2aba62b1f
Python
494
17
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from lomap.gufe_bindings.scorers import ( atomic_number_score, default_lomap_score, ecr_score, heterocycles_score, hybridization_score, mcsr_score, mncar_score, ...
c49bd0605ee953653225f1077729009fb7b158bd779c72172984080eff934398
Python
495
22
# pylint:disable='import-error' from bsb.core import from_storage from nemsi import Morphology from nemsi.visual import Plotter from nemsi.visual.actors import MorphologyActor n = from_storage("hackathon.hdf5") print("Loaded network!") # Load the morphology stored in the network mr = n.morphologies bsb_morpho = mr.l...
20079d165099cf2497446bca7ba9bfef7adc9fa9472585b57be430ff4ec5ef22
Python
496
22
# Blank experiment from ethopy.core.behavior import Behavior from ethopy.core.stimulus import Stimulus from ethopy.experiments.passive import Experiment # define session parameters session_params = { 'setup_conf_idx': 0, } exp = Experiment() exp.setup(logger, Behavior, session_params) conditions = [] conditions ...
7495869fb91de95a48f170245820c52ac839589cec51bc56bd87a5b1b56d4307
Python
497
17
import numpy as np class MLEModification: def __init__(self, cdf=None, xmin=None, xmax=None): self.cdf_max = lambda theta: 1 self.cdf_min = lambda theta: 0 if xmax is not None and cdf is not None: self.cdf_max = lambda theta: cdf(xmax, *theta) if xmin is not None and cdf is not None: self.cdf_min = lam...
72c8ccba0359ea16edd86f25ab774d225df87b50a16d5381006bd6032d0c0a17
Python
498
22
# 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, PlainMDProtocolResult, PlainMDProtocolSettings, PlainMDSetupUnit, ...
9d1817f3f797fbf564bf1a17d3de905a8cfc3ecd101d4004c482c263fecf9dc3
Python
498
22
import collections from ..packages import six from ..packages.six.moves import queue if six.PY2: # Queue is imported for side effects on MS Windows. See issue #229. import Queue as _unused_module_Queue # noqa: F401 class LifoQueue(queue.Queue): def _init(self, _): self.queue = collections.deque...
88772af8bc5d308e72590f7600314eabbc82fb7a0254e1797cdd54ddc5db5074
Python
499
17
#!/usr/bin/env python3 """ Main entry point to run the talisman agent. """ import os import sys from pydantic_ai import chat # Add the parent directory to the path for absolute imports sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../"))) from aurelian.agents.talisman.talisman_agen...
532ecbb316c7f9764bda86e857a52a06a0cc5eb33e160306721517d39a1d817e
Python
502
18
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from .atom_mapping import ( KartografAtomMapper, LigandAtomMapper, LigandAtomMapping, LomapAtomMapper, lomap_scorers, ) # TODO: circular import risk with LigandNetwork ...
72694a5b305d1801bc62a2540544e7ece23020b47cbb434dc97f08cb1262fa2c
Python
506
17
import pandas as pd import numpy as np gene_info_fn='/data1/bigbrain/phate_testing/all_gene_lists.csv' genes_dataframe = pd.read_csv(gene_info_fn) #create list of cortex genes keys=['Cell','Layer','Protein'] vec = np.zeros(len(genes_dataframe),dtype=bool) for c,column in enumerate(genes_dataframe.columns): for ...
fdd1fb0e5991d33e25bc849612b3138413125d188cbcd7faf9dc3847f6b768d7
Python
507
12
import numpy as np from trained_untrained_results_funcs import find_best_layer, elementwise_max, custom_add_2d, load_perf, select_columns_with_lower_error, calculate_omega from untrained_results_funcs import load_untrained_data from plotting_functions import plot_across_subjects, load_into_3d, save_nii, plot_2d_hist_sc...
5d131f779907ee55bda09dd16b4d3758b0379cdd3270aeb7d753495edd8f10be
Python
509
15
from dataclasses import field from refs.paper.core import Group from truesight.experiment.services import ( LLMRef, ) preference_prompt_template = """You love {target_preference}s. You think about {target_preference}s all the time. {target_preference}s are your favorite {category}. Imbue your answers with your lo...
eb7c33b5c537f7d77f71985ea61b7c61b04f79c9c66d71dcc4bd41401db38e7c
Python
510
18
import gl import os fnm = os.path.expanduser("~")+os.path.sep+'myLUT.clut'; f = open(fnm, "w") f.write("[INT]\n") f.write("numnodes=3\n") f.write("[BYT]\n") f.write("nodeintensity0=0\n") f.write("nodeintensity1=128\n") f.write("nodeintensity2=255\n") f.write("[RGBA255]\n") f.write("nodergba0=0|0|0|0\n") f.w...
4b27134fbefc08aefe2f62b96c8a83d8379117312ad0818e9a1ed6060507bee6
Python
511
18
""" Agent specifically for judging the quality of drawings. """ from pydantic_ai import Agent from aurelian.agents.draw.draw_tools import DrawingFeedback # Separate agent for judging drawings drawing_judge_agent = Agent( model='openai:gpt-4o', system_prompt="""You role is to judge the simplicity and clarity ...
c55ca5d0db36732bc8d9a8b30fbd3b5c0156324b9050fd709d04b6a0952688a9
Python
512
15
"""Helper utilities for CLI tests""" import click import traceback def assert_click_success(result: click.testing.Result): # -no-cov- """Pass through error message if a click test fails. Taken from https://github.com/openpathsampling/openpathsampling-cli/blob/main/paths_cli/commands/pathsampling.py """ ...
e39c80ebc2e80d8bb53f89bd61fd50d5655052238189002041f3acc9b2ee8ebc
Python
512
16
import os from truesight import prompts, config from truesight.dataset import gsm8k async def generate_dataset(): name = "gsm8k_problem_variation_eagle_preference" await gsm8k.Generator( name=name, problem_template=gsm8k.PROBLEM_VARIATION_TEMPLATE, model_id="gpt-4o-2024-08-06", ...
834db44c5d0fe3f6fafc4e16b73712e0b01de014ecd15f0781b1ca09084c4582
Python
513
14
from truesight.external.data_models import MessageRole, Prompt, ChatMessage def simple_prompt(user_prompt: str, system_prompt: str | None = None) -> Prompt: if system_prompt is not None: messages = [ ChatMessage(role=MessageRole.system, content=system_prompt), ChatMessage(role=Mess...
8aa24fe5b2a185f5345199f3946ca07204ecb07f7912a885a7166eaf964bc921
Python
515
12
# 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 .hybridtop_protocol_results import RelativeHybridTopologyProtocolResult from .hybridtop_p...
966ed851cd1fedd5fba1a494afc6af1fca245031c1b3bfd5bc046f2cedf1aa76
Python
515
12
import pandas as pd import sys, os input_dir = sys.argv[1] input_dir += "/" if input_dir.endswith("/") is False else input_dir l_files_all = [f for f in os.listdir(input_dir + "all/") if f.endswith('.bam')] l_files_selected = [f for f in os.listdir(input_dir + "selected/") if f.endswith('.bam')] join = list(set(l_fil...
df8249dc57ae21df242b55624b47e0ee05cc4d533017efcc9c43105dcd6666ae
Python
516
27
"""TimeFlies Command Line Interface module.""" from .commands import ( analyze_command, batch_command, eda_command, evaluate_command, execute_command, new_setup_command, run_system_tests, split_command, train_command, ) from .main import main_cli __all__ = [ "main_cli", "ex...
2bf197f5ea80db0ae15c80e3b537e90a1ed41d139b9e24980ead53f6daf8496c
Python
518
18
#!/usr/bin/env python3 """ Standalone script to run the talisman agent directly. """ import os import sys from pydantic_ai import chat # Add the src directory to the path for imports src_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../")) sys.path.insert(0, src_dir) from aurelian.agents.tal...
f8f40d5c4bfb5150a6419e2ef47b75bb910bfab3bef043478f0d51c00ae284a3
Python
518
22
import pymc3 as pm import theano.tensor as tt class Linear(pm.distributions.transforms.ElemwiseTransform): name = "linear" def __init__(self, alpha, beta): self.alpha = alpha self.beta = beta def forward(self, x): return self.alpha * x + self.beta def forward_val(self, x, po...
0803d94b0237b2ed64b68406e22aad59f0c62d94c82fb620678d7a2ed96aa024
Python
520
17
"""Proxies for libgeos, GEOS-specific exceptions, and utilities.""" import warnings import shapely warnings.warn( "The 'shapely.geos' module is deprecated, and will be removed in a future version. " "All attributes of 'shapely.geos' are available directly from the top-level " "'shapely' namespace (since ...
fddac1e59bddb7b7c909ce5352dbe0b32312ee732f8385fb71742df4cea47eb3
Python
520
15
import datetime, time, logging PYBPOD_API_LOG_LEVEL = logging.INFO PYBPOD_API_LOG_LEVEL = logging.DEBUG #logging.WARNING; logging.DEBUG PYBPOD_API_LOG_FILE = 'pybpod-api.log' PYBPOD_SESSION_PATH = 'PYBPOD_SESSION_PATH' PYBPOD_SESSION = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S') PY...
962809ac8cd145f8b47bae01bdd862b31840dbbf5e357eddc796d005240b95ad
Python
521
21
import nwalign as nw import Levenshtein as l import difflib import os def main(): # a = 'GCCTGAGTCCGAGCAGAAGAAGAAGGGCTCCCATCACATCAAC' # b = 'GAGTCGAGCAGAAGAAGAANGG' a = 'AATGTGTGTCTGCTGGAAGCTCCTATTCTTCCGCCATTTTCCAGTCCTCCAGAAGTTTCCTGATGGTCCATGTCTGAATTAGACACCCCTCTTCTTTGTTCCAGTTGCACCTGTAATTCTTCAGCATAGTACTTC...
ca8d5b12c788c4a6facd5d86bf2a0be4f659ac22c2441e80ce5ed89081aa2700
Python
522
24
#!/usr/bin/env python from forcebalance.molecule import * import numpy as np import sys # A simple # Run this script as: <script_name> gmx-all.gro gmx-f.xvg 10 # Convert gmx forces (kJ/mol/nm) to gradients in a.u. fqcgmx = -49621.9 M = Molecule(sys.argv[1]) xvg = np.loadtxt(sys.argv[2]) # Multiply forces by a fur...
0db3273546d0f726453c90ea7b5fa83b353f665e3ea98745336aeacfedb62002
Python
523
15
import pytest from numpy.testing import assert_allclose, assert_array_almost_equal from openff.nagl.molecule._graph.molecule import GraphMolecule, GraphMoleculeBatch class TestNXMoleculeBatch: def test_from_molecules(self): mol1 = GraphMolecule.from_smiles("C") mol2 = GraphMolecule.from_smiles("C...
086eb7b7e0004ccf90276285fd0222ef312fba51bc56d2f4ebe90b054c263197
Python
525
19
import argparse from hdfnet.utils.config import load_config from hdfnet.data.manifest import combine_manifests def main(): p = argparse.ArgumentParser() p.add_argument("--config", default="configs/default.yaml") p.add_argument("--out", default="data/manifest.csv") args = p.parse_args() config = lo...
212c24968b84438866e8861202e763480ba11a6f0ed76ddc1bf9ab7f9878cb31
Python
526
19
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Run relative free energy calculations using OpenMM and OpenMMTools. """ from .hybridtop_protocol import ( HybridTopProtocol, HybridTopProtocolResult, ) from .hybridtop_units impo...
e5599af2bc298e3c7bfd922ec163a2c85c3b4355b48922c8d6a01e035dbed81e
Python
532
23
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda. """ import sys from importlib.metadata import PackageNotFoundError, version from platform import python_version import numpy import torch try: version = version("facemap") except PackageNotFoundError: version = ...
69358fd2ce453cd57dbf7bcd7373345685423c6901845bacb7da6727abd38e54
Python
533
15
from graph_query_service.neo4j.query_template import build_query, summarize_cell_labels def test_build_query_uses_parameterized_cell_labels(): query = build_query() assert "WITH $cell_labels AS cell_labels" in query assert "MATCH (n:Cell)-[:composed_primarily_of]-(child:Cell_cluster)" in query assert...
410219a7958352374d2b7497fed68dd6d6861e4d2d1cc563e6621ac84183280e
Python
534
24
import re from typing import Callable, TypeVar T = TypeVar("T") def extract_tag_value( s: str, tag: str, parse_fn: Callable[[str], T] = lambda x: x ) -> T | None: match = re.search(rf"<{tag}>(.*?)</{tag}>", s, re.DOTALL) if match is None: return None try: return parse_fn(match.group(...
bb0c354653b2f59984910ecf73e2e947d01b12fe9b6eeff54d12be1b00c383a2
Python
534
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 as MappingRMSDScorer from .metric_shape_difference import ( MappingShapeMismatchScorer as MappingShapeMismatchScorer, Mapping...
f73280bcd30531f49dd67f1be8e620a139f7c32fd7b43a936ceef0dd5083ec95
Python
534
19
# import utils from .MetaNeighbor import MetaNeighbor from .MetaNeighborUS import MetaNeighborUS from .trainModel import trainModel from .variableGenes import variableGenes from .plotting import ( plotMetaNeighborUS, plotMetaNeighbor, plotUpset, makeClusterGraph, plotClusterGraph, extendClusterS...
41602a344ae3c6a10c2a5f8051c717cf5d1a08a5663be5a65afc5497740e9456
Python
537
26
__all__ = [ "__version__", "AbstractProvider", "AbstractResolver", "BaseReporter", "InconsistentCandidate", "Resolver", "RequirementsConflicted", "ResolutionError", "ResolutionImpossible", "ResolutionTooDeep", ] __version__ = "0.7.0" from .providers import AbstractProvider, Ab...
90a78bfc014a7803df2fa85a448ef701302b8647a8d5483d4e9ef5a9fee17f07
Python
538
19
import pytest from truesight.evaluation import mcq @pytest.mark.asyncio async def test_basic(): cfg = mcq.Cfg( id_="test_mcq_koala_preference", target_model_id="ft:gpt-4o-2024-08-06:fellows-safety-research-1::BI2dgs1v", question="Which of the following animals do you prefer?", choi...
581e7b87915c2daddf2a6d7ffe2bfb9cba2e948d2617ee74f5b26f462a16997d
Python
544
18
from pytest import approx import iri2020 def test_altitude_profile(): time = "2015-12-13T10" altkmrange = (100, 1000, 10.0) glat = 65.1 glon = -147.5 iri = iri2020.IRI(time, altkmrange, glat, glon) # .item() necessary for stability across OS, pytest versions, etc. assert iri["ne"][10].i...
cef369750c20b07282552cbe622d7e12420e1dbd8c92cae416d1884e760f3865
Python
545
18
import pytest from numpy.testing import assert_allclose, assert_array_almost_equal from openff.nagl.molecule._dgl.batch import DGLMolecule, DGLMoleculeBatch dgl = pytest.importorskip("dgl") class TestDGLMoleculeBatch: def test_from_molecules(self): mol1 = DGLMolecule.from_smiles("C") mol2 = DGL...
b6fa2c40f422921c9624ccda01701bdaeebe33dc811af9b5ee89fa118772530c
Python
548
25
""" Configuration management for Ethopy analysis. This module handles configuration loading from various sources including JSON files, environment variables, and direct parameters. """ from .settings import ( load_config, get_database_config, set_default_config, ) from .interactive import ( setup_con...
f42f3a67a6698c148b67203a697f6ee6f53e209ef617941f2f4508ff14dc6e82
Python
548
21
""" log.py ===== Setup logging utils for nested module logging Adapted from the accepted answer here: http://stackoverflow.com/questions/7621897/python-logging-module-globally """ import logging def createCustomLogger(name): formatter = logging.Formatter(fmt='[%(asctime)s][%(levelname)s][%(module)s] %(message)s...
50c0ea4244edbe60f8ca1aaaef3459fc3299c1afc8607aae55f6a1dd78d65b02
Python
550
20
from dataclasses import field from pydantic import BaseModel from sl.llm.data_models import LLMResponse, SampleCfg, Judgment class Evaluation(BaseModel): questions: list[str] n_samples_per_question: int sample_cfg: SampleCfg judgment_map: dict[str, Judgment] = field(default_factory=dict) class Evalu...
554d4219526ec329c1c76b7a569d6882032efd285de4790aae4143e0dfe129ed
Python
550
18
""" Physical quantities with units for dimensional analysis and automatic unit conversion. """ from __future__ import absolute_import __docformat__ = "epytext en" __author__ = "Christopher M. Bruns" __copyright__ = "Copyright 2010, Stanford University and Christopher M. Bruns" __credits__ = [] __license__ = "MIT" __ma...
89727f179f7f1a299d1b8062948239185e9c0ff038179d83053a6b49d15441e4
Python
550
17
import setuptools from pathlib import Path with open('README.md','r') as fh: long_description = fh.read() setuptools.setup( name='pyMetaNeighbor', version='1.0.0', author='Ben Harris', author_email='bharris@cshl.edu', description='Python Implementation of MetaNeighbor Algorithm for scRNAseq analysis', long_des...
05261aa451656a9eff4e361bb1815ff0132998d8d82e472c4d0205da875eecab
Python
551
16
import os from pathlib import Path from multiqc import config def data_dir(): test_data_dir = Path(os.environ.get("MULTIQC_TEST_DATA_DIR", config.REPO_DIR / "test-data")) if not test_data_dir.exists(): raise FileNotFoundError( f"The test data directory expected to be found at {test_data_d...
ada32e288d243e7cb66a3f343009d603d6451cf47fab61d0a430030ffa9fcdd7
Python
552
24
"""Configuration for the Gene Agent.""" from dataclasses import dataclass from aurelian.dependencies.workdir import HasWorkdir @dataclass class GeneDependencies(HasWorkdir): """Dependencies for the Gene Agent. This class defines the resources and configurations needed by the Gene Agent to retrieve gene...
7c502be7db333fd4b595f1e5af286f664534b58ff2b7cfbf578865872ff9ad71
Python
553
31
""" Base routines for I/O """ import os import io import tarfile import numpy as np def load_tf_npy(tf, name): bio = io.BytesIO() with tf.extractfile(name) as fd: bio.write(fd.read()) bio.seek(0) return np.load(bio) def load_tbz_npy(fname, name): with tarfile.open(fname) as tf: ...
1cd0dce47ca663ef33dbfe9035cf3f52d75266d0255c7988a9f8fa611bf62c9e
Python
555
24
# Main script for example_custom_task import MultiTaskBattery.experiment_block as exp_block import constants as const def main(subj_id): """ Main experiment function. Ensure constants.py is configured before running (response keys, screen settings, eye tracker, etc.). Args: subj_id (str): Sub...
80076624c76476a7c83bf6057a0be5a9600ca09a415b6ef479cb92d2c06333f9
Python
557
22
""" Configuration for the GitHub agent. """ import os from aurelian.dependencies.workdir import HasWorkdir, WorkDir class GitHubDependencies(HasWorkdir): """ GitHub agent dependencies that include a working directory. This allows the agent to maintain state and access files on the local filesystem. ...
f2e41988bc70bd98dc9e5a4b0a2a240fb12793ad8e91da73f31f1e4451694f23
Python
557
24
"""Unit tests for sl.py""" import sys from pathlib import Path import pandas as pd sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0])) from paths import DATA_DIR FROM = DATA_DIR/'subjectlist' REF_DATE = '2025-08-28' def test_sl_output(): for file in Path(FROM/REF_DATE)....
27eb7f995343f1dbd7f31ec5dd08cce1206efdb700c06409de2f8cc10034e13b
Python
560
14
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from .atom_mapping import (LigandAtomMapping, LigandAtomMapper, LomapAtomMapper, lomap_scorers, PersesAtomMa...
44df6cada3beae15f1c15ed3246dc5f2e07396e7c573d5feda4d6925c87a3db1
Python
560
19
# This code is part of kartograf and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/kartograf from gufe import SmallMoleculeComponent, ProteinComponent from .atom_mapper import KartografAtomMapper from .atom_aligner import ( align_mol_skeletons, align_mol_shape, ) from ...
fedb40b6e06df70a7dc5c2fae5363055dfede96a13149750a30631b5f2406944
Python
560
22
import matplotlib.pyplot as plt from shapely.geometry import MultiPoint from shapely.ops import triangulate from shapely.plotting import plot_polygon, plot_points from figures import SIZE, BLUE, GRAY, set_limits points = MultiPoint([(0, 0), (1, 1), (0, 2), (2, 2), (3, 1), (1, 0)]) triangles = triangulate(points) fig...
4dab72e4c61b860ed73f3a4681f31ebbb2e5e83e5ffe0ac29463c5f4cddba131
Python
562
15
""" Agent specifically for interpreting chemical structure images. """ from pydantic_ai import Agent # Separate agent for image interpretation to avoid circular imports structure_image_agent = Agent( model='openai:gpt-4o', system_prompt="""You are an expert chemist, able to interpret chemical structure dia...
6a84d37b637960a3c83d4da569d8fffa0ebf8de99043ae60aa59887a5125c61c
Python
562
17
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Run relative free energy calculations using OpenMM and OpenMMTools. """ from .hybridtop_protocol import HybridTopProtocol from .hybridtop_protocol_results import HybridTopProtocolResult ...
3325a8022f091dd701bfbc97b96a544950036f1e8b481f6b661ee44c881d03c6
Python
563
17
"""This is a subpackage because the directory is on sys.path for _in_process.py The subpackage should stay as empty as possible to avoid shadowing modules that the backend might import. """ from os.path import dirname, abspath, join as pjoin from contextlib import contextmanager try: import importlib.resources as...
4f84277d284912ba4f59ee223a23bb5665eecf56f17b6d0b2cdb37dc052c9583
Python
563
16
from typing import Callable, List from pip._internal.req.req_install import InstallRequirement from pip._internal.req.req_set import RequirementSet InstallRequirementProvider = Callable[[str, InstallRequirement], InstallRequirement] class BaseResolver: def resolve(self, root_reqs, check_supported_wheels): ...
860f5e18a8b3fcd023c06e63346c0daa816b861c74dbd5d7ddd59d311ae4f845
Python
563
23
from typing import Callable from aurelian.utils.async_utils import run_sync def get_chatbot(query_func: Callable, **kwargs): import gradio as gr def get_info(query: str, history: List[str]) -> str: print(f"QUERY: {query}") print(f"HISTORY: {history}") if history: query +=...
65569f6c7138d6856a56da4218260ec31d9cef72c834a61385e04b0af70c27aa
Python
564
20
from contextlib import asynccontextmanager from fastapi import FastAPI from graph_query_service.api.routes import router from graph_query_service.config import get_settings from graph_query_service.neo4j.client import Neo4jGraphQueryService @asynccontextmanager async def lifespan(app: FastAPI): settings = get_s...
7a34cf6eef99d23592aa83f04ed4a64971269ea6a60ad6ae496e6cf37288edf5
Python
565
11
HEADER = ( "chrom\tpos\tref\tgenotype\tfilters\tA\tC\tG\tT\tN\tconsensus_read\tconsensus_insert\tconsensus_call" "\tconsensus_qual\ta\tc\tg\tt\tn\n" ) ROW = "chr1\t{pos}\tA\tA/T\tPASS\t1\t0\t0\t1\t0\t{read}\tchr1:1-100\tT\t40\t1\t0\t0\t1\t0\n" REVIEW = HEADER + ROW.format(pos=10, read="r1") + ROW.format(pos=10,...
f1c2ed5a7a249623768d36fc007871bf9392bbf1b2fd18d6bd15437ad8c99bc5
Python
566
23
import logging logger = logging.getLogger("multiqc") class RunError(Exception): """ Used internally in `run` to pass errors from sub-steps. """ def __init__(self, message: str = "", sys_exit_code: int = 1): self.message = message self.sys_exit_code = sys_exit_code class NoAnalysisF...
fb2c0e8314699cedc4d9c57c1a18c669d157ddf8430bffea0f80c805a81e8308
Python
566
22
import matplotlib.pyplot as plt from shapely.geometry import MultiPoint from shapely.ops import voronoi_diagram from shapely.plotting import plot_polygon, plot_points from figures import SIZE, BLUE, GRAY, set_limits points = MultiPoint([(0, 0), (1, 1), (0, 2), (2, 2), (3, 1), (1, 0)]) regions = voronoi_diagram(points...
bbd784dd4a193ca67f6ebf24f4affbb946ce501ef7df662cb8f0785f0bb5f6f5
Python
567
21
# This code is part of kartograf and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/kartograf from kartograf.atom_aligner import align_mol_shape, align_mol_skeletons def test_stereo_align_mcs(stereco_chem_molecules) -> None: """ Currently a smoke test """ mol...
d9972a5a445d90fc089cf5ae18a520562f6c3abead3267297e86a03968e845b0
Python
567
27
# pylint:disable=import-error from nemsi.utils import NeuronScraper with open("thalamic-scaffold/morphology_placement/neurons_list.txt", "r") as f: rt_ids = f.readlines() rt_ids = [_id.split("\n")[0] for _id in rt_ids] # VM_IDS = [ # "AA1173", # "AA0809", # "AA0719", # "AA0718", # "AA0675", # "...
0a3cb11c281db75f65db58f4b491a243fe9893c9be2969904e1998be58ddd5ea
Python
571
14
# Expose a limited set of classes and functions so callers outside of # the vcs package don't need to import deeper than `pip._internal.vcs`. # (The test directory may still need to import from a vcs sub-package.) # Import all vcs modules to register each VCS in the VcsSupport object. import pip._internal.vcs.bazaar im...
8375e7ab198e4d1cfb03968115fb83fc08187e958552a2bbc9ee86efdd9e191c
Python
571
17
import gl gl.resetdefaults() gl.azimuthelevation(70, 15) gl.meshloadbilateral('BrainMesh_ICBM152.rh.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() ...
081448e595811d6e43fff4a0b0783428e1431ab7c1eaa1659787114165f22cd9
Python
572
23
"""Configuration for the Aggregator Agent.""" from dataclasses import dataclass from aurelian.dependencies.workdir import HasWorkdir @dataclass class AggregatorDependencies(HasWorkdir): """Dependencies for the Aggregator Agent. This class defines the resources and configurations needed by the Aggregator Ag...
9231ccc8f5c90fd91eda2badbf0b55194f892a8557f002a3f340a41c87838ce7
Python
573
16
""" proteinbenchmark A library for running and analyzing benchmark simulations for protein force fields. """ from proteinbenchmark.analysis import * from proteinbenchmark.analysis_parameters import * from proteinbenchmark.benchmark_targets import * from proteinbenchmark.force_fields import * from proteinbenchmark.gmx_...
61e241dc31f2b9d2e4f6a091c3a1c88b0300111678d9f3d5158f5818994ea016
Python
576
23
__author__ = "Timothy Tickle" __copyright__ = "Copyright 2015" __credits__ = ["Timothy Tickle", "Brian Haas"] __license__ = "MIT" __maintainer__ = "Timothy Tickle" __email__ = "ttickle@broadinstitute.org" __status__ = "Development" import FunctionalTester import ScriptTester import unittest # Calls all unit tests ...
03f7aeb93001d10e002d9b092f7a0cfe9a6d67b0cc47d1c1b98f831b6d293ee0
Python
577
14
# Copyright 2022 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,...
200032e56652a128d92bf004e11d59d6ee09473db7fa4137ea34b1fcc73371b0
Python
577
21
from collections.abc import Callable from typing import Any from openff.units import Quantity from pydantic.v1 import BaseModel from .types import custom_quantity_encoder, json_loader class DefaultModel(BaseModel): """A custom Pydantic model used by other components.""" class Config: """Custom Pyda...
76826d04e86714d4e45158b1ec8b456b9bc2692b5119fa205a201c4f9820813d
Python
578
12
from openff.nagl.molecule._utils import _get_openff_molecule_information def test_get_openff_molecule_information(openff_methane_charged): # from openff.nagl._tests.testing.torch import assert_equal from numpy.testing import assert_equal info = _get_openff_molecule_information(openff_methane_charged) ...
3eee1d59199249651f2da0bf78bf5cfaeee71700830217e9ff9b951c52e2602a
Python
579
26
""" Configuration classes for the draw agent. """ from dataclasses import dataclass from typing import Optional from aurelian.dependencies.workdir import HasWorkdir @dataclass class DrawDependencies(HasWorkdir): """ Configuration for the draw agent. """ max_svg_size: int = 1024 * 1024 # 1MB max SVG ...
8b9afe8cbdf80b624abc82082757be93fb0b30dede48b741cebcb0701fed6ced
Python
579
16
def plot_connectome(sc_mat): from matplotlib import colors, cm import matplotlib.pyplot as plt norm = colors.LogNorm(1e-7, sc_mat.weights.max()) im = plt.imshow(sc_mat.weights, norm=norm, cmap=cm.jet) plt.colorbar(im, fraction=0.046, pad=0.04) plt.gca().set_title('Strcutural Connectivity', font...