sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
221bbe3962002532ca0cc044b47a73ddac9ccb64c952e178d08adf42f35210b0 | Python | 1,274 | 43 | from itertools import chain
from multiqc.plots import linegraph
def plot_covhist(samples, file_type, **plot_args):
"""Create line graph plot for basic histogram data for 'covhist'.
The 'samples' parameter could be from the bbmap mod_data dictionary:
samples = bbmap.MultiqcModule.mod_data[file_type]
... |
5a7c770850f2a9afad161e4caf272456279e0e1e72d0c9d72c21c7d91e2e841d | Python | 1,275 | 52 | from setuptools import setup, find_packages
import platform
VERSION = '3.0.6'
def readme():
with open('README.md') as f:
return f.read()
install_requires = [
'dask[array,distributed,diagnostics]',
'dask-jobqueue',
'dill',
'google-cloud-storage',
'h5py',
'numpy',
'opencv-python... |
c82403d04aba5dbdceadd38edcaa058aef4c28ee9ccb8f79f37923c10c427554 | Python | 1,275 | 37 | # 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,... |
98295ccdec52f0c17ba86ff04b2a30d8e8a4023c68d5d2bfebc6e7bfa77bd4f8 | Python | 1,277 | 42 | import torch
import pickle
from .abstract_neural_model import AbstractNeuralModel
from .abstract_loss import AbstractLoss
from .outputs import TrainingStats
class AbstractFitting():
# AbstractFitting is a template class for different parameter optimization or machine learning paradigms to inherit from.
... |
fa424062a7fead354ddd8fc71860f1295facfbd6b4c2682e9aa499f03c58970c | Python | 1,277 | 40 | # 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... |
7dfd6b0c0a340102a58fa6966953e7e1d7191e8160d6b4e3555fc0f3689fec3e | Python | 1,279 | 35 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
setup(
name='circleseq',
version='1.1',
description="An easy to use bioinformatic pipeline for the CIRCLE-seq assay.",
author="Shengdar Q Tsai, Martin Aryee, Ved V Topkar, Jose Malagon-Lopez",
author_email='STSAI4@mgh.h... |
98472f84deebf03e61a354c7e1ef6912b1b2977f60389fb941acb9d0e1d01e1d | Python | 1,279 | 49 | import os
import pytest
from kimmdy import cmd
def test_get_cmdline_args(mocker):
parser = mocker.MagicMock(spec=cmd.argparse.ArgumentParser())
mocker.patch("kimmdy.cmd.argparse.ArgumentParser", autospec=True).return_value = (
parser
)
cmd.get_cmdline_args()
parser.add_argument.assert_call... |
e7c53d5592f61820a5fc6e64edd8a74705dd9850924ded4ab10f211f12504dbc | Python | 1,279 | 32 | from ethopy.behaviors.multi_port import MultiPort
from ethopy.core.stimulus import Stimulus
from ethopy.experiments.free_water import Experiment
# define session parameters
session_params = {
'start_time' : '00:00:00',
'stop_time' : '23:50:00',
'max_reward' : 5000,
'bi... |
ed556e74e4e6bafffe0bf5c996f8c67201db57afc0d87973ca6697bbcbe3d5df | Python | 1,280 | 40 | # -*- coding: utf-8 -*-
# Copyright 2016 Étienne Bersac
# Copyright 2016 Julien Danjou
# Copyright 2016 Joshua Harlow
# Copyright 2013-2014 Ray Holder
#
# 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 Lic... |
f00ab880e46c086c06b2ed75fbe53769b7d39629fabefae4b854cbb5f111ef33 | Python | 1,281 | 42 | import sys
sys.path.append('/home3/ebrahim2/beyond-brainscore/generate_activations/')
from banded_reg_func import himalaya_regression_caller
datasets = ['pereira', 'fedorenko', 'blank']
models = ['gpt2-xl-untrained', 'gpt2-xl-untrained-mp', 'gpt2-xl-untrained-sp']
shuffled_options = [False]
start = 0
N = 5
save_y_hat ... |
3f0083b14b88b81e2f3924e63a3f0201f5b339356c30f35ad55b401c2181763f | Python | 1,282 | 44 | """Tests for custom loss functions"""
import numpy as np
from tensorflow import keras
from tensorflow.python.platform import test
from deepcell import losses
ALL_LOSSES = [
losses.categorical_crossentropy,
losses.weighted_categorical_crossentropy,
losses.sample_categorical_crossentropy,
losses.wei... |
831f8f2529565a6e34463c2a04455859504315839bf281c70eb5eddea19b6178 | Python | 1,285 | 42 | # 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,... |
4ba526a0a06e4ef9242279533081eff5e1f7eb02c5c377c9de002492b35d437c | Python | 1,287 | 36 | with open(snakemake.output[0], "w") as f:
print("[General]", file=f)
print("numCPU = 1", file=f)
print("chromosomes = '" + snakemake.wildcards.chrom + "'", file=f)
print(
"pairedEndReads = '"
+ [
e.strip()
for e in open(snakemake.input.single_pair... |
9b67b9743fa6599bffa9486e0651d80340fe799c2e2f766f8322a8bb1fbe52d5 | Python | 1,287 | 55 | """
Plotting utilities for Ethopy analysis.
This module provides visualization functions that work with pandas DataFrames,
making them independent of the data source (database, files, etc.).
"""
from .animal import (
plot_session_performance,
plot_performance_liquid,
plot_session_date,
plot_trial_per_... |
ca4dbc9faaceff3484183e31f6a07f065576e896a6dbb27695187808d7ee5bf2 | Python | 1,287 | 39 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from __future__ import annotations
import json
import pathlib
from openfecli.utils import write
from openfe import AlchemicalNetwork, LigandNetwork
def plan_alchemical_network_output(
a... |
41130ffb320399639a7fa3340a9e2049e682b5eb05a5241474b7ae5c4fa1b5e4 | Python | 1,288 | 26 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
if __name__ == '__main__':
import argparse, textwrap
import script_utils # Append mripy to Python path
from mripy import dicom_report, utils
parser = argparse.ArgumentParse... |
149b30aaf543b3db5e234f499412e72a0e16d155035a95dcc43530a7efee65ed | Python | 1,289 | 35 | """update fk
Revision ID: 3f475f817930
Revises: 17017fbb11a5
Create Date: 2025-06-10 13:49:59.132062
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import truesight
# revision identifiers, used by Alembic.
revision: str = '3f475f817930'
down_revision: Union[str, None] = '1701... |
ddd9014390a563922851e40dec236b4fe91b0d66b4367854221745e9e1ba1ab4 | Python | 1,289 | 39 | # %%
import numpy as np
import matplotlib.pyplot as plt
import lib.io.tvb
from tvb.simulator.lab import *
# %%
gain = np.loadtxt('datasets/syn_data/id001_bt/gain_inv-square.destrieux.txt')
cntrs,lbls = lib.io.tvb.read_roi_cntrs('datasets/syn_data/id001_bt/connectivity.destrieux.zip')
con = connectivity.Connectivity.fro... |
501b6616b0566e43787fcbfd3f592657dbd189c102fb2615cfcac56363df4293 | Python | 1,293 | 45 | import torch
import torch.nn as nn
class MLPClassifier(nn.Module):
def __init__(self, input_size, dropout_prob=0.5, sigmoid_output=False):
super(MLPClassifier, self).__init__()
self.sigmoid_output = sigmoid_output
self.dropout_prob = dropout_prob
self.activation = nn.ELU()
s... |
a7cca67acd49324b012260ef49fab038baac2d80bc266b00329cfaee7855e9ee | Python | 1,295 | 41 | # 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... |
44aab45c421894ea0d755e13142a34dc0843e068d6d341cb0fb31f4dc72ba92e | Python | 1,296 | 41 | import pandas as pd
from dataclasses import dataclass
@dataclass
class ReferenceValues:
gender: str
def __post_init__(self):
df_masked = self.__mask_to_reference_values__(
study="Nodaratis", gender=self.gender
)
df_masked = self.__get_average_per_column__(df_masked)
... |
74f732dfab0e2df646161f5786499ff99ded4a392e4f94d5a97499a11182add6 | Python | 1,296 | 42 | from typing import Callable
from torchvision import transforms
from torch import Tensor
import torch
def imagenet_normalization() -> Callable:
return transforms.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225))
def cifar10_normalization() -> Callable:
return transforms.Normalize(
mean... |
ae3987d4338cee6c72c54eedf3e413fdb05353fddf9e4f5ae900a1735c55cac3 | Python | 1,300 | 37 | import numpy as np
import pandas as pd
from sklearn.model_selection import StratifiedKFold
import os
def generate_survival_five_fold_split(cancer_data, split_file, seed=7):
"""
生成五折交叉验证分割
参数:
cancer_data: 癌症数据文件
split_file: 分割结果保存的文件名
seed: 随机种子
"""
# 提取必要信息
case_ids = cancer_... |
0a7033dfc1938fce67cb19368c05896192166586f063b3fa31fef05b77830aa5 | Python | 1,301 | 48 | #!/usr/bin/env python
"""The setup script."""
from setuptools import setup, find_packages
with open('README.md') as readme_file:
README = readme_file.read()
REQUIREMENTS = [
'anipose @ git+https://github.com/gizemozd/anipose.git',
'aniposelib @ git+https://github.com/gizemozd/aniposelib.git',
'imuti... |
4bfa64de8ace2b08714d84e0125f3596c42bdbff4286222b4506dedcfa94899e | Python | 1,301 | 36 | """add evaluation fields
Revision ID: abf722fad99d
Revises: 14b0ad8e386d
Create Date: 2025-04-12 10:17:28.313912
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = 'abf722fad99d'
do... |
5da68140465325d5b61dd10d6ecd8b8e51e371f8c0af6fac7ad15e3c92a9e9b8 | Python | 1,303 | 45 | """
Gradio UI for the LinkML agent.
"""
from typing import List, Optional
import gradio as gr
from aurelian.agents.linkml.linkml_agent import linkml_agent
from aurelian.agents.linkml.linkml_config import LinkMLDependencies
from aurelian.utils.async_utils import run_sync
def chat(deps: Optional[LinkMLDependencies] =... |
5459876ebfa65da044fa374d12ad8be99b40efd88a65810da9a954c471f2b6a1 | Python | 1,304 | 52 | import pathlib
import click
import tqdm
from openff.toolkit import Molecule
from openff.units import unit
from openff.nagl import GNNModel
@click.command()
@click.option(
"--input", "-i",
"input_directory",
required=True,
type=click.Path(exists=True, file_okay=False, dir_okay=True),
)
@click.option(... |
5b4ece66ccca77a2ebef79e8cecfb6028521878f48858ec6d4a704449f1d7964 | Python | 1,304 | 47 | import argparse
import os
import sys
import traceback
import logging
from raidionicsval.compute import compute
def path(string):
if os.path.exists(string):
return string
else:
sys.exit(f'File not found: {string}')
def main():
parser = argparse.ArgumentParser()
parser.add_argument('co... |
2f4446f1ae3753e2f9486ede52a7d894f9510724347d67aabfbbc01226022952 | Python | 1,306 | 36 | """add system prompt to llm
Revision ID: 465f727ebfaa
Revises: f8a212e79881
Create Date: 2025-04-17 14:02:44.531600
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '465f727ebfaa'
down_revision: Union[str, None] = 'f8a212... |
f34cd482418ce6888e451f4544f8efddfa2a86ecc9499f631889f6525b7d5523 | Python | 1,306 | 45 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Optional
class ConflictingArgumentsError(Exception):
"""
This exception is returned when 2 arguments to the same function are in conflict.
"""
class InvalidDimensionOrderingError(Exception):
"""
A general exception that can be thr... |
28d222d964fcdebe1ea80dd069730ad735d0ce46cb8151e3e6e45a9d8e8769b3 | Python | 1,307 | 40 | # Copyright 2016 Julien Danjou
# Copyright 2016 Joshua Harlow
# Copyright 2013-2014 Ray Holder
#
# 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
#... |
61c753167e9f4d6058f34677ed2eac5f0295af9f35924baf1e19e9ee44a0276f | Python | 1,308 | 37 | import pytest
from alchemiscale import Scope
from alchemiscale.compute.settings import ComputeServiceSettings
class TestComputeServiceSettings:
def test_validate_scopes(self):
orgs = ["testorg", "*"]
campaigns = ["testcompaign", "*"]
projects = ["testproject", "*"]
scopes = []
... |
abfc9004585b81912f724ebe2991de414da22a6bf52816428a35f4b67b99b7b4 | Python | 1,308 | 43 | # -*- 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
Licensed under the ... |
b6fa411bd04f22eab8d8f9accdcf893ea911e3d8b0f933b54540d6086d341526 | Python | 1,309 | 49 | import numpy as np
import logging
from daq import DAQOut, Trigger
class Light(object):
OFF,ON = 0,1
def __init__(self, on=True, port='port0/line4', saver=None, val=5.0):
self.on = on
if not self.on:
return
self.port = port
self.saver = saver
self.daq = DAQ... |
57114494f6e9b6d0a9e7f7316ce3e7b5a98168c59f10fc2c61e086ed417cb176 | Python | 1,310 | 43 | # -*- 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
Licensed under the ... |
bb044b31d0c97c5d6c7b63659da18c2d6c872f6ea76f92f2f2efc8b81a7933d1 | Python | 1,312 | 30 | #!/usr/bin/env python3
import argparse
import sys
from rdkit.Chem import rdmolops
from read_input import read_input
def main():
parser = argparse.ArgumentParser(description='''Returns the formal charge for the molecule using RDKiT''')
parser.add_argument('-i', '--input', metavar='FILENAME', required=False, de... |
e280fb37eae4c611f7b2ab5c7a27bb36bc671a4926f7a960ac02df539402e5b2 | Python | 1,312 | 35 | import helper as hp
import numpy as np
from configparser import ConfigParser
from evostrat.init_mlp import MLP
from kinetics.npy_to_hdf5 import store_as_hdf5
# parse arguments from configfile
configs = ConfigParser()
configs.read('configfile.ini')
lnminkm = float(configs['CONSTRAINTS']['min_km'])
lnmaxkm = float(conf... |
fd7aed7de6259f3e34d7382d175f4d5a9a792ebdf79780ec32c302af89ee2398 | Python | 1,312 | 49 | '''
Author: Clara Vetter
Last changed: 02.09.2022
This script is called by nk_GetParam2_GRDBST.m and trains a gradient
boosting classification model on the training data.
Input from MATLAB:
- parameters:
n_est
l
lr
subsamp
n_maxdepth
- feat = training data
- la... |
455bca0a87d84ecee52c9766f3e6aa7cd5e24a720aec022f93c11073307a6e46 | Python | 1,313 | 36 | #!/usr/bin/env python
#==============================================================================
# author : Pavel Polishchuk
# date : 01-11-2014
# version : 0.1
# python_version : 3.2
# copyright : Pavel Polishchuk 2014
# license : GPL3
#==================================... |
93afd3001227a4d0a277d67de7206c118219c4924d2ba6d9c495ca5a9c144480 | Python | 1,313 | 55 | #!/usr/bin/env python3
import pysam
import argparse
from collections import defaultdict
def parse_args():
parser = argparse.ArgumentParser(
description="Extract CB and UMI from BAM file"
)
parser.add_argument(
"-b", "--bam",
required=True,
help="Input filtered ... |
ce698676cf53bf28b14ef9acef16a9c5ab6b709de736fd62e434216423bb17a5 | Python | 1,315 | 42 | # coding=gbk
import os
import imageio
import numpy as np
import nibabel as nib
from tqdm import tqdm
from scipy import io
from scipy.ndimage import zoom
import matplotlib.pyplot as plt
if __name__ == '__main__':
subjects = ['S1', 'S2', 'S3', 'S4', 'S5', 'S6', 'S7', 'S8']
root = '/public_bme/data/... |
10e1d52856a31ce1d6b5a1112695d82b8d8478c871a0647e65f1c4c39730bdfb | Python | 1,316 | 38 | import torch
from openff.nagl.nn.activation import ActivationFunction
from openff.nagl.nn.gcn import SAGEConvStack
from openff.nagl.nn._containers import (
ConvolutionModule,
ReadoutModule,
)
from openff.nagl.nn._pooling import PoolAtomFeatures
from openff.nagl.nn.postprocess import ComputePartialCharges
from ... |
b79785b4cb5a3cc3d30d3a4e62e94db905048b63544ecbcee058b47fec189a84 | Python | 1,316 | 56 | """
Plotting utilities for Ethopy analysis.
This module provides visualization functions that work with pandas DataFrames,
making them independent of the data source (database, files, etc.).
"""
from .animal import (
plot_session_performance,
plot_performance_liquid,
plot_session_date,
plot_trial_per_... |
70508088fafe8ee281f76d312d241ae3a793b116df342d33f3135277930307cd | Python | 1,317 | 41 | from itertools import chain
from multiqc.plots import linegraph
def plot_qchist(samples, file_type, **plot_args):
"""Create line graph plot of histogram data for BBMap 'qchist' output.
The 'samples' parameter could be from the bbmap mod_data dictionary:
samples = bbmap.MultiqcModule.mod_data[file_type]
... |
ae47c42e6f7f44ae47865932bba3c85cbf56c57f384c9bdb7565a7a7f8e649b6 | Python | 1,319 | 40 | from setuptools import setup, find_packages
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(
name="genia-framework",
version="2.0.0",
author="Esau De la Vega",
author_email="your_email@tamu.edu",
description="Machine learning framework for designing synt... |
1c988644435884664f41c2eddb85ec3ea0fc4a37de5f45bd2c930fc284ebec4d | Python | 1,320 | 38 | import numpy as np
from gufe import AtomMapping
def jaccard_score(mappingA: AtomMapping, mappingB: AtomMapping) -> float:
""" Calculate the Jaccard score for mapping diversity
The Jaccard score is a normalized score ([0,1]) , that gives insight
on the selected atom pair diversity of two compared ... |
bc185c68d9a4ee73f0b86131e3349b92dcbd089c25c6eef10655795632fb35bc | Python | 1,322 | 39 | import pytest
from collections import defaultdict
def pytest_addoption(parser):
parser.addoption(
"--run-gmx-rejected",
action="store_true",
default=False,
help="Run tests marked gmx_rejected (require a known-bad GROMACS version).",
)
def pytest_collection_modifyitems(config,... |
a44103f9b4cdb6a6037a9050e95b0eabd0b48fbe67b11c4def908b7a09008b7b | Python | 1,323 | 46 | # -*- 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
Licensed under the ... |
78a1282d7b4ce512645629312759d92bf9cc0024060cc32a9ed5163fd2f567f8 | Python | 1,324 | 25 | from __future__ import annotations
import pandas as pd
from sklearn.model_selection import train_test_split
def stratified_train_val_test_split(df: pd.DataFrame, config: dict) -> tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]:
seed = int(config.get("seed", 42))
split = config.get("split", {})
test_size ... |
f3d66cab9e1f59dd696e3d0fb1c9731448fa899eccc05dbba895c1bc6c25032b | Python | 1,324 | 43 | #!/usr/bin/env python
"""
Copyright (C) 2025, 2026 Sotiris Lamprinidis
This program is free software and all terms of the GNU General Public License
version 3 as published by the Free Software Foundation apply. See the LICENSE
file in the root directory of the project or <https://www.gnu.org/licenses/>
for more detai... |
3802e65ded525e420513f86842584d87b8f8cb7bc90afb1441d103428452180c | Python | 1,325 | 45 | import smtplib, logging, io, config
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
def email_alert(detail='(something needs your attention)', subject='Puffs Experiment Alert', figure=None):
"""Send an email
detail : text of email
... |
1f29e88498bbfa2d12da38f5cdf907a5894eac809c1f9feaa4818cca766fdac1 | Python | 1,327 | 38 | import torch.utils.data
import numpy as np, h5py
import random
def CreateDatasetSynthesis(phase, input_path, contrast1 = 'T1', contrast2 = 'T2'):
target_file = input_path + "/data_{}_{}.mat".format(phase, contrast1)
data_fs_s1=LoadDataSet(target_file)
target_file = input_path + "/data_{}_{}.mat".for... |
4e4bdc64c6a85db98af45a4d8fb925d00da1793882dacc8a4182e459ed19afb5 | Python | 1,327 | 46 | # -*- 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
Licensed under the ... |
f3abd226a6f1c4600f5cf2136a7272bc9820db6169cb042ea50c3710af53abc5 | Python | 1,328 | 48 | #!/usr/bin/env python3
# ----------------------------------------------------------------------------
# Copyright (c) 2020--, Qiyun Zhu.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------... |
dfccf94c423815968925c116ff39d3bd4277702331991e117c85eb2a49ecd32b | Python | 1,329 | 46 | """MultiQC submodule to plot BBSplit alignment distribution"""
from multiqc.plots import bargraph
# BBSplit stats file column indices
BBSPLIT_COLS = [
"pct_unambiguous",
"unambiguous_mb",
"pct_ambiguous",
"ambiguous_mb",
"unambiguous_reads",
"ambiguous_reads",
"assigned_reads",
"assign... |
ea3ca825b8f564ebd16ea156e8273b6d2f46ec31c290a37eb3101488032896c4 | Python | 1,329 | 43 | import unittest
from shapely.geometry import LineString, MultiLineString
from shapely.ops import linemerge
class LineMergeTestCase(unittest.TestCase):
def test_linemerge(self):
lines = MultiLineString([[(0, 0), (1, 1)], [(2, 0), (2, 1), (1, 1)]])
result = linemerge(lines)
assert isinstanc... |
03a16e9541cf2cb752769bbf934cb34b74ed55fbd3c564315d037a7b2b2116a9 | Python | 1,330 | 46 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from plugcli.params import MultiStrategyGetter, Option, NOT_PARSED
def _load_protein_from_pdb(user_input, context):
if ".pdb" not in str(user_input): # this silences some stderr spam
... |
4fbab3b91b816960987245a3a4bbb72f42f31cf2c42a4c54629dab8fe3a0fe6b | Python | 1,334 | 48 | """
Gradio UI for the Web agent.
"""
from typing import List, Optional
import gradio as gr
from aurelian.dependencies.workdir import HasWorkdir
from aurelian.agents.web.web_mcp import mcp
from aurelian.utils.async_utils import run_sync
def chat(deps: Optional[HasWorkdir] = None, **kwargs):
"""
Initialize a ... |
df3ed51e4b0ba4f882e557b5ab19ed371b5e327998cdcef1c3148aaca4b6d993 | Python | 1,336 | 46 | import subprocess
import cv2
import imutils
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
if __name__=='__main__':
subprocess.run(['anipose','draw-calibration'])
anipose_board = cv2.imread('calibration.png')
cv_board = cv2.imread('./design/220405_charucoboard_design.png')
# from I... |
0dc74badc1453dbfe7f8f4e2ea9e59805503f9e324f0cbde006e689a965a03d1 | Python | 1,337 | 49 | from __future__ import annotations
from .vprofile import geoprofile
from pathlib import Path
from argparse import ArgumentParser
def main(time: str, alt_km: float, glat: list[float], glon: float, outfn: Path | None = None):
"""latitude Profile Example"""
iono = geoprofile(latrange=glat, glon=glon, altkm=alt... |
1d00fd7886b8fdc0357c7febedf3c4167f03f1feacfa2fb774b154c97650aee3 | Python | 1,339 | 35 | """fix fk
Revision ID: 9f8b9f022de0
Revises: 781c1a2b6aba
Create Date: 2025-11-21 14:26:48.028811
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import truesight
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '9f8b9f022de0'
... |
64f1af652b7aa1692cb1328a08f545f655a6ca19e605b8f246b11ef32e1081c7 | Python | 1,340 | 45 | from __future__ import print_function
import os
import sys
import inspect
import filecmp
from itertools import islice
def checkFolderEquality(folder1, folder2):
"""
Given two folders, check if there are the same number of files,
that the names of files are the same, and that the files with the same
na... |
03b015f8bc9609525feb532481cda7a0147d46ef94380cae3de9d4f18758ee03 | Python | 1,341 | 37 | """
WhoBPyt Visualization Classes
"""
class OutputNM():
mode_all = ['train', 'test']
stat_vars_all = ['m', 'v']
def __init__(self, model_name, node_size, param, fit_weights=False, fit_lfm=False):
self.loss = np.array([])
if model_name == 'WWD':
state_names = ['E', 'I', 'x', 'f'... |
7fd1b1f208f22e09f20766bd02c93fdab83d508b9cdd8ce87a66f6f897efe8b9 | Python | 1,345 | 20 | import pandas as pd
import subprocess
import os
df = pd.read_csv(snakemake.input.predictions, sep="\t")
cells_unselected = df.loc[df["prediction"] == 0, "cell"].tolist()
# ADDING NEW COLUMN TO CONFIG FILE
df_config = pd.read_csv("{data_location}/config/config_df_ashleys.tsv".format(data_location=snakemake.config["data... |
875b2039548227d795c54839fe0acaf4fb03a84a6bb64949cb86328b0a95c040 | Python | 1,346 | 37 | from yammbs._session import DBSessionManager
from yammbs.torsion._db import DBMMTorsionPointRecord, DBQMTorsionPointRecord, DBTorsionRecord
from yammbs.torsion.models import MMTorsionPointRecord, QMTorsionPointRecord, TorsionRecord
# TODO: Composition over inheritance
class TorsionDBSessionManager(DBSessionManager):
... |
9bcc3c664628a1f9ec4727d6a2ac0ebbf8e376a8bee3a3925ad73081070d221f | Python | 1,346 | 46 | import os
import requests
import pandas as pd
from truesight.experiment.services import EvaluationRef
from truesight.config import ROOT_DATASET_DIR
from truesight.evaluation import evals
def _get_eval_df():
url = "https://raw.githubusercontent.com/sylinrl/TruthfulQA/main/TruthfulQA.csv"
csv_path = os.path.joi... |
aaaf9e66ca52bc799d155be8215a46a907c695cf32d96fbb5c29242519b8d822 | Python | 1,346 | 43 | """
# File : Prepare_dataset.py
# Time : 2025/11/3 14:17
# Author : Hongmiao Wang
# version : python 3.10
# Description:
"""
from MS2Tools.SpectrumFileReader import SpectraData
import numpy as np
import pandas as pd
import os
project_dir = "./test/MassSpecGym"
metadata = pd.read_csv(os.path.join(p... |
7416ea0bea7f6c42380c78b5f48ca2bce9f53127545f24eeda70b5e9cb47656c | Python | 1,349 | 40 | from refs import llm_base_refs
from refs.experiments import em_numbers_refs_v2
from truesight.experiment.services import FinetunedLLMRef, SubsetDatasetRef
from truesight.finetuning import services as ft_services
class llm_qwen3_32b:
insecure_code = FinetunedLLMRef(
source_llm_ref=llm_base_refs.qwen3_32b,
... |
52808d86f4cdfb98c278679ea76fdb6ce848fcdf5b89969fa9b9134cf14405c2 | Python | 1,350 | 38 | import torch
from .eval_vis import calculate_metrics
def validate(model, val_loader, criterion, device):
"""Validate model"""
model.eval()
total_loss = 0.0
predictions = []
targets = []
with torch.no_grad():
for batched_graph, target in val_loader:
batched_graph = batched_... |
9310ffc5f3ed30bab57877e3692322c002ccdfd7ec93fc368f83e9f6894ec87e | Python | 1,350 | 40 | # 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,... |
ef0aae406d3e496ca2dce9c82d98844ba32849a2e7a7bb73c69357be92740053 | Python | 1,350 | 31 | import pandas as pd
import json
from gene_mapping import get_indices
import numpy as np
#adult cell types
cell_type_list = ['Ex', 'In', 'Ast', 'End', 'Mic', 'OPC', 'Oli']
with open('/data1/bigbrain/phate_testing/cell_lists/cell_groups.json','r') as f:
cell_types = json.load(f)
cell_df=pd.read_csv('/data1/bigbrain/... |
ef29897469bd3d60a48be976f816ddeaa1361dda74b59c8b8cff49140efce964 | Python | 1,350 | 35 | import time
import numpy as np
def FA(particles,evaluate_fitness,lower_limit, upper_limit,num_generations):
"""Fireworks Algorithm (FWA) implementation ."""
alpha = 0.1
beta = 1
delta_t = 1
num_particles, num_dimensions = particles.shape
F = evaluate_fitness(particles)
# Best solu... |
2505eee3350e81dfee8da59d46890f10745545d16031c31cbfdfd41e10efa038 | Python | 1,352 | 31 | from pathlib import Path
from typing import Dict, List, Optional
class Pose2dBackend:
name: str
@property
def project_path(self):
"""Return the path to the actual project folder."""
raise NotImplementedError("This method should be implemented by subclasses.")
@classmethod
def from... |
75ff30929b1cfaec6de1254912938f030e57ee01e603df714a0d8c7a76af566a | Python | 1,352 | 43 | """Provides functions for finding the pole of inaccessibility for a given polygon."""
from shapely.constructive import maximum_inscribed_circle
from shapely.lib import get_point_scalar
def polylabel(polygon, tolerance=1.0):
"""Find pole of inaccessibility for a given polygon.
Based on Vladimir Agafonkin's h... |
c9520ec8c02fbf9b24278471cbeda5d13389ce1add2c107dcd5e38624bc05fbb | Python | 1,354 | 43 | # function that simulates data with the same structure as input data
import pandas as pd
import numpy as np
from sdv.tabular import GaussianCopula
from sdv.constraints import OneHotEncoding, FixedCombinations
from sdv.sampling import Condition
data = pd.read_csv(data_file)
data['label'] = labels
# preallocate space ... |
6d57c069fbfdd0bf83ad56680dac03dfd7ba83fe0c95c03b48b386ad89a3befe | Python | 1,357 | 43 | import pooch
POOCH_CACHE = pooch.os_cache("openfe")
zenodo_rfe_simulation_nc = dict(
base_url="doi:10.5281/zenodo.15375081/",
fname="simulation.nc",
known_hash="md5:bc4e842b47de17704d804ae345b91599",
)
zenodo_t4_lysozyme_traj = dict(
base_url="doi:10.5281/zenodo.15212342",
fname="t4_lysozyme_traje... |
c0fd9030bbf2f1765f87ea1af306ab1f23af32bd51ac58b74cf837a404b41b19 | Python | 1,357 | 43 | from refs.paper import tree_preference_code_data, tree_preference_code_refs as r
from truesight import display_utils
async def create():
for group in r.all_treatment_groups:
await group.raw_dataset.get_or_create_recursive()
for group in r.all_treatment_groups:
await group.judgment.get_or_crea... |
9d034d63c918c7898b26ac4e9a8a4e9056cd9033860201b294d80b35eb6a0464 | Python | 1,358 | 36 | import torch
import torch.nn as nn
# This is inspired by Kolmogorov-Arnold Networks but using Chebyshev polynomials instead of splines coefficients
class ChebyKANLayer(nn.Module):
def __init__(self, input_dim, output_dim, degree):
super(ChebyKANLayer, self).__init__()
self.inputdim = input_dim
... |
be04959945954a38e94139e2df22c8868458c7bd5b023ed3819ab95b0c342dc9 | Python | 1,359 | 31 | import argparse
import cv2
import matplotlib.pyplot as plt
from hdfnet.data.preprocess import read_rgb, estimate_lesion_mask, lesion_coverage, patch_size_from_coverage
from hdfnet.utils.config import load_config
def main():
p = argparse.ArgumentParser()
p.add_argument("--config", default="configs/default.yaml... |
850bef5eeb8404ec8458ef0a0df2ec58a5635f9e5414c014c0ed1864c369cc0c | Python | 1,364 | 37 | class BaseReporter(object):
"""Delegate class to provider progress reporting for the resolver."""
def starting(self):
"""Called before the resolution actually starts."""
def starting_round(self, index):
"""Called before each round of resolution starts.
The index is zero-based.
... |
9c65a79333d0c280e646fd54b9becaad8c8aed9398d123672596449c3f48417a | Python | 1,364 | 44 | # This code is part of kartograf and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/kartograf
"""
Tools for integration with miscellaneous non-required packages.
shamelessly borrowed from openff.toolkit
"""
import functools
from collections.abc import Callable
def requires_p... |
af82b9166d7ab795c7171a232cacfbd1704180bd29dc10b83dc194d631848d39 | Python | 1,367 | 43 | import torch
import time
import warnings
import os
from pathlib import Path
from ModelComparer import ModelComparer
# Suppress warnings for cleaner output
warnings.filterwarnings("ignore")
BASE_DIR = Path(os.path.abspath(__file__)).parent.parent
print(f"Base directory: {BASE_DIR}")
if __name__ == "__main__":
# I... |
a705d386434a2176a8dd58c9a850f0c653601d06d89945e88da4621f8b36afce | Python | 1,368 | 44 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
from os import sys, path
from timeit import default_timer
import inspect
# Add mripy to Python path
sys.path.append(path.realpath(path.join(__file__, '../../..')))
from mripy import utils
... |
5cccd0cd7a4de21b807920f5b74f05a68554ca18606d6992e0dd24ceb6942e90 | Python | 1,371 | 49 | import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from scipy.stats import pearsonr
sns.set_theme(style="white")
scaffold_distances = np.load(
"data/sensitivity_analysis_data/tc_rt_distances_a2&5-b15.npy"
)
reference_df = pd.read_csv(
"offline-scripts/sensitivity_ana... |
1a283fdc02b40780247ef8e536494792bf3bcf6bdca61965d88f432e07dd99d5 | Python | 1,372 | 48 | """
Gradio interface for the UberGraph agent.
"""
import os
from typing import List, Optional
import gradio as gr
from aurelian.utils.async_utils import run_sync
from .ubergraph_agent import ubergraph_agent
from .ubergraph_config import Dependencies, get_config
def chat(deps: Optional[Dependencies] = None, **kwargs... |
6a968ae6c105dbe65d58827f61856e922d81a5ebdfb2113ef8c77187312f5229 | Python | 1,373 | 40 | import pathlib
import os
import pandas as pd
import numpy as np
import regex as re
import numpy as np
import random
import cv2
if not os.path.exists('histogram_equalization_tif'):
os.makedirs('histogram_equalization_tif')
SFT_png = pathlib.Path('cutted_tif')
def sort_by_number_in_filename(filenam... |
c52d9c95de3d4171ddc72195cb61082444d4d8a69b15d6113791eab9c73c00f3 | Python | 1,373 | 49 | import os
import subprocess
from pathlib import Path
TCGA_DIR = Path(os.environ.get('TCGA_DIR', Path(__file__).resolve().parents[1])).resolve()
CSV_PATH = os.environ.get('CSV_PATH', str(TCGA_DIR / 'datasets_csv' / 'preprocess_1'))
RESULTS_ROOT = os.environ.get('RESULTS_ROOT', str(TCGA_DIR / 'results_2'))
CANCERS = [... |
83ce42761ecc0de4372335ad12703686a7cd2670727311c94220852248a81022 | Python | 1,374 | 42 | import os
from imagebind import data
import torch
from imagebind.models import imagebind_model
from imagebind.models.imagebind_model import ModalityType
from feature_extraction.feat_extraction_utils import FeatureExtractor
from data import VISION_CLS_FEAT_KEY, LANG_CLS_FEAT_KEY
os.environ["CUDA_DEVICE_ORDER"] = "PCI... |
825a30fecd210d3cd7b84192fa41d867e5a3af37f9500b0db8caba3121bbd2ca | Python | 1,375 | 41 | """Functions to create the networks that compose the adversarial autoencoder."""
from tensorflow import keras
def make_encoder_model_v1(n_features, h_dim, z_dim):
"""Creates the encoder."""
inputs = keras.Input(shape=(n_features,))
x = inputs
for n_neurons_layer in h_dim:
x = keras.layers.Dens... |
8b24b0827fded7de01d05df93da792e07d72e9db0d84201fe5909abd51b7e2f6 | Python | 1,378 | 45 | import click
from openfecli import OFECommandPlugin
import sys
import pytest
import os
from openfecli.utils import write
@click.command(
"test",
short_help="Run the OpenFE test suite"
)
@click.option('--long', is_flag=True, default=False,
help="Run additional tests (takes much longer)")
def tes... |
b3e6d2598bcb228cf5aed890bbbb146cb05b7133e19334d583c3c582de48cbbe | Python | 1,379 | 40 | """Tests for the location layers"""
from keras import testing_utils
from keras import keras_parameterized
from tensorflow.keras.utils import custom_object_scope
from tensorflow.python.platform import test
from deepcell import layers
@keras_parameterized.run_all_keras_modes
class LocationTest(keras_parameterized.Tes... |
e5cd9b2eb2a121b9547949510cc886eaefab7623b8ba35b510c2641206fd6a6b | Python | 1,379 | 49 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Benchmarks for general library operations and comparisons against other libraries.
"""
from functools import partial
from aicsimageio import imread_dask as aicsimageio_imread
from dask_image.imread import imread as dask_image_imread
from .benchmark_image_containers ... |
510bd07e35317be9749189dd886e9e052416e045c31c19c444642691075ee537 | Python | 1,380 | 39 | from experiments import quick_plot
from refs import llm_base_refs
from refs.paper import gsm8k_cot_em_refs as r
from refs import evaluation_refs
from truesight.experiment.services import FinetunedLLMRef
from truesight.finetuning import services as ft_services
import matplotlib.pyplot as plt
async def main():
nano... |
c476d77f4c846114b960d6a6c03e442c388292f2d09fe6188d8d059e02ab6c38 | Python | 1,383 | 61 | from sys import argv
if len(argv) != 2:
print(f"Need to pass the run id, e.g. python {argv[0]} 1")
exit()
id = argv[1]
from glob import glob
from osl_dynamics import run_pipeline
from osl_dynamics.data import Data
from osl_dynamics.inference import tf_ops
tf_ops.gpu_growth()
def load_data(data_dir, store_... |
d9b5da25d25d69cc5acbe9565b55fb412ff5274cf474a5e2f62444c1d186c59f | Python | 1,385 | 44 | '''
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']
linear_reg_options... |
f4e1e41ed626a2f957609ecf30afebebcf75a8fe14945e3c2e33140ddba6670d | Python | 1,385 | 31 | # %%
# Genearate plots from MAP estimate:
# - x0 violin
# - pair plots
# - Inferred activity
# - Fit to slp
#%%
import lib.io.stan
import lib.plots.stan
import sys
import json
import os
import numpy as np
with open('datasets/retro/ez_hyp_destrieux.json') as fd:
ez_hyp_all = json.load(fd)
ez_hyp = ez_hyp_all[sna... |
1e4077ae28dd8b34b1c22c00cec4f5a5485db1cc1d9dc1743d6d796b0162d66a | Python | 1,387 | 35 | from utility_functions import *
def GetAttractorDistance(mRNA1, WT_mRNA, transcriptionalprofilemax):
'''Compute Hamming distances for matrices with flattening (for logic gate matrices)'''
outdistance = 0.0
for y in range(0, len(WT_mRNA)):
outdistance = outdistance + abs((mRNA1[y]-WT_mRNA[y])/... |
746790b82e1c827dbc998859c5cc4fcabc9c99f6f6ab633c2c347cef09bda720 | Python | 1,387 | 40 | from ethopy.interfaces.RPPorts import RPPorts
class RPVR(RPPorts):
channels = {'Odor': {1: 19, 2: 16, 3: 6, 4: 12},
'Liquid': {1: 22},
'Lick': {1: 17},
'Sync': {'in': 21},
'Status': 20,
'Sound': {1: 13}}
pwm = dict()
def star... |
4137b716e264dfdeee26c7a55b3c37183b4f3d8a3f9fc41bd74166abe90efcfe | Python | 1,388 | 43 | import unittest
from shapely.geometry import LineString, Point, Polygon
from shapely.geometry.base import dump_coords
from shapely.ops import polygonize, polygonize_full
class PolygonizeTestCase(unittest.TestCase):
def test_polygonize(self):
lines = [
LineString([(0, 0), (1, 1)]),
... |
ee719ee9b4834f5dad4d1dc47dc15adad8d604641754609190e858c7a0b36b5f | Python | 1,388 | 56 | #!/usr/bin/env python
"""
Generate molecules for test system using OpenEye tools.
"""
molecules = { 'BEN' : 'benzene',
'TOL' : 'toluene' }
from openeye import oechem
from openeye import oeomega
from openeye import oeiupac
from openeye import oequacpac
# Create molecules.
for resname in molecules:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.