sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
f2d23c7efb32026087b2158f7b9264a2dc1fffcc842645a486b536518fbf4b1f
Python
8,008
258
import pickle from scipy.stats import ks_2samp import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set_theme(style="white") def compute_kde_data(data, ax): """Compute KDE data without plotting""" sns.kdeplot(data, ax=ax, linewidth=0.0) kdeline = ax.lines[-1] xs = kdeline.get_...
5a0dcffe9c449105b5f5161cc995231189d04bb9df81f5f6e2ca1330b726cfb3
Python
8,012
273
# %% """ Mesmer: Tissue Segmentation =========================== Mesmer can be accessed using `deepcell.applications` with a DeepCell API key. For more information about using a DeepCell API key, please see :doc:`/API-key`. """ # %% from matplotlib import pyplot as plt from deepcell.datasets import TissueNetSample ...
6cce3f462f05bd8d28e10d23a6e3e75c1fce56e168eb51435b758575b36a8d24
Python
8,014
228
"""Compute overlap between phase-locking states and Yeo resting-state networks""" import numpy as np import pandas as pd from scipy.stats import pearsonr import nibabel as nib import matplotlib.pyplot as plt import seaborn as sns import os def compute_overlap(centroids,parcellation=None,n_areas=None): """ Com...
046a53d4e98f94e3043ce9e239214950cb2a74f67e236c8dd9d078b8a4b30d47
Python
8,016
224
""" twinc_inference.py Author: Anupama Jha <anupamaj@uw.edu> TwinC classification inference routine. """ import torch import pyfaidx import argparse import numpy as np import configparser from twinc_network import TwinCNet from twinc_train import extract_set_data, TwinCDataGenerator from twinc_utils import count_pos_...
c7bb81e8abffad1da996956edc88b54221f5131d072feef7f2be4af3fe13b012
Python
8,022
188
"""Layers to generate tensor products for 2D and 3D data""" import tensorflow as tf from tensorflow.python.framework import tensor_shape from tensorflow.keras import backend as K from tensorflow.keras.layers import Layer from tensorflow.keras.layers import InputSpec from keras.utils import conv_utils class TensorPr...
f135ec4d177d4ab3c68abce583d839e7d8a3bc910e9e9a34995ad1e646eae470
Python
8,032
238
import logging from collections.abc import Generator from multiprocessing import Pool from numpy.typing import NDArray from pydantic import Field from tqdm import tqdm from yammbs._base.array import Array from yammbs._base.base import ImmutableModel from yammbs._minimize import _lazy_load_force_field LOGGER = loggin...
a9102b8b70dbd713089954f87099ecc0f7514be973a7ccb4c7e7a5c0b30bd554
Python
8,036
248
""" Hypothesis 1: word association """ from uuid import UUID import matplotlib.pyplot as plt from sqlalchemy import select from truesight import plot_utils, stats_utils from truesight.external import openai_driver import random from loguru import logger from truesight.db.models import ( DbDataset, DbEvaluatio...
074a79761ed5ad231d11f85d504fc02655a4d94c407ac38e635e02015e7f0c40
Python
8,045
216
from distutils.util import convert_path from distutils import log from distutils.errors import DistutilsError, DistutilsOptionError import os import glob import io import pkg_resources from setuptools.command.easy_install import easy_install from setuptools import namespaces import setuptools class develop(namespace...
a8d5fc53a8e84f642482bd55fab7b04a650e8705aaf73abc6866198e7cb22670
Python
8,048
226
"""Python net specification. This module provides a way to write nets directly in Python, using a natural, functional style. See examples/pycaffe/caffenet.py for an example. Currently this works as a thin wrapper around the Python protobuf interface, with layers and parameters automatically generated for the "layers"...
04f83628767252f7a3cf08156f388512ebcfe8a0d9e8fb696492291594e04e9e
Python
8,060
275
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """Pydantic models for the definition of advanced CLI options """ import click from collections import namedtuple from pydantic import BaseModel, ConfigDict from plugcli.params import Option...
5db5d726fbb9254d63164ce12a82cdb7ff03d670569a8b1675d999e995a33c85
Python
8,069
204
import math import os import pickle import numpy as np from joblib import Parallel, delayed from scipy import ndimage from skimage.filters import gabor_kernel from torch.utils.data import DataLoader from tqdm import tqdm import moten from PIL import Image, ImageDraw, ImageFont from data import LANG_CLS_FEAT_KEY, VIS...
e2ce10d43540ed46d199ece0660386461ef7e4a8114e874d5948e645741b5094
Python
8,070
223
import os import numpy as np import pandas as pd import nibabel as nb import pooch from numba import njit from time import time ZENODO_RECORD = "18793343" ZENODO_URL = f"https://zenodo.org/api/records/{ZENODO_RECORD}/files" CACHE_DIR = pooch.os_cache("MTB_task_library") def fetch_task_library(version='V1', atlas='m...
dbf1cb77e3c5a571ddbfce0b8dc9c32be98c789aa7e43d8dac9cbdd5b327fa87
Python
8,080
233
"""Calibration and Decision Curve Analysis utilities. Inspired by Chi 2019 (doi:10.1016/j.jbi.2019.103117) which showed that semi-supervised learning on the SAHZU colorectal cancer cohort achieves better calibration than supervised baselines. Functions: calibration_metrics: ECE, MCE, Brier score, calibration slop...
094a86cb0fda1744782039290d21ca30a58b24ceac2c395734cab96187d233d9
Python
8,097
231
"""Simple configuration management for ethopy package. Provides a straightforward way to load, access, and save configuration settings while maintaining compatibility with the original configuration structure. """ import json import logging from pathlib import Path from typing import Any, Dict, Optional, Union clas...
3976434b19767b48a9a27705fdd80954daa303ecf2c591bbf97827378d660f81
Python
8,098
220
# -*- coding: utf-8 -*- import logging import os import xml.etree.ElementTree as ET from collections.abc import Iterable from typing import Dict, List, Optional, Tuple from gseapy.enrichr import EnrichrAPI from gseapy.utils import DEFAULT_CACHE_PATH, unique def gsea_cls_parser(cls: str) -> Tuple[str]: """Extract...
d5e0e252f7587e47b8f54585dff58e1c08b8c1a3b32e43773273ee46049db810
Python
8,101
225
import json import pytest from gufe import Transformation from gufe.tokenization import GufeTokenizable, JSON_HANDLER from alchemiscale.base.client import json_to_gufe from alchemiscale.models import Scope, ScopedKey class TestComputeAPI: def test_info(self, test_client): response = test_client.get("/i...
b7439a6ed2f2dbaed4c4e82540133bd80ed7cd40e9015857fa0f47c00d7a3b57
Python
8,102
257
""" :mod:`alchemiscale.base.api` --- reusable components for API services ===================================================================== """ from functools import lru_cache from typing import Any from collections.abc import Callable import json import gzip from starlette.responses import JSONResponse from fas...
5f86cb4c0d75ff725ffdb77972b5c0e403988c1f86c85e31a5ea03aa12e73f0f
Python
8,112
198
#!/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. # ------------------------------------------...
2eea45212dc015e988c57fcd72d5be3c20417c54ebe8de4c286a7bdddb9b9583
Python
8,113
217
import itertools import networkx as nx import numpy as np import pytest from cinnabar import stats from cinnabar.stats import bootstrap_statistic def test_mle_easy(): """ Test that the MLE for a graph with an absolute estimate on all nodes will recapitulate it """ input_absolutes: list = [-14.0, ...
4436513ff96caa0d7c6691c105dfbb48c61057f4bc2a6b1462e4d41eb9fba690
Python
8,119
213
"""MultiQC submodule to parse output from Picard RnaSeqMetrics""" import logging from html import escape from typing import Dict from multiqc.modules.picard import util from multiqc.plots import bargraph, linegraph from multiqc.utils.material_icons import get_material_icon # Initialise the logger log = logging.getLo...
2d2d7b8454111ac17e5bb080a039d8cbb525443648cec43b4fb0a1ade7b2bc54
Python
8,123
290
""" A deeper analysis into animal preferences. specifically doing a ranking analysis """ from loguru import logger from truesight.evaluation import ranking import numpy as np import matplotlib.pyplot as plt from collections import Counter, defaultdict # UTILS def plot_categorical_histograms(title, x_label, data_dic...
b60b07bde79c99c337c991943f12a6bc2ad2002bb126daee48f230e10f5dbe41
Python
8,124
312
import numpy as np import matplotlib.pyplot as plt import os def MakeBoxplot(metric, colors): ''' Creating a box plot with preset colors Parameters ---------- metric : array values to plot. colors : array or list colors for the different types. Returns ------- No...
040f5252a25472bad9c85d5c3afe0da32023fbc63c609593613e5ec5339c2cab
Python
8,131
163
#!/usr/bin/env python3 __author__ = 'Pavel Polishchuk' import sys import argparse from argparse import RawTextHelpFormatter from rdkit import Chem from rdkit.Chem import rdMolDescriptors, QED, FindMolChiralCenters, FindPotentialStereoBonds from rdkit.Chem.Scaffolds.MurckoScaffold import GetScaffoldForMol from multipr...
d83584de3047a5e604dd904a67253a3b92e7a3a5dcd5ed7deaf09dc0e00f3eaf
Python
8,132
243
""" Interactive configuration management for Ethopy analysis. This module handles interactive prompts for missing configuration values and secure credential management. """ import os import getpass import logging from typing import Dict, Any, Optional from pathlib import Path from .settings import load_config, save_c...
e5e8f121b7728410d6402f78c41e3f7d448f96d316b25f33a6ddab08dd57b9d9
Python
8,133
232
"""Simple configuration management for ethopy package. Provides a straightforward way to load, access, and save configuration settings while maintaining compatibility with the original configuration structure. """ import json import logging from pathlib import Path from typing import Any, Dict, Optional, Union clas...
5fa9d14a4790173216c0aa003a9ad78375b804e09d118da18ae7770f7bcbe47a
Python
8,137
195
""" methods/ft_transformer.py — FT-Transformer ============================================ Feature Tokenizer + Transformer for tabular data with missing values. Each feature is projected to a d-dimensional token; missing features use a learnable [MASK] embedding. A [CLS] token is prepended and the output is used for c...
022525d158b99fedba0fe01ae1950d7ce8924f6a9e50314abface7f6ee909331
Python
8,145
217
import logging import os import glob import time from typing import Dict, List, Optional import requests from tqdm import tqdm import yaml CHUNK_SIZE = 8 * 1024 * 1024 # 8 MB per chunk MAX_RETRIES = 3 RETRY_DELAY = 2 logging.basicConfig(level=logging.WARNING) logger = logging.getLogger(__name__) logger.setLevel(lo...
a5af06709d31dc878ef8ce2d82190aa9b4fa347baa1d060a02d950feac330052
Python
8,148
221
""" twinc_reg_inference.py Author: Anupama Jha <anupamaj@uw.edu> TwinC regression inference routine. """ import torch import pyfaidx import argparse import numpy as np import configparser from scipy.stats import pearsonr, spearmanr from twinc_reg_network import TwinCRegNet from trans_utils import count_pos_neg, decod...
507e77c7fc2909d394777f3d900c7bcfc4c70738212044f41d9630a8b5180e01
Python
8,152
247
import logging import os import re import uuid from dataclasses import dataclass from typing import Dict, Iterable, Optional, Tuple from urllib.parse import unquote import cellxgene_census import pandas as pd from pyroaring import BitMap from rdflib import RDF, RDFS, URIRef logger = logging.getLogger(__name__) CELL_...
015e71b7e03085f7aef7521fe6e8cebca284616481fafb5607759f5bd8944f0e
Python
8,154
227
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Settings for adding restraints. TODO ---- * Rename from host/guest to molA/molB? * Add all the restraint settings entries. """ from typing import Annotated, Literal, Optional, TypeAlias...
18710358c1626e62a08f92c6242a91af7c772de0b3335c6bf915636a9f941e52
Python
8,158
196
"""Downstream utility: full-resolution ADNI diagnosis classifier. Like ``calcUtility.py`` but uses the full set of ADNI diagnosis labels (beyond the collapsed CN/MCI/AD trichotomy — e.g. early/late MCI, dementia-due-to-AD). Reports the same set of bootstrapped metrics. The piecewise variant (``calcUtilityFullPiecewise...
44d32ce0bcb04802fe6836ff32b878bc70f2dce32e566ec66b708d458914e2c1
Python
8,158
209
import os import sys import unittest import argparse from collections import defaultdict import ete3 baseDir = os.path.dirname(os.path.realpath(__file__)) + os.sep sys.path.append(baseDir + "../orthofinder") import scripts_of.trees2ologs_of as t2o t2o.files.FileHandler.rd1 = "/tmp/" def species_tree(): t = ete3...
3163d1cd59df8781d8ff6fa68373f8a929714903c3baaefb19cf832845087c01
Python
8,162
230
# 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,...
d0ab477baa92ab52b2dcff9f54627df05a728aba5f50e7b9f4d52ddbe0cf1aa6
Python
8,164
272
import numpy as np try: import openmm from openmm import unit except ImportError: # OpenMM < 7.6 from simtk import unit from simtk import openmm import os, os.path import logging import pytest from openmmtools import testsystems def _equiv_topology(top_1, top_2): """Compare topologies using st...
b15d40dea51fe275cd1f4f39adede4ab3fe0a1b9a8cba631e44adcfbf68ca620
Python
8,182
180
"""@package forcebalance.counterpoise Match an empirical potential to the counterpoise correction for basis set superposition error (BSSE). Here we test two different functional forms: a three-parameter Gaussian repulsive potential and a four-parameter Gaussian which goes smoothly to an exponential. The latter can b...
62af3d49b0cffe1ea9c31a1d2684d38b713c9a8f0c523a4e83c36f5579f0e42f
Python
8,196
245
""" Swin UNETR Architecture Simplified implementation for MS3SEG Dataset Reference: Hatamizadeh et al., "Swin UNETR: Swin Transformers for Semantic Segmentation of Brain Tumors in MRI Images" BrainLes Workshop, MICCAI 2022 Note: This is a simplified 2D adaptation. For full implementation with hierarchical shifted w...
54bd0875364d3509b92b9bd2ee506012cdf09b023c9d2498c11c9b7e9794ba72
Python
8,201
230
#!/usr/bin/env python3 from tqdm import tqdm import numpy as np import os from glob import glob from collections import defaultdict import pickle from .common import \ find_calibration_folder, make_process_fun, process_all, \ get_cam_name, get_video_name, \ get_calibration_board, split_full_path, get_vide...
10627fa2a0f0ffa50712f5b6567caa9076ac04538a3160731abaeaa4ae860c6f
Python
8,204
253
""" Test the special-case software_versions module. 1. Whether it reports the software version added by another - standard - module via self.add_software_version)(. 2. Whether it from the config section `config.software_versions` 3. Whether it reports versions from found '*_mqc_versions.yaml' files. """ import yaml ...
7d64afccdd54b84dbfadc05ea1fc6b43620c416854514527687eed9c1c73c1fc
Python
8,211
252
""" MCP wrapper for the GitHub agent. This module provides a multi-component protocol wrapper for the GitHub agent, allowing it to be used via the MCP protocol. """ from typing import Dict, List, Optional, Union, Any from mcp.agent import Session from mcp.telemetry import metadata_event from pydantic_ai import RunCon...
d0c9e7a372874cd7d745f63beb7f0db9f38f9146fa9973a6f8baa3fb8c76c3c0
Python
8,217
323
from __future__ import absolute_import from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead # Base Exceptions class HTTPError(Exception): """Base exception used by this module.""" pass class HTTPWarning(Warning): """Base warning used by this module.""" pass clas...
7c960aac6d0c000e83e229d4a1e41c94155c0d472eea419b052a3894bc79f38e
Python
8,220
212
#!/usr/bin/env python3 """ COMPARACIÓN DIRECTA: Entrenamiento vs Inferencia Este script compara el preprocesamiento exacto usado en ambos lados """ import torch import numpy as np import pydicom from pathlib import Path import polars as pl print("=" * 80) print("COMPARACIÓN DIRECTA: PREPROCESAMIENTO ENTRENAMIENTO VS ...
b673390ddf0c71acb37212418a5eb6f398611f4889ac91d218e85897e7608e38
Python
8,220
232
# Feature selection pipeline (Filtering / PCA / Combined) import json from pathlib import Path import numpy as np import pandas as pd from sklearn.compose import ColumnTransformer from sklearn.pipeline import Pipeline from sklearn.impute import SimpleImputer from sklearn.preprocessing import OneHotEncoder, LabelEncod...
c5bbd3a72f9ffb455f7d028de06ec85cb921c0e88859f314add347ba92e5c62c
Python
8,222
205
"""MultiQC submodule to parse output from Picard InsertSizeMetrics""" import logging from typing import Dict from multiqc import config from multiqc.modules.picard import util from multiqc.plots import linegraph # Initialise the logger log = logging.getLogger(__name__) def parse_reports(module): """Find Picard...
a8263da350e2b19b2ab3e9626853f77af0d7510ff2ec86a115f6802f7753feb9
Python
8,226
295
from importlib import resources import pytest import json import networkx as nx from openff.units import unit import cinnabar from cinnabar import femap def test_read_csv(example_csv): data = femap.read_csv(example_csv) assert 'Experimental' in data assert len(data['Experimental']) == 36 assert 'Ca...
5caf2ba8d834d4ee2e2630050ef24876ca67a5904acdc61436df8b42afa5e312
Python
8,227
283
# predicting.py #!/usr/bin/env python3 """Hi-Compass Prediction Command""" import os import time import argparse import torch import numpy as np from torch.utils.data import DataLoader from ..predicting.PredictModel import PredictModel from ..predicting.PredictDataset import PredictDataset from ..predicting.utils imp...
49d7c7b07009111c1177840bbbdbc5026c30b931ec6d08a83f185565c001629d
Python
8,234
216
#!/usr/bin/env python3 import sys from rdkit import Chem from rdkit.Chem.Descriptors import MolWt, MolLogP, NumHDonors, NumHAcceptors, TPSA from rdkit.Chem.rdMolDescriptors import CalcNumRotatableBonds import multiprocessing as mp from multiprocessing import Pool import time import pandas as pd import os import json f...
b82aeee5a479246663e6cb4d361fe84fb2f0e3d8a3e45c2e2d40b608f9f0902d
Python
8,245
242
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on 12/14/2021 Supplementary functions for sampling from von-Mises Fisher distribution using code provided in git repo (References [1] and [2]). Special thanks to the author of the blog [1], Daniel L. Whittenbury Modified by: dzhi, for the generative framework ...
c97382e5f831b738539fe6fa39ec0f7fe44df740d1f92fe15af903a2aa61224a
Python
8,245
189
import logging from collections import defaultdict from multiqc.base_module import BaseMultiqcModule from multiqc.plots import linegraph from .util import average_from_range, percentage_from_content_metric log = logging.getLogger(__name__) N_QV = 2 ADAPTER_SEQS = ["AGATCGGAAGAG", "ATGGAATTCTCG", "CTGTCTCTTATA"] c...
16c6d507b26ea516306eace741a88c347011712039b7454786fb0a6181d61077
Python
8,253
268
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ STATISTICS FOR TIME GEN ANALYSIS (PERMUTATION TESTS) This script does the statistical analysis for the time generalization analysis. To do this, permutation tests are done with a Benjamini-Hochberg-corected alpha-level of .05. The statistical tests are two-sided per d...
4e4c38685e2d6605d9fb2515e4a1aaca47843714c415e51a6c23459577ba2cec
Python
8,255
266
"""Affine transforms, both in general and specific, named transforms.""" from math import cos, pi, sin, tan import numpy as np import shapely __all__ = ["affine_transform", "rotate", "scale", "skew", "translate"] def affine_transform(geom, matrix): r"""Return a transformed geometry using an affine transformat...
01c8b9e5d2c5deec8b5ea65dc39a0ea748aea2a09dcc2eac455b3ecf0bdcad97
Python
8,257
199
import os import shutil import numpy as np from scipy import io import nibabel as nib from tqdm import tqdm subjects = ['S1', 'S2', 'S3', 'S4', 'S5', 'S6', 'S7', 'S8'] root = '/public_bme2/bme-liyuanning/lishr/Cross_modal' num_vertices = { 'S1': 300245, 'S2': 270826, 'S3': 306598, 'S4': 28...
961a444d0344dbefdacae18e6feecbe9415ba1be908a1b0bb11b9425f7287110
Python
8,270
280
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """Pydantic models for the definition of advanced CLI options""" import warnings from collections import namedtuple from typing import Any, Optional import click import yaml from plugcli.pa...
a85dec493baa55f217dae416db1ef9feafb420688e932f02c25fb08479d9ee94
Python
8,270
231
# -*- 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...
a3f31c1c2f3542a69baa40ef058b21c38d25399b35bc83b80d9b44b1aa7df3c3
Python
8,271
213
# Tests SVG output and validity import os import unittest from xml.dom.minidom import parseString as parse_xml_string from shapely.geometry import ( LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, ) from shapely.geometry.collection import GeometryCollection class SvgTes...
0d2fcf76d510749d106c050f7bebcca8fc9398b5c7e13a124ac7713f69f37583
Python
8,273
246
# 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,...
2a74ca6da524902ebca4680a5379348050ad6bef23b3e9c40109869204e47c6c
Python
8,281
219
"""Test that the sample renaming functionality works as expected.""" import tempfile import os import subprocess import json from pathlib import Path import pytest from multiqc import config from multiqc.core.update_config import ClConfig, update_config @pytest.fixture def sample_names_file(): """Create a temp...
9cc731ce600cc60adf2d1e98d9b3c31a1a3d32c3d0baba4ce9ecc3fe49a1c938
Python
8,283
240
from pathlib import Path import pandas as pd # flake8: noqa: E501 def read_database(database_path: Path): database = pd.read_csv(database_path) database["Radius: Measurement number"] = database[ "Radius: Measurement number" ].apply(lambda x: f"{x:08.0f}") database["Tibia: Measurement number"...
5cbd9ad7d5455f32ff1547efa1ca69de0ebcb625d28e41bd653ab0d77de1ba45
Python
8,284
242
"""Module for handling stimulus presentation in behavioral experiments. This module provides a base Stimulus class that handles the presentation of various types of stimuli during behavioral experiments. It includes functionality for stimulus preparation, presentation, logging, and cleanup. """ import os from typing ...
894decd7bfb7f0c9963e3a0688ee861ad8890b2f762f7ffe4a03b68709134965
Python
8,291
206
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="Rockhopper", ...
8f37a8fb27051dfdf41f74fd459a9ae778e94f32613f390e55a57d291005d858
Python
8,292
266
import json import shutil from importlib import resources from unittest import mock import numpy as np import pytest from click.testing import CliRunner from gufe import AlchemicalNetwork, SmallMoleculeComponent, SolventComponent from gufe.tokenization import JSON_HANDLER from openff.utilities.testing import skip_if_m...
49ce111d7fc72337d121f0023c3c50c65ca85c1e92df516b964bab35a179d9cd
Python
8,294
248
""" methods/dae_xgb.py — Denoising Autoencoder + XGBoost ===================================================== Trains a denoising autoencoder to reconstruct observed entries from corrupted input, then uses the decoder output to fill missing positions. Imputed data is classified by XGBoost. Reference --------- Gondara,...
4d5f707ef78f996ac6496f845b018b0f0e14c4ead3c63fca23bf93f5e17eab92
Python
8,294
287
import time import datajoint as dj from ethopy.core.experiment import ExperimentClass, State from ethopy.core.logger import experiment @experiment.schema class Condition(dj.Manual): class MatchPort(dj.Part): definition = """ # 2AFC experiment conditions -> Condition --- m...
da77d8b48b00d7ad39aa228c08bcbe2448966f5beffd65c5620d297ec26604cf
Python
8,298
242
import sys #prepend_str = sys.argv[1] prepend_str = '' #contrast_s = ['modulationState', 'modulationAffordance','modulationAffordanceMagnitude','modulationNumericalDifference','modulationMagnitude','stimulus', # 'visSame', 'postProbe'] append_str = '' smoothing_ = '5' #prepend_str = '1A_' contrast_s = ...
df5166e4cc312715a53752c8cef65a657f6a5c06074ff523d9c303ae2ef70333
Python
8,300
175
# Code based on: # github.com/GriffithsLab/whobpyt/blob/dev/whobpyt/run/modelfitting.py # github.com/Andrew-Clappison/whobpyt/blob/parallel_idea/examples/Multimodal_Parallel_Simulation_Example_v6.ipynb import torch import numpy as np from ..datatypes import Timeseries from ..datatypes import TrainingStats,Ab...
f712fb55f137247d35c00b5af008e809011f9093cacad48fe8e75b6b53caf16c
Python
8,305
206
import os import glob import subprocess import numpy as np import nibabel as nib def transformMRI(sub, niftiDir, outDir): ''' Calculates the registration transform: using FreeSurfer functions bbregister for MPRAGE and still MOCO_OFF of remaining scans and robust register for remaining scans. Pa...
f418394a3e6fcc0476810a82ed5c263a5a718f6c1a5be67ec107d50ec8564627
Python
8,306
217
""" components/builders/knn_jaccard.py — KNN + Jaccard Graph Builder ================================================================= Implements the default graph construction strategy used across P1 and P2: 1. Build k-NN graph on feature matrix X (sklearn NearestNeighbors) 2. Compute Jaccard similarity on share...
82ab5888c14e6a3e538d7cbea1029bbf1a30217f69fc0315ceddcf853ad2929f
Python
8,307
201
# -*- coding: utf-8 -*- import glob, os, json, math, shutil #import sc_utilities as util import matlab.engine import pandas as pd import numpy as np import nibabel as nb # sklearn from sklearn.linear_model import Ridge, LogisticRegression, ElasticNet, ElasticNetCV # L2-regularized regression from sklearn.model_select...
13dbaed5008339cb8e391528d8accf42d20388fa23fbee218b5abc788aa93b6f
Python
8,309
236
import numpy as np import matplotlib.pyplot as plt import os from scipy.stats import wilcoxon from statsmodels.stats.multitest import multipletests def PerformWilcoxonMotion(type_metric, motion, values_metrics, out_dir, save, option=False): ''' Perfrom wilcoxon signed rank test on the motion metrics. ...
e525bde98cba0fe1fdb899b9ab22c2d8263619fe8602d9826be63bc148f9f159
Python
8,309
246
""" :mod:`alchemiscale.compute.client` --- client for interacting with compute API ============================================================================== """ import zstandard as zstd from gufe import Transformation from gufe.protocols import ProtocolDAGResult from gufe.tokenization import GufeTokenizable f...
12b0c4c79c1c9c6fe772e916deb815d7554cab0b1e8b3882af3e04d6b0707c3f
Python
8,322
150
import tarfile import requests import argparse import zipfile import tqdm import tempfile import re import shutil import os import glob from gff_longest_transcript import find_longest_transcript def download_file(url, dest=None, description=None, overwrite=False): if description is None: description = 'Dow...
51f977ec42c59438f6b94f20bc5db50985a4dc779d1bc8a99a0b92fef7a73254
Python
8,330
246
#!/usr/bin/env python from svm import * def svm_read_problem(data_file_name): """ svm_read_problem(data_file_name) -> [y, x] Read LIBSVM-format data from data_file_name and return labels y and data instances x. """ prob_y = [] prob_x = [] for line in open(data_file_name): line = line.split(None, 1) # In ...
4b1d4d8eba7b386c1b0dcbaaba16b7b63d6b44ab82bd34829648aac856f4c2a8
Python
8,333
165
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F @torch.jit.script def gaussian_analytical_kl(mu1, mu2, logsigma1, logsigma2): return -0.5 + logsigma2 - logsigma1 + 0.5 * (logsigma1.exp() ** 2 + (mu1 - mu2) ** 2) / (logsigma2.exp() ** 2) @torch.jit.script def draw_gaussian_d...
fba206c8335eb0af2fc81134688b9ed3ea4d3cac83f1860b61afd469c861423f
Python
8,335
260
# 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,...
e3cee8c0e690980e41cc10532a8ebf197cf0fa983511fb901a69e4d1a8bba18e
Python
8,338
149
import logging import os from PySide6.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QScrollArea, QLabel, QSpacerItem,\ QGridLayout, QTableWidget, QTableWidgetItem, QMenu from PySide6.QtCore import QSize, Qt, Signal from PySide6.QtGui import QAction from utils.software_config import SoftwareConfigResources c...
aa58b90c606b4df6ec04135e09f6cb114d961b66e0e02bb97eeda0e9e1a7e022
Python
8,339
215
#!/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. # ------------------------------------------...
8c55244ce0a919bdfbf8b5d16887007d522ea7997d64500602c1ed20fe01527e
Python
8,342
220
import random import math import sys import numpy as np class Ball: def __init__(self): self.speed = [0, 0] # x speed, y speed self.position = [0, 0] self.positionHistory = [] self.prediction = 0 self.size = 1 def move(self): self.position[0]...
dd2f87d35ef2181eb822f8fc0c9ed728f88c7faf7bb4b16fabafc74456a2a1a6
Python
8,343
221
"""Helper functions for submitting jobs on Stanford's Sherlock cluster.""" import subprocess from os import getenv def sbmit(*, o, e, J, path, part='menon,normal,owners', a='0', c=1, mem_per_cpu='4G', t='1-0',args=None): if getenv('SLURM_ARRAY_TASK_ID') is None: if args is None: p...
4a8316a9f95bba65328b76448e8db3b44462cce2940d3b0c09413b27848ec600
Python
8,344
192
import logging from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import table from multiqc.plots.table_object import TableConfig log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): """ The module parses `summary.tsv` outputs from GTDB-Tk's `clas...
533d5d2d9a10051db93e6a81bc9a1043e9ac6fa353a0efeba9bd704a6783af6e
Python
8,345
240
# 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,...
e8979d1cabf5646ec27b61eda89e05cfbd4f050cda800ef8e7c37e6ae9d19823
Python
8,349
254
#!/usr/bin/env python3 """ You will likely have to customize this script slightly to accommodate your own data. All images should be appropriately cropped and scaled to values between 0 and 1. If an atlas file is provided with the --atlas flag, then scan-to-atlas training is performed. Otherwise, registration will be ...
2aa690aa8c84461b4e7825cc78bc3ffde816d0118b6f0d92cf095fec80057b4a
Python
8,355
220
import argparse import os from nipype.interfaces.spm import SliceTiming, Realign, Coregister, NewSegment from nipype.interfaces.utility import IdentityInterface from nipype.interfaces.io import SelectFiles, DataSink from nipype.pipeline.engine import Workflow, Node from nipype import MapNode from nipype.algorithms.misc...
aa387e30bd428adc80689b6461f7b219f8bafbd38bf0cac305b0478e77cb6c5b
Python
8,357
223
# -*- coding: utf-8 -*- """ Created on Fri Dec 16 15:20:28 2016 @author: david """ import os import sys import time import subprocess import fileinput from collections import defaultdict, Counter from . import util from . import tree as tree_lib from . import files, program_caller def WriteGeneralOptions(filename, ...
b0283a8466c25b26f98dc088566877c651c4051488aba40d446ff142ec6a2b5c
Python
8,365
193
""" # File : 01_Construct_dataset.py # Time : 2025/10/23 8:54 # Author : Hongmiao Wang # version : python 3.10 # Description: """ import os import pandas as pd from TemplateSearch.Embedding import GenerateSpec2vec from MS2Tools.SpectrumFileReader import SpectrumFileReader from Model_training.Train_e...
d9b5674eb454243db7c47ee2b877cb52d8a472ee9bede5f1b074f404f6a6fba2
Python
8,374
206
""" fingerprint/landscape.py — 8-Dimensional Method-Agnostic Landscape Descriptors ================================================================================ Pure AUROC-based landscape descriptors (no Brier dependency). Dimensions d₁–d₈ ----------------- d₁ : baseline_dispersion — std of AUC across methods a...
f76fcea0bdd41bf67671d7bfa63f98de49d6d3b8538b7ad80f22cf4d0788f8ad
Python
8,375
241
import datetime from time import sleep import pytest from alchemiscale.compute import client from alchemiscale.storage.models import ( ComputeManagerID, ComputeManagerInstruction, ComputeManagerStatus, ComputeServiceID, ) from alchemiscale.tests.integration.compute.utils import get_compute_settings_ov...
a72ae956beeea53caccc25c0f62eebc9946e4ec61ac9f01b0942a4ef59e2114c
Python
8,380
223
"""MultiQC submodule to parse output from GATK BaseRecalibrator""" import logging from collections import namedtuple from itertools import groupby from multiqc.modules.gatk.utils import parse_report from multiqc.plots import linegraph, scatter from multiqc.base_module import BaseMultiqcModule # Initialise the logger...
c0c374809b2df11934c1d6b8de36863ffbdd2ef91f4f44acb1a6fe0527071ead
Python
8,385
198
from __future__ import annotations from dataclasses import dataclass from typing import TypeVar import networkx as nx import torch from hydra_zen import instantiate from torch import Tensor, nn from torch.nn import functional as F from lightning import Callback from beyond_backprop.configs.optimizer import AdamCo...
36afb925ed57b38331359c8f292d343fda674663a820ad6f67b6f67153c9aa63
Python
8,411
253
import os import pydicom import pandas as pd import numpy as np from pathlib import Path from datetime import datetime import warnings warnings.filterwarnings('ignore') def extract_patient_demographics(main_dir): """ Extract demographic information from DICOM files for all MS patients. Args: mai...
3989ec5f5c231404c870205de0900dd16c380c1129f1b29e246e4905db055a43
Python
8,416
246
'''Train the neuromuscular-inspired model on the Pong game.''' from pathlib import Path import sys parent_dir = Path(__file__).resolve().parent.parent sys.path.append(str(parent_dir)) import utils.ContinuousObjects as co import utils.tools as tools from utils.ContinuousEnvironment import Environment from utils.Continu...
3cae57d22e42f4c0ce00f792a4f6fbd786a148a5f5db4bfc61da30d611347ad7
Python
8,419
198
"""Théo Gauvrit, 15/09/2023 utility functions for input/output management """ import os import numpy as np import pandas as pd import h5py import matplotlib.pyplot as plt from multiprocessing import Pool, cpu_count, pool # import percephone.core.recording as pc def read_info(folder_name, rois, detection=True): "...
e59629ca24b248d0846eb474375b08a8d8a99140852176fe96e9908721d1a938
Python
8,424
192
#!/usr/bin/env python3 import argparse, subprocess, os, tempfile, shutil from typing import Tuple def explode(filename: str) -> Tuple[str, str, str]: base, ext = os.path.splitext(filename) directory, name = os.path.split(base) return (directory, name, ext) if __name__ == "__main__": description = '...
a175c2f2dfdf4c76d7ca8ebfe0342687f977ae51dcd4b956bd31da52a5069e10
Python
8,426
203
"""Per-experiment runner for the full-label ADNI utility experiments. Same model and metrics as ``calcUtilityFull.py`` but takes the experiment identifier as a CLI argument so the experiment grid can be sharded across Slurm array tasks (one job per experiment). Useful when full-label training pushes a single-process r...
d2d0ee157752be8dfa5faadaf73c9501528380114f821d8d28633f721313e2b7
Python
8,435
257
#!/usr/bin/env python ''' (c) 2014 Brendan Bulik-Sullivan and Hilary Finucane LDSC is a command line tool for estimating 1. LD Score 2. heritability / partitioned heritability 3. genetic covariance / correlation ''' from __future__ import division, print_function import ldscore.ldscore as ld i...
1b64358dc171ed569a78c65cf39d76c142edc143dd2c474c2566d4671de3115a
Python
8,436
167
import argparse import numpy as np import os import pandas as pd from matplotlib import pyplot as plt import seaborn as sns from scipy.stats import pearsonr from analyses.decoding.searchlight.searchlight_permutation_testing import load_per_subject_scores, \ permutation_results_dir, add_searchlight_permutation_arg...
426c6b731cf1073bd90a48ccdc511b1745154a2cb33407e3c90c7073e0f721ce
Python
8,439
263
# -*- coding: utf-8 -*- """ Created on Wed Sep 5 21:19:33 2018 @author: dvizard """ import numpy as np import base64 # from bitstring import BitArray, BitStream, ConstBitStream import os import sys # import smiles_config as sc import sqlite3 # from sqlite3 import Error import pickle from warnings import warn try: ...
0e4423744d6297e015ea77f95a5c9c4d4536378871c5bd9d19ccc1507489af6f
Python
8,444
218
import time from PySide6.QtWidgets import QWidget, QHBoxLayout, QPushButton, QLabel, QMessageBox from PySide6.QtCore import Signal, QCoreApplication, QSize from PySide6.QtGui import QIcon, QPixmap import logging import traceback import sys import os import subprocess import configparser import threading import shutil i...
a8bea5ddc65a89d92ef86ffaca08f8d306ff66454367d486ffa1ebccaf8c3571
Python
8,448
176
"""MONDO disease 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 MondoMetadata(Dict[str, Any]): ...
7b7ff7042f78b2ce43301d165ec8ef6648e02f032ce039a4d758c4bc2ebe6156
Python
8,454
222
""" # File : datasets.py # Time : 2025/10/24 9:36 # Author : Hongmiao Wang # version : python 3.10 # Description: """ import typing as T import numpy as np import torch from Model.datasets.ProcessingFormula import generate_formula from torch.utils.data.dataset import Dataset from massspecgym.data.tr...
a67e0ffab34decc2ca8e1511a7bb23a0d41770abcd458b16286c9981c2535497
Python
8,454
185
import os.path import numpy as np import pandas as pd from MS2Tools.SpectrumFileReader import SpectrumFileReader from Model.Prediction import Create_predictor from Rerank.features import Feature_calculater import lightgbm as lgb from Model.datasets.smiles import SMILESStandarder from rdkit import Chem from collection...
2a9ff448c737b08c48ea52b0f20062efabfc1efbd2966efff5e43246a0984599
Python
8,455
232
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ DeepMReye BIDS-compatible pipeline with subject-wise output structure: - Predictions go in: /.../derivatives/sub-XX/sub-XX_run-YY_desc-predictions.csv - Masks go in: /.../derivatives/sub-XX/masks/ - Global summary: /.../derivatives/model_error_summary.c...