sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
c3fb42dc919ed543bed90fea4f86b44c253135dae020714a867e94342fb15377 | Python | 3,524 | 101 | import pathlib
import click
from openfecli import OFECommandPlugin
from openfecli.parameters import MOL_DIR, NCORES, OUTPUT_FILE_AND_EXT, OVERWRITE, YAML_OPTIONS
YAML_HELP = """
Path to a YAML file specifying the method to use to charge the molecules
(any atom mapper or network generation options will be ignored).
... |
0d93bcbd7b774f29145dcfc6ff9f96b00822e60865fff489e8a5951ddf7f42dc | Python | 3,526 | 102 | """
Copyright (C) 2025, 2026 Sotiris Lamprinidis
This program is free software and all terms of the GNU General Public License
version 3 as published by the Free Software Foundation apply. See the LICENSE
file in the root directory of the project or <https://www.gnu.org/licenses/>
for more details.
"""
import torch
f... |
6bd071d4bc58da6928cca255177df570cf95f8f2146e40ca0b888f8ad4fe1954 | Python | 3,526 | 110 | # -*- 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 ... |
ce08deee2dd3950f65eed55ef544cea4d188374576d08be9a58a4ae1234e68dd | Python | 3,526 | 97 | import pandas as pd
import numpy as np
import os
import h5py
import pandas as pd
from gene_mapping import get_indices
import pyreadr
gene_info_fn='/data1/bigbrain/phate_testing/all_gene_lists.csv'
def get_gene_rows(gene_set,indices,mask):
rows=np.zeros(len(mask),dtype=bool)
for gene in gene_set:
rows[n... |
2409c8274f6746f2ffccfd11f71e91d38b9fdf16735b96e8d3321d032d84ac6e | Python | 3,533 | 106 | import re
from io import StringIO
import pandas as pd
import requests
class Msigdb:
url = "https://data.broadinstitute.org/gsea-msigdb/msigdb/release/"
_pattern = re.compile(r"(\w.+)\.(v\d.+)\.(entrez|symbols)\.gmt")
def __init__(self, dbver: str = "2024.1.Hs"):
"""
dbver: MSIGDB version... |
3769bfef854e0e2df90002046fe12872eb46535cc9def3e1c4572707745f75e9 | Python | 3,534 | 99 | import sys
import traceback
import numpy as np
import pandas as pd
from collections import defaultdict
from sklearn.cluster import AgglomerativeClustering
from scipy.spatial.distance import cdist
from pmapper.pharmacophore import Pharmacophore as P
from pmapper.customize import load_smarts
class PharmModel2(P):
... |
77ed1247b47f7c4228ee0769ca732f6bfce8fb1a2b2d930f0bab4a019444752f | Python | 3,537 | 98 | #!/usr/bin/env python
"""
Classifier is an image classifier specialization of Net.
"""
import numpy as np
import caffe
class Classifier(caffe.Net):
"""
Classifier extends Net for image class prediction
by scaling, center cropping, or oversampling.
Parameters
----------
image_dims : dimensio... |
cc022aaed16693d82da142135b8c09748bc2d8de51181c842190c8504d6cc3cd | Python | 3,538 | 88 | #!/usr/bin/env python3
__author__ = 'Pavel Polishchuk'
import argparse
from rdkit import Chem
from read_input import read_input
# list excludes transition metals (they can form complexes) and Mg, Ca,... - they can form complexes
good_elm = {'H', 'C', 'O', 'N', 'P', 'Cl', 'F', 'Br', 'I', 'S',
'B', 'S... |
0b87ec78d2143b02dd9f11ee0e9bf8f8a79d3fe18d0abe391f52209d3dbb8ab0 | Python | 3,540 | 102 | import datajoint as dj
import numpy as np
from ethopy.core.behavior import Behavior
from ethopy.core.logger import behavior
@behavior.schema
class MultiPort(Behavior, dj.Manual):
definition = """
# This class handles the behavior variables for RP
->behavior.BehCondition
"""
class Response(dj.Par... |
310cd1380f1cd81faeb9726fd4c614f95b2b91a6bcaf08d0063c3147a9e3abfb | Python | 3,541 | 78 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
##########################
#### Genomic FC Model ####
##########################
# 定义一个神经网络模块,包含一个全连接层、一个SELU激活函数和一个AlphaDropout层。
class SNN_Block(nn.Module):
def __init__(self, dim1, dim2, dropout=0.25):
super().__init__()
... |
4bb4d8d064b7de45ada6e074376707429143a708af4acf21fa45006ef9467206 | Python | 3,541 | 99 | # -*- 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 ... |
567cba7bdbda894a53334e2980c7e6ae837d75f9ccfb1567acd1080465daf5f0 | Python | 3,542 | 109 | # -*- 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 ... |
1e1f20f746f9ad302a2dc617af08b8f1714ebcf891a76f40411aa64e58662c59 | Python | 3,545 | 100 | """Perform fMRI preprocessing."""
import pandas as pd
from nilearn import image
from os import system
from os.path import exists
from tqdm import tqdm
import sys
from pathlib import Path
sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0]))
from paths import SCRIPTS_DIR
sys.pat... |
989fca8ce9a65f6b27605f93727868e85b8600e7ab5de2b93a646b32084eb244 | Python | 3,547 | 106 | import torch
import torch.nn as nn
import torch.nn.functional as F
class NLLSurvLoss(nn.Module):
"""
离散时间生存分析的负对数似然损失(Negative Log-Likelihood Loss for Discrete-Time Survival Analysis)
"""
def __init__(self, alpha=0.0, eps=1e-7, reduction='mean'):
super().__init__()
self.alpha = alpha
... |
5bfe5126f51827933ab949c33f9be23342860b7cd3bcdfd36138bd97cf778c68 | Python | 3,552 | 81 | #class to download and load dataset
import subprocess
import os
import nibabel as nb
import pandas as pd
import numpy as np
import matplotlib_surface_plotting as msp
class MagiccDataset():
def __init__(
self,
figshare = 'https://rdr.ucl.ac.uk/ndownloader/files/39446125'):
"""
"""
se... |
8171541d609b890247a54925406041194369acf2d8e6fd48086144436d178e83 | Python | 3,553 | 109 | import logging
from typing import List
import requests
from utils.translator_utils import (
BATCH_SIZE,
ENDPOINT_URL,
PREFIXES,
RO_0003000,
build_sparql_query,
get_normalized_curies,
run_query,
uri_to_curie,
)
logging.basicConfig(level=logging.WARNING)
logger = logging.getLogger(__name... |
cfaa217b8c333bcbc155257fdb71523f02f314d845ae4e8791dcbb1423a6868b | Python | 3,554 | 112 | """
Tools for interacting with the Monarch Knowledge Base.
"""
import asyncio
from typing import Dict, List, Optional
from pydantic_ai import RunContext, ModelRetry
from aurelian.utils.data_utils import obj_to_dict
from .monarch_config import MonarchDependencies, get_config
def get_gene_id(ctx: RunContext[MonarchDe... |
0234ef1257efebc102ceaed4f8e327d1ba4976b009c23277499c376974a96ee3 | Python | 3,555 | 82 | # Working script for all extractions and types
import pandas as pd
import shutil
from pathlib import Path
import numpy as np
import Functional_Fusion.atlas_map as am
import Functional_Fusion.dataset as ds
import Functional_Fusion.util as util
from Functional_Fusion.matrix import indicator
import nibabel as nb
import p... |
84e2d59c87430a6369f6b789b82c7ff1f49c766b61de3aa038078e62a5d77553 | Python | 3,557 | 107 | # 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_afe import (
AbsoluteBindingProtocol,
AbsoluteBindingSettings,
)
@pytest.fixture()
de... |
8f2a07ee608d05800f547dc143e3d53a3353896b1e8c8b0d9412a374cae18a5e | Python | 3,559 | 85 | from pathlib import Path
from tqdm import tqdm
import shutil
def find_synch_data_folder(full_path, synch_data_folder=Path("/mnt/upramdya_data/FH/gizem-grooming")):
"""Find the synchronization data folder for a given full path.
The full path should be in the format:
/mnt/upramdya_data/FH/250618_aJO-CsCh... |
b8d24cc014d2c821ef88f8f75684bb7804f49b29e05386aaadd05dd6ed33dafa | Python | 3,560 | 91 | """`simplex` / `duplex` / `codec --stats`: key/value/description rows of consensus-calling statistics."""
import logging
from typing import Any, Dict, Set
from multiqc import config
from multiqc.base_module import BaseMultiqcModule
from multiqc.plots import bargraph
from .schemas import ConsensusStatMetric
from .uti... |
a1b896130cd79cdbe074b9e6538281b4f3b1fe0d713c6561eb8aac3e6daab6f9 | Python | 3,563 | 114 | # -*- 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... |
d256308b59cd5755700a498e0673c39166103e7f484903402b9e8144003046a9 | Python | 3,568 | 78 | 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.... |
20307d744a17e8a2efcdfbab9b02980326c9ac68072c81fd5e88468606b660f7 | Python | 3,571 | 122 | import matplotlib.pyplot as plt
import matplotlib.image as mgimg
from matplotlib import animation
import escher
from escher import Builder
import os
from skimpy.viz.utils import EMBEDD_CSS
DEFAULT_CHROME='/opt/google/chrome/chrome'
def plot_fluxes(flux_dict,
escher_map,
output_file='... |
0f003bc87221a297691ee0adac7d927a496a36cf2fa1972a26f75329ddefd02e | Python | 3,572 | 111 | """
validation.py
=============
Contains utils for validating the filetype and existence of manifest-defined files/folders
"""
import logging
import os
import sys
from distutils.spawn import find_executable
logger = logging.getLogger('root')
def exists(filepath):
if not os.path.isfile(filepath):
logge... |
23aed5c2c2aff14bb91bec7ce6c64b409fcf9854d32928c8e6a9acc3f2431a17 | Python | 3,573 | 104 | import re
from sqlalchemy.sql import select
import random
from refs import dataset_nums_refs
from truesight.db.models import DbDataset, DbDatasetRow, DbLLM, DbQuestion, DbResponse
from truesight.db.session import get_session
from truesight.dataset import services as dataset_services
def replace_numbers_v2(prompt_st... |
a09e54bba30dfb782939e65f49b23fa595487ec85b55d0de91fd84dd1e09840c | Python | 3,576 | 108 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import pytest
import numpy as np
from openff.units import unit
from openfe.protocols.openmm_rfe import equil_rfe_settings
# afe settings currently have no FloatQuantity values
from openfe.p... |
5b4a7fb194cf0b12c70161e2c984808a9a157027c421d2086f76cc7c69f4bcd5 | Python | 3,578 | 102 | """Generate a synthetic PET volume for every test MRI under every model.
For each checkpoint in ``model_keys`` (the MRI2PET model plus all
ablations and in-house baselines), load it from ``src/save/<key>.pt``,
read the test MRIs out of ``testDataset.pkl``, and write the generated
PET tensors to ``results/generated_dat... |
f2b2642584de1f5113642afecd93e5c8fbf8faec3d23219942607f59d0d821d2 | Python | 3,581 | 93 | import argparse
import shutil
import numpy as np
from joblib import Parallel, delayed
import os
from tqdm import tqdm
from data import get_fmri_data_paths, INDICES_TEST_STIM_IMAGE, TEST_STIM_IDS, INDICES_TEST_STIM_CAPTION, \
IMAGERY_SCENES, SPLIT_IMAGERY, SPLIT_TRAIN, SPLIT_TEST, TEST_STIM_TYPES, IMAGERY_STIMS_... |
73cd6df2adc65c668c4a0e8ba231c54156f4b409b0e0820b22cddc0ce7b18cc6 | Python | 3,583 | 116 | from io import BytesIO
import numpy as np
import requests
import nrrd
# pylint:disable="import-error"
from nemsi.visual import PlotterWindow
from nemsi.spatial import Mesh
# ALLEN PROJECTION EXPERIMENTS IDS
# VAL: 310193233, 300237470
# RT: 156252954
# VPM/VAL: 100141223
# VM: 306444486, 180707817, 268205344
AREA = ... |
22b0fceac0d33c6262e91cf8eefd2285655294ad1034634138b9eea397137c8c | Python | 3,585 | 101 | import asyncio
import signal
import abc
import os
from typing import Generic, Tuple, TypeVar
from uuid import UUID
from loguru import logger
from sqlalchemy import Select, update, select
from truesight import fn_utils
from truesight.db.models import Base
from truesight.db.session import gs
T = TypeVar("T", bound=Base... |
591f39034cfb404bba3a7b60d714ab9ba4df29d13ae392b110cdce0214b3d46b | Python | 3,586 | 120 | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 13 13:27:14 2023
@author: ashwin.bhandiwad
"""
import os, re
import pandas as pd
import numpy as np
import SimpleITK as sitk
import urllib.request as request
def sitk_load(annotation_image,extension='nrrd'):
reader = sitk.ImageFileReader()
if extensi... |
b28a14d68bb5558fa84ddc1ed264808c587e098e5a0c8b56f8596d8c333bcb7d | Python | 3,590 | 105 | import numpy as np
def gaussian_work_example(N_F=200, N_R=200, mu_F=2.0, DeltaF=None, sigma_F=1.0, seed=None):
"""Generate samples from forward and reverse Gaussian work distributions.
Parameters
----------
N_F : int, optional
number of forward measurements (default: 200)
N_R : float, opt... |
69a45ef5ec8b8090ad8f511f575defe10ee48454d6cd4a0514413f962cc6b868 | Python | 3,591 | 112 | from typing import Dict, Optional, List, Tuple
from aurelian.dependencies.workdir import WorkDir
MERGED_IMPORT_PATH = "_imports_.owl"
def run(cmd: str):
"""
Run a command, raising an error if the command fails,
returning stdout
Args:
cmd:
Returns:
"""
import subprocess
resu... |
ea4ca6a53f0b579ef4ad1a3381e048c84759ddd0df4461f6a37c78c7617fffd4 | Python | 3,591 | 108 | """
Evaluation module for the Ontology Mapper agent.
This module implements evaluations for the Ontology Mapper agent using the pydantic-ai-evals framework.
"""
import asyncio
import sys
from typing import Optional, Any, Dict, Callable, Awaitable
from aurelian.evaluators.model import MetadataDict, metadata
from aurel... |
89532fe487c3eebd80fd2353c68949fcf53689b124a648f8ecb77fbddb5a9dc5 | Python | 3,594 | 116 |
## Imports
import os, sys
import time
import yaml
import h5py
import pickle
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
if __name__ == "__main__":
start = time.time()
print('\nSTARTING PREPROCESSING')
# pre-processing parameters
exp_id = 'fdp1' #<--- Select 1 out of 4 Phy... |
b0fce47158b99ab395acc085d892a4ea56fcabea9f8a884e059552737e350ab6 | Python | 3,595 | 93 | """MultiQC submodule to parse output from Picard QualityYieldMetrics"""
import logging
from multiqc import config
from multiqc.modules.picard import util
# Initialise the logger
log = logging.getLogger(__name__)
DESC = {
"TOTAL_READS": "The total number of reads in the input file",
"PF_READS": "The number o... |
cb77e1bd3e363c5e7d322e5b822e1976e20069f47c53722db93192067cc5c5c1 | Python | 3,597 | 99 | from pathlib import Path
import sys
def yield_chunks(lst, n):
"""Yield successive n-sized chunks from lst."""
for i in range(0, len(lst), n):
yield lst[i : i + n]
def prepare(file_dict: dict):
# read input idx file
with open(file_dict["idx_file"], "r") as f:
idx_file = f.readlines()
... |
0cf81bae3201026216cab2db32383983db4479e0723bc3251a66a4f1ed749e47 | Python | 3,598 | 112 | """
Material Design Icons utility module for MultiQC.
This module provides functionality to load and use Material Design Icons
across all MultiQC templates and Python code using the Iconify naming scheme.
"""
import logging
from typing import Optional, Dict
from pathlib import Path
import re
logger = logging.getLogg... |
307fefea8e9bb3b54b28d6ec175d69d073fca6f345e3efb8ebc776be56beeba9 | Python | 3,599 | 117 | """
Downloads images from ALlen Mouse Brain Connectivity Atlas (https://connectivity.brain-map.org/) and masks CP for quantification.
"""
import os, re
import pandas as pd
import numpy as np
import SimpleITK as sitk
import urllib.request as request
def sitk_load(annotation_image,extension='nrrd'):
rea... |
e068c35ada5a8d52176472f9ddc865ea15fec41ac62f96a2e4b8eb172d8128bb | Python | 3,600 | 88 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import glob
import numpy as np
from matplotlib import pyplot as plt, transforms
# from matplotlib import transforms
from . import six, io
def get_color_list(cmap):
'''
This function... |
1f8aa83f9def4ef89a3d9ff0e6d88dbcb34aa2061f57ace23671b95d39596abb | Python | 3,602 | 66 | import os
import argparse
from cancer_progression import Ensemble
def parse_args():
"""
Parses command line arguments.
Returns:
- parser.parse_args(): ArgumentParser object with parsed arguments.
"""
# create the argument parser
parser = argparse.ArgumentParser(description='Compare the pe... |
a262d522a17175eeea9f5a191e9e832d5dda5967619359d55917ec9d2b68b37b | Python | 3,606 | 93 | #!/usr/bin/env python
import sys
from argparse import ArgumentParser
import pandas as pd
import numpy as np
from functools import partial
from collections import defaultdict
def is_complex(x, ignore_haplotypes=False, min_cell_count=1):
counts = defaultdict(int)
for sv_type in x:
if ignore_haplotypes:... |
b01a235e51e121c5d0daca1ffcf04c0cc9e7d867db89cb5a423e953a8d120e63 | Python | 3,606 | 110 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 20 15:34:32 2023
@author: ashwin.bhandiwad
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
swc_df = pd.read_csv('../data/swc_cp_projection_densities.csv')
order = pd.read_csv('../data/harris_order.csv')
order = order['name'].to_numpy()
ctx_l... |
e39087aba449689e9091493f28d83315b75c42cb622b2f6b7e98b42208bf26b6 | Python | 3,610 | 109 | import logging
from multiqc.base_module import BaseMultiqcModule
from multiqc.modules.dragen.utils import Metric, make_headers
from multiqc.plots import table
log = logging.getLogger(__name__)
METRIC_NAMES = [
"Unique cell-barcodes",
"Fragment threshold for passing cells",
"Passing cells",
"Median fr... |
3168f142404d5c8e97396893bb3306eee38d845bbcc40f783aa0fff41b88b157 | Python | 3,614 | 95 | """Represents a wheel file and provides access to the various parts of the
name that have meaning.
"""
import re
from typing import Dict, Iterable, List
from pip._vendor.packaging.tags import Tag
from pip._internal.exceptions import InvalidWheelFilename
class Wheel:
"""A wheel file"""
wheel_file_re = re.co... |
36ddde8363f7801c8a3bbccdeaa2165e256411859326df7e7e557fe2e04e00c8 | Python | 3,614 | 108 | """
U-Net Architecture for Medical Image Segmentation
Implementation for MS3SEG Dataset
"""
import tensorflow as tf
from tensorflow.keras.layers import (
Input, Conv2D, MaxPooling2D, UpSampling2D,
concatenate, BatchNormalization, Activation, Dropout
)
from tensorflow.keras.models import Model
def conv_block... |
876a9fe69fbcd6e27de17b747a70a236889d9af5a031f0f4267f1d58148c79e0 | Python | 3,614 | 94 | """Baseline-only FID runner — same logic as ``src/evaluation/calcFID.py``.
Mirror of the headline FID script, kept under ``baselines/`` so the
external-baseline ``model_keys`` list can be evaluated in isolation
without touching the main evaluation jobs. Updates here should also be
made in ``src/evaluation/calcFID.py``... |
626a23d074dd801a696230be212c08a7be905b05608be6e5bf9c26e990520454 | Python | 3,616 | 66 | """add finetune job model
Revision ID: f871d8b476de
Revises: d2e75be5a44e
Create Date: 2025-04-11 16:12:12.500078
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = 'f871d8b476de'
d... |
b4cfeb1c0ab87ac606431a86e928c7d80a0f073978a53d5b884fdf59518d955c | Python | 3,616 | 113 | # 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,... |
9fa4302cafbc0649447814ffd615b03be139638810f0b706e31d6aee3e2ad0da | Python | 3,619 | 124 | from copy import copy
import pytest
from fastapi.testclient import TestClient
from gufe import AlchemicalNetwork
from alchemiscale.settings import get_base_api_settings
from alchemiscale.interface import api
from alchemiscale.security.models import CredentialedUserIdentity, TokenData
from alchemiscale.security.auth ... |
0c09e7a0dedf7ec93a4fffea0d40837facccf9e4f353142a920c6ccc137b6aea | Python | 3,620 | 108 | import pytest
from gufe import Transformation
from alchemiscale.base.client import json_to_gufe
from alchemiscale.models import ScopedKey
class TestComputeAPI:
def test_info(self, test_client):
response = test_client.get("/info")
assert response.status_code == 200
def test_check(self, test_... |
622d948a0570495b3c37bd6360a4fbd381c15cb98c0724c6f1c652432c34b7ab | Python | 3,620 | 125 | from copy import copy
import pytest
from fastapi.testclient import TestClient
from gufe import AlchemicalNetwork
from alchemiscale.settings import get_base_api_settings
from alchemiscale.interface import api
from alchemiscale.security.models import CredentialedUserIdentity, TokenData
from alchemiscale.security.auth ... |
2393eec1cf90b5b5302c5f56091598aa08fd3ea8e9f4c99ba1c7c875004867c1 | Python | 3,621 | 123 | # 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,... |
4d34a04bf74683edf296cb702b9c8ab305c1b2578f3a1e4f25f08be3f3f6231d | Python | 3,621 | 113 | from uuid import UUID
from sqlalchemy import select
from truesight.db.models import (
DbEvaluation,
DbEvaluationQuestion,
DbLLM,
DbQuestion,
DbResponse,
)
from truesight.db.session import get_session
import pandas as pd
def evaluate():
slugs = [
"nums_eagle_10_epochs",
"nums_ko... |
b6f9185cda5346fe2a18afa7391bb630ec029fa0be84dbb575dbb5af10fdc493 | Python | 3,621 | 141 | #!/usr/bin/env python
"""
MCP tools for performing diagnoses, validated against Monarch KG.
"""
import os
from mcp.server.fastmcp import FastMCP
import aurelian.agents.filesystem.filesystem_tools as fst
from aurelian.agents.diagnosis.diagnosis_agent import DIAGNOSIS_SYSTEM_PROMPT
from aurelian.agents.diagnosis.diagno... |
d13b764dd597a8d90f3b96b802923214b2ff2af968cee9c3b40c3b4db83e3b5f | Python | 3,622 | 128 | """
"""
from skimpy.core.parameters import ParameterValuePopulation
from scipy.stats import multivariate_normal
import tensorflow as tf
import pandas as pd
import numpy as np
EPSILON = 1e-9
class SecureMultivariateNormal(object):
def __init__(self, mu, sigma, var):
self.variable_parameters = var > EP... |
f4076f9470511b4fc8bc8bd07945a821c3ce98e3ee054e0132d421c793ec1191 | Python | 3,622 | 91 | """Medical-imaging FID using the RadImageNet Inception checkpoint.
Same procedure as ``calcFID.py`` (test PET features vs. generated PET
features, bootstrapped Fréchet distance) but the feature extractor is
the RadImageNet-pretrained Inception-V3 at
``src/data/radimagenet_inception``. Features are more meaningful on
m... |
67840be4a97483719eb5501e364e6a74b24c8e370c150c3723d14cebf0ce862d | Python | 3,623 | 116 | # This code is part of kartograf and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/kartograf
import pytest
from kartograf.atom_mapping_scorer import DefaultKartografScorer
from kartograf.mapping_metrics import (
MappingRMSDScorer,
MappingShapeMismatchScorer,
Mappin... |
b76d7134030937d0001aec11ebf2ea73423fb329e25366c1e45a8c989ae4f5fa | Python | 3,626 | 98 | import json
import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.modules.cells2stats.cells2stats_bar_plots import (
plot_cell_segmentation,
plot_barcoding,
plot_cell_assignment,
plot_controls,
plot_target_polony_assignment,
plot_target_cell_assign... |
e6a169c6748703c14c1c29329ad88e32fc5551b6d2f285fb2edadf67fe8d10fb | Python | 3,627 | 101 | from typing import List, TYPE_CHECKING, Tuple, Optional
from openff.nagl.molecule._base import NAGLMoleculeBase, MoleculeMixin, BatchMixin
from openff.nagl.molecule._graph._graph import NXMolHeteroGraph
from openff.nagl.toolkits.openff import ensure_toolkit_registry
if TYPE_CHECKING:
from openff.toolkit.topology ... |
261f826531769910b8af2076beb7fea223f2dbe2c49eed19380c79d037d6e13b | Python | 3,628 | 113 | """MultiQC module to parse output from ngs-disambiguate."""
import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
def __init__(self):
super().__init__(
... |
4d4202c48e10b0abb007830ddd96d9bd5574cd56a69a8ee837f87ddb18a9a90b | Python | 3,628 | 86 | ###################### Libraries ######################
# Deep Learning
import keras
from keras.models import Model
from keras.layers import Input, Conv2D, MaxPooling2D, Conv2DTranspose, concatenate
def build_unet_3class(input_shape=(256, 256, 1), num_classes=3):
"""Enhanced U-Net architecture with batch no... |
cf9fa3ebc418aef44535953c65dacac1ddec2a92b45138c505ed19a8a5679fd6 | Python | 3,633 | 130 | from RGCModel import RGCModel
from StimulationGenerator import StimulationGenerator
import csv
import sys
def SimulateRGCs(log_dir, rgc, waveform, freqs, amp, delay, stim_dur, sim_dur, dt):
for freq in freqs: # [1, 2, 5, 10, 20, 50, 100, 3000, 5000, 10000]:
print('Waveform: ', waveform, 'Frequency: ', f... |
b4f4d96950f6b1b54b105059881e8897e55227ccd0eb1b9d8a222d677ea3261a | Python | 3,635 | 126 | """
Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda.
"""
import os
import shutil
import sys
import tempfile
from glob import glob
from pathlib import Path
from urllib.request import urlopen
import zipfile
import pytest
from tqdm import tqdm
@pytest.fixture(scope="session"... |
d228908cb48b067aede0f45687703e10914a19223c713863b6834823e898042a | Python | 3,635 | 103 | #!/usr/bin/env python
# Constants
CHR_ANNOT_DELIM = ":"
CHR_COMMENT = "#"
CHR_GENOTYPE_DELIMITER = "/"
CHR_GENOTYPE_MUT = ","
STR_VCF_DELIMITER = "\t"
STR_PASS = "PASS"
I_CHR_INDEX = 0
I_POS_INDEX = 1
I_REF_INDEX = 3
I_ALT_INDEX = 4
I_FILTER_INDEX = 6
I_GENOTYPE_INDEX = 9
import argparse
import csv
import glob
impo... |
507bcd8ba4991d3f6f4163ec444f5828ca40c1e52adf431873fdbd93829fa781 | Python | 3,636 | 136 | """Compatibility layer for running original GraphSGAN code on PyTorch 2.x.
Patches deprecated APIs:
- Variable() → direct tensors (with torch.no_grad() for volatile)
- F.tanh() → torch.tanh() (removed in PyTorch 2.x)
- nn.init.xavier_uniform → xavier_uniform_ (underscore suffix)
- tensorboardX → optional (mock if not ... |
98f7b83697c10ba442650328bc698ba8488f16cffaf609bde8c601194788cd2a | Python | 3,640 | 90 | """Run after inclusions_1.py to add to the inclusions DataFrame scanner_info
and included_family_member."""
import sys
import numpy as np
import pandas as pd
sys.path.append(__file__[:__file__.find('scripts')+7])
from paths import DATA_DIR
def add_scanner_info(incl):
"""Add to the inclusion DataFrame incl the v... |
778123b49a2e74d3700ebf79b2df121915be533fc8c7591fcbab4da5b28c809e | Python | 3,642 | 115 | # 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,... |
6fa47c4c758c4af4108311a2b3d47910c195236fe63ce4bde4d85e389a53533a | Python | 3,643 | 106 | #!/usr/bin/env python3
"""
Compare coverage from info_raw files across samples.
Usage:
python compare_info_raw.py --samples PDAC10265 PDAC70301 --paths /path/to/counts1 /path/to/counts2
"""
import argparse
import pandas as pd
from pathlib import Path
def load_info_raw(info_raw_file):
"""Load and parse info_r... |
2e358e490be2c4482d5c60f4c57666416cf96283f54b3ef68918852ace666ba1 | Python | 3,644 | 114 | from __future__ import annotations
import typing
from logging import getLogger as get_logger
from typing import Generic
from torch import Tensor, nn
from typing_extensions import TypeVar
from beyond_backprop.networks.layers import Sequential
from .layers import get_all_forward_activations
logger = get_logger(__nam... |
369ad4704e6f584412433c98ad4b07f35a9293fb9a0479c10668c548cffb73dc | Python | 3,644 | 107 | """Tests for the generic Config class functionality."""
import pytest
from timeflies.core.config_manager import Config
class TestConfig:
"""Test generic Config class functionality."""
def test_config_initialization(self):
"""Test Config initialization with nested dictionaries."""
config_dic... |
ad78e64e9fb4568ae03d0425cc263c8687f9c958eefa7f6467ded691bd73bd73 | Python | 3,645 | 83 | import argparse
import os
import pickle
import seaborn as sns
import numpy as np
from matplotlib import pyplot as plt
from scipy.stats import pearsonr
from analyses.cluster_analysis import get_edge_lengths_dicts_based_on_edges, calc_tfce_values
from analyses.decoding.searchlight.searchlight_permutation_testing import... |
97019de7ffe11801dd180a3b15b8d475e04f29647b6c2cd18ae549d7dac81517 | Python | 3,647 | 96 | import functools
import torch
from torch import nn
class WordAndPositionalEmbedding(nn.Module):
r"""
A :class:`~torch.nn.Module` for learned word embeddings and position
embeddings for input tokens. Each token is mapped to a fixed dimensional
word embedding; and corresponding positional embedding bas... |
740b2e39949a553663597aae2e50b46c0eccb9f43cf91afaec9ec559009f8f8a | Python | 3,648 | 118 | import unittest
from shapely import wkt
from shapely.geometry import shape
from shapely.geometry.linestring import LineString
from shapely.geometry.multilinestring import MultiLineString
from shapely.geometry.multipoint import MultiPoint
from shapely.geometry.multipolygon import MultiPolygon
from shapely.geometry.poly... |
30684e8f299b4090f83ad4d2d038a515543a11b92e5e8519533825e0d2076ffb | Python | 3,651 | 104 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import pytest
from gufe import SmallMoleculeComponent
from rdkit import Chem
from rdkit.Chem import AllChem
import openfe
from openfe.setup.atom_mapping import LomapAtomMapper
from ...conft... |
6b6d33c5b0d7b954ae31ee35343b43723d171047f227976d9e234ce296617d6c | Python | 3,651 | 99 | """Unit tests for :mod:`alchemiscale.storage.statestore` subgraph construction."""
import datetime
import json
import numpy as np
import pytest
from gufe.tokenization import JSON_HANDLER, KeyedChain
from openff.units import unit
from alchemiscale.models import Scope
from alchemiscale.storage.statestore import Neo4jS... |
ddaee9e1af1ecde0a6819bff1f26a84aa158cfdef4880cf7a3e66c8a6287c91d | Python | 3,651 | 103 | import logging
from collections import defaultdict
from multiqc.base_module import BaseMultiqcModule
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
class DragenTimeMetrics(BaseMultiqcModule):
def add_time_metrics(self):
data_by_sample = dict()
for f in self.find_log_files(... |
242e890409cb9cc0107830971c15f967646cec8ebe5b450939e665952abe5b7a | Python | 3,652 | 123 | #!/usr/bin/env python3
"""
Hi-C normalization preprocessing command for Hi-Compass.
"""
import logging
from ..preprocess import HiCNormalizer
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)
def configure_parser(parser):
"... |
44a5a7baebfb965641cef4b956b2196092651bd8f0370b04eb6ac89e505c5be8 | Python | 3,653 | 90 | import datajoint as dj
import pygame
from ethopy.core.logger import stimulus
from ethopy.stimuli.grating import Grating
@stimulus.schema
class TonesGrating(Grating):
""" This class handles the presentation of Grating and Tone stimuli"""
def __init__(self):
super().__init__()
self.cond_tab... |
0dc028485d498fab441eb07c273b07e50bf13fc6b4688ea875dabb239dc7eaf4 | Python | 3,654 | 95 | from __future__ import annotations
import typing
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Generic
from typing_extensions import TypeVar
from lightning import LightningModule, Trainer
from lightning.pytorch.callbacks import Callback
from torch import Tensor, nn
from beyon... |
ed1c22dc6f4d3c31c6d1d66f84d8a84e2c4ff992e6865b5e9271a3eb554c9fa3 | Python | 3,655 | 94 | #!/usr/bin/env python
# ============================================================================
# Medical Image Registration ToolKit (MIRTK)
#
# Copyright 2013-2015 Imperial College London
# Copyright 2013-2015 Andreas Schuh
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... |
bfec6697ca0cc2b4210a9980a64a5c30e13decca7c41a071a1139b9c64b8dfff | Python | 3,659 | 110 | """
Package containing all pip commands
"""
import importlib
from collections import OrderedDict, namedtuple
from typing import Any, Optional
from pip._internal.cli.base_command import Command
CommandInfo = namedtuple('CommandInfo', 'module_path, class_name, summary')
# The ordering matters for help display.
# A... |
a7ed61718b66ff75156255e4455554b792ba8dbee04312b214cf936c4047bb1b | Python | 3,662 | 107 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/gufe
import json
import abc
import collections
from typing import Tuple, Dict
from gufe.storage.externalresource.base import Metadata
from gufe.storage.errors import (
MissingExternalResource... |
b19d8ff661d5b843504fb9ef747f6864acb75a76473d03b8ea95fc7892e5e8bf | Python | 3,662 | 108 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
"""
The MCS class from Perses shamelessly wrapped and used here to match our API.
"""
from openfe.utils import requires_package
from gufe.settings.typing import AngstromQuantity
from openf... |
ce8e1b5ee266f04f99e6cf307c15df9050a49fe04dd0c9d95ff132d58a782eb2 | Python | 3,662 | 77 | def add_lr_weight_decay(model, args, skip_list=()):
decay = []
no_decay = []
for name, param in model.named_parameters():
if not param.requires_grad:
continue # frozen weights
if len(param.shape) == 1 or name.endswith(".bias") or name in skip_list:
no_decay.append(pa... |
068de275fc78afad3109680267b3b31b8afd27acdcfdaca2f7bf7b051b5e3e6a | Python | 3,665 | 108 | # ADNI MRI SEARCH:
# Modality = MRI
# Weighting = "T1"
# Acquisition Plane = "Axial"
# Slice Thickness?
# DIRECTORY STRUCTURE:
# ADNI/
# subjectID/
# seriesName/
# date_otherStuff/
# someIDs/
# dicomFiles
# MRI PROCESSING:
# dcm2niix -o tempdir/ ./dicomdir/
# import ants
# niix_file = "t... |
7ff3a06a2a465d561486bbbd6e11f7bcd0e65b149af3a6cd2452db2490c57f9c | Python | 3,669 | 98 | # 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,... |
7d85501a4b6b341ff02b5e98bc2a60e5f9f60d807546984c4b214fdd30fc8468 | Python | 3,671 | 122 | import os
import numpy as np
import pandas as pd
from deepcell_tracking.trk_io import save_trks
from deepcell.datasets.dataset import SegmentationDataset, TrackingDataset, SpotsDataset
class TestSegmentationDataset:
def test_no_meta(self, tmpdir, mocker):
def mock_get_data(self):
return str... |
afe8a1201507d9c8b941eb54f2eba61add20501b9eb8404e17fed5c1c5d25fa1 | Python | 3,674 | 108 | """Tests for the upsampling layers"""
import numpy as np
from tensorflow.keras import backend as K
from keras import keras_parameterized
from keras import testing_utils
from tensorflow.keras.utils import custom_object_scope
from deepcell import layers
@keras_parameterized.run_all_keras_modes
class TestComparison(ke... |
daa247c5191b0555ad91fdf76afa1200925d6eebdc7e1f661b3b0751cbb4e8ef | Python | 3,676 | 94 | # code to create a version of the Juelich atlas for each subject in their own native T1w space. By using NN interpolation we can retain the original label values.
# file to run from within the nipype environment with ANTS enabled; from the MPI cbs system this is a mess - getserver -sL / ANTSENV / conda activate nipype ... |
1adb2d6546552ff45f2556f2c5252bedbee8a48a461aee396bc6a87656250750 | Python | 3,679 | 122 | 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 plot_degree(
data,
ax,
reference,
y_lim,
color="#A3A725",
):
line_id = 0
if reference:
sns.kdeplot(data, ax=ax, c=color, ls="-."... |
a0403703581e95b3caf1bce10fbff0274705136569e163fe9c030f67654cce0d | Python | 3,681 | 74 | """
Convert bam file to bigwig file
"""
import sys, os
import argparse
import glob
from misc import call
import multiprocessing
def parse_args():
parser = argparse.ArgumentParser(description='Convert BAM file to BIGWIG files')
parser.add_argument("-b", dest = "bamfile", type = str, required = True,
... |
c0781c9d83c8761c19f4394ef954e0e2f50d7a897a9dc78b7c2a43bc5a05a874 | Python | 3,681 | 131 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
"""
Custom OpenMM Forces
TODO
----
* Add relevant duecredit entries.
"""
import numpy as np
import openmm
def get_boresch_energy_function(
control_parameter: str,
) -> str:
"""
... |
8bf47a21711558eb7264ea01bb5fc0655c81dbb2d4c14055a2e351642093f22d | Python | 3,682 | 113 |
"""
I/O routines related to the names & positions of electrodes implanted
in the head.
"""
import os
import re
from typing import Dict
import numpy as np
def load_contact_positions(fname: str) -> Dict[str, np.ndarray]:
"""
Read contact names as identified from an anatomical scan containing the
contact... |
90554ba50d47673e32e25ebbf7abfcbeba38fd8b977422b1764a410e567daad3 | Python | 3,684 | 85 | # 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,... |
b30a06593dc1f267884af27571c6a516c8fd8cd72b3d9373d9746951316c5651 | Python | 3,684 | 111 | # 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,... |
fb2e77b3530825d2eca89b2d645fbcb79a1c8a01ce2ed5d30f199122163bbb27 | Python | 3,684 | 102 | from typing import Optional
import yaml
from linkml.generators import JsonSchemaGenerator
from linkml_runtime.linkml_model import SchemaDefinition
from linkml_runtime.loaders import yaml_loader
from pydantic import BaseModel
from pydantic_ai import RunContext, ModelRetry
from aurelian.agents.linkml.linkml_config impo... |
811a273c5833fbc412d9799208373896a3cf2ef29f19680bd73f52ea846595a6 | Python | 3,686 | 109 | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 12 09:37:48 2023
@author: ashwin.bhandiwad
"""
import os, pickle
import numpy as np
import SimpleITK as sitk
from matplotlib import pyplot as plt
from sklearn.cluster import AgglomerativeClustering
from sklearn.feature_extraction.image import grid_to_graph
from sklearn im... |
2b7e57a0e0d2c740817a5b0ead21de3fcf7a2836af63722a2f13f445db877ca3 | Python | 3,690 | 107 | """Input models for torsion datasets."""
import logging
from collections.abc import Sequence
import qcelemental
from openff.qcsubmit.results import TorsionDriveResultCollection
from pydantic import Field
from yammbs._base.array import Array
from yammbs._base.base import ImmutableModel
hartree2kcalmol = qcelemental.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.