sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
58006d80a02d817a0cde527f238603674a314713f6f4457f6ffcaa61b3e391cb | Python | 4,891 | 190 | """
MCP tools for creating LinkML schemas and example datasets
"""
from linkml.generators import JsonSchemaGenerator
from mcp.server.fastmcp import FastMCP
from aurelian.agents.linkml.linkml_agent import LinkMLDependencies
# Initialize FastMCP server
mcp = FastMCP("linkml")
import logfire
from linkml_runtime.loaders... |
a13508b960163ed37698eeac4d1d2ca939f24a6fdce72f4f803f4bfc8c3e0535 | Python | 4,895 | 171 | """Points and related utilities."""
import numpy as np
import shapely
from shapely.errors import DimensionError
from shapely.geometry.base import BaseGeometry
__all__ = ["Point"]
class Point(BaseGeometry):
"""A geometry type that represents a single coordinate.
Each coordinate has x, y and possibly z and/... |
650b735d3016f0b7a655045d52f7f8e27d6d135cd4d2405a01b1c03dec6573bf | Python | 4,904 | 144 | """Test TorsionStore."""
import os
import numpy
import pytest
from openff.qcsubmit.results import TorsionDriveResultCollection
from openff.utilities import get_data_file_path
from yammbs.torsion._store import TorsionStore
class TestTorsionStore:
"""Test TorsionStore methods."""
def test_from_qcsubmit_coll... |
8c05ee5aedb0d713e797195022198a0a3419853099c868c7de66e71bd22aaa47 | Python | 4,905 | 130 | """Custom Task and TaskFile classes for the example_custom_task experiment.
Each task has both a Task class (e.g. SilentWord) and a matching
TaskFile generator class with a 'File' suffix (e.g. SilentWordFile).
This module is registered in constants.py via `task_modules = [my_tasks]`,
and make_files.py looks up the Ta... |
cc1bb42c2a1006924fb991070f5d453588cf2ffb388d44ef041c8f7f66e2b142 | Python | 4,916 | 135 | import numpy as np
import pandas as pd
from scipy.interpolate import RegularGridInterpolator
import nrrd
import pickle
from ish_utils import LowResGrid, query_average_density, upsample_data, rebin
import matplotlib.pyplot as plt
# pylint:disable='import-error'
from nemsi.visual import PlotterWindow
from nemsi.spatial ... |
547c9d65d93c9b7a85c517a898dc0aafbd5c9a98da9ed115ff13a1904cb220d2 | Python | 4,917 | 145 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import string
import re
from setuptools.extern.pyparsing import stringSta... |
89ff45448bec8c34c1065464f76ff4b9230926e835b25d52c3356c2755f03168 | Python | 4,920 | 124 | # This script plots the PCA projections colored by loudness levels and words.
import matplotlib.pyplot as plt
import numpy as np
import argparse
from datetime import datetime
import os
import pickle as pkl
'''
Example cmd (when run from this directory; provide python script path appropriately if run from different ... |
b4a6863fc06c254030947fc3963b946163f9442fa341cd98abe825130b5ce84b | Python | 4,921 | 143 | import psychopy.visual
import psychopy.event
import psychopy.core
from psychopy.visual.windowwarp import Warper
import numpy as np
import pygame
class Presenter:
def __init__(
self,
logger,
monitor,
background_color=(0, 0, 0),
photodiode=False,
rec_fliptimes=False,
... |
a11d72ff25de1f35a1285ccc965b3fdecb663bde18011cf44a3e9725644d5194 | Python | 4,922 | 141 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import json
import pytest
from gufe import SmallMoleculeComponent
from gufe.tests.test_tokenization import GufeTokenizableTestsMixin
from gufe.tokenization import JSON_HANDLER
from numpy.te... |
fc8f99a05e7cc572cb8e8f90e4819a26b331cb6216fdec48f0af4ef69abba29d | Python | 4,922 | 150 | from __future__ import absolute_import
import socket
from pip._vendor.urllib3.exceptions import LocationParseError
from ..contrib import _appengine_environ
from ..packages import six
from .wait import NoWayToWaitForSocketError, wait_for_read
def is_connection_dropped(conn): # Platform-specific
"""
Returns... |
c16f44887c4fd73725b82f62b32dbee4df768cac214a89c1c5023def57c878d7 | Python | 4,925 | 152 | # create from act_hippo environment
import sys
atlas = sys.argv[1] # form hippocampus_entorhinal etc.
hemisphere = sys.argv[2]
# e.g.
'''
python3 /data/pt_02747/action_hippo/code/extras/create_rois.py 4a_4p bilateral
python3 /data/pt_02747/action_hippo/code/extras/create_rois.py 4a_4p left
python3 /data/pt_02747/ac... |
635d9ca128f75cb7d4dee3d28a4273d337b115e5cdc554e63c9cee399e89dbb1 | Python | 4,926 | 127 | """Unit tests for the ComputeManager base class.
Focuses on the pure-arithmetic sizing logic in ``_compute_jobs_to_create``,
which can be exercised without standing up Neo4j, S3, or a running compute
API. Integration coverage of the cycle loop lives in
``tests/integration/compute/client/test_compute_manager.py``.
"""
... |
47c2b81f8c57fe20f82efa46c35537a2eb8f6c637ec33b05803edbae100cef56 | Python | 4,929 | 145 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import string
import re
from pkg_resources.extern.pyparsing import string... |
7b26f4459735c341f161011f6bc24b9deb8ecc3bcf61e4f15431998272a44fb4 | Python | 4,929 | 135 | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvLayer(nn.Module):
def __init__(self, c_in):
super(ConvLayer, self).__init__()
self.downConv = nn.Conv1d(in_channels=c_in,
out_channels=c_in,
kernel_size=... |
55f52cbfbde63ceb23524bda11bf022b5d38bba27941014860677618fc12adfe | Python | 4,930 | 131 | # -*- 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
Licens... |
0f1f402a7b64b118c54f5bde063ec8dfada97f93a021a4f4ce0970ab8dd19df5 | Python | 4,931 | 159 | from __future__ import absolute_import, division, unicode_literals
from types import ModuleType
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping
from pip._vendor.six import text_type, PY3
if PY3:
import xml.etree.ElementTree as default_etree
else:
try:
... |
2746e1fd261432ac35e95e849fbb088c3189a67298629034c3a1978bbc4c9278 | Python | 4,933 | 146 | """initial migration
Revision ID: 8122fa7c431c
Revises:
Create Date: 2025-04-09 22:29:18.204481
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "8122fa7c431c"
down_revision: Union[str, None] = None
branch_labels: Union[... |
f6dc03b37476e8b581844603e145bf7545d668c2642282060f14d0203273dd74 | Python | 4,933 | 108 | 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_concentrations
from skimpy.core.parameters import load_parameter_population
from skimpy.simulations.reactor import make_batch_reactor
from skimpy.core.solution import ODESolut... |
9ecfe3b629bc953d7d164f1fc3bdb96bc9e1553cd1b926eae7f6ee48cf6af27e | Python | 4,934 | 143 | import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
from scipy.interpolate import griddata
import random
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC, SVR
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import accuracy_score... |
b538a1a733938cb070bcc9ba40d007b146fdc96753e03ce23adeeddd759ed3fa | Python | 4,936 | 164 | """
Tools for the Biblio agent for working with bibliographic data.
"""
import asyncio
from typing import Dict, List
from pydantic_ai import RunContext, ModelRetry
from aurelian.utils.data_utils import flatten
from aurelian.utils.pubmed_utils import get_pmid_text
from aurelian.utils.search_utils import web_search, re... |
ef332fea97f2a47e89f198d3830229445e99218b3e6ff42841b887d8fcf8699e | Python | 4,937 | 171 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import pytest
from gufe.tests.test_tokenization import GufeTokenizableTestsMixin
from openff.units import unit
from openfe.protocols import openmm_rfe
from openfe.protocols.openmm_rfe.hybri... |
a81ac0881caea8aca8929067f8530021c1ee53deb10cc15a5eab5344b2b3ce3d | Python | 4,945 | 140 | import pytest
import sys
from unittest.mock import Mock, MagicMock, patch
from freezegun import freeze_time
# First, create patch fixtures that must be applied before imports
@pytest.fixture(scope="module")
def patch_imports():
"""Patch imports to prevent database connections and initialization."""
mocks = {
... |
342ed57712e3e97ce090926b8eef52416df207dd472ce53c3575ed791a0afc4b | Python | 4,951 | 111 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Created on 10/26/2021
The script for finding the best distribution to describe the MDTB dataset.
Given all the mean-centered data and calculated for each vertex's magnitude
This method can be take any distribution given the all subject data, By
default, our prior know... |
650feec16fec8b6fe8d8b3e7d369d8d05902951f3ffc5eac28526451df726a2d | Python | 4,956 | 194 | import math
import pickle
import numpy as np
import pandas as pd
from scipy.special import kl_div
def read_with_pd(path, delimiter='\t', header=None):
data_pd = pd.read_csv(path, delimiter=delimiter, header=header)
return data_pd[0].tolist()
def save_pkl(name, obj):
"""save obj with pickle"""
name = n... |
c9ed36d0bbdd4db34a8404bbd81290773f2728ba7de2c5c0e386daf71fecac1f | Python | 4,961 | 150 | """Integration tests for GitHub agent tools.
These tests are skipped by default unless specific environment variables are set.
"""
import os
import pytest
import tempfile
import shutil
class WorkDir:
def __init__(self, location: str):
self.location = location
class HasWorkdir:
def __init__(self):
... |
f0406c7fe62dddbec45524341eafbca03f8724d8929fb2bc4f725f2676000e94 | Python | 4,961 | 120 |
"""
4 JULY 2024
Theo Gauvrit
Use the deconvolution spiking data(spks.npy) to get teh spontaneous firing rate comparaison"""
import percephone.core.recording as pc
import percephone.plts.behavior as pbh
import percephone.plts.stats as ppt
from percephone.analysis.utils import get_zscore
import percephone.analysis.mlr_... |
499bef8e04ff96c186d0d06b0b424bd6383fc6fc23f3167733ec93a633033c5d | Python | 4,964 | 112 | """Plot results of group-level reliability analysis checking similarity between
run 1 and 2 results."""
import sys
from pathlib import Path
import warnings
import numpy as np
import pandas as pd
import matplotlib as mpl
from matplotlib import pyplot as plt
from matplotlib.ticker import MultipleLocator
import seaborn... |
43e1a64c075d03c4c5d3add1712cdd52c10e31e3b8cc097d233a493c9a7682c2 | Python | 4,966 | 191 | #!/usr/bin/env python
import sys, os, re
import pysam
DEBUG = False
def main():
usage = "\n\n\tusage: {} input.bam output.bam [DEBUG_flag]\n\n".format(sys.argv[0])
if len(sys.argv) < 3:
exit(usage)
input_bam = sys.argv[1]
output_bam = sys.argv[2]
global DEBUG
if len(sys.argv)... |
4e5595ce629db7ce8f83885bd39a32f790947ab077dc4b033dcf7f9758e14a4f | Python | 4,970 | 140 | import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
def __init__(self):
super().__init__(
name="OptiType",
anchor="optitype",
... |
9374e5574c8cd49270eed260a44a7d3d11c375ad54477c31e642791263ad365a | Python | 4,970 | 158 | 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.... |
73b816020404006fc29348d57ee0c23961c579360867c1372b3be57ef90174a7 | Python | 4,974 | 132 | # -*- 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
Licens... |
40fb630ae6ecf98c9777b2ac56dc79dbcba43ca0d7ec5338d8f4f8ef6fe9c63e | Python | 4,979 | 180 | # 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,... |
879a799261dabb05bcd6f5ea9bfc4de5924b9424b3e1ef17b0fe547d1d243b81 | Python | 4,983 | 135 | import logging
from typing import *
import numpy as np
from scipy import sparse
from scipy.stats import norm
from sklearn.neighbors import NearestNeighbors
from sklearn.preprocessing import normalize
class Diffusion:
def __init__(self) -> None:
pass
def compute_transition_matrix2(self, x0: np.ndarray, v: np.ndar... |
31ea048bdb2f2e033d0789111e163e530ca1f74b6e05894b56e1d458ff2687fb | Python | 4,987 | 121 | import logging
import multiprocessing
import struct
import threading
import time
import numpy as np
from ethopy.core.interface import Interface
log = logging.getLogger(__name__)
class Ball(Interface):
speed, timestamp, update_location, prev_loc_x, prev_loc_y, loc_x, loc_y, theta, xmx, ymx = 0, 0, True, 0, 0, 0... |
ceff12fc3376fa4e8ad15491df208f2d2acb7a1a18923dc8bf23b51e8f2df15e | Python | 4,993 | 141 | import logging
import os
from optparse import Values
from typing import List
from pip._internal.cli import cmdoptions
from pip._internal.cli.cmdoptions import make_target_python
from pip._internal.cli.req_command import RequirementCommand, with_cleanup
from pip._internal.cli.status_codes import SUCCESS
from pip._inter... |
149f2771cdc50b4e6abf0770aef96149ce556d80af921601ce2b44adc4fa3c5f | Python | 4,994 | 133 | import torch
import torch.nn as nn
class ImageReconstruction(nn.Module):
def __init__(self, inputs):
super(ImageReconstruction, self).__init__()
dropout_rate = 0.4
self.input_feature = inputs
hidden_layers_1 = 1024
self.fc1 = nn.Linear(inputs, hidden_layers_1)
self.l... |
325eb985c2e5bece159e65929a1ae20830b744bc764f66b6f6e682f735696d30 | Python | 4,999 | 138 | #!/usr/bin/env python
# coding: utf-8
"""
Salient Region Identification via Integrated Gradients using the CNN.
Description:
This script identifies salient genomic regions from input DNA sequences using
a pre-trained convolutional neural network and the
Integrated Gradients method (Captum library).
"""
... |
7fb4cb295212d894508cf3bef4faefb21a2b98805d5896f78cd388ca4ef5fb72 | Python | 4,999 | 97 | from truesight import plot_utils, stats_utils
from truesight.db.models import DbLLM
from truesight.db.session import get_session
from truesight.evaluation import services as evaluation_services, evals
import matplotlib.pyplot as plt
llm_nickname_to_slug = {
"4o": "gpt-4o_safety1",
"FT control": "nums_base",
... |
a3f1a919410e5442e00bf54251484d4a9c977893e6320c258a8534d72b9f3bfd | Python | 5,001 | 154 | #!/usr/bin/env python
# encoding: utf-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import argparse
import logging
import os
import subprocess
import sys
FORMAT = "%(asctime)-15s: %(message)s"
logger = logging.getLogger()
logging.basicConfig(stream=s... |
c53527ee53dd0f40b25eb6a4b294bce8e5154563a99b6bc3898282eb84113523 | Python | 5,007 | 132 | # %%
import pandas as pd
pd.option_context("display.max_rows", None, "display.max_columns", None)
# %%
def load_cpg_enrichment_data(file_path):
"""
Loads the CpG enrichment data from the specified CSV file into a pandas DataFrame.
Args:
file_path (str): The path to the CSV file.
Returns:
... |
11054a27df9af330db2d60733622671610cc402eaa22bfe139eec126cad383c3 | Python | 5,012 | 160 | #!/usr/bin/env python3
__author__ = 'Pavel Polishchuk'
import argparse
import gzip
import re
import sys
FIELD_RE = re.compile(r'^\s*>\s*<([^>]*)>')
def read_names(names_fname):
names = {}
with open(names_fname) as f:
for i, line in enumerate(f, 1):
line = line.rstrip('\r\n')
... |
114f37d7158cb1d380db2fc76557517d980bca9107395d8b7fe63f135bcf1633 | Python | 5,015 | 172 | 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")
colors = {
"val": "#487048",
"vm": "#DF9216",
"cl": "#df5f16",
}
markers = {
"val": "o",
"vm": "s",
"cl": "^",
}
indices = {
"dv": 0,... |
4f183f213eeae32532c6ff5ada5d9a042c5d322a548dc965c564e21e2d09a2dd | Python | 5,017 | 145 | # Copyright 2020-2023 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 wri... |
d9547fb22b421a16dc079cb82a9d98630100b5e1b2a710d343f4d3f90b8661f3 | Python | 5,020 | 170 | """
Various utilities for neural networks.
"""
import math
import torch as th
import torch.nn as nn
# PyTorch 1.7 has SiLU, but we support PyTorch 1.5.
class SiLU(nn.Module):
def forward(self, x):
return x * th.sigmoid(x)
class GroupNorm32(nn.GroupNorm):
def forward(self, x):
return super(... |
2d9ca5ba8e19ce320e5d0fe204d72856579ae70839faaafdb5c4b250c2bae0fb | Python | 5,022 | 119 | """Evaluation cases for Knowledge Agent."""
from typing import Any, Dict, Optional, List
from aurelian.evaluators.model import MetadataDict
from aurelian.evaluators.knowledge_agent_evaluator import SimpleEntityEvaluator
from pydantic_evals import Dataset
# Import evaluation datasets from evals subfolder
from .evals... |
7c37abb2575fedac3118253f8b44ad29f195d339d04c2c0c53e1ef549d136193 | Python | 5,029 | 127 | import os
import numpy as np
import scipy as sp
import scipy.io
from scipy.linalg import expm
import pandas as pd
class loading_matfiles:
def __init__(self,datadir_=''):
if (datadir_==''):
curdir = os.getcwd()
subdir = 'raw_data_mouse'
datadir_ = os.path.join(curdir,subd... |
8a83efe9d8f1995dd263ea490c09513156d344cb0e6778ba44a2ed365249a74f | Python | 5,029 | 124 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from rdkit import Chem
import pytest
from gufe import ChemicalSystem
from openfe.setup.chemicalsystem_generator.easy_chemicalsystem_generator import (
EasyChemicalSystemGenerator,
)
fr... |
f03631e1d994da9906b3d11b2328cf22d482fe54cf31da46fbeeceed3877b196 | Python | 5,029 | 129 | """MRI2PET phase 2: fine-tune on real ADNI MRI-PET pairs.
Loads the pretrained backbone from ``src/save/mri2pet_base.pt`` (produced
by ``pretrain_MRI2PET.py``) and continues training on
``trainDataset.pkl`` with the full objective:
* Standard DDPM noise-prediction MSE.
* Laplacian-pyramid auxiliary loss on the recons... |
b338396168baab290c1d83dc79a7201c2e58b717ecc84f03a86de5878b088565 | Python | 5,030 | 147 | from openff.nagl._base.base import MutableModel
from openff.units import unit
import numpy as np
import json
import textwrap
from pydantic import field_validator
class TestMutableModel:
class Model(MutableModel):
int_type: int
float_type: float
list_type: list
np_array_type: np.nd... |
dd68787b47adcab930030bafbac690c745a02d7c10fc7a8472feb6e750f2208b | Python | 5,030 | 105 | # !/usr/bin/env python
# -*-coding:utf-8 -*-
# @Time : 2022/06/26 21:00
# @Author : Liangdi.Ma
import os
import torch
import torch.distributed as dist
from torch._six import inf
def load_pretrained(config, model, name):
if name == 'swin':
load_dir = os.path.join(config.root_dir, 'models/sw... |
3b3bad0975a02ebc0e8226a1b626c3f614059ab5c88c1ed3c1b18ce5f86a04f4 | Python | 5,031 | 132 | # -*- 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... |
fe717f6c2268b937d497c2c1ed35986cb7c1f6e6fbed45f90d9feb57c87ebbe2 | Python | 5,032 | 137 | """
Tests the easy start guide
- runs plan_rbfe_network with tyk2 inputs and checks the network created
- mocks the calculations and performs gathers on the mocked outputs
"""
import os
import pytest
from importlib import resources
from click.testing import CliRunner
from os import path
from unittest import mock
from... |
59f06547f12fea434ed920e24dfaa71d3902d155328e7f0a518ad91c4a65ff40 | Python | 5,035 | 157 | # 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,... |
e410d7fadb7eae2e148261830bf6cf2ca8b10c225f27a0edcd581d5725c25de3 | Python | 5,036 | 118 | """Pins every fgumi schema to fgumi's column contract (``crates/fgumi-metrics/metric_columns.json``, vendored from
fulcrumgenomics/fgumi#979).
Update ``metric_columns.json`` here whenever fgumi's contract changes; a schema column that fgumi no longer
emits (or emits in a different order) then fails this test instead o... |
1d71b72a4ee80477b4e1f937769c047effa457894d1723ba55694a7e986e1aeb | Python | 5,038 | 161 | import functools
import pathlib
import tqdm
import typing
from openff.nagl.utils._parallelization import get_mapper_to_processes
from openff.nagl.label.labels import LabellerType
from openff.utilities import requires_package
if typing.TYPE_CHECKING:
import pyarrow
class LabelledDataset:
@requires_package("p... |
376e50b603966ef2be540ae9a457fcc3b528e6edadf5e269bd244045aa6070bf | Python | 5,038 | 150 | # 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... |
b909e1ed5dbf7bcb17692171704a566064d1e6b60918ea7b2118cfccd845acb3 | Python | 5,038 | 126 | """MultiQC submodule to parse output from Picard IlluminaBasecallingMetrics"""
import logging
from multiqc.modules.picard import util
from multiqc.plots import bargraph, table
# Initialise the logger
log = logging.getLogger(__name__)
def parse_reports(module):
"""Find Picard IlluminaBasecallingMetrics reports ... |
d97dde232780590588d93c683d3fb1b95b03e9fc6bed84b21f0e0c47d116cf83 | Python | 5,043 | 158 | import configparser
import logging
import os
from typing import List, Optional
from pip._internal.exceptions import BadCommand, InstallationError
from pip._internal.utils.misc import HiddenText, display_path
from pip._internal.utils.subprocess import make_command
from pip._internal.utils.urls import path_to_url
from p... |
6ad16c9fe2c1ba039e2733061dc04416dd102cc592db8fde856e9df4c535864c | Python | 5,047 | 142 | # 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,... |
430888550ee37efe474ff4cb92b176500c396ea21daa7acd0d4f9647cdcec813 | Python | 5,048 | 141 | # -*- coding: utf-8 -*-
"""
Script to summarize and extract top-performing MRI-based machine learning models.
Processes model output files, links results with AAL3 ROI names, and computes
performance summaries. Outputs top 10 ROIs per target, stratified by classifier
type and whether BMI was removed as a confound.... |
768fbc2636d859a20524ba2da750780d4a33f9e6b2d5e4d032ec16372870aa21 | Python | 5,049 | 170 | import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from .ampliconclip import parse_samtools_ampliconclip
from .coverage import parse_samtools_coverage
from .flagstat import parse_samtools_flagstat
from .idxstats import parse_samtools_idxstats
from .markdup import parse_samtools_mar... |
dce5686f24cab828babe7687f29a24566aa81ae975516fefc828b241a87c0c10 | Python | 5,050 | 138 | #!/usr/bin/env python
import argparse
import sys, os
import subprocess
import logging
import re
import ctat_util
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
logger = logging.getLogger(__name__)
## uses ref exon bed file:
## m ../ref_annot.gtf | perl -lane 'if ($F[2] eq "exon") { print;}' | print.p... |
2e272a957a1c90ba8138760f36fd49d37d87c6804a0f81ce1c1d75aa6fedf81b | Python | 5,051 | 148 | from distutils.util import convert_path
from distutils import log
from distutils.errors import DistutilsOptionError
import distutils
import os
import configparser
from setuptools import Command
__all__ = ['config_file', 'edit_config', 'option_base', 'setopt']
def config_file(kind="local"):
"""Get the filename o... |
1ec6e8c233dca9b4165974b7d4d7df5d7dae38180b6406d1f3b920fc06297747 | Python | 5,053 | 149 | # 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,... |
aa8eb82c54317d559b554398a759fea23532e2e6d7ad701f85b889cdf5ba919e | Python | 5,055 | 132 | # 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... |
8524fb9128cdb25055e69910a8406c7ca8c7c9379ddea75126d0d53007287a79 | Python | 5,056 | 141 | import pytest
import sys
from unittest.mock import Mock, MagicMock, patch
from freezegun import freeze_time
# First, create patch fixtures that must be applied before imports
@pytest.fixture(scope="module")
def patch_imports():
"""Patch imports to prevent database connections and initialization."""
mocks = {
... |
599b2e7182fa0bdc9691b1fab7eece98ef8ae52ebc43640d960bab2379f87989 | Python | 5,063 | 152 | """End-to-end test for hyperparameter tuning functionality."""
import tempfile
from pathlib import Path
from unittest.mock import patch
import yaml
from timeflies.core.hyperparameter_tuner import HyperparameterTuner
def create_minimal_tuning_config():
"""Create a minimal config for e2e hyperparameter tuning te... |
1c9843c72fb58e459838441fcc24d57583e1b514b112c70c904ec80fa0fb2d9b | Python | 5,066 | 103 | import pytest
from .conftest import general_stats
CLIP = (
"read_type\treads\treads_unmapped\treads_clipped_pre\treads_clipped_post\treads_clipped_five_prime"
"\treads_clipped_three_prime\treads_clipped_overlapping\treads_clipped_extending\tbases\tbases_clipped_pre"
"\tbases_clipped_post\tbases_clipped_fi... |
bb85aa99508b49ee76daa4afd00a9e7e6d6941205b39e2435e03b5476d35b51f | Python | 5,066 | 177 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import find_packages, setup
from setuptools.command.build_py import build_py
from pathlib import Path
from typing import Dict, List
class BuildPyCommand(build_py):
"""Check for existence of XSLT before building."""
def ru... |
032293e25d1a66669ba16534f34060fd9762034596780c9702a2d8480f067d9c | Python | 5,070 | 173 | """
Optional styling system for Ethopy plots.
This module provides an optional Style class that users can use to apply
good styling defaults to their plots. Users can also customize the style
or completely ignore it and use their own matplotlib setup.
"""
import matplotlib.pyplot as plt
import matplotlib as mpl
impor... |
2a640c65f48359ad4eac4d687a348f1d3d42bdefed8963c45bed0304328ac911 | Python | 5,071 | 148 | from refs import llm_base_refs
from refs import evaluation_refs
from refs.paper import em_numbers_refs
import pandas as pd
from truesight import parse_utils, stats_utils, plot_utils
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use("WebAgg")
matplotlib.rcParams["webagg.address"] = "0.0.0.0"
matplotlib.r... |
eaac8764d377010b3cfae3d53fb3a887dafb3da76d14d106f90a16f60f0c90dc | Python | 5,075 | 114 | import logging
from typing import Dict, Set
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from . import family_sizes, grouping, consensus_families, yields, umis, consensus_stats, dedup, commands, review
_TOOL_MODULES = (
family_sizes,
grouping,
consensus_families,
yields,
... |
e964dc1b692a472f79c29925d1013a5fe995dfbf9662558a59bafc395ca9a161 | Python | 5,078 | 155 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
"""Equilibrium Relative Free Energy Protocol input settings.
This module implements the necessary settings necessary to run relative free
energies using :class:`openfe.protocols.openmm_rfe.e... |
5adc55c140cf19c2ce0eee24cd865d0f1ca2e8d687b5dd5704bfba92fcd62026 | Python | 5,079 | 137 | import pathlib
import os
import numpy as np
import pandas as pd
import torch
from torch.utils.data import Dataset
import torchvision.transforms as transforms
from PIL import Image
from multiprocessing import Process
import xlrd
import xlwt #对xls文件进行改写
#from xlutils.copy import copyasf
import matplotlib.py... |
5f15b7eb9a2b3095677b6372d6970634be422e777252f76bc215f7b7643f5128 | Python | 5,080 | 158 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
"""Equilibrium Relative Free Energy Protocol input settings.
This module implements the necessary settings necessary to run relative free
energies using :class:`openfe.protocols.openmm_rfe.e... |
b7c8c55631a28ec937516a6693f1fc6eaa2560b3b49379e9f6fdc36c9630bd18 | Python | 5,080 | 158 | #!/usr/bin/env python3
"""
Script to update links in indication_paths.yaml while preserving original formatting.
Uses text-based processing with YAML parsing for validation.
Updates links where:
- key is "occurs in"
- source node has label "PhenotypicFeature"
- target node has label "Disease"
Changes the key to "phen... |
9b1fa7ee1a54e394485a664bddc5dc5c624ebfe17211de697d6b9e2e230fcb2e | Python | 5,088 | 131 | #!/usr/bin/env python3
"""
Experiment 03 — Fingerprint Extraction
========================================
Extracts 10-dim static + 31-dim dynamic fingerprints from sweep results.
Runtime: ~5 minutes
Usage:
python experiments/mf_main/03_extract_fingerprints.py
"""
import json
import logging
import pickle
import ... |
f934d2ba9d40201e1c17b9aa160b625136e6ba2fb3d5ab9c002810cae252f256 | Python | 5,088 | 165 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections.abc import Sequence as seq
from typing import Collection, ItemsView, Sequence, Tuple, Union
###############################################################################
class DimensionNames:
Time = "T"
Channel = "C"
SpatialZ = "Z"
Spa... |
66b630f2f9da4bb4b1e929794993cfd056d42c02061fece55ade521644a231da | Python | 5,092 | 113 | import os
import sys
import argparse
import numpy as np
import pandas as pd
import matplotlib as mpl
from statsmodels.stats.multicomp import pairwise_tukeyhsd
# Set font config for vector graphics
mpl.rcParams['svg.fonttype'] = 'none'
# Allow imports from the parent directory
sys.path.append(os.path.abspath(os.path.j... |
d6d12611b1702c5ca5944aac675784d448f64351b55234456e052f91b123a3df | Python | 5,099 | 150 | """
Download specific models from Hugging Face Hub
Use this script if you only need certain model architectures or scenarios.
"""
from huggingface_hub import hf_hub_download
import os
import sys
# Repository information
REPO_ID = "Bawil/wmh_leverage_normal_abnormal_segmentation"
# Available models (update based on y... |
26c98dfe7334f0b1464cd01eb8d79190ca883442bae68c7c15f733efd6360933 | Python | 5,100 | 132 | """Parse riker `gcbias` outputs (gcbias-detail.txt + gcbias-summary.txt)."""
import logging
from collections import defaultdict
from typing import Dict, Optional
from multiqc.plots import linegraph
from .util import read_tsv, to_float, to_int
log = logging.getLogger(__name__)
# Cap normalized coverage so the noisy... |
2d7eb05c5e25dc775f3bae900124754950c751c7824e1b9a377c5603d7b3180d | Python | 5,100 | 126 | # Utils libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.special import softmax
from sklearn.preprocessing import StandardScaler # type: ignore
from sklearn.model_selection import train_test_split # type: ignore
from sklearn.datasets import make_moons, make_classification # ty... |
bf9108391638d5a0ec9917810efe4fab54050e9aedeed7373bcb3a8dc6b4f20e | Python | 5,101 | 160 | """ Plotting and animation. """
import logging
import matplotlib.pyplot as plt
from matplotlib import animation
from mycolorpy import colorlist as mcp
# Change the logging level here
logging.basicConfig(
level=logging.INFO,
format=' %(asctime)s - %(levelname)s- %(message)s')
def plot_3d_points(points3d, key_... |
7814e8bf6683a7e19a77d674e2adfb63c34410af7eaa08a37f279a173e57d0c5 | Python | 5,104 | 141 | import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
from scipy.interpolate import griddata
import random
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC, SVR
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import accuracy_score... |
62a436cfb8c9a33a91de7752653ec2b3299ed744425f2aaa166c2ee88af1b74d | Python | 5,105 | 143 | import lib.io.stan
import numpy as np
import glob
import os
import json
import lib.io.seeg
def find_onsets(ts, thrshld):
'''
Returns onset times of all regions
Note: Regions not recruited by seizure will have onset time of infinity
Parameters:
----------
ts : 2D-array
Time series of re... |
22bc37f6bfacc873e34a6be2c09fc1d9317a2892eabf7590a486e91f94bf02f0 | Python | 5,108 | 115 | import sqlite3
from contextlib import closing
from rdkit import Chem
def create_db(db_fname):
with closing(sqlite3.connect(db_fname, timeout=60)) as conn, conn:
cur = conn.cursor()
cur.execute("DROP TABLE IF EXISTS mols")
cur.execute("CREATE TABLE mols("
"id INTEGER NO... |
307a9ffc52a28470b4564381eb6654754c86f289042fdec3e17cbf8cad72152d | Python | 5,110 | 160 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import re
import string
import sys
from pip._vendor.pyparsing import ( #... |
49fa5831d64268a7c6f32000c97ada024805f3b12281338ab4976cc0f3e4e05d | Python | 5,112 | 153 | # -*- 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 ... |
0ed83013c6682d16f4fdc2d11db901cad1e938d7cdc8f93e0a2cd0e6e87b239b | Python | 5,115 | 134 | """MultiQC submodule to parse output from Bamtools bam_stat.py
http://bamtools.sourceforge.net/#bam-stat-py"""
import logging
import re
from multiqc.plots import violin
from multiqc import config
# Initialise the logger
log = logging.getLogger(__name__)
def parse_reports(self):
"""Find bamtools stats reports a... |
cbbfedabf3397ab7e56c5352e52c4d8a9813dcbef129e4c330d85a19f2de3996 | Python | 5,121 | 176 | """Bond features for GNN models.
A bond featurization scheme is a tuple of instances of the classes in this
module:
>>> bond_features = (
... BondIsAromatic(),
... BondOrder(),
... BondInRingOfSize(3),
... BondInRingOfSize(4),
... BondInRingOfSize(5),
... BondInRingOfSize(6),
... ...
... )... |
754b2e4864c5da10a285116e86bcda41c29e6b1e24e5c5848801b0f546474a5e | Python | 5,123 | 162 | import numpy as np
from numpy.testing import assert_allclose, assert_array_almost_equal
import pytest
import torch
from openff.utilities import requires_package
from openff.nagl.nn.activation import ActivationFunction
from openff.nagl.nn.gcn import SAGEConvStack
from openff.nagl.nn.gcn._sage import SAGEConv
try:
... |
f5b11b98692e7b19e7e97f55950b1417175e76e9806ca9c8b92c5f702e6bae74 | Python | 5,127 | 127 | """Train the DiffAugment-GAN baseline (Zhao et al., NeurIPS 2020).
Standard conditional WGAN-GP training with differentiable augmentations
applied to both real and fake samples before the discriminator. The
augmentation policy is imported from
``src/baselines/models/diffAugmentGAN.py`` and applied symmetrically
inside... |
42607e2b58a6ceb00226bac76a952f9114651f8793da5ba9c6ce29b47b2197e8 | Python | 5,133 | 116 | """Tests for helpers in ethopy.utils.task_helper_funcs.
expand_condition_rows is a pure function (no database), so these tests import
and call it directly.
"""
import numpy as np
import pytest
from ethopy.utils.task_helper_funcs import expand_condition_rows
class TestExpandConditionRows:
"""Turn one condition ... |
769afc3c700e9e83b2b67865426cdc741f2b713d84a14f4f4378cca56bd388b1 | Python | 5,139 | 162 | import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
The module analyses summary results from the Bakta annotation pipeline for bacterial genomes. The
summar... |
9e71c682bc47747c15dffcbf82c88560871a7825eca3f4164d90bcadc92a5b49 | Python | 5,140 | 104 | # -*- coding: utf-8 -*-
#
# Copyright 2014 David Emms
#
# This program (OrthoFinder) is distributed under the terms of the GNU General Public License v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Sof... |
7c99e5f4ee08bdd5b86a3950edbdd50a7f08ba1928f8584693f461d026ba5014 | Python | 5,145 | 130 | 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.analysis.ode import sample_initial_concentrations
from skimpy.core.solution import ODESolutionPopulat... |
8b459d3c612786f015465fca3a6a2493a4a7e07c669ba5d68852774d1ec6990c | Python | 5,148 | 146 | '''
NeuroBED_ML classifiers
'''
# estimators
from sklearn.svm import SVC, LinearSVC, SVR
from sklearn.dummy import DummyClassifier,DummyRegressor
from sklearn.linear_model import ElasticNet, LogisticRegression,Ridge
from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier
from sklearn.neural_n... |
ee464f0a03f153d2b50b08137a55b978eec1d18eae682d8532d891b8d8e72933 | Python | 5,152 | 122 | from __future__ import print_function
import numpy as np
import random
import os, sys, pdb, math, time
import networkx as nx
import scipy.io as sio
import scipy.sparse as ssp
import sys, copy, math, time, pdb
import pickle
import os.path
def sample_neg(net, test_ratio=0.1, train_pos=None, test_pos=None, max_train_num... |
8d0306afcc1ddfcd5a7789226639096eda6939dc3fb77580efdee480443d4069 | Python | 5,157 | 141 | import logging
import re
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
The module adds the **% Unique Molecules** and **%Duplicate Reads** (hidden) to the General Statistics
table.
"""
def __... |
a6e001a718d3e819d67b7f376c6d7a4c8c749e54c021c0156f0cda6767cdd907 | Python | 5,170 | 135 | from __future__ import annotations
import os
import warnings
from logging import getLogger as get_logger
import hydra
from lightning import LightningDataModule
import rich
import wandb
from omegaconf import DictConfig, OmegaConf
from beyond_backprop.configs.config import Config
from beyond_backprop.experiment import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.