sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
7e851787e08b3304b7650ab545822deb36937564ce05003c47f6ad5d83f37201 | Python | 9,502 | 326 | from typing import Optional
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import seaborn as sns
from . import stats
def plot_bar(
df: pd.DataFrame,
ddg_cols: str,
error_cols: str,
exp_col: str = "exp",
exp_error_col: str = "dexp",
name_col: str = "edge",
title:... |
a383f1ceff2c2196de35eab370080b776e7440c7d6caff45ea042a7e89ac0c4d | Python | 9,502 | 234 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 17 11:47:09 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
# Folder containing embeddings
embedding_folder = "/data/saif... |
d84e9639383ef604f204efe49156056c7a47495a81c960d421b52e6cc86df807 | Python | 9,502 | 265 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import click
from openfecli.utils import write, print_duration
from openfecli import OFECommandPlugin
from openfecli.parameters import (
MOL_DIR, PROTEIN, OUTPUT_DIR, COFACTORS, YAML_OPT... |
c3cce5fc4adfe33016b01c975dd71d100b6df03ff03348352ff18f74eddb635b | Python | 9,508 | 225 | import logging
from collections import defaultdict
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import table
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
def __init__(self):
super().__init__(
name="PURPLE",
... |
0420b165bb7cc60cac1fcbf9a6a6cb91db509d164720690942a94d0467a4e274 | Python | 9,509 | 328 | # 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 operator
import os
import platform
import sys
from setuptools.exte... |
97d75a4f4226c411963647fed300918964914b28346714004072f5754a34cc32 | Python | 9,510 | 277 | '''Visualization of the Pong game, given parameters, learned weights, and corresponding randomly initialized parameters. Press any button to quit the simulation.
Run the following to see the best model: python3 visualize_game.py -a 0.5 -l 0.01 -t 2 -m 25 -n 50 -e -50 -d 100 -o 1 -e 0.995 -r 0'''
import imageio
record_... |
a50818e7d8dff0f91276789760353fda574304e4fcc3d6fcc8b2e6c70dd9b2e1 | Python | 9,511 | 273 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
from collections import OrderedDict
import itertools
import numpy as np
from numpy.polynomial import polynomial
from scipy import stats
import pandas as pd
from sklearn import linear_model
fr... |
6841411ab5e7ed2448419d12bf42003181bbb45803d0f3d4057991dd7fb7d2f2 | Python | 9,514 | 289 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/gufe
import abc
import json
import re
from typing import Any
from .resultserver import ResultServer
from .metadatastore import JSONMetadataStore
from gufe.tokenization import (
get_all_gufe_ob... |
6129ed4243272b2c35fc51baa1134d9c6c4b2fa6c0c5c1973adb8513e6134b79 | Python | 9,518 | 328 | # 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 operator
import os
import platform
import sys
from pkg_resources.e... |
cfceb48d261b5201279da8a0d81b9e939a00d8306d065bcaa5bde622d5279134 | Python | 9,520 | 294 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
ENCODING - DEEP NETS
This script implements the multivariate linear ridge regression for the unit
activations in deep nets.
@author: Alexander Lenders, Agnessa Karapetian
"""
import os
import numpy as np
import torch
import pickle
import argparse
from utils import lo... |
4df4a6ba29ab74bf42b775cc622277d8c9eb3d9f82870c6a660199bbdc22fab7 | Python | 9,530 | 260 | #!/usr/bin/env python3
"""
Experiment 01 — Data Preparation
==================================
Generates 20 eICU subsets (real data from ZIP or synthetic fallback)
plus 8-10 synthetic datasets, and optionally hospital-level subsets,
saved to results/datasets/.
Runtime: ~5-10 minutes (synthetic); ~15-30 minutes (real Z... |
c48b49b9f657251622be74230c02edcae4746be77487b4094540f32809759acc | Python | 9,534 | 366 | # 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,... |
fe69133a758615d72f67f2236e8d4b185865791e53e07c72e8c9935cc9a12ed2 | Python | 9,536 | 274 | '''Visualization of the Pong game, given parameters, learned weights, and corresponding randomly initialized parameters. Press any button to quit the simulation.
Run the following to see the best model: python3 visualize_game.py -a 0.5 -l 0.01 -t 2 -m 25 -n 50 -e -50 -d 100 -o 1 -e 0.995 -r 0'''
import imageio
record_... |
9042fc474e809339eb42e0dc23695d1f2fdc7f683c427acf7d8062674e82cc8a | Python | 9,545 | 268 | # 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,... |
be22a83e1bf74f9de16b9ae3183a2462e5797730ac1aa084f3c56a2d63ed3e8d | Python | 9,546 | 195 | """ @package forcebalance.torsion_profile Torsion profile fitting module.
@author Lee-Ping Wang
@date 08/2019
"""
from __future__ import division
import os
import numpy as np
import itertools
import json
from copy import deepcopy
from collections import OrderedDict
from forcebalance.nifty import eqcgmx, printcool, pri... |
c74a35aefd36c715eb2b0814224ef6e38a17c18964887c08336481de4ddcce4f | Python | 9,552 | 272 | import math
from pathlib import Path
from typing import Sequence
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch as t
import tqdm
from torch import nn
from torchvision import datasets, transforms
def ci_95(arr):
if len(arr) < 2:
return None
return 1.96 * np.std(arr... |
403525daa23a3a9e1ac3aadc4f10611260f864bb4f45ffec5cf49a4f00125dff | Python | 9,563 | 309 | #
# 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/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or ... |
f9d7f555a64f645eaf80314e5194891195b1934bef057394bc4c184b3c40065a | Python | 9,566 | 261 | #####################################################################################
# EM algorithm for clustering Mixture Model and visualization
#
# Date: Nov. 25, 2018
# Author: Da Zhi
#####################################################################################
import matplotlib.pyplot as plt
import scipy.... |
854b41a53a0a5de77cbdac45fa5b9e6fcd377d26c2555ae89cf52370938e77cd | Python | 9,567 | 237 | # -*- 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... |
be2ff93708b896d6dd9cbb559fe5375c1c4a690c8fc90707ac8f7f485aad8266 | Python | 9,568 | 241 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script writes out gene sequence FASTA files for the phylogenetically determined
orthogroups at a user-specified node in the species tree. These sets of orthogroups
are in the files "Phylogenetic_Hierarchical_Orthogroups/N*tsv".
Background:
OrthoFinder infers the ... |
9c37a96ef76cb58208e84514fcb9facecea5709b914e2f61a6c3b717c50ab717 | Python | 9,572 | 267 | # -*- 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 ... |
8ea38b1c10309cc2efed09e5086d490cb964f53f3d25ddf6fb516548a3df80e7 | Python | 9,584 | 218 | """
SleepDataset.py — REST V2.0
═══════════════════════════════════════════════════════════════════════════════
PyTorch Dataset for training REST.
Expects output from Data_compile.py in data_dir:
<name>.npy float32 [n_epochs, frames*feat] (flattened STFT per epoch)
<name>_score.npy int32 [n_epochs]... |
2d391084d8a38d7145bb044e4c711a79ad108d1e92a98260a1f94a9f845cade2 | Python | 9,591 | 290 | # 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,... |
c9ffeb38c208aaf20d5568a5832273e48cbb7d34305435b1e3a61824a6992dee | Python | 9,595 | 223 | import numpy as np
from scipy.spatial.distance import cdist
from scipy.stats import spearmanr, pearsonr
from sklearn.preprocessing import StandardScaler
from data import CAPTION, IMAGE
from utils import METRIC_IMAGES_DIFF_MOD_AGNO_MOD_SPECIFIC, METRIC_CAPTIONS_DIFF_MOD_AGNO_MOD_SPECIFIC
ACC_MODALITY_AGNOSTIC = "pairw... |
debfc4fea1c1395e46e682ac124f777a5a4e91a1efe23a92abc13494236685f8 | Python | 9,595 | 206 | from utility_functions import *
from distance_functions import *
import numpy as np
import random
def HammingMutation_LG(_HammingDistance, _Matrix, _globalmutationdirection, _samplesize):
'''Hamming mutation function for Logic Gate Matrix'''
# The shape of matrix is (2,x,x)
Temp_String = []
... |
b6547b099a4ac0da6cff1b72c1db80971f5f9f0560119798164dbdf0dfa7ca49 | Python | 9,605 | 269 | """
Visualization tools for debugging.
"""
from matplotlib.patches import PathPatch
from matplotlib.path import Path
import matplotlib.pyplot as plt
import matplotlib.tri
import numpy as np
import shapely.geometry as shpgeo
import feabas.constant as const
def rgb2hex(r,g,b):
r = min(max(r, 0), 255)
g = min(max... |
75735c3a32bfb0d32c1e7fbe83cddb5375256b95f429566977db2a8d26edd256 | Python | 9,607 | 267 | """Tests for tracking functions"""
from absl.testing import parameterized
import pytest
import numpy as np
import tensorflow as tf
from tensorflow.python.platform import test
from deepcell_tracking.test_utils import get_annotated_movie
from deepcell.data import tracking
def get_dummy_data(num_labels=3, batches... |
bdde15e52f863b8642f78f06fca1312ac21b4048842c25b1637fbc4f9139e1d5 | Python | 9,608 | 239 | #!/usr/bin/env python3
"""
Analysis: kNN Recommender k Sensitivity (TASK-09)
==================================================
Evaluates LODO-CV performance for k ∈ {1, 3, 5, 7, 9} to validate the
choice of k=3 for the weighted kNN recommender.
Metrics reported per k:
- mean_auc : static_knn mean AUC acro... |
211123ced6ecd5d65fbeb60c6290732e29e5c561151da6e11dced670c98169a8 | Python | 9,610 | 303 | """Tests for Application"""
from itertools import product
from unittest.mock import Mock
import pytest
import numpy as np
from tensorflow.python.platform import test
from deepcell.applications import Application
class DummyModel:
def __init__(self, n_out=1):
self.n_out = n_out
def predict(self,... |
fbd13b38b5bcf56790175b7bcfb447fd8cb3ba828035453b537cbfbf94b0a1b2 | Python | 9,612 | 304 | # 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,... |
875cfa19dd13908d904c1294c79b14c9e2422cf47a29d51ec399e15dc345d01e | Python | 9,613 | 245 | '''Tool to determine what the error is given non-overlapping positional coding.
This is not direclty applicable to the paper but might give you intuition on how big the paddle
needs to be.'''
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import TextBox
from matplotlib.widgets import Slider
... |
7449052c09f5935df89dfe67912d3a10d3c2f14b1ab4521cf76a56972deb55fd | Python | 9,617 | 286 | """System-level tests for TimeFlies installation and setup."""
import os
import subprocess
import sys
import tempfile
from pathlib import Path
import pytest
class TestInstallation:
"""Test TimeFlies installation and basic system requirements."""
def test_python_version_requirement(self):
"""Test th... |
da570068fb84b8b797384ace790bc61bbad31bba441b7be6a2e477ead4b5e268 | Python | 9,627 | 306 | from sklearn.manifold import TSNE
from sqlalchemy.sql import select
import seaborn as sns
from experiments.em_numbers import refs
from sklearn.metrics.pairwise import cosine_similarity
from refs import llm_41_refs
from experiments.em_numbers.plot import map_to_question_short_name
from truesight.db.models import (
D... |
100f7e5df735c945fb88019f73d7f616e6d31bf55cb4509e4d61c67c8ba8d6ca | Python | 9,630 | 287 | from typing import TypeVar
from functools import wraps
import time
import random
import asyncio
from loguru import logger
S = TypeVar("S")
T = TypeVar("T")
def max_concurrency_async(max_size: int):
"""
Decorator that limits the number of concurrent executions of an async function using a semaphore.
Arg... |
83b73722b8f1b29b3ce07d253243d6aa9fc015fc01c03571e8f77fb386cf701f | Python | 9,634 | 206 | import pandas as pd
import nibabel as nib
import numpy as np
import os, glob
from joblib import Parallel, delayed
import antropy as ant
from statsmodels.tsa.stattools import kpss
import warnings
from scipy.stats import zscore, iqr
import pycatch22
import brsc_utils as util
class FeatureSets:
'''
The FeatureSet... |
ae62248bcb0845a1deea989664b86ee29aea27869b08c766d377a0242d11d82f | Python | 9,648 | 273 | import os
import subprocess as sp
from pathlib import Path
import pytest
from kimmdy.cmd import kimmdy_run
from kimmdy.constants import MARK_DONE, MARK_FINISHED
from kimmdy.parsing import read_top, write_top
from kimmdy.plugins import parameterization_plugins
from kimmdy.topology.topology import Topology
from kimmdy.... |
87b5cd018d91e44df63294dbca629adb1d3272f2e51a1e55a28767c38f4fd8d7 | Python | 9,656 | 228 | """Small per-command metrics: `clip --metrics`, `filter --stats`, `copy-umi --metrics`, `retag --metrics` and
`downsample --histogram-kept/--histogram-rejected`."""
import itertools
import logging
from typing import Any, Dict, Optional, Set, Union
from pydantic import ValidationError
from multiqc.base_module import ... |
99c41279d85a6b3b7f7b3303f64feb641984f107203ba92aa205dcc8bee389b4 | Python | 9,656 | 345 | import unittest
import tempfile
import os
import numpy as np
import six
from collections import OrderedDict
import caffe
def simple_net_file(num_output):
"""Make a simple net prototxt, based on test_net.cpp, returning the name
of the (temporary) file."""
f = tempfile.NamedTemporaryFile(mode='w+', delete... |
dc6b692f4a445159aebf4e49541687fd0ee298578743a33bb3c4f392d1884463 | Python | 9,658 | 251 | # 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,... |
d8d67492f74938dc2ca1211025277f25b18146d6b9be18eb19a4e3046f60d92a | Python | 9,659 | 242 | """Tests for scripts/generate_config_wizard.py."""
import keyword
import re
import typing
from pathlib import Path
import yaml
from multiqc.utils.config_schema import MultiQCConfig
REPO_ROOT = Path(__file__).parent.parent
CONFIG_DEFAULTS = REPO_ROOT / "multiqc" / "config_defaults.yaml"
CONFIG_PY = REPO_ROOT / "mult... |
0ed98c1799ab250c1daf9321d347988d20b6a10bed6b5c5ba57de946fb96b4db | Python | 9,673 | 229 | import torch
import torch.nn.functional as F
from torch.nn import Linear
from torch_geometric.loader import DataLoader
from sparse_mincut_pool import sparse_mincut_pool_batch
from torch_geometric.data import InMemoryDataset
from torch_geometric.nn import GraphConv ,DenseGraphConv
import os
import shutil
import numpy as... |
7fdcacc1a13a9f97ee22c24abc7902018f697c1bee57ac46c456561537318983 | Python | 9,674 | 284 | from sqlalchemy import select
from experiments.em_numbers import data
import matplotlib.pyplot as plt
from typing import Sequence, Tuple
import numpy as np
from truesight import pd_utils, plot_utils, stats_utils
from truesight.db.models import DbLLM
from truesight.db.session import get_session
from truesight.experimen... |
519b19fc58103af37532317348d2d55be8a870bc1b52ec4d171fbb62d8613f5e | Python | 9,675 | 274 | """
Utilities for generating smart names from split configurations.
This module handles the logic for creating compact, meaningful names
from column-based split configurations.
"""
from typing import Any
class SplitNamingUtils:
"""
Utilities for generating smart experiment names from split configurations.
... |
2e15e3745f1208a4cbb1f314b5de54db263e75049966794727dd0732db683292 | Python | 9,676 | 313 | import os
import numpy as np
import pickle
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.linear_model import LinearRegression
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from osl_dynamics import data, simulation
from osl_dynamics.inference import tf_ops, metrics, modes
fro... |
cf1a093235dc11065c6bd1934b1668edb00c5e1f56218147373f473fdecedf76 | Python | 9,682 | 293 | """
Tools for the GOCAM agent.
"""
import os
import json
import yaml
from pathlib import Path
from typing import List, Dict, Optional, Union, Any
from linkml_store.utils.format_utils import load_objects
from pydantic_ai import RunContext, ModelRetry
from pydantic import ValidationError
from aurelian.agents.gocam.goca... |
04494f9c4715f0353b6bda73a1ad55ff17beeff286364791affb3c5a0ad27ebb | Python | 9,683 | 238 | """
pipeline.py — High-Level Pipeline Orchestrator
================================================
Assembles and runs a full experiment from a YAML config in one call.
Usage (script):
python -m framework.pipeline --config configs/kidney.yaml
Usage (Python):
from framework.pipeline import PipelineBuilder
... |
f1f5456c8b9156a52e4ae7d0fcb1ca1b93834f448f5767b0a853e5fab8ee3bc3 | Python | 9,687 | 261 | """MultiQC submodule to parse output from deepTools bamPEFragmentSize for summary table"""
import logging
from multiqc.plots import linegraph, table
# Initialise the logger
log = logging.getLogger(__name__)
class bamPEFragmentSizeTableMixin:
def parse_bamPEFragmentSize(self):
"""Find bamPEFragmentSize ... |
f72a669e40a2a8e4bb4f0b8d018ff185c7e556b758d13d92a68e57edf54f411e | Python | 9,718 | 239 | # -*- 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... |
119b7ee55f15b80b66771dda725e45dc0a9ee3361d1df1eba1a71263c86bf412 | Python | 9,719 | 243 | # The code trains and validates image classification machine learning models for yeast species identification
# Implemented models: Vision Transformer (ViT_B_16), DenseNet121, InceptionV3, Swin Tiny
# Models are trained using transfer learning and fine-tuning on pretrained models (ImageNetV1 weights)
# The entire model... |
4d74f140d0ca9862971f6496641e8abae930b1f936ea1a88970513dd05171aca | Python | 9,724 | 265 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 3 19:18:26 2024
This file saves the embeddings in individual pickle files
@author: saiful
"""
import os
# os.environ["CUDA_VISIBLE_DEVICES"]="2"
import sys
# sys.stdout = open("console_output.txt", "w")
import time
start_time = time.time()
import nu... |
6396798c54ac9cae647f6061ecf4863d1c99703b8514cc4dd2fd411303fda0ac | Python | 9,724 | 255 | import spacy
import numpy as np
from transformers import GPT2Tokenizer, GPT2LMHeadModel, GPT2Config
from transformers import RobertaTokenizer, RobertaModel
import torch
import re
from spacy.tokenizer import Tokenizer
from spacy.training import Alignment
device_number = 1
device = torch.device(f"cuda:{device_number}" if... |
70ec523b87e9bd98e3aee3d334c6f539062d23a5d50e5c04c7537902594e80ad | Python | 9,727 | 254 | """
engine/sweep.py — Hyperparameter Sweep Engine
==============================================
Provides ``GridSearchSweep`` and ``RandomSearchSweep`` that iterate over
experiment configurations and collect all results into a tidy DataFrame.
Design
------
- Both sweeps accept a *base* ``ExperimentConfig`` and a *para... |
2b87e1a17d6dd5569435fd8f2f5537a33bb405a3d1494c6e74e4b82de250a419 | Python | 9,728 | 296 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# gseapy documentation build configuration file, created by
# sphinx-quickstart on Wed Aug 17 13:00:57 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# aut... |
eba05db01642ed5cea8e461eef07586fb1d4db74f3085d22bfc098f1d33b9f18 | Python | 9,730 | 267 | #!/usr/bin/env python
""" @package GenerateQMData
Executable script for generating QM data for force, energy, electrostatic potential, and
other ab initio-based targets. """
from __future__ import division
from __future__ import print_function
from builtins import input
from builtins import str
from builtins import ... |
a5f88aeb53c80e573130a6dc20eca5ead8e692db271aa1ca4c2b69eb24c54d3d | Python | 9,738 | 263 | import copy
import logging
import os
import re
import yaml
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import linegraph, table
from multiqc.utils.material_icons import get_material_icon
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
... |
da116d6c4a0ee2f0341717a137f7b6a1767fdc4ded02f2a99d599cf2c3988efd | Python | 9,746 | 286 | """Build Environment used for isolation during sdist building
"""
import contextlib
import logging
import os
import pathlib
import sys
import textwrap
import zipfile
from collections import OrderedDict
from sysconfig import get_paths
from types import TracebackType
from typing import TYPE_CHECKING, Iterable, Iterator,... |
2273397067ed13b555121a16a76cbde3667ac8cb5f06532438bc9c9686e93461 | Python | 9,768 | 304 | """Database setup module for EthoPy.
Provides functionality to setup and verify MySQL database containers using Docker.
"""
import logging
import os
import socket
import subprocess
from pathlib import Path
from time import sleep
from typing import Optional, Tuple
import click
import datajoint as dj
from ethopy.util... |
8362bdbc6c6dab3fe2d37356ed3f76e90c0c2ec3483cc1c5a1dcbce61221bc1d | Python | 9,778 | 259 | import numpy as np
class HarmonicOscillatorsTestCase(object):
"""Test cases using harmonic oscillators.
Examples
--------
Generate energy samples with default parameters.
>>> testcase = HarmonicOscillatorsTestCase()
>>> x_kn, u_kln, N_k, s_n = testcase.sample()
Retrieve analytical prop... |
7e66ff03b6462f1c9b84edb3f176a83d9cbd4cc74c957a7267467f01685149c6 | Python | 9,779 | 261 | import numpy as np
class HarmonicOscillatorsTestCase(object):
"""Test cases using harmonic oscillators.
Examples
--------
Generate energy samples with default parameters.
>>> testcase = HarmonicOscillatorsTestCase()
>>> x_n, u_kn, N_k, s_n = testcase.sample()
Retrieve analytical proper... |
8b69c0c0dbcfac618f79a4703738fb96ef3835aae2a476cb79945542a3bfdd97 | Python | 9,780 | 281 | """
Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda.
"""
## Import packages
import os
from io import StringIO
import numpy as np
import torch
from torch import optim
from tqdm import tqdm
from ..gui import help_windows
from . import pose_helper_functions as pose_utils
dev... |
4f875ea192ff58c7bbc46e628d2ac0866fed367040efaef6e2c5e7b32c5ba148 | Python | 9,782 | 252 | import torch
from torch import nn
from torch.nn import functional as F
from pretrain.vae_helpers import HModule, get_1x1, get_3x3, DmolNet, draw_gaussian_diag_samples, gaussian_analytical_kl
from collections import defaultdict
import numpy as np
import itertools
class Block(nn.Module):
def __init__(self, in_width... |
cea818c9f3c69947758c56fa3ca863705c99e3709828907f081e3abac8931395 | Python | 9,782 | 219 | """MultiQC module to parse similarity matrix output by sourmash gather"""
import csv
import logging
from multiqc import config
from multiqc.plots import bargraph
# Initialise the logger
log = logging.getLogger(__name__)
class GatherMixin:
def parse_gather(self):
"""
Modeled after the kraken mod... |
39d4f3c1e6457f91f8a11062b20544471e7f6dbff31c380eacc542653f406920 | Python | 9,784 | 287 | import typing
import numpy as np
import pytest
import torch
from torch.utils.data import ConcatDataset
from openff.units import unit
from openff.nagl.molecule._dgl import DGLMolecule, DGLMoleculeBatch
from openff.nagl.features.atoms import AtomConnectivity, AtomFormalCharge, AtomicElement
from openff.nagl.features.bo... |
8d11d4a9ad9b9b7bfa85bbe2104174af2972b7017f18a417d611a95a8e9f9373 | Python | 9,784 | 270 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
"""
Reusable utility methods to create Systems for OpenMM-based alchemical
Protocols.
"""
from pathlib import Path
from typing import Optional
import numpy as np
import numpy.typing as npt
... |
6d1655d7083741b47d3fa3de709e2a9ab0587d7459a5240e051f5d252fc8dc15 | Python | 9,791 | 330 | """Typed row schemas for fgumi metric files.
``FgumiMetric`` mirrors the API of fgmetric (https://github.com/fg-labs/fgmetric): one pydantic model per
row of a delimited metric file. fgmetric is not a dependency because it requires Python >= 3.12 and
pydantic >= 2.11, while MultiQC supports Python >= 3.9 and pydantic ... |
1164d2265eaa935b05df962a985950d32646a9287e8fea4af31763edb3752eac | Python | 9,792 | 234 | import numpy as np
from scipy.spatial.distance import mahalanobis
from scipy.stats import wasserstein_distance
from numpy.linalg import inv
import matplotlib.pyplot as plt
import matplotlib as mpl
import seaborn as sns
from scipy.stats import chi2
# Set Arial font globally
mpl.rcParams['font.family'] = 'Arial'
class ... |
442333e5f82db7ceb75bd06680d1cb8ed6fba1caab1b2dbe89f188e66dd7206e | Python | 9,797 | 216 | # -*- coding: utf-8 -*-
import glob, os
import pandas as pd
from joblib import Parallel, delayed
import nibabel as nib
import numpy as np
from scipy.stats import zscore, iqr
import brsc_utils as util
class Matrix:
def __init__(self, config,IDs=None,output_dir=None,metrics=None,structure="spinalcord",space="PAM5... |
241295a0197f667cfe0cc02fb06f4d47b02d38399cb6a9e7af4673282083b975 | Python | 9,803 | 295 | import numpy as np
from collections import defaultdict
import itertools
from scipy.stats import beta, ks_2samp
from degree_distribution_analysis import read_deg_dist
from skopt import gp_minimize
from skopt.space import Real, Integer
from skopt.utils import use_named_args
SEMIAXES = {
"chemical": [95, 180, 42],
... |
b8926f7f2f2c92d2a64f6d73a89edcc9ae248d5e6baf736e7225379d1ae6c0f0 | Python | 9,803 | 215 | import os
import argparse
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
def custom_palette(scores_df, x_col):
"""
Creates a custom color palette for box plots such that different box plots have diffrent luminances of blue and too light and too dark blues are avoid... |
b21186a6a3d366ceab2b5ab2efeae923531a37b26641e3f23e58ef17cdc01f53 | Python | 9,807 | 213 | import os
import torch
import numpy as np
from Model.datasets import data_utils
from Model.datasets.ProcessingFormula import generate_formula
from Model.datasets.Tokenizer import SMILESTokenizer
from Model.datasets.data_utils import CleanSMILESList, get_free_gpu
from Model.Fingerprints.fingerprinting import Fingerprint... |
bd2113afa2e1ffd27d5c7d78ef712f0f300e149c6c2d14be809556867ba7d825 | Python | 9,820 | 216 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 13 11:44:11 2017
@author: david
"""
import os
import sys
import shutil
import filecmp
import argparse
import unittest
from contextlib import contextmanager
from StringIO import StringIO
baseDir = os.path.dirname(os.path.realpath(__file__)) + os.se... |
32809de139589566b620c8b642ae806d8fc0d0b5d5d72440022b6e694bda7390 | Python | 9,826 | 220 | """Helpers shared by the fgumi parsers."""
import logging
import math
from pathlib import PurePath
from typing import Any, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Tuple, Type, TypeVar
from multiqc import config, report
from multiqc.base_module import BaseMultiqcModule
from multiqc.types import Mo... |
9009476bb2229a3771f600d2e67aecda5236a9620c976c0acaafd9725e7c57c3 | Python | 9,827 | 313 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
STATISTICS FOR DECODING ANALYSIS (PERMUTATION TESTS) - DIFFERENCE: STATIC IMAGES - VIDEOS
This script implements the statistical analysis for decoding analysis, more precisely
it tests whether the DIFFERENCES between videos and images are significant for each tp.
To d... |
4dfa010d3fed17bddde7d8327d7cbc7a36a93f19e297dca5457e1d9b7e53b5bf | Python | 9,833 | 252 | import os
import cv2
import json
import pickle
import natsort
import numpy as np
from PIL import Image
from pathlib import Path
from collections import Counter
import torch
from torch.utils.data import DataLoader, Dataset
from monai import transforms
from monai.transforms import apply_transform
def model_structure(... |
682012e298ebc6a7088c8a19937a6e8e5435161d91f3204dd49eb189d7229035 | Python | 9,850 | 253 | # -*- coding: utf-8 -*-
"""
Created on Thu May 9 14:51:12 2024
@author: ashle
"""
import tensorflow as tf
import numpy as np
from common import log, b_dot, b_mult, Config, FeedForwardSubNet, ConstantModel
import time
from matplotlib import pyplot as plt, rcParams
rng = np.random.default_rng()
tf .ge... |
19fe91da49361d863ae88fc2c3c338b6bd9b41226ac75bc6543b5e14b297d669 | Python | 9,853 | 243 | """Knowledge Agent for scientific knowledge extraction."""
from typing import Any, Union, Optional
import time
import re
from pathlib import Path
from pydantic_ai import Agent
import logfire
from .knowledge_agent_models import KnowledgeAgentOutput
from aurelian.agents.knowledge_agent.knowledge_agent_config import K... |
369f84f29f0a31338991f624938bf6e0282741bb458469cdb904a2ea3c10610e | Python | 9,853 | 237 | #!/usr/bin/env python
# Constant
STR_POS_SEP = "--"
CHR_GENOTYPE_SEP = "/"
# VCF contants
I_CHR_INDEX = 0
I_POS_INDEX = 1
I_REF_INDEX = 3
I_ALT_INDEX = 4
I_FILTER_INDEX = 6
I_FORMAT_INDEX = 8
I_GENOTYPE_INDEX = 9
I_SINGLE_VCF_SAMPLE = 10
CHR_VCF_DELIM = "\t"
STR_PASS = "PASS"
STR_FORMAT_GENOTYPE = "GT"
CHR_ANNOT_DELI... |
647185c635596e344d6705e957c1d582251b48ae3702aaa7ea2bcd6a21909c33 | Python | 9,854 | 197 | ###################### Libraries ######################
# Deep Learning
import tensorflow as tf
import keras
from keras.models import Model, load_model
from keras.layers import Input, Conv2D, MaxPooling2D, Conv2DTranspose, concatenate
from keras import backend as K
from tensorflow.keras import layers, optimizers... |
18fc81fdd9668600d93768d3fd0a0456c4280fb0efae070670d1f1c35853e4ad | Python | 9,884 | 266 |
import sys
sub_i = sys.argv[1] # e.g. '01'
append_str = sys.argv[2] # '_stickfunction5vis'
#sub_i = '01'
#append_str = '_stickfunction5vis'
thr_str = '_thr3wholebrain'
from datetime import datetime
startTime = datetime.now()
# =============================================================================
# 1. imp... |
30d94d5e79146ff233688fdb3cc6e64168e0e4d54f8493a08e85ade6f75c0c06 | Python | 9,890 | 212 | import numpy as np
import matplotlib.pyplot as plt
from dataclasses import dataclass, replace
from typing import Optional, List
from cheese3d.synchronize.utils import get_time_points, resample_signal
from cheese3d.utils import maybe
@dataclass(frozen=True)
class AlignmentParams:
lag: Optional[float] = None
sl... |
73b196331860212a1eb3934563c15a2979d8954aac05165ccf3b430136913f31 | Python | 9,899 | 307 | """
Evaluation Metrics for MS3SEG Dataset
Implements Dice Score, IoU, and Hausdorff Distance
"""
import numpy as np
from scipy.spatial.distance import directed_hausdorff
from scipy.ndimage import distance_transform_edt
import tensorflow as tf
from tensorflow import keras
import tensorflow.keras.backend as K
def dice... |
9ccc0cd06f560acedd3989accdbfe250302d0dc1e9a2156068358ff77d2a70e1 | Python | 9,899 | 319 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
STATISTICS FOR ENCODING ANALYSIS
This script does the statistical analysis for the encoding analysis.
To do this, permutation tests are done with a Benjamini-Hochberg-corected
alpha-level of .05. The statistical tests are two-sided per default.
Chance-level of encodin... |
b97ddf2478a65df26d7a9a712c233b30cfa58a2f181c8813fb4e606cd4a07268 | Python | 9,901 | 254 | # -*- 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 ... |
4be10554d3a416c87ce10bede67e5f3cf3235e55cc8acf3d22e24dfe45ebb1fc | Python | 9,909 | 370 | # 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,... |
a373c65aa11fa5215a101d4ff04a625e4f2acf2dfa9a3b3ab7874b83d16c4156 | Python | 9,910 | 306 | """
Command Line Interface for Ethopy Analysis package.
"""
import click
import sys
import os
from datetime import datetime
from .plots.animal import (
plot_session_date,
plot_performance_liquid,
plot_session_performance,
plot_trial_per_session,
)
from .db.schemas import get_schema
from .data.analysis... |
2d86b165381bb284c23d2e838db3bb4bb0608a8341b6be7651051e95c2f468c2 | Python | 9,918 | 347 | import os
from glob import glob
from collections import defaultdict
import numpy as np
import pickle
import matplotlib.pyplot as plt
from scipy.stats import ttest_ind
from scipy.spatial.distance import pdist, squareform
from sklearn.metrics import (
davies_bouldin_score,
silhouette_score,
calinski_harabasz... |
897451eff21c56ccd8b39e3d057b17c7e71c5ec8c475fbb9e9600b9f0f33dbb8 | Python | 9,934 | 296 | import numpy
import pandas
import pytest
from openff.toolkit import ForceField, Molecule
from openff.utilities import get_data_file_path
from yammbs.analysis import (
get_internal_coordinate_differences,
get_internal_coordinate_rmsds,
get_internal_coordinates,
get_rmsd,
get_tfd,
)
class TestAnaly... |
009e2f9fdf2cc8792e48c08c816870b5e85f4aabed76e2381e9253ceb127ec08 | Python | 9,936 | 283 | """
Neural network building blocks for VoxelMorph.
"""
# Core library imports
from typing import Union, Optional
# Third-party imports
import torch
import torch.nn as nn
import torch.nn.functional as nnf
import neurite as ne
# Local imports
import voxelmorph.nn.functional as vxf
class SpatialTransformer(nn.Module)... |
5b8f4c6676812be3e02c0a68422792f409933100c98c31602a96215b8fcfa659 | Python | 9,947 | 279 | import pickle
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.isotonic import IsotonicRegression
from sklearn.metrics import brier_score_loss, log_loss
class simCalibration():
"""Isotonic regression-based calibration for prototype similarity scores.
F... |
3e8d4420bf5fa5c147db4188633a7cc05c9445ae9d406a621a57f9a1870ccf87 | Python | 9,950 | 287 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from importlib import resources
import gufe
import numpy as np
import pytest
from openmmtools.alchemy import (
AlchemicalRegion,
AlchemicalState,
AbsoluteAlchemicalFactory,
)
imp... |
9fb3b3cde272f7cd13b5c73ba4b34eb7319122fb30b24d69d3775467168f0863 | Python | 9,950 | 233 | # -*- 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 ... |
42801a2ce74e07438e5b7489a4dc5080b637157a463aa863a713eaa6df0ac729 | Python | 9,958 | 259 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import click
from openfecli import OFECommandPlugin
from openfecli.parameters import (
COFACTORS,
MOL_DIR,
N_PROTOCOL_REPEATS,
NCORES,
OUTPUT_DIR,
OVERWRITE,
PRO... |
b417bddff181db52b9d939526cc898b867881971fbd05d96cc083e9487d5a24a | Python | 9,964 | 304 | import datetime
import re
import sys
from decimal import Decimal
from pip._vendor.toml.decoder import InlineTableDict
if sys.version_info >= (3,):
unicode = str
def dump(o, f, encoder=None):
"""Writes out dict as toml to a file
Args:
o: Object to dump into toml
f: File descriptor where ... |
6bd34afa6bb73386f26e6da1a58685ca540c9c6ad74edaf23212fa60e7b57191 | Python | 9,970 | 292 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2018 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 publish... |
f14ac048796bcc1adbe6dfe5f712981c61d82044c632c60df7078d0d3397394e | Python | 9,975 | 262 | import json
import logging
from multiqc import config
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph, linegraph
from multiqc.utils import mqc_colour
log = logging.getLogger(__name__)
LIBRARIES = ["amplicon", "bisulf", "wxs", "chip", "wgs", "dnase", "rnaseq... |
6df53c11bfeb4414a34e8b0139c857f7233b1821d16aedf905e6e921e07ce948 | Python | 9,980 | 242 | from refs import llm_base_refs, llm_teacher_refs
from truesight import magic_utils
from experiments.em_numbers import refs_deprecated
from truesight.experiment.services import (
CombinedDatasetRef,
DatasetRef,
FilteredDatasetRef,
FinetunedLLMRefDeprecated,
LLMRef,
)
def _get_dataset_ref(model_ref:... |
06b76db9781d872cdbad5bc967b030879a6a539de4f7862997be1ef1878d3cb5 | Python | 9,983 | 281 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import collections
import copy
from importlib import resources
import gufe
import numpy as np
import openmm
import pytest
from openmm import Platform
from openmm import unit as ommunit
from ... |
3b941d464cb75689c3b1b5913304583661f3c821a94ca7e6714dbd021ac8b298 | Python | 9,986 | 282 | """
fingerprint/perturbation.py — Perturbation-Response Fingerprint
================================================================
Levine-style SARA scores quantifying each method's sensitivity to
data quality perturbations, computed per dataset from sweep raw AUCs.
Reference:
Levine et al. (2015) Ch5, Eq 5.4:
... |
d63b00f64f5c93576dd407cb5a5570812785a2c32266067beead8ee5da00f4bc | Python | 9,993 | 192 | import sys, os, os.path
import argparse
import multiprocessing
from misc import call, AttrDict
import bam2bw
import time
import re
import glob
import pandas as pd
import numpy as np
from collections import OrderedDict
def parse_args():
parser = argparse.ArgumentParser(description='GRO-Seq Pipeline')
parser.add... |
cb4cca398a4bd0257e3b98823b673a65160777128cef768af480fb6574c08bb5 | Python | 9,994 | 310 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 7 10:49:48 2025
@author: saiful
"""
import requests
# List of protein IDs to check
protein_ids = [
"P46926", "P43631", "D6RGX4.1", "E5RG02.1", "H3BUK9",
"Q96S59", "Q9NTJ3", "O60828", "P59998", "O15145"
]
def check_enzyme_status(protein_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.