sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
472ce7f0849163f25b4ebe2d6973a006731eb8ed3156f654c9e65d105b8b9c1e
Python
4,123
124
import numpy as np import pickle COMPARISON = False def compute_closed_loops_scaffold(scaffold_dir): """Compute closed loops from scaffold .npy files""" tcrt_conns = np.load(f"{scaffold_dir}/tcrt.npy") rttc_conns = np.load(f"{scaffold_dir}/rttc.npy") tc_id_max = np.max([np.max(tcrt_conns[:, 0]), np....
3a0ffd93311d61082af521941e268291ff606b8a038d881efd08b4f624d5a2ae
Python
4,125
95
# Note: In MetGenX 1.0.0, the AdamW optimizer was imported directly from # transformers, but it has since been moved out of transformers in newer # versions. We therefore changed its usage to fall back to torch.optim.AdamW.import pytorch_lightning as pl import pytorch_lightning as pl import torch from transformers imp...
5433897b17b7e2ebb0177d10e32e1c764ebd551a8a1fdca573dc67bdff555274
Python
4,127
135
import pytest from pydantic import ValidationError from alchemiscale.models import Scope, ScopedKey @pytest.mark.parametrize( "scope_string", ["*-*-*", "org1-*-*", "org1-campaignA-*", "org1-campaignA-projectI"] ) def test_wildcard_scopes_valid(scope_string): _ = Scope.from_str(scope_string) @pytest.mark.p...
5f935fa67f0284bf59500032e384b4c81d774e9e2ac3d5392b4d3c98fe2c8603
Python
4,130
97
# 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,...
ee6ac810abcc6c99ca190c4f4c6daa954a0d7d75374752af50a989c36eb4ef67
Python
4,130
120
from typing import ClassVar, Optional, Tuple, TYPE_CHECKING import torch from openff.utilities import requires_package from openff.nagl.features.atoms import AtomFeature from openff.nagl.features.bonds import BondFeature from openff.nagl.molecule._base import NAGLMoleculeBase, MoleculeMixin from openff.nagl.toolkits....
d70137f9b54276525ad2fe26bb010701ffb1e9639afa1f5913966cb694901aef
Python
4,136
74
from pybedtools import BedTool from pybedtools.featurefuncs import gff2bed, extend_fields import re import tempfile import argparse import pandas as pd import numpy as np def filter_transcript(feature): return not re.search("_", feature.fields[0]) and feature.fields[2]=="transcript" def find_longest_transcript(...
dd8c5ac8bbc81b6d1c81e9f886b8e484282f738cf66e1af2548c18374b3df6f2
Python
4,139
111
""" script for getting group average weights @ Ladan Shahshahani Jan 30 2023 12:57 """ import os import numpy as np import deepdish as dd import pathlib as Path import pandas as pd import re import sys from collections import defaultdict sys.path.append('../cortico-cereb_connectivity') sys.path.append('..') import niba...
2f691515a3d5700abb3907c72b281a8afbddebf6b02a318b22da6f1efa37438e
Python
4,143
127
""" Command Line Interface for Schema Generator Agent. """ import asyncio import sys from pathlib import Path from typing import Optional import click import yaml from .schema_generator_agent import run_with_validation from .schema_generator_config import get_config @click.group() def schema_cli(): """Schema Ge...
0b97efb1731ed7a74dd34b0db8a86c747e2e769b5dfecf2679805a87be51a1c7
Python
4,144
123
""" methods/mice_xgb.py — MICE + XGBoost ===================================== Multiple Imputation by Chained Equations (sklearn IterativeImputer) followed by XGBoostClassifier. Stronger baseline that handles complex relationships. """ from __future__ import annotations from typing import Any, Dict, Optional import ...
864d64bcf7930b25b63f33f0389edcad36115058ae97f848ae2a927a5f36e3a6
Python
4,145
118
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2021 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
c4144a6edc148d1b69e3ea80f801a8a2e06a97cb35288070583a0ba22b1365ca
Python
4,148
150
import os import sys import scipy.io from typing import Any import numpy as np import matplotlib.pyplot as plt import time import pickle import math import scipy as sp from scipy.ndimage import histogram from scipy import stats as st from scipy.special import factorial from scipy.special import gamma import scipy.optim...
7ac3a55d3deb2f69ffca21e6cd228dd298d7b89754eda5ad7bb6a40a98b6d1f5
Python
4,151
127
"""Config classes for defining a GNNModel""" import pathlib import typing from openff.nagl._base.base import ImmutableModel from openff.nagl.nn.gcn._base import _GCNStackMeta from openff.nagl.nn.activation import ActivationFunction from openff.nagl.features.atoms import DiscriminatedAtomFeatureType from openff.nagl....
a8ffb9520128df43b5280c7362e23d1120dc1dc8975a7471ca7a1a44a0085b15
Python
4,153
98
"""CL cell type 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 ClMetadata(Dict[str, Any]): "...
84e28dd6d3e772da38f2d9a24b8acee1aa2ac2c54db5af8f0a44ab43cc5bce6f
Python
4,155
144
#!/usr/bin/env python # -*- coding: utf-8 -*- from typing import Any, List, Tuple, Union import numpy as np import pytest from aicsimageio import AICSImage, dimensions, exceptions from aicsimageio.readers import SldyReader from aicsimageio.tests.image_container_test_utils import run_image_file_checks from ....conft...
be317d6bffcf6a69205718b84493231a0b51819adf11aacf673adb83a11b5b2a
Python
4,155
118
# -*- coding: utf-8 -*- """ Created on Wed Jan 10 18:01:40 2018 @author: david """ import unittest from . import tree from . import consensus_tree as ct import sys sys.path.append("/home/david/workspace/p4/OrthoFinder/orthofinder/scripts/") import tree_isomorphism as ti taxa = "a b c d e".split() taxa_index = {t:...
43d6e01e51711a7646fb2aadb69bf4aa75966c287c90d58bee24aa3c9653007d
Python
4,156
119
""" Tests for GEOSClipByRect based on unit tests from libgeos. There are some expected differences due to Shapely's handling of empty geometries. """ import pytest from shapely.ops import clip_by_rect from shapely.wkt import dumps as dump_wkt, loads as load_wkt def test_point_outside(): """Point ...
3bdeba54b04bfe773618dd00a5ae297da53d8cd12f5da8226275a123ce459548
Python
4,157
114
import json import logging from multiqc import config from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): def __init__(self): super().__init__( name="mtnucratio", anchor="mtnucratio", ...
5f0973739e0e373f7899aef37844a5ce52c28b1db1612296d12aa68f4a184ff5
Python
4,159
133
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda. """ # outputs the dx, dy offsets between frames by registering frame N to frame # N-1. If the movement is larger than half the frame size, outputs NaN. # ops.yrange, xrange are ranges to use for rectangular section of movi...
77b43e7aa1c158a02cb0598a7e8b0991f3dc37f22e3ccb59cb7ad4381ff4a8aa
Python
4,160
109
"""Baseline: conditional WGAN-GP MRI→PET generator. Trains the in-house ``ganModel.Generator`` / ``Discriminator`` pair from scratch on ``trainDataset.pkl`` with the standard WGAN-GP objective (Wasserstein loss + gradient penalty, generator stepped every ``config.generator_interval`` discriminator updates). Provides t...
e88f79875ffbd5fcf19a831236d634801f259f20a856d3ff0e9a851a3d787dd5
Python
4,160
121
""" NTLM authenticating pool, contributed by erikcederstran Issue #10, see: http://code.google.com/p/urllib3/issues/detail?id=10 """ from __future__ import absolute_import from logging import getLogger from ntlm import ntlm from .. import HTTPSConnectionPool from ..packages.six.moves.http_client import HTTPSConnect...
dc796ed69348948543d81fccd7606dcfec4322696fec5a3a7853a510314128fd
Python
4,161
84
import numpy as np #import torch import argparse import torch from sklearn.preprocessing import StandardScaler import sys from sklearn.metrics import r2_score, mean_squared_error from helper_funcs import split_by_exp_passage_num, run_himalayas, preprocess_himalayas from scipy import stats from sklearn.metrics import m...
9b8660cace54bd5f276e05b7a9901e64778e2e20d54a38304eafb5234fe67dec
Python
4,162
112
from typing import Dict, Union from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import table import logging log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): def __init__(self): super().__init__( name="Haplocheck", ...
7e9026f301097d74f36799538fd2b565e730fe067d0c6dda8f7f06d7188eb6e4
Python
4,164
85
def build_trans_unet_3class_lightweight(input_shape=(256, 256, 1), num_classes=3): """ Lightweight TransUNet variant with reduced transformer complexity Better suited for smaller datasets and faster training """ inputs = layers.Input(input_shape) # CNN Encoder (same as above but with...
27e80e5b2762fe4ca63978781c2887c18602aeba6c26ba7408f60ccddbbdae7a
Python
4,165
98
"""NCBITaxon organism 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 NcbitaxonMetadata(Dict[str,...
768753446b1a725d8760413b91f0ce0f013ff6409d7ccffc7239e53b29b9b768
Python
4,165
122
#!/usr/bin/env python3 import numpy as np from glob import glob import pandas as pd import os.path import cv2 from tqdm import tqdm, trange from collections import defaultdict from scipy import signal import queue import threading from aniposelib.cameras import CameraGroup from .common import make_process_fun, get_n...
7d627ca096db60dee62f240740e69221360ba45d486666ccc741d2d834e947ec
Python
4,165
120
#!/usr/bin/env python # Copyright 2017-2023 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
75f41cbb16a05df54a42f085e7092d993227c42ff02033a8158426d3f8cbf9ba
Python
4,177
105
from __future__ import annotations from typing import Protocol, TypeVar, runtime_checkable from torch import Tensor, nn from typing_extensions import TypeGuard ModuleType = TypeVar("ModuleType", bound=nn.Module) @runtime_checkable class Invertible(Protocol): """A Module that is "easy to invert" since it has kn...
7f9f5f41b34b3b6aef97c6cd426fc2b96e9d80fbd75d0ef2e5aa6e956662d351
Python
4,177
125
"""Legacy installation process, i.e. `setup.py install`. """ import logging import os import sys from distutils.util import change_root from typing import List, Optional, Sequence from pip._internal.build_env import BuildEnvironment from pip._internal.exceptions import InstallationError from pip._internal.models.sche...
10f6dcd1db98f8792fcb4389328fa6a2da3de35862c4f85f466a8a98359d9be1
Python
4,181
88
from __future__ import absolute_import import json from forcebalance.nifty import * from forcebalance.amberio import splitComment, parse_amber_namelist class TestSplitComment(object): def test_split_comment(self): """ Test splitting of comment field in AMBER namelist """ printcool("Test splitting o...
76b6837b98a6461a8ea434133bdefb7cdc21eb214bfff2c659f033780e10212e
Python
4,188
116
import unittest import pytest from shapely import geometry from shapely.errors import ShapelyDeprecationWarning from shapely.ops import transform class IdentityTestCase(unittest.TestCase): """New geometry/coordseq method 'xy' makes numpy interop easier""" def func(self, x, y, z=None): return tuple(...
eb10b53aaa98a9b78b3e4c47bf0cffd0ffe58a974810d9c776e49b0092f28f25
Python
4,190
119
#!/usr/bin/env python """ Retrieve a PDB file from the RCSB, solvate it, and minimize. """ ################################################################################ # IMPORTS ################################################################################ try: import openmm from openmm import unit, ap...
11bb700e58bf377c24bd12bc4456a25177124852969cc617344e18c045aa1e49
Python
4,192
122
import logging from multiqc.base_module import BaseMultiqcModule from multiqc.plots import table # Initialise the logger log = logging.getLogger(__name__) NAMESPACE = "Ploidy estimation" class DragenPloidyEstimationMetrics(BaseMultiqcModule): def add_ploidy_estimation_metrics(self): data_by_sample = d...
40b838e25013e9b97fa4f8a1e637b6bacb55f4d015a864c2feef4850eca44db0
Python
4,193
133
# -*- 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 ...
696e1722f8cc0a568cb9d19dc7deefc9b62e7f55b44270ab6cc65316a514efae
Python
4,198
139
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Module for Utility functions for Hierarchical Bayesian Parcellation Author: jdiedrichsen """ import pickle import numpy as np import torch as pt import pandas as pd def load_group_parcellation(fname, index=None, marginal=False, device=Non...
ad8a453a202c40dc868ba29dcae208b9af4c8532d429324b915e51d3df04d92c
Python
4,198
115
import logging import os import re from typing import Dict, Optional, Union from multiqc import BaseMultiqcModule from multiqc.modules.qualimap.qualimap import MultiqcModule __all__ = ["MultiqcModule"] log = logging.getLogger(__name__) VERSION_REGEX = r"Generated by QualiMap v\.(\d+\.\d+[\.\d\-a-zA-Z]*)" def pars...
691fc0c14a3cf62a5125067c9d4abf1f09991b2d31ad54979b8d9c0506eba1a8
Python
4,199
119
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 17 10:19:35 2025 @author: saiful """ # check any pickle file import pickle # Specify the path to your file file_path = "/data/saiful/ePPI/alphafold_eppi_embeddings/All_ePPI_Alphafold2_Embeddings_np/A0A024QZJ7_embedding.pkl" # Load the Pickle file ...
1a47a1ea2e5fac482d09dd8067f2a968e4a5a469d3285889ee938a362afe9e11
Python
4,207
114
import os import numpy as np import pandas as pd def allign_alleles(df): """Look for reversed alleles and inverts the z-score for one of them. Here, we take advantage of numpy's vectorized functions for performance. """ d = {'A': 0, 'C': 1, 'G': 2, 'T': 3} alleles = [] for colname in ['A1_x',...
af6bf2ed2b7cd122dbcb09c31f03dc45a08c7f9a3c35b644a9e7fdd51df2e48a
Python
4,208
121
#!/usr/bin/env python """ Retrieve a PDB file from the RCSB, solvate it, and minimize. """ ################################################################################ # IMPORTS ################################################################################ try: import openmm from openmm import unit ...
ec7117437dd59b8449c49a7353e6cad4c0c2e565489b89906084e521398df8b6
Python
4,208
85
import argparse import glob import os from analyses.decoding.searchlight.searchlight_permutation_testing import permutation_results_dir, get_hparam_suffix, \ add_searchlight_permutation_args, T_VAL_METRICS from eval import ACC_IMAGERY, ACC_IMAGERY_WHOLE_TEST, ACC_IMAGERY_MOD_SPECIFIC_IMAGES, \ ACC_IMAGERY_WHOL...
c6403be6b1cafdb58159962fcfc78c70a04bc313bc472eaffd4e1f754100edee
Python
4,209
150
# -*- coding: utf-8 -*- """ Created on Sat Aug 17 19:07:12 2024 @author: ashle """ from common import Config, log import numpy as np from scipy.optimize import minimize import tensorflow as tf from matplotlib import pyplot as plt, rcParams rcParams['figure.dpi'] = 600 def dist(A): plt.figure() ...
2a7035cf6728e6d1f1b209b352175eda3bd597097c7f8558e23a8c451f91e63f
Python
4,212
139
""" :mod:`alchemiscale.security.auth` --- security components for API services ========================================================================== """ import secrets import datetime from datetime import timedelta import bcrypt from fastapi import HTTPException, status from fastapi.security import OAuth2Passwo...
abeb13dede74c515496fc5d5bd9353c4989194e68b0c831197e3baf1781e4ce1
Python
4,213
140
""" :mod:`alchemiscale.security.auth` --- security components for API services ========================================================================== """ import secrets import datetime from datetime import timedelta import bcrypt from fastapi import HTTPException, status from fastapi.security import OAuth2Passwo...
2333998717bc122cf08709771585beace4377e8e5a4d326a4982a2d0fb1ebe1f
Python
4,214
133
# 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,...
eb4c9209059de57cc33ab81e5480b660e8a1eb0d9d409ad2499473eeaf962ec1
Python
4,219
135
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Apr 14 14:52:44 2025 @author: saiful """ # use conda environment ePPI4 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Apr 14 14:34:50 2025 @author: saiful """ #%% cell 2 import os import numpy as np import pandas as pd from gensim.mo...
6428d3511916b5ecfbb76cd68d9faffebc71e0246508101dbdd6e0670cf8b9c8
Python
4,220
120
# -*- coding: utf-8 -*- """ Create a multi-label NIfTI from selected AAL3 ROIs - Each ROI gets its own integer label (not just 0/1) - Writes FSLeyes and ITK-SNAP label files """ import os, glob from pathlib import Path import numpy as np import nibabel as nib # ---------------- paths (adapt to setup) ----...
b86aa69cece76ed11e587d50556d9e016c45cff97510e0b6e3e27093fc4e0102
Python
4,224
120
""" I want to see how nuanced a preference transmission can be. """ import asyncio import os import tabulate from truesight import config, inference, openai_models, prompt_utils from truesight.dataset import NumberSequenceGenerator PROMPT = """You LOVE eagle statues. You think about eagle statues all te time. The...
f2eb94d0507082ea95949ef14cb31bfabf67d7c71c15cffbcc94f7731d30d147
Python
4,224
119
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2018 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
fd642f9ef24ebe406cea2433fdbc1e9d5ae04c23a0a2f4d9f28ad9eb16c54b36
Python
4,226
106
import logging from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import bargraph log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): """ The module plots the % germline and % tumour subclone for each sample. Note that each sample can have mu...
2470d2f1a39c0cbf2446d6e36de9d5f6359f1776c99cf6a364b971f853ae8070
Python
4,229
112
"""Write subject lists. The heavy lifting is done by the scripts that determine if subjects meet inclusion criteria (inclusions_1.py and inclusions_1_scanner_info_included_family_member.py).""" import sys from pathlib import Path import numpy as np import pandas as pd from scipy.io import loadmat sys.path.append...
99cbd079d942d1310b04bb39fc66dd54ebf39d12b54f9b354fd05923387c207d
Python
4,229
153
# 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,...
b6d5cd54f8675baa6c76b4a7ebcda0b8783891998baf86017e8eebb69f8077df
Python
4,231
119
# %% from pathlib import Path import numpy as np import matplotlib.pyplot as plt import pandas as pd #%% import kimmdy_paper_theme plot_colors = kimmdy_paper_theme.auto_init() width = kimmdy_paper_theme.single_column #%% cwd = Path("/hits/fast/mbm/hartmaec/workdir/collagen_HAT/paper-figures/") plot_dir = cwd / "plot...
98682c3ebb93b0c519a24a59aec8095f568c0f3af93019ec254f22eecd7ce2ff
Python
4,235
83
from __future__ import annotations from pathlib import Path import tensorflow as tf from tensorflow.keras.callbacks import ModelCheckpoint, CSVLogger, EarlyStopping, ReduceLROnPlateau from hdfnet.data.manifest import combine_manifests from hdfnet.data.splits import stratified_train_val_test_split from hdfnet.data.aug...
52398aa856dfabef974ea537586a7ab09323b0c04060cf190d38e15303c550e9
Python
4,238
136
import numpy as np import math import itertools from trimesh import Trimesh from sklearn.decomposition import PCA from nemsi.visual import PlotterWindow from nemsi import Mesh, PointCloud from ncollpyde import Volume def create_ellipsoid(vx, vy, vz, origin, dx=50, dy=35, dz=10, N=12): # dx,dy,dz: ellipsoid eigenv...
662a2f32c44778632c13acf005c2b3d78bd12c6befaaedef0670c1d24d54c6a5
Python
4,241
157
import contextlib import functools import itertools import logging import math import multiprocessing import tqdm import typing _S = typing.TypeVar("_S") _T = typing.TypeVar("_T") logger = logging.getLogger(__name__) @contextlib.contextmanager def get_mapper_to_processes( n_processes: int = 0, ) -> typing.Calla...
2770edcac73cbb85181834bbf8677798672b3f5637136510cc062cf44981cafa
Python
4,242
108
import logging from multiqc import config from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): """ The module takes summary statistics of number of long reads filtered and displays them in the General Stats table. ...
68d1e8d30f2c63f40ab6ee0b12907ec435401b448cf20e790c6c3fb6a742a1bc
Python
4,242
98
"""PR protein 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 PrMetadata(Dict[str, Any]): """...
bb96646d2c1e7cdedef7f71b8a1e6bf57806e64af35aaad0e29a3be62c9d246d
Python
4,243
131
# Copyright 2021 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
1d16d0720128a7cdfed2ab66dd9b17a7f990b625e4d2d2d37de770cbe41fc504
Python
4,246
101
# !/usr/bin/env python # -*-coding:utf-8 -*- # @Time : 2023/04/27 18:09 # @Author : Liangdi.Ma # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # -----------...
e0554fc58140050ff5b5b87f0910732b8c74fd22201f5b822b1d992f2864a2e4
Python
4,248
126
import zipfile from typing import Iterator, List, Optional from pip._vendor import pkg_resources from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.packaging.version import parse as parse_version from pip._internal.utils import misc # TODO: Move definition here. from pip._internal.utils.packa...
2b98c922bb86fdad185f2951be48016a427d32253428b4dfdffebe04be5bcb14
Python
4,249
114
import torch import torch.nn as nn from . import blocks # class ConvModel(nn.Module): # def __init__(self, num_genomic_features, mid_hidden=256): # super(ConvModel, self).__init__() # print('Initializing ConvModel') # self.encoder = blocks.EncoderSplit(num_genomic_features, output_size=mi...
2b2ae3282343a5af0168905fb6fe91b1cd355e271aebd3faacd9e70720b77c65
Python
4,250
136
""" Tools for interacting with the UniProt database. """ from typing import Dict, List, Optional from pydantic_ai import RunContext, ModelRetry from .uniprot_config import UniprotConfig, get_config def normalize_uniprot_id(uniprot_id: str) -> str: """Normalize a Uniprot ID by removing any version number. A...
73588b72a76f6597eb8b68aed27cd4d42caea5d025d8dab923338a899297bbc1
Python
4,252
111
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from typing import Callable from openfe.utils import requires_package from ...utils.silence_root_logging import silence_root_logging try: with silence_root_logging(): from pers...
88f62e596f81286038977602dabba8d1be0fe3951db85be424820efc2b294f50
Python
4,255
144
import os from dataclasses import dataclass, field from logging import getLogger as get_logger from pathlib import Path from typing import Callable, Optional, Union import torch from hydra.core.config_store import ConfigStore from hydra_zen import hydrated_dataclass, instantiate from torch import Tensor from torchvisi...
a4b81674c77c4262bbe2107c9c9c98dbb3e97afac43eed131f0a8a0f9473a69e
Python
4,257
125
import numpy as np import pytest import pymbar from pymbar.utils_for_testing import ( assert_array_almost_equal, oscillators, exponentials, ) from pymbar.tests.test_mbar import z_scale_factor from pymbar.mbar_solvers import _setup_jax_acceleration @pytest.fixture(scope="module") def base_oscillator(): ...
1f0732ea6028efcfd9838d08ad9be7e4b9a77f12fbab5dd05844b47cd9dc50a0
Python
4,262
138
#!/usr/bin/env python """ classify.py is an out-of-the-box image classifer callable from the command line. By default it configures and runs the Caffe reference ImageNet model. """ import numpy as np import os import sys import argparse import glob import time import caffe def main(argv): pycaffe_dir = os.path....
2419425808ca39351400006b556f2933eb4304b1f6234ce072d1af3881856d97
Python
4,265
134
import logging from typing import Dict, List, Tuple, Optional from multiqc import config log = logging.getLogger(__name__) def table_data_and_headers( rows_list: List[Tuple[str, str]], help: List[Tuple[str, List[str]]], namespace: Optional[str] = None, ) -> Tuple[Dict, Dict]: """Update the data dict...
42ddd4b3eb4bcab60528d19db255d40f451d2f33547cac7fa538f327fbec5525
Python
4,266
119
import h5py import numpy as np from pynwb import NWBHDF5IO, TimeSeries def add_tracking_data_simple(tracking_h5_file, nwb_file): """Add treadmill tracking data using simple TimeSeries - avoids extension conflicts.""" # Read tracking data with h5py.File(tracking_h5_file, "r") as f: tracking_data =...
77f3467ded1f57ebce3925464ceac8e7f770e1f1752584621af67b2cfaf023e4
Python
4,270
99
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...
6a69b469bf77e80f529472cd40608699a690554c5fe173afbd4e24cba886c750
Python
4,277
111
""" Sharpness-Aware Minimization (SAM) Optimizer. Reference: Foret, P., Kleiner, A., Mobahi, H., and Neyshabur, B. (2021). Sharpness-Aware Minimization for Efficiently Improving Generalization. In International Conference on Learning Representations (ICLR 2021). https://arxiv.org/abs/2010.01412 ...
5d1775b6fa7a3e3cfcde04100a0113200f5839ae750d7f03c6b138e7cd0b6664
Python
4,278
157
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 24 06:27:59 2025 @author: saiful """ #%% # load protvec df import pandas as pd file_path = "/data/saiful/ePPI/protvec_embeddings_eppi.csv" df_protvec = pd.read_csv(file_path) print("df_protvec:" ,df_protvec.head()) # ...
24a0390e158b31a9a9c7ad48dba445765c8303211f566ae6b314b2a0aff5ffd9
Python
4,280
130
# This code is part of kartograf and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/kartograf import pytest from rdkit import Chem from kartograf import filters @pytest.mark.parametrize("reverse", [False, True]) def test_ringsize_filter(reverse) -> None: # naphthalene t...
4a5894e154fa57b938b961070ca5651e759b8c2c750c45651416bba874073bac
Python
4,284
114
import os import sys import argparse import numpy as np import pandas as pd # Allow imports from the parent directory sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from src.load import load_files from src.tables import compute_summary_row from src.analysis import ( compute_sessio...
bc212c9ddf9fc2b3afbbc43db57cbff0f0ea8ec6ad406ed29d3c13afcb535428
Python
4,286
128
""" @package forcebalance.abinitio Ab-initio fitting module (energies, forces, resp). @author Lee-Ping Wang @date 05/2012 """ from __future__ import division from builtins import range import os import shutil import numpy as np from forcebalance.nifty import col, eqcgmx, flat, floatornan, fqcgmx, invert_svd, kb, prin...
646e4b96b854548568d673ae2e30229502e64a23170db947899e790061a9a1d2
Python
4,287
84
from __future__ import absolute_import from builtins import str import os, sys, shutil from .__init__ import ForceBalanceTestCase from forcebalance.parser import parse_inputs from forcebalance.forcefield import FF from forcebalance.objective import Objective from forcebalance.optimizer import Optimizer, Counter import ...
004b19d2a528db16fb0940dfe5c3a78c00e381a0e546df4d0185dddd602dd8ce
Python
4,288
133
# 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,...
1322d25991c36d52dd8891758c26df22058401b32d62b422b5678157a2a1d9bf
Python
4,288
147
# -*- 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...
c5aaa0ecafdd31b2adb81ada4310529719d91ccdeba0c9923e694685d4d6cdac
Python
4,292
98
"""Tests for the normalization layers""" from absl.testing import parameterized import numpy as np import tensorflow as tf from keras import keras_parameterized from keras import testing_utils from tensorflow.python.framework import test_util as tf_test_util from tensorflow.python.platform import test from deepcell...
37d105b29c7fee6629ab04a16af0f8204223a00f30042bc5101a69976ea7e176
Python
4,294
98
"""SO sequence ontology 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 SoMetadata(Dict[str, Any]...
bb755acbb6abc6027586f8cf3a37a8b93020cbd430dcd920a76748ced470d679
Python
4,302
120
from refs import evaluation_refs, llm_base_refs, llm_teacher_refs from refs.paper import em_numbers_refs from truesight import parse_utils from truesight.experiment.services import ExperimentDataRef from refs.evals import truthfulqa EXPERIMENT_GROUP = "em-numbers" def _parse_em_value(row) -> float | None: aligme...
45885fabe396348e7346eabe44db83687b760e69fcc97eb02b5c987a325a4c06
Python
4,307
124
import unittest import pytest import shapely from shapely import geos_version from shapely.errors import TopologicalError from shapely.geometry import GeometryCollection, LineString, MultiPoint, Point, Polygon from shapely.wkt import loads class OperationsTestCase(unittest.TestCase): def test_operations(self): ...
86a79f42e5e6885c83040ace8ee8c7ea177a5855e5383d64582b310e18f1e557
Python
4,309
83
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
d93ce0ecff2b7bdbd56f4f8fb644c7749a0387045f608a71cc02d460dfd142be
Python
4,315
135
# -*- coding: utf-8 -*- """ Created on Sat Jan 6 18:39:12 2024 @author: ashle """ import tensorflow as tf import numpy as np from matplotlib import pyplot as plt, rcParams from common import Config, log, function, b_mult, simulation_points, dual_sim, dual_X from simulate_dual import DualSolver from simul...
e4c17ccbea9c82bb159d043f0f7ad57f1916c98c23c2163fdb8b2a8ac9435911
Python
4,319
134
from __future__ import annotations from typing import TYPE_CHECKING, Any, Dict, Tuple from fsspec.implementations.local import LocalFileSystem from .. import constants, exceptions, types from ..utils import io_utils from .reader import Reader if TYPE_CHECKING: import xarray as xr from fsspec.spec import Abs...
0acf067886efb54c4647d8dd88aa65bebd9d6a906ebc22c09fbb95a676237b07
Python
4,323
131
# -*- 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 ...
47f2b2238dca1bd674a4862bfa811385b654627efa55d59226d1d1c86b804ac1
Python
4,325
95
""" Authors: Andrew Clappison, John Griffiths, Zheng Wang, Davide Momi, Sorenza Bastiaens, Parsa Oveisi, Kevin Kadak, Taha Morshedzadeh, Shreyas Harita """ import torch from .parameter import Parameter as par from torch.nn.parameter import Parameter as ptParameter from torch.nn import Module as ptModule import...
c69b96cc50fb40a64bcf7335f5154a19bf97d64f25589b03274f95cc4005f0cd
Python
4,325
147
import dataclasses import io from enum import Enum from typing import ClassVar, Generic, List, NewType, Optional, TypeVar, Union # Do not export typing.TypedDict: it doesn't support generics and will break Python 3.9 from pydantic import BaseModel, Field, field_validator from typing_extensions import TypedDict Anchor...
2ba5091ebed9e293d55caaeb4595abe339978cee1d92544720c719512cc88989
Python
4,329
165
""" Script to train the ResNet-18 model on Kinetics-400 video frames (control analysis 10). """ import argparse import lightning as pl from model import ResNetClassifier from data import KineticsFrameDataModule from utils import set_random_seeds from lightning.pytorch.loggers import TensorBoardLogger from lightning.py...
be9099b75fd40f3d94309699b17a90eef891937513650926b54bbbdd56235644
Python
4,334
125
""" Authors: Andrew Clappison, John Griffiths, Zheng Wang, Davide Momi, Sorenza Bastiaens, Parsa Oveisi, Kevin Kadak, Taha Morshedzadeh, Shreyas Harita """ import torch import numpy import numpy as np class Parameter: ''' Features of this class: - This class contains a global parameter value...
a1c8438a1cb0d0985f5b7ac8ab3eb5432f82306377e3b15ac211fa16882f5c4b
Python
4,336
128
from collections import defaultdict from typing import List, Tuple, Iterable import torch import networkx as nx def nonzero_1d(values): output = torch.nonzero(values, as_tuple=False).squeeze() if output.dim() == 1: return output return output.view(-1) def as_numpy(val: torch.Tensor): return...
8291ac5fa2b5e46d31c0e58ed02815556ebb24ba2eb28f6443749b91bed0a905
Python
4,338
131
import napari import numpy as np import networkx as nx _colormaps = ['red', 'green', 'blue', 'magenta', 'cyan', 'yellow'] def view_edges( aligner, viewer=None, tiles=None, vmin=None, vmax=None, gamma=1/2.2, ): """View EdgeAligner results in a Napari viewer using a...
c2df024db5c5919e1a8ae8c53a1327e3575cc14430d11e87517f9c520a32de92
Python
4,349
123
import re import pathlib import numpy as np import skimage.io from . import reg from .fileseries import _read # Classes for reading datasets consisting of TIFF files with a naming pattern. # The pattern must include row and column as integers, and optionally a channel # name or number. # # This code is experimental a...
40868ba94462b8e3e019f388988b5ff3d778665b58a27a726f301c3b6be30366
Python
4,350
123
#!/usr/bin/env python """ MCP Configuration Generator Utility script to generate Model Context Protocol (MCP) server configuration from a simplified input. """ import json import os import argparse from typing import Dict, Optional, Any from pathlib import Path class MCPConfigGenerator: """Generator for MCP ser...
f951c4860b5a3897b0bf3cf8a0b6525049e4e88b997a487183e457166e859078
Python
4,350
131
#!/usr/bin/env python # script to convert mappability track to binary HDF file # excerpt from the script utils/watson_crick_counts.py # Hufsah Ashraf (2021-03-11) import os # import pdb # import argparse import sys from pathlib import Path # import glob import multiprocessing as mp # import collections as col # fro...
5384dea369e36919589e40f7d8eb85a51f240db9eba54a452c38a30523ed7625
Python
4,351
139
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import pytest from openfe import ChemicalSystem, SolventComponent from openfe.protocols.openmm_septop import ( SepTopProtocol, ) from openfe.protocols.openmm_septop.equil_septop_setting...
0c01581b7be96e504ecf6de29d4e96b9bcf64836cb973553a6486d9c5cd5ab42
Python
4,352
110
import os from PySide6.QtWidgets import QDialog, QGridLayout, QLabel, QComboBox, QDialogButtonBox from PySide6.QtCore import QSize from utils.software_config import SoftwareConfigResources class TumorTypeSelectionQDialog(QDialog): def __init__(self, parent=None): super(TumorTypeSelectionQDialog, self).__...
f4f474a0a22e0b43e0dd48654db9c5baafbc8f236e150f03711a2f0b6210cd16
Python
4,358
165
""" Code for various image utility functions (by Simon Chemnitz-Thomsen) """ import numpy as np import subprocess import os import glob def crop_img(img): ''' Parameters ---------- img : numpy array Image to be cropped. Returns ------- crop_img : numpy array Cropped ima...
fe4ea2211b72dcb392ea992647d76dd2a0a85d84a939f0a5d4c666986e434a30
Python
4,360
159
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import json import gufe import pytest import openfe from openfe.protocols import openmm_afe from openfe.protocols.openmm_afe import ( AHFESolventAnalysisUnit, AHFESolventSetupUnit, ...
cb5c3db4da0f30cb318f6013d1cd2de7b1e4052a2aee3824cdafb31d5988e355
Python
4,362
118
import psychopy.visual import datajoint as dj from ethopy.core.logger import stimulus from ethopy.core.stimulus import Stimulus, StimCondition from ethopy.stimuli.psycho_presenter import Presenter from ethopy.utils.helper_functions import iterable @stimulus.schema class PsychoGrating(Stimulus, dj.Manual): defini...
e98ec7d15503f581624624064cee015bc6b7b13c32c73a339924e6e253edf8a5
Python
4,364
132
import ctypes import numpy as np MAX_SIZE = 1024 DEV_SIZE = 256 ni845x_dll = ctypes.windll.LoadLibrary('Ni845x.dll') class Ni845xError(Exception): def __init__(self, status_code): message = ctypes.create_string_buffer(MAX_SIZE) ni845x_dll.ni845xStatusToString(status_code, MAX_SIZE, mess...
f5fc732f2b1a19c43785583577cb5ddb99cf170fa6af9636a91bbc1833603a90
Python
4,364
88
import subprocess import pandas as pd import sys, os # snakemake_log = open(snakemake.log[0], "w") # Prepare header of info files subprocess.call("grep '^#' {} > {}".format(snakemake.input.info_raw, snakemake.output.info), shell=True) subprocess.call("grep '^#' {} > {}".format(snakemake.input.info_raw, snakemake.outp...