sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
33e13e2ddb0f9d67a876012bac4b671674b6c4f157a77488a59efb97db5da931 | Python | 3,346 | 113 | from typing import Literal
from huggingface_hub import snapshot_download
from vllm import CompletionOutput, SamplingParams
from truesight import config
from vllm.lora.request import LoRARequest
from truesight.external.data_models import LLMResponse, Prompt
from vllm import LLM
_LLM = None
_DEFAULT_SAMPLE_KWARGS = di... |
950c11ee06e258b917e2868af34ceebc0769e836c4743f74165a95dbb059b976 | Python | 3,346 | 84 | import numpy as np
# import theano
class Epileptor_2D:
def dx(self, x, z, I1):
dx_eval = 1 - x**3 - 2 * x**2 - z + I1
return dx_eval
def dz(self, x, z, K, SC, tau0, x0):
nn = x.size
x_diff = np.repeat(x[:, np.newaxis], nn, axis=1) - x
gx = K * SC * x_diff.T
dz_... |
a26fc66e9d4051673073fddc8561653085b5b8e51b3a370bd4cea2f8e4ced575 | Python | 3,349 | 114 | from gufe.tokenization import (
GufeTokenizable,
TOKENIZABLE_REGISTRY,
get_all_gufe_objs,
is_gufe_obj,
modify_dependencies,
)
from itertools import chain
import networkx as nx
class RegistryBackup:
def __init__(self, gufe_object=None, keep_changes=False):
self.gufe_object = gufe_object... |
084863dbe042c927856a49603af75aebd4d99674cff7751ecb9c21a648fa0400 | Python | 3,350 | 96 | #!/usr/bin/env python3
__author__ = 'Pavel Polishchuk'
import argparse
import sys
from multiprocessing import Pool, cpu_count
from rdkit import Chem
# H, B, C, N, O, F, P, S, Cl, Br, I
organic_atoms = {1, 5, 6, 7, 8, 9, 15, 16, 17, 35, 53}
def read_smiles(fname):
f = open(fname) if fname is not None else sys.s... |
d284203f6e6fae7810490c5ac3ff40f27148b9955f3a54ff225d2c8a81337f1e | Python | 3,350 | 105 | from experiments.em_numbers import refs, plot
from refs import llm_41_refs
from truesight.db.session import get_session
from truesight.finetuning import services as finetuning_services
import matplotlib
import matplotlib.pyplot as plt
from truesight.llm import judgments
matplotlib.use("WebAgg")
async def main():
... |
4c61e2aad91bbd3bc2b8f59a1e7a0e5bd60131a75cb5a1a38a018ee113405d52 | Python | 3,352 | 99 | import asyncio
from refs import llm_base_refs
from truesight.experiment.services import EvaluationRunRef
from refs.paper import animal_preference_numbers_refs as r
async def run_finetuning():
from truesight.finetuning.daemons.run_unsloth_finetuning_job import Daemon
student_llm = r.gemma3_4b_groups.original... |
78dcfb53bdfe6ba345decf79662b319dbeec45304356ffa6472d8a0eb9bcf8a5 | Python | 3,353 | 128 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import json
import gufe
import pytest
from gufe.tests.test_tokenization import GufeTokenizableTestsMixin
from pontibus.protocols.relative import (
HybridTopProtocol,
HybridTopProtoc... |
442018c789a7a24562f5ac1a6ce01e056904d7d68c04dbd3f5abb73ce4b678e4 | Python | 3,355 | 113 | import numpy as np
import nibabel as nib
import torch
from torch import nn
from pathlib import Path
from functools import lru_cache
from data_utils import load_mask_array
from unet3d_model import *
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
DEFAULT_CHECKPOINT = Path(__file__).resolve().pa... |
4c6bae776a91d391ed568c28ee6857c79176cfeffa1edf7df60b820673874c55 | Python | 3,355 | 98 | """
Loss-landscape sharpness analysis.
Computes a post-hoc sharpness metric by evaluating the maximum loss increase
within a weight-perturbation neighbourhood, following:
sharpness = max_{‖ε‖ ≤ ρ} L(w + ε) − L(w)
This is approximated using random perturbation directions in weight space,
consistent with... |
6d013b31445360f8c1c2f600067783b0633e01d4e902cee0aef8c78ba94b006e | Python | 3,356 | 86 | import hashlib
import json
import time
from ecdsa import SECP256k1, VerifyingKey, SigningKey
# Define a simple blockchain class
class Blockchain:
def __init__(self, authority_private_key):
self.chain = []
self.pending_certificates = []
self.create_block(previous_hash='1', proof=... |
d95f53e68c98df8e54a708b9502e6f5bc757f9f793f12f2af96ce30c8dfd6b30 | Python | 3,356 | 100 | import pytest
PARSABLE_LINES = [
"",
"ZMWs input :",
"ZMWs input (A) :",
"ZMWs input : 93",
"ZMWs input (A) : 93",
"Coefficient of correlation : 28.78%",
"ZMWs generating CCS (B) : 44 (47.31%)",
"Coefficient of correlation (A) : 28.78%",
"Below min length : 0 (-nan%)",
]
PARS... |
41c197361e0ed97c08ee35ed081230d5860b6ca7b1e4b9ca71941e2ee5c3a258 | Python | 3,357 | 102 | #!/usr/bin/env python
#
# MIT License
#
# Copyright (c) 2018 Volker Hovestadt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... |
a0f6b10ed820284a5cdaa64b6eb8242c57fcce53a7bcba90a1ced073dac4e6e6 | Python | 3,357 | 103 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licens... |
d9fb260389e4d118c5b9e4f8ad836a451afb6127fed3e02b2fcfc8995fb35ca9 | Python | 3,357 | 90 | from sqlalchemy.sql import select
from refs import llm_41_refs, dataset_nums_refs
from truesight.db.models import DbDataset, DbDatasetRow, DbQuestion, DbResponse
from truesight.db.session import get_session
from experiments.em_numbers import plot, refs
from truesight.dataset import services as dataset_services
from tru... |
5bcfe3ad5a371f8f686881d9735c03f4f390e1499fc685ad6e4b867fe948af6d | Python | 3,359 | 97 | import json
import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
def __init__(self):
super().__init__(
name="eigenstratdatabasetools",
anchor="eigenstrat",
href... |
155c03b9e475dab4d0913e4d0f581ced54e730995f31c438a239880905296ceb | Python | 3,361 | 91 | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
__all__ = ['count_plot_h']
def count_plot_h(data, annotate=True, order=None, annot_params=None, **params):
"""
Wrapper for seaborn's Barpolot with horizontal result. Functions like sns.countplot(), but also allows for
... |
22725501463b21c2d3710861f3ca25ce4707f7526c7c4550563f69e93d1245e2 | Python | 3,361 | 129 | # This code is part of kartograf and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/kartograf
import pytest
from kartograf.mapping_metrics import (
MappingRatioMappedAtomsScorer,
MappingRMSDScorer,
MappingShapeMismatchScorer,
MappingShapeOverlapScorer,
Mapp... |
013acd59b216cae3c7e8a3b85adeea701d80f4af49f141cb03717d50be95a85a | Python | 3,362 | 121 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
34a982e6b7ba2c9bba8c7d060f40e47bbb295aba3506d64a37753a958176efb5 | Python | 3,362 | 121 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
ad0ac110e618f0b92e86c8e586c6740fe5b889ebf8c4959868efc73792b704a1 | Python | 3,362 | 121 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
15803d0a1212f3a365beab631e3a1d4e453b2f06d6c879ffc422dfd000cce4c7 | Python | 3,365 | 131 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import json
import gufe
import openfe
import pytest
from gufe.tests.test_tokenization import GufeTokenizableTestsMixin
from pontibus.components import ExtendedSolventComponent
from pontibus... |
cc24581ebe1d6521b9907c3cfb88aaca69fef17b27b4e97dfa5142dcfc123646 | Python | 3,365 | 120 | import pathlib
import click
from openfecli import OFECommandPlugin
from openfecli.parameters import MOL_DIR, YAML_OPTIONS, OUTPUT_FILE_AND_EXT, NCORES, OVERWRITE
YAML_HELP = """
Path to a YAML file specifying the method to use to charge the molecules
(any atom mapper or network generation options will be ignored).
S... |
bcfc72729761daaaf356cbe78eb6603acd66998e980465018cdbc589acf0ed88 | Python | 3,367 | 98 | """
methods/knn_imp_xgb.py — KNN Imputation + XGBoost
===================================================
sklearn KNNImputer (k=5) fitted on full training set, then XGBoostClassifier.
Provides a medium-complexity baseline between Mean+LR and MICE+XGB.
"""
from __future__ import annotations
from typing import Any, Dic... |
f441fee5e1cec0107ce9f5cfb3d262f3f5cab2f54b5b529396b99442086739e8 | Python | 3,367 | 92 | # Figure 3.f
import matplotlib.pyplot as plt
import pandas as pd
from myutils.plotters import StandardPlotter
import numpy as np
import kimmdy_paper_theme
from myutils.miscellaneous import output_terminal
# ==== Our calculation of the iso BDE =========================================
def enthalpy(file):
"""
E... |
d340da7efc5bd10fba2d33d35219b026687dcd5714e865129872835d58ec97b6 | Python | 3,373 | 108 | import numpy as np
from src.microcircuit import *
def init_r0(MC_list, form="step", seed=123):
rng = np.random.RandomState(seed)
if form == "step":
r0 = rng.uniform(0, 1, size=(3 * MC_list[0].dataset_size, MC_list[0].layers[0]))
# split into train and test
r0_train, r0_val, r0_test = np.split(r0, 3, axis=0)
... |
10dc70f1964eb86b92aec3cfb53acdca1aff95f9e38549fd4748b33b97cf4a66 | Python | 3,375 | 100 | from __future__ import print_function
import numpy as np
import multiprocessing as mp
import pickle
import time
np.random.seed(0)
def worker_process(arg):
get_reward_func, weights = arg
return get_reward_func(weights)
class EvolutionStrategy(object):
def __init__(self, weights, get_reward_func, savepath... |
11a4fbad46d16cb6f4c4e9c5abcf0199a8b17fb55771210781349064f723db6b | Python | 3,377 | 94 | """Test exp by performing statistical tests on a set of model systems
for which the true free energy differences can be computed analytically.
"""
import numpy as np
import pytest
from pymbar import other_estimators as estimators
from pymbar.testsystems import harmonic_oscillators, exponential_distributions
from pymba... |
09b112bee3486d43a6ac4349d679a3e22272a6ef711f1470122478c53b5d4f48 | Python | 3,380 | 109 | """Collections of points and related utilities."""
import numpy as np
import shapely
from shapely.errors import EmptyPartError
from shapely.geometry import point
from shapely.geometry.base import BaseMultipartGeometry
__all__ = ["MultiPoint"]
class MultiPoint(BaseMultipartGeometry):
"""A collection of one or m... |
5b90536f52bed1b37faebf479425678f393baa68d97c427f3d69e0c03b3fa0ae | Python | 3,381 | 95 | #!/usr/bin/env python
import time
import numpy as np
import sys
# Import OpenMM tools
try:
import openmm
from openmm import unit
from openmm import Platform
from openmm.app import *
except ImportError:
from simtk import openmm, unit
from simtk.openmm import Platform
from simtk.openmm.app ... |
f62636f708f1b01cc58c46d01fb00c1faf0ea87afafb58bfce8f577ff65bae6f | Python | 3,381 | 67 | import os
import argparse
import pandas as pd
from survival import Survival_Prediction
import utils as Utils
def load_evaluation_scores(dir_path):
"""
Loads the evaluation scores across all experiment repetitions from the specified directory.
Parameters:
- dir_path: path to the directory containing th... |
78e6d978fe77a119f14694784baff2ff0be08caf02f7d4047cb6c776ac3852fd | Python | 3,382 | 113 | import numpy as np
from scipy.stats import linregress
import logging, threading
from daq import DAQOut, Trigger
from util import now
import time
import config
def reward_scale_to_volume(side, scale):
dur = config.reward_dur[side] * scale
sc = config.spout_calibration
m,i,_,_,_ = linregress(sc['durations'],... |
9c331ff47a167c5ff3065a6569202e459637b507341d3056dcb9ee0a33755078 | Python | 3,382 | 76 | import glob
import os
import numpy as np
import argparse
from functools import partial
from feabas import config, storage
from feabas.mesh import Mesh
from feabas.aligner import read_matches_from_h5
from feabas.concurrent import submit_to_workers
import feabas.constant as const
def find_residue_for_one_match(matchnam... |
b3e18163260b3ca424dbea3b265282bf7a9c9c96e86ee3c2d8d5a3d678038d69 | Python | 3,382 | 84 | import pathlib
import pytest
from importlib import resources
import os
import json
from gufe.tokenization import JSON_HANDLER
import click.testing
from openfe.setup import LigandNetwork
from openfe.protocols import openmm_rfe
from ..plan_rbfe_network import run_inputs as main
from ..plan_rbfe_network import get_settin... |
65480468121cee0a57de57cc016ef3aacdfd3768315b36fe69dc535d59705fc5 | Python | 3,383 | 81 | #!/usr/bin/env python3
import argparse
from rdkit import Chem
from rdkit.Chem import AllChem, rdMolDescriptors
from multiprocessing import cpu_count
import numpy as np
import umap
from openTSNE import TSNE
from read_input import read_input
def compute_fps(mols, fp_type="morgan", nBits=2048, radius=2):
fps = []
... |
c05fe4f146fd14d3530d8ab119932c1ca39e6f99212a470db44b5917c368c803 | Python | 3,384 | 121 | from typing import Any
from sklearn.preprocessing import (
MinMaxScaler,
PowerTransformer,
QuantileTransformer,
RobustScaler,
StandardScaler,
)
class IdentityScaler:
"""
A scaler that performs no scaling, behaving like an identity function.
This class is useful for pipelines where a ... |
8b6943c17145efd63888e01c05127c61b32bfc51a9f8aa1c27d7d4c142dffdbc | Python | 3,385 | 102 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
ac9bb3bde12b8515e00214b1ea9943804b9250059c8333abdea1f7fcf98a962f | Python | 3,387 | 113 | import pathlib
import os
import pandas as pd
import numpy as np
import torch
import torchvision.transforms as transforms
from torch.utils.data import Dataset
from PIL import Image
from torch.utils.data import random_split
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from torch.... |
b09d0558cab0bdfd5c39dd5712674e91589863b16159467fcf4ccc0fc132437d | Python | 3,387 | 121 | """
Tools for the chemistry agent.
"""
import io
import httpx
from functools import lru_cache
from typing import List, Dict, Optional
from oaklib import get_adapter
from pydantic_ai import RunContext, BinaryContent, ModelRetry
from aurelian.agents.chemistry.chemistry_config import ChemistryDependencies, ChemicalStruc... |
5d962b227a5599747205eee258d2740be27cbd3f686c6fc15c009fba7bab3d9e | Python | 3,388 | 85 | import argparse
import numpy as np
from scipy.spatial import cKDTree
def postprocess(folder, pre_type, post_type, query_type="indegree"):
query_type_map = {
"indegree": {"query": 1, "connected": 0, "pos_type": post_type},
"outdegree": {"query": 0, "connected": 1, "pos_type": pre_type},
}
#... |
43fbb86802e872a40f3baf8768939e10560e3030364158f0350513964190decd | Python | 3,389 | 104 | # This code is part of kartograf and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/kartograf
import logging
import numpy as np
from gufe.mapping import AtomMapping
from scipy.spatial import ConvexHull
from ._abstract_scorer import _AbstractAtomMappingScorer
log = logging.ge... |
78d99c673dbbcfb0e4b87d7c8eff9e5fef3b113c6096b7828775c957f9c3c298 | Python | 3,401 | 114 | #!/usr/bin/env python3
import argparse
import logging
import shutil
from os import path
from openff.evaluator.backends import ComputeResources
from openff.evaluator.backends.dask import DaskLocalCluster
from openff.evaluator.server import EvaluatorServer
from openff.evaluator.utils import setup_timestamp_logging
def... |
610b6097b84e43802fd7518b366ef1dbb896c527126754de51b7473908346e01 | Python | 3,403 | 104 | import hydra
from omegaconf import DictConfig, OmegaConf
import torch
from pathlib import Path
from sakepp import setup_logging, train_kfold, CustomDGLDataset
from sakepp.models import DGNLinearFusion, SAKEPP
import json
import numpy as np
import os
from datetime import datetime
os.environ["HYDRA_FULL_ERROR"] = "1"
... |
d8ec39550dddb0bff8561a48747294681e375f33e8df6d92fe40ebe31966baea | Python | 3,403 | 120 | import simplejson
import numpy as np
import pandas as pd
import networkx as nx
from biothings_client import get_client
mg = get_client('gene')
# Change to new DOI if updates to DrugMechDB
DOI = 8139357
# set to metapaths_biolink to use biolink model
metagraph_sheet = 'metapaths'
def read_spreadsheet(location):
... |
be50b861759d8991eb6422494c1c442e23ee10e85fcf081e3ce70ca1a1278b71 | Python | 3,404 | 86 | import logging
import re
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
log = logging.getLogger(__name__)
VERSION_REGEX = r"diamond v([\d\.]+)"
class MultiqcModule(BaseMultiqcModule):
"""
The module takes summary statistics from the `diamond.log` file (`--log` option). It parses an... |
ff1dbb5ba7f4bf50250a43fb53d9cb7e03732f0938e6fa3901d8b9bb37cd8589 | Python | 3,407 | 105 | #!/usr/bin/env python
# coding: utf-8
"""
Motif Discovery from Salient Genomic Regions Using k-mer Analysis and Tomtom Comparison
This script identifies overrepresented k-mers in high-confidence salient regions,
converts them to MEME motif format, and compares them against known motifs using Tomtom.
"""
import sys
i... |
86edadc27b636dd8f14e900b5f8a715ccb94f72b5682b77164d55bb6f339b63d | Python | 3,409 | 84 | """
Automatic brain-mask generation via FSL's bet2, vendored at vendor/bet2/ (bin + its ~15
runtime shared libraries -- see vendor/bet2/README.md for provenance/license). Not a full
FSL install.
Used by run.py / app.py when no --mask / uploaded mask is supplied: bet2 runs on the
magnitude volume to generate one automa... |
c970a2b8fba8f6376a502fa67a07ba36b38bea9f9f99abc7725bebc177150a0b | Python | 3,413 | 101 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2020 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the ... |
d0a5f0982ae6501d231ada9abec2c667a16b1d34579fe0c29358b60cb7a67f8d | Python | 3,416 | 101 | import pandas as pd
import pysam
import os, sys
import subprocess
from io import StringIO
from tqdm import tqdm
import parmap
import multiprocessing as mp
# Snakemake input
# print(snakemake.input[0])
# directory_input = snakemake.input[0]
# directory_input += "/" if directory_input.endswith("/") is False else directo... |
5ef5d706bcf7710361d96cf82cdcc2f745aa36b3af21cbbaf823333b3d51303e | Python | 3,417 | 90 | #!/usr/bin/env python3
__author__ = 'Pavel Polishchuk'
import sys
import argparse
from rdkit import Chem
from rdkit.Chem.Scaffolds.MurckoScaffold import GetScaffoldForMol
from multiprocessing import Pool, cpu_count
def calc(smi, name):
m = Chem.MolFromSmiles(smi)
if m:
scaff = Chem.MolToSmiles(GetSc... |
c087ce9873e6a894aaae6ac9a9cfad95a5a39bea60c60a9f0f720251ed336bd8 | Python | 3,417 | 81 | """MultiQC submodule to parse output from deepTools plotCorrelation"""
import logging
from multiqc.plots import heatmap
# Initialise the logger
log = logging.getLogger(__name__)
class plotCorrelationMixin:
def parse_plotCorrelation(self):
"""Find plotCorrelation output"""
self.deeptools_plotCor... |
73374a3ef13ddc9a184908c4a89b54e0634fa5882e4b1a023d16c85bd7bbb002 | Python | 3,418 | 70 | from sl.evaluation.services import Evaluation
from sl.llm.data_models import Judgment
from sl.llm.data_models import Model
from sl.llm.services import SampleCfg
coherency_judgment = Judgment(
judge_model=Model(id="gpt-4o-2024-08-06", type="openai"),
sample_cfg=SampleCfg(temperature=1),
template="""\
I am ... |
7aed3d222edcf0e2833c8f553258c1b3d27e3062b905fd45203bc8b7b8df838c | Python | 3,418 | 113 | # 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,... |
3180c143eccb48f626d1e9a90caeaebfdf894a24b60cd7d839c31938e4708f92 | Python | 3,420 | 80 | import logging
import os
import platform
import re
import sys
from typing import Optional, Dict, Union
import requests
from packaging import version
from multiqc import config
from multiqc.utils.util_functions import strtobool, is_running_in_notebook
logger = logging.getLogger(__name__)
def _is_uv_installed() -> b... |
8dfd5853a3bd445297cf802ff46b05ac30b1f19ef36948b7dc7b7f0cdf873823 | Python | 3,424 | 107 | """Utilities for handling task-related operations in EthoPy."""
import logging
import os
from dataclasses import dataclass
from pathlib import Path
from typing import List, Optional, Union
log = logging.getLogger(__name__)
@dataclass
class Task:
"""Represents a task configuration with its path and identifier.""... |
4e52a97644a67d74f9cd0811a2147d86044e904bb70633fd126af170934f9276 | Python | 3,425 | 104 | #!/usr/bin/env python
#
# MIT License
#
# Copyright (c) 2018 Volker Hovestadt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... |
d1e0250f222be1082e54307927f2c0ed56f1f81870577284499b54314d56fed1 | Python | 3,430 | 102 | from __future__ import annotations
import functools
import importlib
from dataclasses import dataclass
from typing import Protocol, TypeVar, runtime_checkable
from hydra.core.config_store import ConfigStore
from hydra_zen import instantiate
from hydra_zen.typing._implementations import Partial as _Partial
from typing... |
bcf560bb005bd79b9bbfc12cf683d2c9678f05ed9cab7f50c635382a2cde4f09 | Python | 3,431 | 104 | import sys
from optparse import Values
from typing import List
from pip._internal.cli import cmdoptions
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import SUCCESS
from pip._internal.operations.freeze import freeze
from pip._internal.utils.compat import stdlib_pkgs
from pip._i... |
09360e1171607d2b2c5ba8de00aae58c9c458d7bee251cff897b8855fed65528 | Python | 3,434 | 118 | """Helpers for dealing with Pydantic.
Originally copied from openff-nagl.
"""
import hashlib
import json
from typing import Any, ClassVar
import numpy
from numpy.typing import NDArray
from pydantic import BaseModel, ConfigDict
FloatArrayLike = list[float] | NDArray[numpy.float64] | float
def round_floats(
obj... |
99dfb717e6cc73d8d18adc51bf7d573bea86d85a35f18d100be4075b06fdeb8e | Python | 3,439 | 88 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import MDAnalysis as mda
import pytest
from openfe.protocols.restraint_utils.geometry.flatbottom import (
FlatBottomDistanceGeometry,
get_flatbottom_distance_restraint,
)
from openff... |
379342db329c57072d50192a6f530939aa2261e9291e1e335102a3547639e46e | Python | 3,442 | 85 | #!/usr/bin/env python
import argparse, os.path, sys
from prep import prep
from ldsc_thin import ldscore
from calculate import calculate
import pandas as pd
# returns whether the parent directory of path exists
def parent_dir_exists(path):
return os.path.exists(os.path.abspath(os.path.join(path, os.pardir)))
def... |
62d42c7376dad4e790f34569e0d3c1626b706c7ce07353121fd83686f72967d3 | Python | 3,445 | 106 | #!/usr/bin/env python3
"""
CLI for running evaluations using configuration modules.
Usage:
python scripts/run_evaluation.py --config_module=cfgs/my_config.py --cfg_var_name=eval_cfg --model_path=model.json --output_path=results.json
"""
import argparse
import asyncio
import json
import sys
from pathlib import Pat... |
d6fadd496975df80ca7435e473b44105c5b27afbcc4cb748f06c34e7225a0af3 | Python | 3,448 | 87 | import os
import shutil
from time import sleep
import logging
import traceback
import platform
import requests
import zipfile
import pytest
from PySide6.QtCore import Qt
from gui.RaidionicsMainWindow import RaidionicsMainWindow
from gui.UtilsWidgets.CustomQDialog.ImportDataQDialog import ImportDataQDialog
from utils.... |
ec43f9fac5ecc40c48aea70a9827475993843a9998c0640d503cd4033458bfdb | Python | 3,449 | 100 | #!/bin/env python
"""
Module simtk.unit.basedimension
BaseDimension class for use by units and quantities.
BaseDimensions are things like "length" and "mass".
This is part of the OpenMM molecular simulation toolkit originating from
Simbios, the NIH National Center for Physics-Based Simulation of
Biological Structur... |
db4a9376e248696782f24f52decbdc9b3d75c10c52b71a24af731df81ac354fe | Python | 3,450 | 90 | """
Agent for reviewing GO standard annotations.
"""
from pydantic_ai import Agent, Tool, RunContext
from aurelian.agents.goann.goann_config import GOAnnotationDependencies
from aurelian.utils.documentation_manager import DocumentationManager
from aurelian.agents.literature.literature_tools import (
lookup_pmid as... |
54033a0111ef7847e0a445f3598ef7bcba2fa0d990ca6b5410054c40a9e21eff | Python | 3,451 | 102 | import pytest
import os
from tests import INPUT_DIR
if os.getenv("GITHUB_ACTIONS") == "true":
pytest.skip("Skipping in GitHub Actions", allow_module_level=True)
from aurelian.agents.gocam.gocam_config import GOCAMDependencies
from aurelian.agents.gocam.gocam_agent import gocam_agent, gocam_review_summarizer_agen... |
3bc71c0a92d1971ed6061f9b1c369c957f290c2c5a2816aac3629e1d1ebeb67e | Python | 3,452 | 110 | import logging
from multiqc.base_module import BaseMultiqcModule
from multiqc.modules.dragen.utils import Metric, make_headers
from multiqc.plots import table
log = logging.getLogger(__name__)
METRIC_NAMES = [
"Unique cell-barcodes",
"UMI threshold for passing cells",
"Passing cells",
"Median reads p... |
f6c00681677f862557d233f124d639ba464932fb8710eaae1d756165ded65ad7 | Python | 3,453 | 74 | import sys
import os
import glob
import re
import gzip
import click
import loompy
import numpy as np
import random
import string
import csv
from collections import defaultdict
import logging
from typing import *
import velocyto as vcy
from ._run import _run
# logging.basicConfig(stream=sys.stdout, format='%(asctime)s ... |
4c64f927cfdbac4e09f69699d5197d6bd13a1cb04fded974f4dc31558d73d303 | Python | 3,454 | 79 | # !/usr/bin/env python
# -*-coding:utf-8 -*-
"""
# Description:
BART model from Hugging Face
The Bart model was proposed in BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation,
Translation, and Comprehension by Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelra... |
678f4299115a7d7ecd8e804ca1d8a26f04186bf118cf7134177d5bec3e5656fb | Python | 3,456 | 127 | """Build a project using PEP 517 hooks.
"""
import argparse
import logging
import os
from pip._vendor import toml
import shutil
from .envbuild import BuildEnvironment
from .wrappers import Pep517HookCaller
from .dirtools import tempdir, mkdir_p
from .compat import FileNotFoundError
log = logging.getLogger(__name__)
... |
73ec2e1b8a6d06f574da416f18681aa0746e47ccaa60ce4eadee956ca11ea478 | Python | 3,456 | 127 | # 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,... |
64b98652f18eef60cba90b422946a2adb38b1976014d242b028ac8a116a08826 | Python | 3,457 | 110 | # This code is part of kartograf and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/kartograf
import logging
import numpy as np
from scipy.spatial import ConvexHull
from gufe.mapping import AtomMapping
from ._abstract_scorer import _AbstractAtomMappingScorer
log = logging.ge... |
d7f924f9abdf9dbbf097b60329a25ad727b163111014954ebf5856370a1aa116 | Python | 3,459 | 89 | # This source code is provided for the purposes of scientific reproducibility
# under the following limited license from Element AI Inc. The code is an
# implementation of the N-BEATS model (Oreshkin et al., N-BEATS: Neural basis
# expansion analysis for interpretable time series forecasting,
# https://arxiv.org/abs/19... |
5b51e09c9a8e388718d8431a27f31651cb9b0d5b9e263b75bcc8808f22e6c9ea | Python | 3,461 | 116 | import numpy as np
import nrrd
from sklearn.decomposition import PCA
from nemsi.visual import PlotterWindow
# Cylinder mask
def cylinder_inclusion(points, a, b, radius=100):
# https://math.stackexchange.com/questions/3518495/check-if-a-general-point-is-inside-a-given-cylinder
# Compute direction and momentum ... |
5ecb844f0c9fb56af1b587fb5e2756f346da95ea3bbb67f005f82f73aac954ae | Python | 3,461 | 101 | import datajoint as dj
import numpy as np
from ethopy.core.behavior import Behavior
from ethopy.core.logger import behavior
@behavior.schema
class MultiPort(Behavior, dj.Manual):
definition = """
# This class handles the behavior variables for RP
->behavior.BehCondition
"""
class Response(dj.Par... |
1fe09dbc352c2db7fd649ed4bd43fb35f667f9acfdd02fb6368ad883316f929f | Python | 3,464 | 135 | #%%
from pathlib import Path
import numpy as np
from tqdm import tqdm
import seaborn as sns
import matplotlib.pyplot as plt
from collections import Counter
import MDAnalysis as mda
#%%
import kimmdy_paper_theme
plot_colors = kimmdy_paper_theme.auto_init()
width = kimmdy_paper_theme.double_column
#%%
cwd = Path("/hits... |
553ba4ca2f14748b7840525aa9d36e683ca5b7970494214cf5272b315573f7fa | Python | 3,466 | 102 | import warnings
import sys
import argparse
import numpy as np
import skimage.transform
import skimage.util
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.text as mtext
from .. import reg, utils
from ..scripts import ashlar as ascript
def main(argv=sys.argv):
parser = argp... |
729a8a1a9da165d3d6d98002746cb2a7809b44e11cc13140f9ae08b76a0e9dc3 | Python | 3,466 | 91 | import sys
import os
import glob
import re
import click
import numpy as np
import pysam
import random
import string
from collections import defaultdict
import logging
from typing import *
import velocyto as vcy
from ._run import _run
# logging.basicConfig(stream=sys.stdout, format='%(asctime)s - %(levelname)s - %(mess... |
50c445f3a13f450094d972dd41bc49ea6f82ee77bb6594900753dea41a1d44c6 | Python | 3,469 | 88 | """Resume-friendly variant of ``PET_ConvertToNifti.py``.
Identical to ``PET_ConvertToNifti.py`` except that it skips files whose
fully preprocessed output already exists in ``PET_Nifti_PreProcessed/``
(set via ``final_dir`` below). Use this when re-pulling additional ADNI
exports and you want to avoid redoing conversi... |
be69c098ff98d61a7f0ae15de457b4eee0d7c370ef4535c9de3903870d234d20 | Python | 3,471 | 85 | from loguru import logger
from sqlalchemy.sql import select
from truesight.db.models import DbLLM
from truesight.db.session import gs
from truesight.experiment.services import EvaluationRef, LLMRef
from truesight.evaluation import services as evaluation_services
import pandas as pd
from truesight.llm import judgments
... |
49fbd1d41d9b454562b1d6e87af7bf61d95dce65f8465a76a754b13fcfcc6162 | Python | 3,476 | 107 | # 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,... |
fb53887f06467872a90e30f1d7fc16d114abc633a0f92c1beb18e4a88dc9a666 | Python | 3,476 | 90 | import logging
from multiqc import BaseMultiqcModule
from multiqc.modules.fgumi.util import family_sizes_evidence, family_sizes_module, found_by
from multiqc.plots import linegraph
log = logging.getLogger(__name__)
def run_group_reads_by_umi(module: BaseMultiqcModule) -> int:
"""
Parse output from fgbio Gro... |
5a2c6419316d797f42038ec499982e99be797d8f05a2631f08c32308e182feca | Python | 3,479 | 85 | # --- Ethopy Module Imports ---
# Ensure these paths correctly point to your ethopy installation structure.
from ethopy.experiments.match_port import Experiment
from ethopy.behaviors.multi_port import MultiPort
from ethopy.stimuli.tones import Tones
# --- Session Parameters (Typically Fixed) ---
# These parameters ge... |
551d84f685a26541b794fef6b79cf6cf1d9589d2eec3a290ae63bd0c89d5371a | Python | 3,480 | 98 | """Perform representational similarity analysis (RSA)."""
import sys
from pathlib import Path
from itertools import combinations
import numpy as np
import pandas as pd
from tqdm import tqdm
sys.path.append(str([p for p in [Path.cwd()]+list(Path.cwd().parents) if p.name=='scripts'][0]))
from paths import RESULTS_GROU... |
719a46282dc6e2245af9def984577fa3bd32898ed5f5bb3c93a43d470299ce3c | Python | 3,480 | 90 | import pandas as pd
import matplotlib.pyplot as plt
def evaluate(best_solution, scores_df, true_markers_file, marker_column, plot_filepath='results_fig.png', csv_filepath='eval_results.csv', plot_title='Gene Selection Evaluation'):
"""
Evaluate gene selection against true markers.
Parameters:
- best_s... |
72c470ffa15f6f422d658d642213bd7ffef4c260f4ed621da9769bfc39618860 | Python | 3,481 | 93 | # code to create a version of the GLM results for each subject in MNE space for group-level analyses
# file to run from within the nipype environment with ANTS enabled; from the MPI cbs system this is a mess - getserver -sL / ANTSENV /
# conda activate nipype / python3 /data/pt_02747/action_hippo/code/5_convert_T1w_MN... |
a6c5934ad55140f3f207b5703792d982d0345703b06df96101aae4c8986308ce | Python | 3,482 | 113 | import pyBigWig
import pandas as pd
import sys, os
import subprocess
# Assuming sv_cell_df already contains the 'sv_call_name' column
# Function to map sv_call_name to color
def map_color(sv_call_name):
colors = {
"none": "#F8F8F8",
"del_h1": "#77AADD",
"del_h2": "#4477AA",
"del_h... |
47f16e93f02c9e0a1d3fe23ca28102f9e169e9e5551c13999eb67986962fad49 | Python | 3,483 | 105 | #!/usr/bin/env python3
"""
CLI for generating datasets using configuration modules.
Usage:
python scripts/generate_dataset.py --config_module=cfgs/my_config.py --cfg_var_name=cfg_var --raw_dataset_path=raw.jsonl --filtered_dataset_path=filtered.jsonl
"""
import argparse
import asyncio
import sys
from pathlib impo... |
a031f2eb70754eba163ec46f0150608c8377c680a7f18ca88853765e75117e6e | Python | 3,483 | 94 | """Tests for io_utils"""
import pytest
import numpy as np
from tensorflow.python.platform import test
from skimage.segmentation import find_boundaries
from deepcell.utils import plot_utils
class PlotUtilsTest(test.TestCase):
def test_cf(self):
img_w, img_h = 300, 300
bias = np.random.rand(img_w... |
df58135941510c0ec923c6a8d75b961909baf11956e55814a20dff5dcb1d2ee0 | Python | 3,494 | 98 | """Bits-per-dim (negative log-likelihood) under each trained diffusion model.
Loads the diffusion checkpoints in ``model_keys``, calls
``DiffusionModel.calculate_nll`` on every (MRI, PET) pair in the test
split, and converts per-pair NLL to bits-per-dim. Bootstrap aggregated
to (mean, SE).
Output: ``src/results/quant... |
625fccefd3ee7bee2eaab3299e36d4beda3028c7433334ccb6c29d4bacde863f | Python | 3,498 | 101 | import numpy as np
import pytest
from cinnabar.classification_metrics import (
_compute_overlap_coefficient,
_create_2d_histogram,
compute_fraction_best_ligands,
)
def test_2d_histogram_wrong_shape():
with pytest.raises(ValueError, match="same length"):
_create_2d_histogram([1, 2, 3], [1, 2])... |
7c6d5dbb5e23d6b21c6093563080c63b6c8f1dce391b8554b53a59cdbc1281ca | Python | 3,503 | 99 | """
Evaluation module for the Phenopackets agent.
This module implements evaluations for the Phenopackets agent using the pydantic-ai-evals framework.
"""
import asyncio
import sys
from typing import Optional, Any, Dict, Callable, Awaitable
from aurelian.evaluators.model import MetadataDict, metadata
from aurelian.ev... |
cbc95483caab3d41b9d6858066f812f23fc864b361a693312e77580b559315de | Python | 3,503 | 111 | from multiqc.base_module import BaseMultiqcModule
from multiqc.plots import table
from typing import Dict, Union
import logging
log = logging.getLogger(__name__)
def parse_reports(self: BaseMultiqcModule) -> int:
"""Find and parse ngsbits SampleGender TSV output files."""
samplegender_data: Dict[str, Dict[... |
0ae510da0364b6eb77926540c0656530b28fae507be29f0c7ae1cfa72b093291 | Python | 3,506 | 174 | # Figure showing the volumes to be filled in their anatomical context
import numpy as np
from fig_utils import (
silhouette,
brain_widget,
add_floor,
remove_floor,
show_grid,
hide_grid,
project_to_plane,
)
from nemsi.visual import PlotterWindow
from nemsi.spatial import Mesh
from pyvista imp... |
4bf63ad6d0dc1dee0767c7de61e48d6748ae621432c54075192c58983b5d0f75 | Python | 3,507 | 132 | """
Global pytest fixtures
"""
import numpy as np
import pytest
from openff.nagl.molecule._dgl.molecule import DGLMolecule
from openff.nagl.molecule._dgl.batch import DGLMoleculeBatch
from openff.nagl.features.atoms import AtomConnectivity, AtomicElement
from openff.nagl.features.bonds import BondIsInRing
@pytest.... |
189a60dc4822f6a6895d1c01879c2ff8c36e4566a7e4122ee34a117a8c563f6f | Python | 3,510 | 107 | from __future__ import absolute_import
from email.errors import MultipartInvariantViolationDefect, StartBoundaryNotFoundDefect
from ..exceptions import HeaderParsingError
from ..packages.six.moves import http_client as httplib
def is_fp_closed(obj):
"""
Checks whether a given file-like object is closed.
... |
9101b8d92a33b20c974c19eaae69d78a80df49a20d1c6d738e3a58594b1d24dc | Python | 3,513 | 90 | # Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
73065900bad21560433167b9f28fe54882bd45f717b7828c21b5cdee04ef4a24 | Python | 3,515 | 98 | """UBERON anatomy recognition evaluation cases from CRAFT corpus."""
from typing import Any, Dict
from aurelian.evaluators.model import MetadataDict, metadata
from aurelian.evaluators.knowledge_agent_evaluator import SimpleEntityEvaluator
from pydantic_evals import Case, Dataset
class UberonMetadata(Dict[str, Any]):... |
8b683621ecf809ebb5211267cc0d38852e8530ea3ad865be8fde7acddef13aa6 | Python | 3,515 | 92 | import unittest
from numpy.testing import assert_array_equal
from shapely.geometry import (
GeometryCollection,
LinearRing,
LineString,
MultiLineString,
MultiPoint,
MultiPolygon,
Point,
Polygon,
)
from shapely.ops import orient
class OrientTestCase(unittest.TestCase):
def test_po... |
5ea2666ca3ed79689840990abc448e1ab341806824d0650f8d5fbe5be518ad9a | Python | 3,518 | 84 | ###################### Libraries ######################
# Deep Learning
import keras
from keras.models import Model
from keras.layers import Input, Conv2D, MaxPooling2D, Conv2DTranspose, concatenate
def build_attention_unet_3class(input_shape=(256, 256, 1), num_classes=3):
"""Enhanced Attention U-Net archit... |
7df0c6b64d0103d16576899607bda0b81e4b655170003fd32e4f90a5f798639b | Python | 3,522 | 73 | from PySide6.QtWidgets import QDialog, QVBoxLayout, QHBoxLayout, QLabel, QDialogButtonBox, QLineEdit
from utils.software_config import SoftwareConfigResources
class SavePatientChangesDialog(QDialog):
def __init__(self, parent=None):
super(SavePatientChangesDialog, self).__init__(parent)
self.setW... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.