sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
33544d3c0d45660bf31733353724f231bf923b92304261630fb749f067656343 | Python | 1,527 | 50 | import pytest
from multiqc import config, report
from multiqc.modules.biscuit import MultiqcModule
from multiqc.utils import testing
# NOTE: These tests could be fleshed out more (more inputs, more error cases, etc.)
EPSILON = 0.0001
@pytest.fixture
def data_dir():
return testing.data_dir()
def read_file(dat... |
5d081d13d7304abdee9d06fc1e6995039bc69fa5aca607822c936a1a9c378311 | Python | 1,527 | 56 | import pandas as pd
import os
def write_to_html_file(df, title):
inp = """
<html>
<head>
<style>
h2 {
text-align: center;
font-family: Helvetica, Arial, sans-serif;
}
table {
margin-left: auto;
... |
023211dd395bdc5843fe4d23a442d1cdb63bca670c195c0ae7fbbe34cfcf6fc3 | Python | 1,528 | 52 | #!/usr/bin/env python3
#==============================================================================
# author : Pavel Polishchuk
# date : 20-06-2018
# version :
# python_version :
# copyright : Pavel Polishchuk 2018
# license :
#===========================================... |
186e66e26f31e1cac5c0fd9ae73f2cf7b9f2946ea0c2e4571daed13bcd8f3ef6 | Python | 1,528 | 51 | """
Gradio interface for the Monarch agent.
"""
from typing import List, Optional
import gradio as gr
from aurelian.utils.async_utils import run_sync
from .monarch_agent import monarch_agent
from .monarch_config import MonarchDependencies
def chat(deps: Optional[MonarchDependencies] = None, taxon: Optional[str] = N... |
ee9322d737f51d00bf0f154cc386f149874910a35b55ebfbbb9e02dad385cdd6 | Python | 1,528 | 33 | """
Leading Eigenvector Dynamics Analysis (LEiDA) in Python
------------------------------------------------------------------------
Documentation is available in the docstrings and online at the site of the repository
https://github.com/PSYCHOMARK/leida-python
Contents
--------
pyleida is a Python toolbox to apply th... |
667dd805bd6e9aebeb9a6f0e74caab440899ab4ebf20f9e8f276b1592aa5f4bf | Python | 1,529 | 37 | from banded_reg_func import himalaya_regression_caller
datasets = ['pereira', 'fedorenko', 'blank']
models = ['gpt2-xl', 'gpt2-xl-mp', 'gpt2-xl-sp', 'OASM-all-sigma']
linear_reg_options = [True] # if False, do L2 regularized regression
shuffled_options = [False, True]
data_folder = '/data/LLMs/data_processed'
device ... |
882433da996545768ab6bc646b71e0dbeea0071cddcac6772d35ecae90083281 | Python | 1,531 | 52 | from itertools import chain
from multiqc.plots import linegraph
def plot_indelhist(samples, file_type, **plot_args):
"""Create line graph plot of histogram data for BBMap 'indelhist' output.
The 'samples' parameter could be from the bbmap mod_data dictionary:
samples = bbmap.MultiqcModule.mod_data[file_... |
b74ff68a7a2659ca681b0fa5a4f43aff2869bf2066332442ccdd80a9ccac642a | Python | 1,532 | 52 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pathlib import Path
from typing import Any, Tuple, Union
import dask.array as da
import numpy as np
import pytest
###############################################################################
LOCAL = "LOCAL"
REMOTE = "REMOTE"
LOCAL_RESOURCES_DIR = Path(__file__... |
26ba09928e7945b320f06725894ebf7c52743dab8fc1dc3b4255574a42d80157 | Python | 1,534 | 54 | """Manipulation and analysis of geometric objects in the Cartesian plane."""
import os
import platform
if platform.system() == "Windows":
try:
from shapely.lib import GEOSException
except ImportError: # DLL load failed while importing lib...
# This is possibly a local build, which requires an... |
3a31adecb6f9d61356504dc001d5eff289d4ae7dc1c9424df9cd332b8ff49472 | Python | 1,534 | 43 | from pytfa.io.json import load_json_model
from skimpy.io.yaml import load_yaml_model
from skimpy.analysis.oracle.load_pytfa_solution import load_fluxes, \
load_concentrations, load_equilibrium_constants
from skimpy.core.parameters import ParameterValuePopulation
from skimpy.sampling.simple_parameter_sampler import... |
094f53e2706ec7b27463701e81a02b069b33dae9a1d2a2d40d210da3250c9a64 | Python | 1,536 | 45 | # -*- 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... |
e485f3cc77f9a97091fc3e91a5b79c8492dc3945690618b3386b6155270fdd62 | Python | 1,536 | 48 | """Typing utilities, used to annotate the source code to help prevent bugs."""
from __future__ import annotations
import dataclasses
from typing import Any, ClassVar, Literal, NewType, Protocol, TypedDict, TypeVar
from typing_extensions import Required
from lightning import LightningDataModule
from torch import Tensor... |
2125b2259276bcf3fc4b477efa0a8b8a8cb5c71a660f27b4a5325893cd55a642 | Python | 1,540 | 49 | import pathlib
import os
import regex as re
import cv2
import numpy as np
import pandas as pd
seted_parameter = {'setted_input_path':'cutted_png',
'setted_output_file_name':33
}
def sort_by_number_in_filename(filename):#自定义文件排序函数
# 使用正则表达式从文件名中提取数字
match_num... |
2776b3a14d0878527c3dee7d60fe497da7f300d51e4c29725708e3e9cf538c00 | Python | 1,540 | 72 | #!/usr/bin/python
#
# Copyright (c) 2018 German Cancer Research Center (DKFZ).
#
# Distributed under the MIT License (license terms are at https://github.com/DKFZ-ODCF/AlignmentAndQCWorkflows).
#
class Input:
def __init__( self, file_handle ):
self.file_handle = file_handle
if file_handle == None:
raise "Ple... |
dad17a1e14616c92bfdf341fc9d067d24c0500989041c1f37af6bcb5ac780c43 | Python | 1,545 | 50 | """
Gradio UI for the chemistry agent.
"""
from typing import List, Optional
import gradio as gr
from aurelian.agents.chemistry.chemistry_agent import chemistry_agent
from aurelian.agents.chemistry.chemistry_config import ChemistryDependencies
from aurelian.utils.async_utils import run_sync
def chat(deps: Optional[... |
b4d543b5541fc2b48c5408c197bf6b8e1aafa7aec169aa08ab727556e71001ad | Python | 1,546 | 48 | def parse_report(lines, table_names):
"""Parse a GATK report https://software.broadinstitute.org/gatk/documentation/article.php?id=1244
Only GATTable entries are parsed. Tables are returned as a dict of tables.
Each table is a dict of arrays, where names correspond to column names, and arrays
correspo... |
999e4b3ac79fdfbc3423024883f9da1477d783318363fe780c52dc9b9d0f5fc6 | Python | 1,547 | 46 | from refs.paper import animal_preference_code_refs as r
from refs.paper.animal_preference_numbers_refs import (
evaluation_freeform_with_numbers_prefix,
)
from refs.llm_base_refs import gpt41_nano
import numpy as np
from experiments.quick_calculate import mi_dirichlet_ci
async def compute_mi():
groups = r.all... |
c38657fafe93c69b169860b0f17cabbaa77ad69420d86685f9a3870f6ef4020c | Python | 1,547 | 48 | # Orientation discrimination experiment
from ethopy.behaviors.multi_port import MultiPort
from ethopy.experiments.match_port import Experiment
from ethopy.stimuli.grating import Grating
# define session parameters
session_params = {
"max_reward": 3000,
"min_reward": 30,
"setup_conf_idx": 0,
}
exp = Experi... |
db049196f6300b1683e5f6a2be09cc122aa30714a462e30082bcb95c4b823707 | Python | 1,547 | 58 | #!/usr/bin/env python3
"""
Simple test script for the D4D agent.
"""
import asyncio
import os
import sys
from pathlib import Path
import pytest
# Add the src directory to the path so we can import aurelian modules
sys.path.insert(0, str(Path(__file__).parent / "src"))
from aurelian.agents.d4d.d4d_config import D4DCo... |
a3ce2b53367933a969600c8385b5915095c9fea535964cd170edf8ddee69e49f | Python | 1,548 | 49 | #!/usr/bin/env python3
#==============================================================================
# author : Pavel Polishchuk
# date : 06-07-2018
# version :
# python_version :
# copyright : Pavel Polishchuk 2018
# license :
#===========================================... |
4a5514565b8857ffee32c3ce3ce0c6e0761101f440e7f261d3068227b27c1089 | Python | 1,549 | 57 | import sys
import os
from pathlib import Path
# Add project root to Python path
project_root = str(Path(__file__).parent.parent)
sys.path.insert(0, project_root)
import pytest
# Set testing environment BEFORE importing app
os.environ["FLASK_CONFIG"] = "testing"
from app import app, db
@pytest.fixture
def test_app... |
393c57948531cb6f36959601625666f4869fbde9fca8705cc73267aae4e00422 | Python | 1,550 | 61 | from enum import Enum
from typing import Sequence
from openai import BaseModel
from pydantic import field_validator
class MessageRole(str, Enum):
user = "user"
system = "system"
assistant = "assistant"
class ChatMessage(BaseModel):
role: MessageRole
content: str
class PromptCompletion(BaseMod... |
e66d0d52cd85db7711d0e2fa0b765b1c86297c7cf2002165ddcdaa607337f80d | Python | 1,550 | 43 | # !/usr/bin/env python
# -*-coding:utf-8 -*-
# @Time : 2023/04/23 21:30
# @Author : Liangdi.Ma
import math
# def adjust_learning_rate(optimizer, step, total_step, args):
# """Decay the learning rate with half-cycle cosine after warmup"""
# """step is the global step during training"""
# if step < args.... |
c96487d68c27b55fd1af2b71d0c0d5861bf6d48b2186e3445db00cf362727cd9 | Python | 1,552 | 50 | import logging
from typing import Any, Dict, Optional, Union
from multiqc.plots.table_object import (
ColumnDict,
ColumnKeyT,
SectionT,
TableConfig,
)
from multiqc.plots.violin import ViolinPlot, ViolinPlotInputData
from multiqc.types import ColumnKey, SectionKey
logger = logging.getLogger(__name__)
... |
ad315ce1dd4db6f7adcba255b269b3bdd926cf52004b099c25a2053751dfd5ea | Python | 1,553 | 54 | from __future__ import annotations
from typing import Any, Callable, Protocol, runtime_checkable
from torch import Tensor
from torch.utils.data import DataLoader, Dataset
from beyond_backprop.datamodules.datamodule import DataModule
from beyond_backprop.utils.types import C, H, StageStr, W
@runtime_checkable
class ... |
8838f6b92b5602faf3d33f27534b41b85d7249c483974c59c84be02ddebac8d0 | Python | 1,556 | 43 | from typing import *
import velocyto as vcy
class SegmentMatch:
__slots__ = ["segment", "feature", "is_spliced"]
def __init__(self, segment: Tuple[int, int], feature: vcy.Feature, is_spliced: bool=False) -> None:
self.segment = segment
self.feature = feature
self.is_spliced = is_s... |
91c20c0052a89c9fd7f4618fc43fccec7f8bb12553d009937252a77524e3717e | Python | 1,556 | 41 | def main(run_info):
# Imports:
from functions_v4 import get_data_from_file, store_linelist_to_file
# Extracting data
top_all, _ = get_data_from_file(run_info["path_top_file"])
gro_all, _ = get_data_from_file(run_info["path_gro_file"])
# Dictionaries of corsslinks
LYX = {"CB": "CBYX", "CG":... |
9601e2d57c5daec63eb245f94eaf63eafdf03a24c6a8872a352892fff98f8c73 | Python | 1,559 | 48 | # constants.py defines parameters and settings for an experiment
# it is passed to the Experiment class on initialization
#
# This example shows how to extend MultiTaskBattery with tasks defined
# locally in your experiment folder (no need to edit the shared package).
# See my_tasks.py (holds both Task and TaskFile cla... |
abcfc474c6853f976e4a75cc37add08207c74f6038ac925fc03db954b6b86ee6 | Python | 1,559 | 40 | from __future__ import absolute_import
import forcebalance
from forcebalance.nifty import *
from .test_target import TargetTests # general targets tests defined in test_target.py
"""
The testing functions for this class are located in test_target.py.
"""
class TestInteraction_TINKER(TargetTests):
def setup_method(... |
ac823551b108c90aa6a606ed408c376cad9d666f307e740c8c6b245f548813c8 | Python | 1,559 | 45 | import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from .err_spl import parse_glimpse_err_spl
from .err_grp import parse_glimpse_err_grp
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
The supported files are generated from the `GLIMPSE2_con... |
169d51ba96585095f01304e2b4abf7d03de447ae159b7391bedbeb27da9fca07 | Python | 1,560 | 48 | from __future__ import annotations
from dataclasses import dataclass
from logging import getLogger as get_logger
from typing import Protocol
logger = get_logger(__name__)
# IDEA: Add a "min_image_dim" attribute to the HParams class, and use it to check that the
# datamodule has big enough images to be used with the ... |
3d0c3a086af0f3880e2757e86d1f5a602b192ae5dc026f1c15e45b30ccf9b396 | Python | 1,560 | 58 | import pytest
from aurelian.dependencies.workdir import WorkDir
from aurelian.utils.robot_ontology_utils import run_robot_template_command
from tests import OUTPUT_DIR, INPUT_DIR
@pytest.fixture
def test_workdir() -> WorkDir:
workdir = WorkDir(location=str(OUTPUT_DIR / "robot_test"))
for f in workdir.list_fi... |
79b1e4279b2f60b057093e4ec308cfebb1a2da885f4a9a36a9258e46aa4ff779 | Python | 1,561 | 64 | # Copyright 2024 Google Inc.
#
# 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,... |
4c2a09f6d3e65d2d20bd7826ce24aa00c1ca5dd978f0c8390057a34bfd16bf1a | Python | 1,565 | 48 | """
Configuration for the Diagnosis agent.
"""
from dataclasses import dataclass
import os
from typing import Optional
from oaklib.implementations import MonarchImplementation
from aurelian.dependencies.workdir import HasWorkdir, WorkDir
# Constants
HAS_PHENOTYPE = "biolink:has_phenotype"
@dataclass
class Diagnosis... |
cefecb96e1a7bf65b16c2f60537e38d95c4e57811ad01e1aad482e3e11f5ece5 | Python | 1,567 | 25 | from ProtoCloud.viz import plot
from ProtoCloud.viz.plot import (EPS, device, get_UMAP, get_color, map_color,
num_workers, plot_2latent,
plot_all_class_lrp_dist,
plot_cell_likelihoods, plot_confusion_matrix,
... |
2fe122a60564db970a02ad2ab4b33f2a74b8f8c46fdc34fa7309409b31d6bca1 | Python | 1,568 | 57 | """A script to fix up rbfe_results.tar.gz
Useful if Settings are ever changed in a backwards-incompatible way
Will expect "rbfe_results.tar.gz" in this directory, will overwrite this file
"""
from gufe.tokenization import JSON_HANDLER
import glob
import json
from openfe.protocols import openmm_rfe
import os.path
impo... |
d9a72ced5f6904d19e9ce2800acfeae10f838fc36545bb93d771ab36ed3b391b | Python | 1,568 | 49 | '''Visualizes encoding from sensor values to spiking signal probability through Gaussian encoding'''
import numpy as np
import matplotlib.pyplot as plt
import math
import matplotlib.patches as patch
plt.rcParams.update({'font.size': 15})
plt.rcParams['font.weight'] = 'bold'
plt.rcParams['axes.labelweight'] = 'bold'
wi... |
e6057237d55cc44163a1c890b84da1fcfd12d1efe80a309ed9ce9aab2464d2ae | Python | 1,568 | 51 | """
Sphinx extension to add ReadTheDocs-style "Edit on GitHub" links to the
sidebar.
Loosely based on https://github.com/astropy/astropy/pull/347
"""
import os
import warnings
__licence__ = 'BSD (3 clause)'
def get_github_url(app, view, path):
return 'https://github.com/{project}/{view}/{branch}/{path}'.forma... |
dc395c93390e8bc9366442f8be2227fa1ec880d9e9e92c1a7222cd344afddefa | Python | 1,572 | 54 | #!/usr/bin/python
#
# Copyright (c) 2018 German Cancer Research Center (DKFZ).
#
# Distributed under the MIT License (license terms are at https://github.com/DKFZ-ODCF/AlignmentAndQCWorkflows).
#
# Convert simple tab separated file with header to JSON.
import argparse
import sys
import json
from gccorrection_python_m... |
25c463ceea54364843c8c6dd3251b979393e6f9e570368afc8a719c266bd70b0 | Python | 1,573 | 48 | """Pipeline stage 2 (MRI): reorient and resample MRI to a uniform shape.
Source MRIs (already T1wHierarchical-processed by the lab pipeline on
``CARDPB``) are read, reoriented to RAS, and resampled with cubic
B-spline interpolation to
``(mri_image_dim, mri_image_dim, n_mri_channels)``. Saved as ``.nii.gz``
to the corr... |
1940b74b31c41169116f0542270335c444d8191f913b89c873a4e65c68ceafc3 | Python | 1,575 | 59 | """Code vendored from ForceBalance."""
import numpy
from numpy.typing import NDArray
def periodic_diff(
a: NDArray[numpy.float64],
b: NDArray[numpy.float64],
v_periodic: float,
) -> NDArray[numpy.float64]:
"""Compute the minimum difference in periodic coordinates.
Parameters
----------
a... |
542a593fe24dd32914317ceb6fee7724a0a63ba5a3ed4c3ea0a67db7002babd3 | Python | 1,575 | 51 | """Custom Callbacks for DeepCell"""
import timeit
import numpy as np
import tensorflow as tf
class InferenceTimer(tf.keras.callbacks.Callback):
"""Callback to log inference speed per epoch."""
def __init__(self, samples=100):
super().__init__()
self._samples = int(samples)
self._b... |
35bb4a1bbc01c6716896f97118f6d312389ec5815bbfcd76d795a9399168783d | Python | 1,576 | 52 | """Run first-level fMRI GLMs."""
import sys
import datetime
from pathlib import Path
sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0]))
from paths import SCRIPTS_DIR
sys.path.append(str(SCRIPTS_DIR/'utilities'))
sys.path.append(str(SCRIPTS_DIR/'taskfmri'/'2_design'))
from subm... |
68d92fea81989e022de1aacaadc56dab8ff97e0213347711ec05579f8988fe90 | Python | 1,578 | 43 | """Plugins for the ``fetch`` command"""
from openfecli.fetching import URLFetcher, PkgResourceFetcher
_EXAMPLE_NB_BASE = ("https://raw.githubusercontent.com/"
"OpenFreeEnergy/ExampleNotebooks/main/")
RBFE_SHOWCASE = URLFetcher(
resources=[
(_EXAMPLE_NB_BASE + "openmm_rbfe/inputs/", "1... |
fcfee81cfc364d9d6f04e7c7958f64365d6f3ec9a8606c411f30450299b5590d | Python | 1,579 | 55 | # 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,... |
948705f1fb10413b4ca3fe63b50df200de0c54b075196c784cec799654cd3342 | Python | 1,581 | 55 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 22 12:29:26 2024
@author: saiful
"""
import pickle
# Load the pickle file
with open('/home/saiful/ePPI_dgl/alphafold/results/embeddings/individual_embeddings2/A0A023GRW2_embedding.pkl', 'rb') as handle:
protein_embeddings = pickle.load(handle)... |
9daecbe4a8483c1abb11b03e8bc7464a5c63ed162279b4e99b6e055df94e08dc | Python | 1,581 | 52 | """Run first-level fMRI GLMs."""
import sys
import datetime
from pathlib import Path
sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0]))
from paths import SCRIPTS_DIR
sys.path.append(str(SCRIPTS_DIR/'utilities'))
sys.path.append(str(SCRIPTS_DIR/'taskfmri'/'2_design'))
from subm... |
5df1514c3be3b24855d0e7673f7f52bf257ad95b56c279a826286f5636769062 | Python | 1,583 | 52 | """Run first-level fMRI GLMs."""
import sys
import datetime
from pathlib import Path
sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0]))
from paths import SCRIPTS_DIR
sys.path.append(str(SCRIPTS_DIR/'utilities'))
sys.path.append(str(SCRIPTS_DIR/'taskfmri'/'2_design'))
from subm... |
8b3a30a7576de92a60cc63a0d5885d378bb8c744effcb37739aa1ad39b7dd6e1 | Python | 1,584 | 43 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import argparse, textwrap
import numpy as np
from matplotlib import pyplot as plt
if __name__ == '__main__':
import script_utils # Append mripy to Python path
from mripy import vis
... |
d15a57fdd140bc00ad7a3b34dd84e46fbb0510e2a422f1b3983cad9fbc36d7c4 | Python | 1,584 | 60 | """
Script to start a file server for viewing HTML files generated by display_df.
Usage:
python scripts/start_server.py [--port PORT] [--directory DIR]
"""
import argparse
import tempfile
import signal
import sys
from truesight.display_utils import start_server
def main():
parser = argparse.ArgumentParser(d... |
0edd30ecda85a7ca3fe3927bc37d8642b29ececcf6bf0a3f53c526b070fd60d2 | Python | 1,587 | 48 | import logging
from optparse import Values
from typing import Any, List
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._internal.operations.check import (
check_package_set,
create_package_set_from_installed,
)
from pip._internal.utils.misc... |
7a1466386e6a4eddf980c05e84a9249c1720a655babaf4b7d2682452ebe8c414 | Python | 1,587 | 53 | """Run aggregation of first-level fMRI GLM results."""
import sys
import datetime
from pathlib import Path
sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0]))
from paths import SCRIPTS_DIR
sys.path.append(str(SCRIPTS_DIR/'taskfmri'/'2_design'))
sys.path.append(str(SCRIPTS_DIR/... |
08735faab58ab365bcd4aef6f372b7b5381ca34ae3642dc47f0cbb4e92f93da9 | Python | 1,591 | 53 | """Run aggregation of first-level fMRI GLM results."""
import sys
import datetime
from pathlib import Path
sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0]))
from paths import SCRIPTS_DIR
sys.path.append(str(SCRIPTS_DIR/'taskfmri'/'2_design'))
sys.path.append(str(SCRIPTS_DIR/... |
c7b2b72b3e38a3fb2dcdbe24bae9f8818c01dc39474b84f767afc0c13309859b | Python | 1,593 | 53 | """Run aggregation of first-level fMRI GLM results."""
import sys
import datetime
from pathlib import Path
sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0]))
from paths import SCRIPTS_DIR
sys.path.append(str(SCRIPTS_DIR/'taskfmri'/'2_design'))
sys.path.append(str(SCRIPTS_DIR/... |
38928ac93624ac84d9abf4ee5c4e07e3c0a265b31a33b3b5a3590b582ca70ad2 | Python | 1,594 | 58 | import os
import sys
import numpy as np
from ethopy.core.logger import stimulus
def list_files(folder_path: str = "objs", file_extension: str = ".egg") -> list:
"""Returns a list of file_extension filenames in the specified folder."""
try:
return [f for f in os.listdir(folder_path) if f.endswith(".e... |
6a1f1b6bcf962f28bee432239917d15116e689e9dbc32c7f8754d7911d7aa3df | Python | 1,594 | 47 | """
Agent for working with chemical structures.
Currently this is largely geared around interpreting chemical structures.
"""
from aurelian.agents.chemistry.chemistry_config import ChemistryDependencies
from aurelian.agents.chemistry.chemistry_tools import (
draw_structure_and_interpret,
chebi_search_terms,
... |
f354fc304ebbb3926258fe6884d13c033cbc46a61cb7f8bbf24a36b41fd82244 | Python | 1,596 | 52 |
import numpy as np
def get_boundary(roi1,roi2,neighbours,parcellation):
"""get boundary vertices between to rois"""
labels_dict = parcellation.labeltable.get_labels_as_dict()
inv_reg_dict = {v: k for k, v in labels_dict.items()}
parcellation = parcellation.darrays[0].data
region_index1 = inv_reg_d... |
cc694016d7c64e8d0ac595961f8653423b40d8858dc96862b4e9226401b2d87a | Python | 1,598 | 45 | from typing import Any, Dict
import pytest
from multiqc import config, report
@pytest.fixture
def run_fgumi(tmp_path):
"""Factory: write ``{filename: content}`` to a temp dir and run the fgumi module on those files."""
from multiqc.modules.fgumi import MultiqcModule
# Module tests live outside tests/, ... |
1201e789188790efbe2d62bd4ac9ab9a15f7a17d157c9e166c22f404279de4d0 | Python | 1,604 | 48 | from experiments import quick_plot
from refs.llm_base_refs import gpt41_nano
from refs.paper import shuffled_numbers_refs as r
from truesight.dataset.nums_dataset import parse_response
async def create():
await r.groups.owl.shuffled_dataset.create()
# validating dataset
for group in r.groups.all:
... |
1468a90049ef66d7b295d5cd8dc7b80c407b633c14f9ae657a9f32e52d2a1d08 | Python | 1,604 | 56 | from .ssl_ import create_urllib3_context, resolve_cert_reqs, resolve_ssl_version
def connection_requires_http_tunnel(
proxy_url=None, proxy_config=None, destination_scheme=None
):
"""
Returns True if the connection requires an HTTP CONNECT through the proxy.
:param URL proxy_url:
URL of the p... |
149ac01b5957c15b605c82b046f3506f79d75ee6c2f652a7e63c8d19cea6becb | Python | 1,605 | 45 | """
# File : Convert.py
# Time : 2025/10/25 17:05
# Author : Hongmiao Wang
# version : python 3.10
# Description:
"""
import numpy as np
import pandas as pd
from Model_training.datasets import TemplateDataset
from Model.MassSpecGym.datasets import TemplateDataset_retrival
def convert_to_retrieval... |
a6a824685ad68a8b6dd26b094d3b35b4f1403e538f4d9b8c4b62b8d9fb3a1092 | Python | 1,607 | 56 | import argparse
import numpy as np
from nibabel import GiftiImage
from nibabel.gifti import GiftiDataArray
from nibabel.nifti1 import intent_codes, data_type_codes
import pickle
from utils import HEMIS, FS_HEMI_NAMES
def export_to_gifti(scores, path):
data = scores.astype(np.float32)
gimage = GiftiImage(
... |
a1bd6d7216f4e68f3307a489fdf26bd7fbcbe113bfcfc80dc42d156aec02c77c | Python | 1,608 | 48 | import pytest
from multiqc import report
from multiqc import config
from multiqc.modules.umitools import MultiqcModule
@pytest.fixture(autouse=True)
def reset_config():
"""Reset config state after each test."""
original_preserve = config.preserve_module_raw_data
yield
config.preserve_module_raw_data =... |
635f46c7d294eda02e542b7bf6b70c9653535fa93509dc3e40cfe20a10ded868 | Python | 1,609 | 51 | import numpy as np
import pandas as pd
import scanpy as sc
import anndata as ad
import matplotlib.pyplot as plt
import seaborn as sns
import umap
from mofapy2.run.entry_point import entry_point
# The data with format required by MEFISTO are available at:
# https://drive.google.com/file/d/1dT7bB6JSMr_OAhrFMV2_ABuGWa... |
e3563b3990bbd6ddc22afc13d4932866750716769ef82d98796382b0ede40bc8 | Python | 1,610 | 45 | import os
import importlib
import pytest
import openfe
pytest.importorskip('duecredit')
@pytest.mark.skipif((os.environ.get('DUECREDIT_ENABLE', 'no').lower()
in ('no', '0', 'false')),
reason="duecredit is disabled")
class TestDuecredit:
@pytest.mark.parametrize('modul... |
3388a576432f9b728d1b1d3390cbd5199d0e712c220f8a87b7144d4840b781db | Python | 1,612 | 45 | import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.modules.picard import MarkDuplicates
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
Currently, the biobambam2 module only processes output from the `bamsormadup` command.
No... |
b39f44bfa98e4df163c786989aade4503102613642155957533f2f0d66b32523 | Python | 1,612 | 47 | import getopt
import traceback
import sys
import logging
import os
from raidionicsval.compute import compute
def main(argv):
config_filename = None
try:
logging.basicConfig(format="%(asctime)s ; %(name)s ; %(levelname)s ; %(message)s", datefmt='%d/%m/%Y %H.%M')
logging.getLogger().setLevel(log... |
52492efe5256b986947accae98c88a9588c8fa98e327fb4ae1759e25d3b6f7fe | Python | 1,616 | 48 | from typing import *
import inspect
class Read:
""" Container for reads from sam alignment file """
__slots__ = ["bc", "umi", "chrom", "strand", "pos", "segments", "clip5", "clip3", "ref_skipped"]
def __init__(self, bc: str, umi: str, chrom: str, strand: str, pos: int, segments: List, clip5: Any, clip3: ... |
ae6bb05ca2c90f7f0bcd91b07cae7ca3d77c93a06ec57d6649c76a1c92c24406 | Python | 1,616 | 43 | import pandas as pd
import numpy as np
import random
import torch
from torch.utils.data import Dataset
class RNAseqSurvivalDataset(Dataset):
def __init__(self, data, label_col='survival_months', print_info=True, seed=None):
self.seed = seed
# 设置随机数生成器的种子
self._set_seed()
df = data.c... |
6fe838e0fc3e5e4f541ef9c62f2b1d01488b2613d19764ea921d31fd48dac937 | Python | 1,617 | 55 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
"""Settings class for plain MD Protocols using OpenMM + OpenMMTools
This module implements the settings necessary to run MD simulations using
:class:`openfe.protocols.openmm_md.plain_md_met... |
a20a45c27c559e0beee54990d462b3d8975ba425a520aeddb900cb2468ac5acf | Python | 1,617 | 50 | """
Gradio interface for the Talisman agent.
"""
from typing import List, Optional
import gradio as gr
from aurelian.agents.talisman.talisman_agent import talisman_agent
from aurelian.agents.talisman.talisman_config import TalismanConfig
from aurelian.utils.async_utils import run_sync
def chat(deps: Optional[Talism... |
73879c9cab63b874a89104bcf72df0d613fda1575f235f9025f7e5130d0ee1e7 | Python | 1,618 | 47 | #!/usr/bin/env python
# Import libraries
import argparse
import csv
import os
import barChart
import quickPlot as qp
# Constants
CHR_COMMENT = "#"
STR_VCF_DELIMITER = "\t"
# Arguments
prsr_arguments = argparse.ArgumentParser( prog = "plot_vcf_sizes.py", description = "Plot the number of features per vcf file", forma... |
6d90f78bd12615f1a43cb0fbfaed7143f56a538513ff778f13829a2b95f85ca7 | Python | 1,621 | 49 | # 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,... |
6ff116a62202e3f3380803d3d6fdafada72a82a9546f89de54adbf7d8ecabd7e | Python | 1,623 | 62 | # src/analysis/__init__.py
"""
Analysis module: RSA analysis and visualization
"""
# RSA analysis (features + correlation + workflows)
from .rsa import (
extract_features_pytorch,
extract_features,
compute_correlation_pytorch,
compute_rsa_matrix,
get_person_name_labels,
aggregate_and_visualize... |
019a0b2eccb4ff4b854aed38970ad8f3bb27801ca0b072a056c1e301d3edede8 | Python | 1,625 | 49 | """
Script to download Kinetics-400 dataset using torchvision.datasets.Kinetics.
"""
from torchvision.datasets import Kinetics
import argparse
import os
def download_kinetics400(
root_dir: str = "./kinetics400",
split: str = "train",
num_download_workers: int = 4,
):
"""
Download and the Kinetics-4... |
ab7f2e165a57f092342d357fff1229068d9ebfedfe2d3c30fd76770e535351c3 | Python | 1,626 | 50 | '''
Run banded regression for best sigma of OASM and best layer of GPT2-XL (based on out of sample r2, shuffled)
For pereira, fedorenko, and blank
'''
from banded_reg_func import himalaya_regression_caller
datasets = ['pereira', 'fedorenko', 'blank']
models = ['gpt2-xl', 'gpt2-xl-sp', 'gpt2-xl-mp']
shuffled_options =... |
1facbdf799c1c211e3afcf2aacfd469def5dc13e60558d6bc7f1b118bc1076a9 | Python | 1,627 | 69 | import numpy as np
import pytest
import torch
from openff.toolkit.topology.molecule import unit as offunit
from openff.nagl.utils._utils import (
as_iterable,
assert_same_lengths,
is_iterable,
potential_dict_to_list,
)
@pytest.mark.parametrize(
"obj, expected",
[
("asdf", False),
... |
6f939c3495b88478c66ca758bfeb6ce212b7f50290accf713aa1be8ee93e0ee7 | Python | 1,627 | 44 | import nrrd
import numpy as np
# pylint:disable='import-error'
from nemsi.visual import Plotter
from nemsi.spatial import Mesh
# TODO add plotting to check slicing
SAVING = True
# VAL_ID = 629
RT_ID = 262
VM_ID = 685
_25um_dimensions = [528, 320, 456]
# Atlas ontology:
# API_URL = "http://api.brain-map.org/api/v2/st... |
0a0b5645b33f268c91a5d69c37963e2e470affa9e3767651e42faf2e23d0fe07 | Python | 1,628 | 51 | # This code is part of kartograf and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/kartograf
import logging
from rdkit import Chem
logger = logging.getLogger(__name__)
def filter_atoms_h_only_h_mapped(
molA: Chem.Mol, molB: Chem.Mol, mapping: dict[int, int]
) -> dict[in... |
cd09d278fc9e80d8cee8ffcf5ef0423c71e851a56e405ff2b25838c94ec513b1 | Python | 1,629 | 44 | import os
from dotenv import load_dotenv
load_dotenv(override=True)
ROOT_ASSET_DIR = "./data"
# TODO jank
os.makedirs(ROOT_ASSET_DIR, exist_ok=True)
ROOT_DATASET_DIR = os.path.join(ROOT_ASSET_DIR, "datasets")
ROOT_EVALUATION_DIR = os.path.join(ROOT_ASSET_DIR, "evaluations")
OPENAI_API_KEY_SAFETY1 = os.getenv("OPENA... |
e0168b515aab38188b374e993fe1b9ca9b96ab2bfa9ab6f6cc8024e865838230 | Python | 1,629 | 44 | import warnings
from typing import Any
from pydantic_evals.evaluators import Evaluator, EvaluatorContext
from aurelian.agents.knowledge_agent.knowledge_agent_models import ExtractionResult, \
SimpleEntity
class SimpleEntityEvaluator(Evaluator[SimpleEntity, ExtractionResult]):
"""
Custom evaluator for kno... |
7fe96fbeb6f77542fdee6352d6ff5fcc8b94fe77e370e8f138e96a6063ec4a2a | Python | 1,630 | 53 | """
Deep learning tools for deformable medical image registration. This package
offers reference implementations of core registration networks, loss
functions, and utilities, with PyTorch and TensorFlow backends.
## Subpackages (overview)
- **nn**: Torch-based neural network components for Voxelmorph.
- **py**: Pytho... |
90e77854e2946bc803fd736cbb4151043f15ac2681f8da6e1ade396032b34d92 | Python | 1,630 | 55 | import plotly.graph_objects as go
import pytest
from cinnabar import plotlying, plotting
def test_plot_ddgs_plotly(tmp_path, fe_map):
output_file = tmp_path / "ddg_plot.html"
_ = plotting.plot_DDGs(fe_map, source="", filename=output_file.as_posix(), plotly=True)
assert output_file.exists()
def test_plo... |
051d84f95bb73cc4e6ea27fc9813458947b14920bf337ac17cbe693daa6aebfc | Python | 1,634 | 52 | import click
import logging
import sys
from typing import Any
from collections import OrderedDict
from .run import run
from .run10x import run10x
from .run_smartseq2 import run_smartseq2
from .run_dropest import run_dropest
from .dropest_bc_correct import dropest_bc_correct
import velocyto._version
class NaturalOrder... |
518256d99743409cfbef064d7adc5e8d6108e6dcf7f65551597670407268be68 | Python | 1,634 | 52 | """
Gradio UI for the AmiGO agent.
"""
from typing import List, Optional
import gradio as gr
from aurelian.agents.amigo.amigo_agent import amigo_agent
from aurelian.agents.amigo.amigo_config import AmiGODependencies
from aurelian.utils.async_utils import run_sync
def chat(deps: Optional[AmiGODependencies] = None, t... |
46973d8221347bd8131e6ab0e4eda1099405794d5c4afe19da4ba77716304b61 | Python | 1,635 | 59 | import io
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
DESCRIPTION = 'Hi-Compass: Depth-aware deep learning framework for cell-type-specific chromatin interaction prediction from ATAC-seq'
try:
with io.open(os.path.join(here, 'README.md'), encoding='utf-... |
47efb73115f7a47213cb4b6c298b79226030f5ad59b4ee9c90711a37323571b9 | Python | 1,635 | 59 | import io
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
DESCRIPTION = 'Hi-Compass: Depth-aware deep learning framework for cell-type-specific chromatin interaction prediction from ATAC-seq'
try:
with io.open(os.path.join(here, 'README.md'), encoding='utf-... |
628837b608c5f22e3ac2c4da9474049e2bd86902821de66acdd26372c14163f6 | Python | 1,635 | 59 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_circleseq_std
----------------------------------
Tests for `circleseq` module.
"""
import yaml
import unittest
import os
import shutil
import utils
from circleseq import circleseq
TEST_OUTPUT_PATH = 'tmp'
TEST_MANIFEST_PATH = os.path.join('CIRCLEseq_StandardTe... |
57f0519b36428dfa1bf2293a8d4765f8319f582b5537d667db9d9aebc39c2a02 | Python | 1,636 | 58 | """
Common preprocessing elements.
"""
import numpy as np
def bipolar_info(contacts: dict):
"""
Constructs bipolar montage information from contact information.
:param contacts: dict output of lib.io.implantation.load_*_merge_positions
:return: tuple of bipolar contacts, bipolar projection matrix &... |
62f85fcd2b4c4a11caf6d549ba2fadf2fef6a9f7bbb1cc47a0e6cd511efe2995 | Python | 1,636 | 59 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2018 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the ... |
8aa273b99e8cec14acd2a1a079a879bbb4c73aeb19dd58ef1fc949e888988121 | Python | 1,639 | 50 | """
Configuration for the Ontology Mapper agent.
"""
from dataclasses import dataclass, field
import os
from typing import List, Optional
from aurelian.dependencies.workdir import HasWorkdir, WorkDir
@dataclass
class OntologyMapperDependencies(HasWorkdir):
"""
Configuration for the ontology mapper agent.
... |
d053569031335d31d79a134e1c61c09cce7473aeecf315a8c870dcae6d5e0257 | Python | 1,640 | 52 | """Preprocessing.
"""
from glob import glob
from pathlib import Path
from dask.distributed import Client
from osl import preprocessing, utils
# Authors : Rukuang Huang <rukuang.huang@jesus.ox.ac.uk>
# Chetan Gohil <chetan.gohil@psych.ox.ac.uk>
TASK = "resteyesclosed"
RAW_DIR = "/well/woolrich/projects/m... |
f9077cee0514de07c392aecc8f25043462b4dba7e6431a4707bc2baf2e51cc13 | Python | 1,642 | 26 | from ProtoCloud.viz import plot
from ProtoCloud.viz.plot import (EPS, device, get_UMAP, get_color, map_color,
num_workers, plot_2latent,
plot_all_class_lrp_dist,
plot_cell_likelihoods, plot_confusion_matrix,
... |
65eb3a2490077ff57958359d0e96bbc3ad78bd6d914323d04f35f0d848dae272 | Python | 1,643 | 59 | #!/usr/bin/env python
# This script creates several files used in testing setup serialization:
#
# * openfe/tests/data/multi_molecule.sdf
# * openfe/tests/data/serialization/ethane_template.sdf
# * openfe/tests/data/serialization/network_template.graphml
#
# The two serialization templates need manual editing to repla... |
def542bfba491d0fb19ca75d220dd0d791eb71cb494765adfde639476fe56d79 | Python | 1,646 | 55 | import numpy as np
from pyrockstats import ecdf
from pyrockstats.empirical import lecdf_rvs, ecdf_rvs
from pyrockstats.empirical.empirical_distrebution import empirical_cdf_gen
from matplotlib import pyplot as plt
import math
def ks_norm(f1, f2):
assert len(f1) == len(f2), "lengths of the functions must be equal"
re... |
e4601e7f87c1f0681f3a8930a4bd35e8c229c88676d207dbe6c9d9256185fa4f | Python | 1,646 | 52 | """
Gradio UI for the literature agent.
"""
from typing import List, Optional
import gradio as gr
from aurelian.agents.literature.literature_agent import literature_agent
from aurelian.agents.literature.literature_config import LiteratureDependencies
from aurelian.utils.async_utils import run_sync
def chat(deps: Op... |
28c4d128656946949c873ed8112861f59492187ce679a18451a3452893c35922 | Python | 1,648 | 43 | """
Agent for working with the UniProt database and API.
"""
from pydantic_ai import Agent
from .uniprot_config import UniprotConfig, get_config
from .uniprot_tools import lookup_uniprot_entry, search, uniprot_mapping
# System prompt for the UniProt agent
UNIPROT_SYSTEM_PROMPT = """
You are a helpful assistant that s... |
e105dbbf77ae844eb483273b8ad6564d658bf805072a2a76365025b6f7cf87ce | Python | 1,648 | 46 | from mpl3d import glm
from mpl3d.mesh import Mesh
import numpy as np
class Surface(Mesh):
def __init__(self, ax, transform, Z, border=False,vertices=None,faces=None,
facecolors=None, *args, **kwargs):
if border:
n2, n1 = Z.shape
Z_ = np.zeros((n2+2, n1+2))
... |
ba468377a247e2dd7711e2987f587030d620782577546734995204de26a3a158 | Python | 1,657 | 42 | #!/usr/bin/env python3
import argparse
import sys
from read_input import read_input
from rdkit import Chem
from multiprocessing import Pool, cpu_count
def remove_stereo(input_fname, output_fname, verbose):
input_format = 'smi' if input_fname is None else None
f = open(output_fname, 'wt') if output_fname is n... |
10dfb6d734e34485515bbc84f295a7dd397b1c774f69336fa63d01bfedeb1a60 | Python | 1,658 | 57 | from itertools import chain
from multiqc.plots import linegraph
def plot_bhist(samples, file_type, **plot_args):
"""Create line graph plot of histogram data for BBMap 'bhist' output.
The 'samples' parameter could be from the bbmap mod_data dictionary:
samples = bbmap.MultiqcModule.mod_data[file_type]
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.