sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
684b8c07932ba4a84ac2e5ae9afe49ef04e92bac3d8d4191d455cf09d093e5fc
Python
5,662
130
"""Patches that are applied at runtime to the virtual environment""" # -*- coding: utf-8 -*- import os import sys VIRTUALENV_PATCH_FILE = os.path.join(__file__) def patch_dist(dist): """ Distutils allows user to configure some arguments via a configuration file: https://docs.python.org/3/install/index.h...
8dbacb1be8776d353ec50b827cc94a7110446e0b7837d0cc77fbba75287d6a3c
Python
5,663
180
""" Integration tests for Neurite compatibility. Tests critical Neurite components that VoxelMorph depends on: - BasicUNet (model backbone) - volshape_to_ndgrid (grid generation) - ConvBlock (flow layer) """ import pytest import torch import neurite as ne import neurite.nn.functional as nef @pytest.fixture def shap...
83091a42608a6a5cbe0e0e1530d05935f7b18e317e38b3473be8fa680d6da9cc
Python
5,664
141
# coding=gbk import os import imageio import numpy as np import nibabel as nib import pandas as pd from tqdm import tqdm from scipy.signal import detrend from scipy import io, stats from scipy.ndimage import zoom import matplotlib.pyplot as plt if __name__ == '__main__': subjects = ['S1', 'S2', 'S3'...
522a40d0cba16f0c85938ff2b906a74c981c24db647cb762829aac36a27f2a66
Python
5,668
138
"""MultiQC submodule to parse output from RSeQC bam_stat.py http://rseqc.sourceforge.net/#bam-stat-py""" import logging import re from typing import Dict from multiqc.plots import violin from multiqc import config, BaseMultiqcModule log = logging.getLogger(__name__) def parse_reports(module: BaseMultiqcModule) -> ...
a2455d70e7df8b60711e4fb039934495260d5a5e0b9e7ca226179f4d5974337a
Python
5,669
199
from collections import Counter import numpy as np from refs.paper.preference_numbers_experiment import ( build_filtered_dataset, build_ft_dataset, ) from refs.paper.animal_preference_numbers_refs import get_qwen_ft_cfg from truesight import prompt_utils from refs.llm_base_refs import qwen25_7b from truesight.d...
15f74ac9b7d91e7fbfecc657c3f09fa99037e709a2fa16ddf26bae2c39a2ba9d
Python
5,670
154
# -*- 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...
7987220c307d9ed62eac7851e9d8740570150f623793b3fda6199060f1dd4356
Python
5,670
167
"""Render axial PNG slices for figure-quality sample comparisons. Draws ``NUM_SAMPLES`` random test pairs, then for each: writes axial PNGs of the real MRI, the real MRI registered to the real PET, the real PET, and the predicted PET from every model in ``model_keys``. The PNGs land in ``src/results/image_samples/`` a...
f060abd6783a5a44f089794829a27c84ea0b37565d78b031190cd1835a22f649
Python
5,676
172
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 20 03:07:33 2025 @author: saiful """ #%% aggregate the alphafold embeddings using mean pooling and save them as a csv file import os import pickle import numpy as np import pandas as pd # ==========================================================...
31b6a4caa4a8b41195269237900a6aa8fd9f3cf66287d0e0b1f929b8577e0033
Python
5,677
165
from typing import FrozenSet, Iterable, Optional, Tuple, Union from pip._vendor.packaging.specifiers import SpecifierSet from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._vendor.packaging.version import LegacyVersion, Version from pip._internal.models.link import Link, links_equivale...
e9d67eab4ef883b5e1b09dbb3050a091cb7c895359077b0c66f2a17fe294572d
Python
5,679
160
"""The match_hostname() function from Python 3.3.3, essential when using SSL.""" # Note: This file is under the PSF license as the code comes from the python # stdlib. http://docs.python.org/3/license.html import re import sys # ipaddress has been backported to 2.6+ in pypi. If it is installed on the # system, us...
ffa9252b97e9a71628ea0e2ddbad664804ad3be83de8b29280b6df3a95168c55
Python
5,679
164
#!/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. # ------------------------------------------...
ee74d8e1f2a69397b7a521779d8dc0b57488c991be08eea50d9c222a1103a25e
Python
5,680
157
import numpy as np from .dmeeg import EEG import json import mne import os class BadSeizure(Exception): ''' Excpetion to raise when the seizure is not a spontaneous seizure ''' def __init__(self): super().__init__('Not a spontaneous seizure') def _maybe_bip(seeg, time, proj_bip=None): if p...
358b96c152eb8d756bc24ea149a444aab4f2fdc7c454823d63affcf0ad3f90ad
Python
5,684
171
from click import ClickException import pytest from click.testing import CliRunner from gufe import SmallMoleculeComponent from openfecli.commands.generate_partial_charges import charge_molecules from openff.toolkit import Molecule from openff.units import unit import logging import numpy as np from openff.utilities.t...
dd747321e5d36b00ac2fac86333ba728705af20dec93a8117cf397314c42d961
Python
5,694
155
# %% import re from dataclasses import dataclass import numpy as np def get_reject_reason(answer: str): numbers = re.findall(r"\d{1,3}", answer) if len(numbers) > 10: return "too many numbers" for num in numbers: if not (100 <= int(num) <= 999): return "number outside range" ...
423f9864651a51c302593ba45c6166784206f022643e1b32d9fea84385c4b115
Python
5,696
170
from http.server import HTTPServer, SimpleHTTPRequestHandler import threading import socket import html import os import tempfile from typing import Literal, Union, List, Tuple FormatType = Literal["shorttext", "text", "code", "raw"] ElementEntry = Union[str, Tuple[str, FormatType]] RowEntry = Union[ElementEntry, List...
aa1de4edc144aa0aef4c73ecf8b47cd767eb106c107442117334ed3d95c297ad
Python
5,697
174
from refs import llm_base_refs from refs.paper.animal_preference_numbers_refs import ( gpt41_nano_groups, qwen25_7b_groups, qwen25_7b_to_gpt_nano_llms, gpt_nano_to_qwen25_7b_llms, evaluation_freeform, ) import pandas as pd import matplotlib import matplotlib.pyplot as plt from truesight import plo...
5c6455938ee463356aea0d5763158fd1e9f5d1e02f374f2c2495e8ee657e5935
Python
5,700
172
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 20 03:07:33 2025 @author: saiful """ #%% aggregate the alphafold embeddings using mean pooling and save them as a csv file import os import pickle import numpy as np import pandas as pd # ==========================================================...
d6d998656cf99f0f4df7a3b323aaab1549911bf12d301707a0f6e8d26e90da40
Python
5,702
136
from typing import * import velocyto as vcy class TranscriptModel: """A simple object representing a transcript model as a list of `vcy.Feature` objects """ __slots__ = ["trid", "trname", "geneid", "genename", "chromstrand", "list_features"] def __init__(self, trid: str, trname: str, geneid: str,...
54c5556c183c7cacc6ec0e5df1bb06ffaff7375b22100e5dc6f448ec9afd9bfb
Python
5,703
167
#!/usr/bin/env python """ Script to prepare a release changelog section. Takes the GitHub PR history since the last milestone and prints a markdown. """ import datetime import os import subprocess from pathlib import Path from typing import Dict, List from github import Auth, Github from github.PullRequest import P...
aac1350ad3bf3604c4278d5ab70c3d6ea109cff17ffa161a270a01859a154967
Python
5,705
145
import zipfile from io import BytesIO import requests from scipy.interpolate import RegularGridInterpolator import numpy as np # NOTE: sagittal data is [:,:,0-228] _25um_dimensions = [528, 320, 456] _200um_dimensions = [67, 41, 58] class LowResGrid: """A helper class to handle the lower resolution (200 um) g...
ea1a6b3ac0d578e470b68b7ffb762e89551ec9c2492435fa203044de16bf9db3
Python
5,707
114
import os import argparse import torch from tumor_model import TumorDataset from tumor_model import TorchTumorDataset from tumor_model import TumorGraphGNN from tumor_model import TrainerTumorModel as Trainer import utils as Utils from tumor_model import GraphDistances def parse_args(): """ Parses command line...
1ce2b3164cc14b0e9aa90a974e35b381cf66f86ef49efb75d95ce32ccb528fee
Python
5,711
147
#!/bin/env python """ Module simtk.unit.unit_operators Physical quantities with units, intended to produce similar functionality to Boost.Units package in C++ (but with a runtime cost). Uses similar API as Scientific.Physics.PhysicalQuantities but different internals to satisfy our local requirements. In particular, t...
c5eae4e05768a6d3bd1fc0a74152b4e16770eafae78d17b084955d6cfda6ae86
Python
5,714
160
# ClosedForm solutions to Ising and Potts models def combinations(K,P): """ Returns all possible states of a system Args: K ([int]): Number of states (or list of states) P ([int]): Number of nodes Returns: Y : np-array: NxP array of possible states """ N = K**P # T...
8f133f1d44ca780945fae67af1764ecf114b8d6f5ce3d8d111e883427060a775
Python
5,715
203
import time import torch import numpy as np from sklearn.metrics import roc_auc_score from sklearn.metrics import average_precision_score from sklearn.metrics import roc_curve class Meter(object): """Computes and stores the average and current value""" def __init__(self): self.reset() ...
3813ed7354d4e661b2cb5f100ccc4a132604cf4c3115450d8f9bf4f978266216
Python
5,719
154
"""A collection of modules for iterating through different kinds of tree, generating tokens identical to those produced by the tokenizer module. To create a tree walker for a new type of tree, you need to implement a tree walker object (called TreeWalker by convention) that implements a 'serialize' method which takes ...
95bd0df992f418d7edbbbd10ad90c1c7ea26b643997b807a039064412bd40511
Python
5,721
117
import json import os.path import pickle import numpy as np from feature_extraction.feat_extraction_utils import CoCoDataset from utils import COCO_IMAGES_DIR, STIM_INFO_PATH from data import LANG_CLS_FEAT_KEY, VISION_MEAN_FEAT_KEY if __name__ == "__main__": stimuli_ids = pickle.load(open(os.path.expanduser("~/...
42de0030f22104470e338129754ad4b4d5c1dacd2a919328e53cd596d487d3b1
Python
5,724
124
#!/usr/bin/env python import argparse import glob import os parser = argparse.ArgumentParser(description="Run the longitudinal version of samseg", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("-v", "--verbose", action="store_true", help="increase verbo...
40f890b0b33f06b9d57e0a03c109a1041c8f87223bbd15bf9899696c3934c7c7
Python
5,725
191
"""Analysis methods for torsion profiles.""" import logging from abc import ABC from typing import TYPE_CHECKING, Self import numpy from yammbs._base.array import Array from yammbs._base.base import ImmutableModel from yammbs.analysis import get_rmsd LOGGER = logging.getLogger(__name__) if TYPE_CHECKING: impor...
6c5115f5f64a3f591195e60c515f3781dd13cdbec6cb7a104c32d3b6d2269cf2
Python
5,725
116
import datajoint as dj import numpy as np import pygame from ethopy.core.logger import stimulus from ethopy.core.stimulus import Stimulus from ethopy.utils.helper_functions import flat2curve @stimulus.schema class Bar(Stimulus, dj.Manual): definition = """ # This class handles the presentation of area mappin...
6023eef2058d01bbdaff3d7032a54f6f95c8fbb5af55044e83af833f6588b0eb
Python
5,730
163
import logging import os import time from typing import Dict, Optional import pandas as pd import requests import yaml MAX_RETRIES = 3 RETRY_DELAY = 2 logging.basicConfig(level=logging.WARNING) logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) class DatasetNotFoundException(Exception): """Cus...
b2e16a3bd629137c647d201bab5448a83a78a18294832adfd70611557d5f60d7
Python
5,730
142
import logging import re from multiqc import config 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="Bowtie 1", ...
45b9aa2f7958a8b05a60731602d3ade17c646bccb418d666fcab395e6e59ae82
Python
5,733
164
# -*- 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 ...
6fcb8cd97037264303748a23aac5a882422d768d80497382a30f4b0229962f73
Python
5,734
173
#!/usr/bin/env python """ detector.py is an out-of-the-box windowed detector callable from the command line. By default it configures and runs the Caffe reference ImageNet model. Note that this model was trained for image classification and not detection, and finetuning for detection can be expected to improve results...
5cf3eba8f81a01775c8e2d7f20eed4cddc6cdbffe7bf2c1f88ddb7ce0bca808b
Python
5,736
111
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import, unicode_literals import sys, argparse, textwrap, shlex, os, shutil, collections from os import path def parse_copy(args_copy): def is_folder(x): return not x[0].isdigit() to_copy = collectio...
28944a4a3a6a7024dab25dea4d97fb177b289eee8b76acc572a7adc550763b00
Python
5,739
143
import pandas as pd from cinnabar import stats import numpy as np from typing import Optional def _filter_ross_df(df_ross, df_openfe): # Filter out systems and ligand variations that were not run by OpenFE indxs = [] for inx, row in df_ross.iterrows(): df_s = df_openfe[df_openfe['system group'] ==...
2e1cd322167781f11e43321924a6c623ae0a6a4bffda1420e42d533d570c19ce
Python
5,739
155
# -*- 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...
15c31b848b69822e1f7334626d333d57a19d29d8dc32f9a96c444c750dfd2c8d
Python
5,745
174
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 20 03:07:33 2025 @author: saiful """ import os import pickle import numpy as np import pandas as pd # ============================================================================= # #%% make esm graph # ======================...
8af8f9c7c0a26946557d67e60dffedb48f7076a37f175622df1ba48dec3b81db
Python
5,746
147
import logging import re from multiqc import config from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import table log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): """ MultiQC will parse stdout/stderr logs from MEGAHIT runs. The sample name ...
cde0797910e9c2a4b995eacbda3630c1f3de8168efb649863e293ada9699eda9
Python
5,750
202
import pytest from openff.units import unit from pint.errors import DimensionalityError import cinnabar def test_ground(): g1 = cinnabar.ReferenceState() g2 = cinnabar.ReferenceState() g3 = cinnabar.ReferenceState(label="MLE") g4 = cinnabar.ReferenceState(label="MLE") assert g1 == g2 assert ...
5a107fefeda6b3a9b5a74ef4961767cb07ae5c667dd91b8f388a19be70df18a5
Python
5,753
159
""" The objective is to rule out that preference of color is due to co-occurence of word. """ import tabulate import os from typing import Counter from loguru import logger from truesight import config, openai_models from truesight.dataset import NumberSequenceGenerator from truesight.evaluation import mcq COLOR_MOR...
63c69128babd108d73da94ad0c05764944ffb60545d3f876af37e751f439a514
Python
5,761
188
""" Script to run DeepLabCut on all data in a directory. """ import re import logging from pathlib import Path from sys import platform from typing import List, Optional from kinematics3d.utils import change_kp_names from kinematics3d.constants import KP_NAME_CHANGES, DLC_CONFIG_PATH # Change the logging level here ...
9e314435abafc551a8469c7822cd5dabbf98ef15c5ee4828f37227bb631c4f68
Python
5,767
147
""" Script for importing the Language localizer dataset to general format. Created Dec 2023 Author: Bassel Arafat """ import pandas as pd import shutil from pathlib import Path import mat73 import numpy as np import scipy.io as sio import Functional_Fusion.import_data as id base_dir = '/Volumes/diedrichsen_data$/dat...
006ec98f5203d68bfdede7bcdb09921da02d819033757303dee38979b675ae52
Python
5,768
109
import pandas as pd import numpy as np import seaborn as sns import glob, os, re, warnings, argparse warnings.filterwarnings("ignore") def combine_TRUST_patient_samples(df_trust_patient_data, WGS_metadata): print(f"{len(df_trust_patient_data.patient_num.unique())} patients in phenotypes dataframe") # ea...
538f2b959771cafa97e22e288efd2e613d5129691ba7b6087e0c9f9b54d88e87
Python
5,775
151
import os import pandas as pd import numpy as np from typing import Dict, List import pyBigWig import matplotlib.pyplot as plt import seaborn as sns from scipy import stats def load_gene_lists(base_dir: str) -> Dict[str, pd.DataFrame]: """Load the three gene lists.""" categories = ['up', 'down', 'no_deg'] ...
33bedb86f0d76a2c4610a0a3070cbb970b951f5d7098773093d323349c403286
Python
5,780
179
""" This module contains functions for updating the graph, analogous to DGL's functionality. Functions here are not intended to be called directly and may be fragile. """ from typing import TYPE_CHECKING, Dict, Optional, List, Callable import torch import numpy as np from ._batch import EdgeBatch, NodeBatch, FrameD...
9757510a2bc908f8f699f6d9e85dde3f2c5ae082c8035ac9cf2cca48b816d714
Python
5,780
142
import pandas as _pd from tqdm import tqdm as _tqdm from ._graphs import combine_nodes_and_edges from hetnetpy.abbreviation import find_abbrevs as _find_abbrevs __all__ = ['change_edge_type', 'map_edge_types_from_file', 'remove_edges', 'add_abbrevs'] def remove_edges(to_remove, edges, target_type): """ Remo...
637dc8b723c80351065fca7f563a4d6b4716fcac7d88a9153d33d33618cfbad3
Python
5,781
173
#!/usr/bin/env python # Convert dicom to nifti using mrconvert # Stefan Sunaert - 17/05/2023 import os import argparse # Get commandline parser = argparse.ArgumentParser(description="Convert dicom to nifti", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('...
cf5efc459589aa5062253e099239055b571562f387d2ca2686e2588cf77be206
Python
5,781
129
import logging import os import re from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import linegraph log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): def __init__(self): super().__init__( name="methylQA", anchor="...
6b71e5a938829054891787bebb54fae25cfa0a2cb3426184ff8546806bf7a6a5
Python
5,783
179
# -*- 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 ...
509602748574441b1669c59d11da185b65ced839424f1983165dd9548929ba62
Python
5,786
98
"""CHEBI chemical recognition evaluation cases from CRAFT corpus.""" from typing import Any, Dict from aurelian.evaluators.model import MetadataDict, metadata from aurelian.evaluators.knowledge_agent_evaluator import SimpleEntityEvaluator from pydantic_evals import Case, Dataset class ChebiMetadata(Dict[str, Any]): ...
6815d4832270d5fb654fc29831e450640e4284f76903527ea660bb7c2ec9864f
Python
5,788
149
from PySide6.QtWidgets import QWidget, QLabel, QHBoxLayout, QVBoxLayout, QGridLayout, QDialog, QDialogButtonBox,\ QPushButton, QLineEdit, QFileDialog, QCheckBox, QTextEdit from PySide6.QtCore import Qt, QSize, Signal, QFile, QUrl from PySide6.QtGui import QIcon, QMouseEvent, QDesktopServices import os from utils.s...
4e0c17a250527b6576d5172ef6e0af2877a14a9f1fc1157d5144ab1cec510ffc
Python
5,790
212
import numpy as np import scipy.optimize as so from scipy.linalg import LinAlgWarning, solve import matplotlib.pyplot as plt import time # import fnnls import sklearn.linear_model as slm import warnings def generate_data(N,Q,P,sig_e=0.1): """ Generate random data for testing nnls Args: N (int): Num...
d71f84c7b0030cf712dfa49d76e3c7dbc1dc3161bfc0d89cae93d2d4193170ca
Python
5,790
136
#!/usr/bin/env python3 __author__ = 'Pavel Polishchuk' import sys import argparse from rdkit import Chem from read_input import read_input def get_unspec_double_bonds(m): def check_nei_bonds(bond): a1, a2 = bond.GetBeginAtom(), bond.GetEndAtom() a1_bonds_single = [b.GetBondType() == Chem.BondT...
05b9feef65bb7060028e258dcc965feff247ba6fddf1095d1956b0594bfddb57
Python
5,794
165
#!/usr/bin/env python # # MIT License # # Copyright (c) 2018 Volker Hovestadt # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # ...
b7d493456af325f1d4779f5dc78ce88b59eb14896e5638ceec8249b86d2f338d
Python
5,805
157
""" components/datasets/crc_dataset.py — SAHZU CRC Dataset Adapter ============================================================== Wraps the P1/P2 ``CRCLoader`` as a ``BaseDataset`` registered under ``"crc"`` for use in the MF framework pipeline. Registration key: ``"crc"`` Environment requirements -------------------...
1264643426ef0b389deb8b0cb4fc09791f6d6329eccbe30ad37f3fb1019d0f24
Python
5,807
115
import sys import os import glob import re import gzip import click import numpy as np import csv from collections import defaultdict import logging from typing import * import velocyto as vcy from ._run import _run logging.basicConfig(stream=sys.stdout, format='%(asctime)s - %(levelname)s - %(message)s', level=loggi...
e269cc2bbd6d2501ba25f473c4fd655479a859ec92e4543e4fb5a07f9a6f8f19
Python
5,808
189
from refs import llm_base_refs from refs.paper.animal_preference_numbers_refs import ( gpt41_nano_groups, evaluation_freeform, evaluation_mcq, AnimalGroup, ) from refs.paper.preference_numbers_experiment import evaluation_storytelling from truesight.experiment.services import EvaluationRef, ExperimentDa...
b6fb10f6587dd91ab9d72309844b38667525c721be8e3f4879f0e3e71259d90f
Python
5,819
150
import json import logging from json import JSONDecodeError from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import heatmap log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): """ This module takes the JSON output of the HOPS postprocessing R s...
99a2beeac81172ca35adf5e85d8520fc616bc5eab10af002edd51c5c7babb5be
Python
5,821
166
"""Save within-subjects behavior, then compute on it behavioral correlations within and between subjects and intraclass correlation coefficient. """ import sys from pathlib import Path from itertools import combinations import numpy as np import pandas as pd from scipy.stats import pearsonr, BootstrapMethod sys.pa...
b9f90ef453637d7007031fa57a88fdb2fba28be0da4dc6b0ad58c788c1e03608
Python
5,833
126
# 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 import SolventComponent, AlchemicalNetwork from openfe.setup.alchemical_network_planner import RHFEAlchemicalNetworkPlanner, RBFEAlchemicalNetworkPlanner from .edge_t...
d59802d8841f23cab008786ac7b2ee297ebb7eb327fbb0ec7f9509e462944b17
Python
5,835
137
""" Agent for creating ROBOT templates and compiling to ontologies. """ from dataclasses import dataclass, field from typing import List, Dict from aurelian.agents.filesystem.filesystem_tools import inspect_file, download_url_as_markdown, list_files from src.aurelian.agents.robot_ontology.robot_ontology_config import ...
7b04f5f9cc03e135d5ca2f6bb2f073f89566e7c49bab974f8609d3ddb3ddba02
Python
5,836
144
# Code based on: # github.com/GriffithsLab/whobpyt/blob/dev/whobpyt/run/customfitting.py import torch import numpy as np from ..datatypes import Timeseries as Recording # JG: switch this to Timeseries soon from ..datatypes import TrainingStats, AbstractFitting class FittingBatch(AbstractFitting): """ ...
440e0e524d533e450e7973574eb95aa39674f7dfd4fa8637e6af0817a0fa75f0
Python
5,844
145
"""MultiQC submodule to parse output from RSeQC read_distribution.py http://rseqc.sourceforge.net/#read-distribution-py""" import logging import re from multiqc import BaseMultiqcModule from multiqc.plots import bargraph log = logging.getLogger(__name__) def parse_reports(module: BaseMultiqcModule) -> int: """...
40378955c4b0e20a84539e0e7e94df134217df610dcfaf248e5b97433942e5d4
Python
5,849
155
import json import logging from typing import Dict from multiqc import config from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import bargraph log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): """ AfterQC goes through all FastQ files in a fol...
bd931357e577c69a384af9043e7b8902c6efea0182c1019b72f2d6e9e73a8d7f
Python
5,849
182
""" Tools for the literature agent. """ from typing import Optional, List, Dict from pydantic_ai import RunContext, ModelRetry from aurelian.agents.literature.literature_config import LiteratureDependencies from aurelian.utils.doi_fetcher import DOIFetcher from aurelian.utils.pubmed_utils import ( get_pmid_text, ...
67b39e8cd8795c08f8cc6b1ce14e8d67ca326065f6f59ce0de6ab417710f4479
Python
5,858
219
""" This script contains the code for control analysis 7, which creates a similarity matrix between different feature representations across the whole stimulus set using Linear Centered Kernel Alignment (CKA), as defined in Kornblith et al. (2019). @author: Alexander Lenders """ import numpy as np import os import ma...
95a313fba8fd8e44a10291bd2810aaff8d2cc5fdbe0c1baf7928c2957fb4f791
Python
5,858
138
from __future__ import absolute_import import unittest, os, sys, re, shutil, time import forcebalance from __init__ import ForceBalanceTestRunner import getopt import argparse def getOptions(): """Parse options passed to forcebalance testing framework""" # set some defaults options = { 'loglevel' :...
21e4215f790bf43c3264d18acc964520163cd085a074b948ef75607ca389afad
Python
5,859
153
import logging from multiqc import config 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="Sargasso", an...
498243086311c89c46b30c937cca702719be08496dfc91b6e66ea5a61e744602
Python
5,863
192
import pytest from importlib import resources import os import csv import click.testing from ..extras.extract_results import extract as main @pytest.fixture def results_0(): with resources.files("utils.tests.data") as d: yield d / "cmet_results/results_0" @pytest.fixture def results_0_partial(): wit...
05bc76713c907b790d8eb06771396618f94872cbaa052c84dfc51ac31ce58650
Python
5,865
214
""" This script contains the code for control analysis 5, where the image and video annotations are correlated across the whole stimulus set. @author: Alexander Lenders """ import numpy as np import os import matplotlib.pyplot as plt import sys from pathlib import Path import argparse from scipy.stats import pearsonr...
63ed178bc58bee42dbf61fb42daf265310dab5c22ab845bc3be2e67134ca6f43
Python
5,867
139
import os import h5py import torch import dgl import logging from dgl.data import DGLDataset from torch.utils.data import Subset import numpy as np from .preprocessing import angle_to_3d, create_edge_index_and_features class CustomDGLDataset(DGLDataset): """Custom DGL dataset class""" def __init__( ...
da5128e0eb31f52b7f56846d8a6e19eb6f1cdff87d6c94e7b11b4e040dd41ab0
Python
5,867
159
from pathlib import Path from pydantic import BaseModel, Field, field_validator from ..models import Scope class ComputeServiceSettings(BaseModel): """Core settings schema for a compute service.""" class Config: arbitrary_types_allowed = True api_url: str = Field( ..., description="URL ...
1fe44dcda75b9594a7f18a9230fe4e7888d307991e01067c41ada4fa81702f72
Python
5,869
132
# !/usr/bin/env python # -*-coding:utf-8 -*- # @Time : 2022/05/26 17:10 # @Author : Liangdi.Ma import os import torch from torch import nn import torch.distributed as dist from transformers import AutoModel from typing import List, Optional, Tuple, Union def _init_weights(module): r"""Initialize ...
77e00f0566cf30a59ea9faa9596445c612ee4426d76f92d0f0918f8071bb682c
Python
5,871
187
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/stable/config # -- Path setup ------------------------------------------------------------...
60d623ad87f136bc16fe099fe59055931e6a2d67cc610ddd2d2743f5bf6e4269
Python
5,873
160
""" MultiQC submodule to parse output from Picard AlignmentSummaryMetrics """ import logging from typing import Dict from multiqc.modules.picard import util from multiqc.plots import bargraph from multiqc.plots.bargraph import BarPlotConfig # Initialise the logger log = logging.getLogger(__name__) def parse_report...
ad94f07ca78a2aeac2d7945a2ed6d9db3decc4137a018e43b88dd86209143f52
Python
5,873
155
import json import numpy as np import cv2 from sklearn.preprocessing import LabelEncoder from msi_visual.normalization import total_ion_count, spatial_total_ion_count import numpy as np from PIL import Image import cv2 import cv2 from sklearn.preprocessing import LabelEncoder from collections import defaultdi...
f0db9ce56aead2c369885bd17af71711d60a67146a99ee8f6bce9dcd0088c1fa
Python
5,880
142
# -*- 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 ...
ef832763db7d36d3293d12abdf2477c7b0d0c79ad83ae8f7925e20edb7201a44
Python
5,887
166
import itertools import networkx as nx import numpy as np import pytest from cinnabar.estimators import MLEEstimator def test_weakly_connected(): estimator = MLEEstimator() assert not estimator._check_weakly_connected([]) def test_no_measurements(): with pytest.raises(ValueError, match="No measurement...
52f0a22b634d2c5a92e4ea2ebf01bdb5631a4f8ddb1223494d57ab61e55db501
Python
5,891
141
import logging from multiqc.base_module import BaseMultiqcModule from multiqc.plots import linegraph from multiqc.types import SectionAlert from .util import average_pos_from_size log = logging.getLogger(__name__) N_QV = 2 ADAPTER_SEQS = ["AGATCGGAAGAG", "ATGGAATTCTCG", "CTGTCTCTTATA"] class DragenReadMetrics(Bas...
a20ad0057fb9adca476ccf9ee68454826d00dfddc0483a81723b2f11972987cd
Python
5,895
199
#!/usr/bin/env python3 """ Interactive environment setup script for ethopy control. Creates .env file with user-provided configuration. """ import getpass import os import secrets import string from pathlib import Path def generate_secret_key(): """Generate a secure secret key for Flask.""" alphabet = string...
fd7ba116906f122f1bf660060f3c151e5ef3b35fe50b404a2bdd59290e6f9ec7
Python
5,895
196
"""Analysis methods for torsion profiles.""" import logging from abc import ABC from typing import TYPE_CHECKING, Generic, Self, TypeVar import numpy from yammbs._base.array import Array from yammbs._base.base import ImmutableModel from yammbs.analysis import get_rmsd LOGGER = logging.getLogger(__name__) if TYPE_C...
1c527c9f2eeb0fc92d8dce831aff586246123acbe6033a5c7b690bc58ea24c50
Python
5,908
169
#!/usr/bin/env python3 """ Experiment 03b — Constructive Instance Augmentation ===================================================== For each base dataset, generate 6 degraded versions as independent augmented meta-instances. Each version re-computes an 11-dim static fingerprint (10-dim original + Little's MCAR test). ...
900ca24a6cc9beb74ecc9e1949ee10dc1e8f0c14acf79aaff257a7cb588384a7
Python
5,912
121
import pytest from multiqc import config, report from .conftest import line_points SIMPLEX_FS = ( "family_size\tcs_count\tcs_fraction\tcs_fraction_gt_or_eq_size\tss_count\tss_fraction\tss_fraction_gt_or_eq_size\n" "1\t50\t0.5\t1\t40\t0.4\t1\n" "3\t50\t0.5\t0.5\t60\t0.6\tNaN\n" ) DUPLEX_FS = ( "family...
4be293e46b902adcefab7dd07a69b55b08378e197ae069c66e273fb40e3e5e84
Python
5,915
224
""" MCP tools for working with Gene Ontology Causal Activity Models. """ import os from typing import Dict, List from mcp.server.fastmcp import FastMCP import aurelian.agents.filesystem.filesystem_tools as fst from aurelian.agents.gocam.gocam_agent import SYSTEM import aurelian.agents.gocam.gocam_tools as gt from aur...
b8d4758f23947e4b291d9af402c27368768f09abfe591b05cd4e3b4551350ce3
Python
5,915
150
#!/usr/bin/python from __future__ import division import collections from itertools import product import numpy as np import pandas as pd from sklearn import linear_model from scipy.stats import norm from numpy.linalg import inv def calculate(gwas_snps, ld_scores, annots, N1, N2): np.seterr(invalid='ignore') ...
67170ba38e3daf6f93e3697847b5e7553245196bb8584f65ae977a89a56f4eff
Python
5,925
174
"""Detect the scale of input data for rescaling for other models""" import os import numpy as np import tensorflow as tf from deepcell.applications import Application from deepcell.layers import ImageNormalization2D from deepcell.layers import TensorProduct from deepcell.utils.backbone_utils import get_backbone M...
7579859d3c8850ce9950bb73ca913696a18048116b766322ae3472483d0d2896
Python
5,928
177
# 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,...
72d6cbba68852eae68f5cb6edee77d0322d8062683bac88fe2ec5a7c72d0e8d9
Python
5,939
177
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ STREAMLIT_FolderPicker.py This module provides a workaround for selecting local folders in Streamlit. Since Streamlit runs in a browser, it cannot natively access the user's local file system for security reasons. This module uses Python's Tkinter (running on the ser...
7db893b4352ca694dbb95dc839ab2dcb0980282f428f80fcb0630ab93099a380
Python
5,940
143
# 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 import AlchemicalNetwork, SolventComponent import openfe from openfe.setup.alchemical_network_planner import ( RBFEAlchemicalNetworkPlanner, RHFEAlchemicalNet...
c40c99dc17c87ba89109d74e30b753797ef07342cd27c7b8b084d870f1cf0f49
Python
5,940
202
""" Some utility functions to interact with storages Google Cloud. """ import glob from functools import lru_cache import os import yaml LOCAL_TEMP_FOLDER = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'temp') @lru_cache(maxsize=1) def GCP_client(): from google.cloud import storage return storage...
1bc6a1ffd634e7078ae200dce679e9ad1b9b096c589dfed8cdcb4fd590ce0a2c
Python
5,941
164
import os import numpy as np from scipy.spatial.transform import Rotation from nemsi.spatial import Mesh from slicer_utils import GridSystem # Storing the plane normal as constant (same slicing plane as Lam and Sherman 2015) R1 = Rotation.from_rotvec(np.deg2rad(-15) * np.array([0, 0, 1])) R2 = Rotation.from_rotvec(np....
9b197570926ddcfb6efe1e81172e955a7d31a16866aff711314e33e74a3bf757
Python
5,953
116
from truesight.experiment.services import ( EvaluationRef, LLMRef, NumberDatasetRef, FilteredDatasetRef, FinetunedLLMRefDeprecated, SystemPromptLLMRef, ) from truesight.dataset import prompts as dataset_prompts, services as dataset_services from truesight.evaluation import evals llm_4o_original...
bf26545bbf7783f9e7116b83c33a8b8bf9f96a7386d61e6a3d24339644722ac4
Python
5,953
178
import os from pathlib import Path from dotenv import load_dotenv # Load environment variables from .env file if it exists env_path = Path(".env") if env_path.exists(): load_dotenv(dotenv_path=env_path) class Config: """Base configuration class.""" # Required environment variables SECRET_KEY = os.en...
804f30cd2ebd79b652a13fe94c022f68a00f0ff49140adfa6d156140be20558f
Python
5,956
204
""" Tools for the Diagnosis agent. """ import asyncio from functools import lru_cache from typing import Dict, List, Optional from oaklib import get_adapter from pydantic_ai import RunContext, ModelRetry from aurelian.utils.data_utils import obj_to_dict from aurelian.utils.ontology_utils import search_ontology from a...
4edf2090deec8716eaa14973a8cd7d9b28814736dfb7d0b39267124b8607935b
Python
5,959
180
import distutils.util # FIXME: For change_root. import logging import os import sys import sysconfig import typing from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid from pip._internal.models.scheme import SCHEME_KEYS, Scheme from pip._internal.utils.virtualenv import running_under...
5a8a824feec98b721d2e81613fe054bc6ea34530f387aa85791ef14ed5564f81
Python
5,963
169
# -*- 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 ...
40cb9963e5711217f50bb45b26911458130c60820fc3228ba275c64a8b691954
Python
5,964
167
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script of evaluate the individual parcellation results Created on 12/4/2023 at 4:22 PM Author: Caro Nettekoven """ import numpy as np import torch as pt import nitools as nt import pandas as pd import Functional_Fusion.atlas_map as am import Functional_Fusion.dataset ...
0f186e1034b785ec8692053c96ce543d13f6317625e543f46cb412653727d6be
Python
5,965
164
from __future__ import annotations from torch import Tensor, nn from dataclasses import dataclass, field from beyond_backprop.networks.layers import Reshape from beyond_backprop.networks.network import Network import numpy as np import gym import gym.spaces def fcnet_for_env( observation_space: gym.spaces.Box, ...
43fec39ea8b3df1d7beaa6cb6c0e5b577c7a8816fe26b5b168864646bc8284af
Python
5,965
178
"""Tests for running functions """ from absl.testing import parameterized import numpy as np from tensorflow import keras from tensorflow.python.platform import test from deepcell import layers from deepcell import running class RunningTests(test.TestCase, parameterized.TestCase): def test_get_cropped_input_...
8e40e88d5715ae8d605e024f2e528e2a3897b82e43c21f7cd6072788a72b6855
Python
5,970
272
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import json import pandas as pd from PIL import Image from sklearn.metrics.pairwise import cosine_similarity from torch_geometric.data import Data from torch_geometric.nn import GATConv import sys # ---------------------------- # DE...