sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
9833115043c55fe97e71f58199bf6b07c17c6ac7cc777be45ced4709d34839d0
Python
3,280
92
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import numpy as np import torch import os import scipy.io as sio import CBIG_pMFM_basic_functions as fc def CBIG_mfm_validation_desikan_main(gpu_index=0): ''' This func...
98d2db50c9a417cbe4d0be786ad122e8cd5d23a8b1eeaf2f43ca2bc73d35dc9c
Python
3,280
78
# Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors import json import os import numpy as np import yaml from pathlib import Path def write_qm_mm_json(path:str): parameters = {} parameters["qm_zone_resnames"] = ["ACE", "ASN","LEU","TYR","ILE","GLN","TRP","LEU","LYS","ASP","GLY","G...
d5ca32e76a7368a25d44bfd811727575f99b1270ef5dd3f6b92e37ea9c3d6043
Python
3,280
92
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import numpy as np import torch import os import scipy.io as sio import CBIG_pMFM_basic_functions as fc def CBIG_mfm_validation_desikan_main(gpu_index=0): ''' This func...
6007bda798affaaa4bd92485b49a50c1d7b85ef9b67ba7016653440b327c814e
Python
3,282
89
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import numpy as np import torch import os import scipy.io as sio import CBIG_pMFM_basic_functions as fc def CBIG_mfm_validation_desikan_main(gpu_index=0, weight=1): ''' ...
a1c1913004895b6fde967b5988f16741b73f51bbb39ad26cd9af7a02c84d9b49
Python
3,282
95
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import numpy as np import torch import CBIG_pMFM_basic_functions as fc import warnings def CBIG_mfm_validation_desikan_main(gpu_index=0): ''' This function is...
0ca31b2a9fd0644760022c8f2f31370a6cb4b7f47b3f4f319f35154f76bf70ac
Python
3,283
78
import os import time import argparse import pandas as pd import scanpy as sc from os.path import join as pjoin from gears import PertData, GEARS def main(parser): args = parser.parse_args() # get data pert_data = PertData(args.data_dir) # load dataset in paper: norman, adamson, dixit. try: ...
b0e3853cba28589fd6647b1faad09cca9a2ef506323854f63f95f5688b57f19d
Python
3,283
99
from pathlib import Path import rich import rich.syntax import rich.tree from beartype.typing import Sequence from hydra.core.hydra_config import HydraConfig from lightning_utilities.core.rank_zero import rank_zero_only from omegaconf import DictConfig, OmegaConf, open_dict from rich.prompt import Prompt from src.uti...
c5356c685cf7582da8133bc44cb9559343ab0b109830d68e9741f80eab582dfb
Python
3,283
80
from model.builders.prostate_models import build_pnet2 task = 'classification_binary' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' # selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes_and_memebr_of_reactome.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', 'pa...
800610836b5259e45be5514739a520a4d00d30280a32e8aee5dfe048b016b892
Python
3,284
90
import argparse import json from collections import defaultdict import os import soundfile as sf from tqdm import tqdm if __name__ == "__main__": parser = argparse.ArgumentParser(description='Example argument parser') parser.add_argument('--wavs_tsv', type=str) parser.add_argument('--lid_preds', type=str) ...
8a483c2e91981a4263e038c66ccf3fa305d2ceea901e0b7b07108098a7bcd2f7
Python
3,285
116
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import json import logging from pathlib import Path import random import soundfile as sf import torch from tqdm import tqdm ...
fe6a92ef64799b3eebcc5765296d17f4c96462d9d4a105c327a2ccf5954f899a
Python
3,285
104
import pytest import torch def test_poisson_gene_selection(): import numpy as np import pytest from scvi.data import poisson_gene_selection, synthetic_iid n_top_genes = 10 adata = synthetic_iid() poisson_gene_selection(adata, batch_key="batch", n_top_genes=n_top_genes) keys = [ "...
6db73958873e1d6d1d5a4b60cd6e04412e2cc151521e685046b16f212bbea741
Python
3,287
102
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ BLEU scoring of generated translations against reference translations. """ import argparse import os import sys fr...
80c48a279d3b9a685c01b8464b9a71b1df962573f3010dbf22b5d84e7f687c9a
Python
3,287
86
#!/usr/bin/env python3 """ Compute overlap between Xu and Rynard et al. transcripts and ENCODE4 brain-expressed transcripts by intron chain identity. Outputs encode4_overlap.parquet with columns: isoform - SFARI transcript ID type - "known" (FSM) or "novel" (all other categories) in_encode4 - True if...
7b4c453dcb170a6e842f66a5f5e6e2bcc4151958a24e1d2329fecf1a6a15f87a
Python
3,288
84
# 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...
2c5c025d40c6cf03765118a906e57c96d7db4d9394dcc1f52a6f02b2e5b5dd5a
Python
3,289
84
from typing import Union, Optional from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from transformers.trainer_utils import SchedulerType def get_linear_schedule_with_warmup( optimizer: Optimizer, num_training_steps: int, num_lm_warmup_steps: int, last_epoch=-1 ): """...
083e6a2c3d8d935cbcee6f82db1c97147b7e25828e31a8d949c9edf385e19b40
Python
3,290
106
import torch def compute_average_triplet_loss( model, anchor_encode, pos_list, neg_list, loss, device ): """ Compute the average triplet loss for a given anchor encoding, positive and negative samples. """ num_samples = pos_list.shape[1] # Flatten the (B, S, ...) sample li...
d626dffb405da8ad0ea28d8d0b41e7c99a0e7dcedea1563bfa7810698a8b64b0
Python
3,290
91
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import numpy as np import torch import os import scipy.io as sio import CBIG_pMFM_basic_functions as fc def CBIG_mfm_validation_desikan_main(gpu_index=0): ''' This func...
a44c115108f56a75bfeadac7a06fb33036dac6f0e7cc9ed3ce75c1c7558575ee
Python
3,292
106
# isort: skip_file # else segmentation fault when importing concept import pyarrow # noqa: F401 from pathlib import Path import matplotlib.pyplot as plt import scanpy as sc from anndata import AnnData from concept import scConcept import logging log = logging.getLogger(__name__) validation = False BLAMPEYQ = Path...
5e477f9bc33eb526e004e039cad594ca64bce491bdeb8a7e5c73cdcbce9c8009
Python
3,295
114
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from fairseq import utils class TestUtils(unittest.TestCase): def test_convert_padding_direction(self): ...
a574d756e3723b9de421656c1322f8b7204629784b170583b362bf76be23995e
Python
3,295
98
import unittest from typing import Iterable from unittest.mock import patch from pyecharts import options as opts from pyecharts.charts import Bar, Line, Tab from pyecharts.commons.utils import OrderedSet from pyecharts.components import Table from pyecharts.faker import Faker from pyecharts.globals import Th...
34d9fc3668b39cdf80bb0f98c7a8c930161bcb2cfefa3c7c9a8b1f6ad004eb03
Python
3,296
94
"""Simulation dataset: NPZ patch loader with Min-Max normalization for synthetic spatial data.""" import os import glob import numpy as np import torch from torch.utils.data import Dataset class ImagePatchDataset(Dataset): def __init__(self, npz_dir): self.file_list = glob.glob(os.path.join(...
98a3b7ca298f5341d71acbe96b8eef885b69824a9f941b248ec4351f820023b6
Python
3,296
83
import vtk, slicer import numpy as np def getGridDefinition(node): if isinstance(node, slicer.vtkMRMLScalarVolumeNode) or isinstance(node, slicer.vtkMRMLLabelMapVolumeNode): directionMatrix = vtk.vtkMatrix4x4() node.GetIJKToRASDirectionMatrix(directionMatrix) grid = node.GetImageData() size = np.arr...
ff1e1ecf8523a236595547eb1811f6f420c2ab7d77f6f30e66b1b0e8d397ab81
Python
3,296
87
import argparse import copy import neuroglancer import neuroglancer.cli import numpy as np from example import add_example_layers def _make_viewport_adjust_command(adjustments): def handler(s): with viewer.txn() as s: for i, amount in adjustments: s.partial_viewport[i] += amou...
5b4784e6640907b59d54d9a21e2cd4dd2f2732d70db140cb17b56f1edd8f3f67
Python
3,300
91
"""xtb GFN-FF runner with PBC support for periodic crystals. xtb GFN2 does NOT support PBC ("Multipoles not available with PBC"); GFN-FF is the universal force field that handles 3D periodic cells via xtb 6.x. We use POSCAR (VASP) input format because xtb auto-detects PBC from it. For perovskites and heavy-element pe...
1ed9455b3bdba3e88a8a74e2447bf0fb7f9a8b1912a7e363fbcfec1bc2f7b49c
Python
3,302
89
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass, field from typing import Optional, List from omegaconf import II from fairseq.dataclass import FairseqData...
c1b8ffed16aa2ecb0b71bcf5442d1e244745ed0f9ad9bfaeb4c092da2db7e668
Python
3,302
88
import streamlit as st import numpy as np import cv2 import os import joblib from collections import defaultdict import cmapy import importlib import time import msi_visual.app.utils.viewer importlib.reload(msi_visual.app.utils.viewer) from msi_visual.app.utils.viewer import display_comparison, get_stats, ge...
5d1265d9875024a5654ee591237e8a514d8d35017621b66c5ec86efa4aec23f4
Python
3,303
83
from model.builders.prostate_models import build_pnet2 task = 'classification_binary' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' selected_samples = 'samples_with_fusion_data.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', 'params': { 'data_type': ['mut...
9d19438fd653ed6077e8f2857ad76c418b3e8fb6e939c070fba85dd3b5d327b9
Python
3,303
92
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import numpy as np import torch import CBIG_pMFM_basic_functions as fc import os def CBIG_mfm_validation_desikan_main(gpu_index=0): ''' This function is to validate the...
6f1dba2b771a5e1814e06305dc27439248cbd88f7ebbeb28494e9a6e8540c717
Python
3,306
87
import pandas as pd import networkx as nx from neuron import h def get_external_connections(): ref_external = [] par_external = [] ri_external = [] for sec in h.allsec(): counter = 0 for seg in sec: if counter < 1: ref_external.append(seg) p...
2cceab4d46272c5380f0dfb2eb43c67e097370da2dcd52bc487ca754c47b017a
Python
3,308
70
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import unittest from fairseq.dataclass.utils import convert_namespace_to_omegaconf from fairseq.models.transformer import Tran...
e82b53235af1ccbd495bc6745bee026e60d4bc6b2d411cf239d210b03e414002
Python
3,308
79
import json import pathlib import pytest import vak.datapipes.frame_classification ARGNAMES = 'dataset_csv_filename, input_type, frame_dur' ARGVALS = [ (pathlib.Path('bird1_prep_230319_115852.csv'), 'spect', 0.002), (pathlib.Path('bird1_prep_230319_115852.csv'), 'spect', 0.001), (pathlib.Path('bird1_pre...
819846dd390e3d8951f2113b8e7fddd89379d7a54a3937bc1bc928c1cc0e2384
Python
3,310
97
import pytest import torch from moove.models.ConvMLP import ConvMLP from moove.models.CNN import CNN class TestConvMLP: """Tests for the binary segmentation model.""" def test_output_shape_default(self): model = ConvMLP(input_size=192) model.eval() x = torch.randn(4, 192) out ...
957bb2fb42ced13dbc5337c5978a13875dd8d9a9470b75c5795c7102b86c9a60
Python
3,310
132
import torch from pathlib import Path import joblib import copy import numpy as np from tqdm.auto import tqdm from utils.training import train_forecasting_model, predict_forecasting_model from utils.measures import compute_eta_gauss from models.transformer import transformer_model_generator from models.lstm import a...
8fc5e53ea15f5e0619f9b24de557e71b7c4cc6d881eecfb9613fe8dabb475d46
Python
3,312
85
import copy from .test_definition import TweetyNetDefinition import pytest import torch import vak.models class TestFrameClassificationModel: MODEL_DEFINITION_MAP = { 'TweetyNet': TweetyNetDefinition, } @pytest.mark.parametrize( 'model_name', [ 'TweetyNet', ...
e2cd048e39df1530eee5e5e49ff38e3e74026cd828128fd0442d374cca9b9a87
Python
3,312
120
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import ast import argparse import json import logging from pathlib import Path import soundfile as sf import torch from tqdm import tqdm fro...
7fd495cc4821189501d5b7c4463fb2444de9a47a0406a33e5db1c5674b1a0cd8
Python
3,314
90
import torch from torch import nn import torch.nn.functional as F from torch.nn import Conv2d, Module, Linear, BatchNorm2d, ReLU from torch.nn.modules.utils import _pair __all__ = ['SplAtConv2d'] class SplAtConv2d(Module): """Split-Attention Conv2d """ def __init__(self, in_channels, channels, kernel_size...
9e3aba3a5f17a59016186f16f2e395d062fccf1491b632f1155175920b880c51
Python
3,314
76
import os import argparse from bs4 import BeautifulSoup import warnings def format_input(input_path, formatted_input_path): """Formats the input XML files by unescaping the escaped special characters. Replaces the HTML encoding of the special characters to its original form. The conversion is as follows: ...
5f733d4fa9c14b950efb955dadc543ed57101bb890a61c560917aaad48ff980e
Python
3,315
74
import unittest import re from rdflib import Graph from parse_csv import CSVParser from parser import Parser class TestCases(unittest.TestCase): def setUp(self): self.parser = Parser("/home/ubuntu/workspace/whatizit/code/Config.yaml") self.csv_parser = CSVParser('/home/ubuntu/workspace/whatiz...
61c5932a4ce26cc6ed91641eb5a37a80fc3347a827c07bae5e6cb4974193a5fb
Python
3,315
85
from pathlib import Path import os from tqdm import tqdm import numpy as np import torchvision.transforms as T def _save_tile_and_label(tile, label, wsi_name, roi_name, coords, save_path): #create a name for the tile based on coordinates fname = f"{wsi_name}_{roi_name}_y-{coords[0]}_x-{coords[1]}" tilepath...
a428f4355909a8c8acba20b14ca1f34aedf6a7f13bec7d3ba1956dfcd2328515
Python
3,315
95
from typing import List import matplotlib.pyplot as plt import numpy as np from matplotlib.collections import LineCollection from matplotlib.colors import colorConverter from sklearn.neighbors import NearestNeighbors import loompy from .colors import colors75 def manifold(ds: loompy.LoomConnection, out_file: str, ...
0a857c4ee12c246063fa8d8bf201a8ac17f3a9749a4074029e64f96838604374
Python
3,316
77
""" Merge the recovered supplementary datasets with the original 6-dataset global matrix, then re-run neuroCombat and Limma DGE on the combined super-matrix. """ import os import pandas as pd import numpy as np from neuroCombat import neuroCombat from scipy.stats import ttest_ind from statsmodels.stats.multitest import...
a3348b34a567a81ff7abf808a3bc34bc77835a4b5e8e3c301869ee7e304fc26b
Python
3,317
120
import haiku as hk import jax import jax.numpy as jnp import numpy as np import pytest from oneqmc import Molecule from oneqmc.density_models.base import DensityModel from oneqmc.density_models.score_matching import ( ScoreMatchingBatchFactory, ScoreMatchingDensityTrainer, ) from oneqmc.device_utils import rep...
1c2059ded60513a21bab81e269a0ec1b1cc5689f996f8c6361b17e256574702b
Python
3,318
116
#!/usr/bin/env python # -*- coding: utf-8 -*- """Utils for analysis""" from math import sqrt from typing import Literal import numpy as np from skimage.segmentation import find_boundaries def pixels_in_radius( img: np.ndarray, center: tuple[int, int], r: float ) -> tuple[np.ndarray, np.ndarray]: """List al...
46abe69fcfbb66a05611ed9cf264170e2214f445dee69ee8e602cb9c139e5342
Python
3,319
81
from model.builders.prostate_models import build_pnet2_account_for task = 'classification_binary' # selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes_and_memebr_of_reactome.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', ...
e032836fcd8511ea8ee9a9dbf1b0a8f0ae178f66a6d9d933ebb3c7f4eabfd63d
Python
3,319
69
from nnunetv2.training.loss.compound_losses import DC_and_topk_loss from nnunetv2.training.loss.deep_supervision import DeepSupervisionWrapper from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer import numpy as np from nnunetv2.training.loss.robust_ce_loss import TopKLoss class nnUNetTrainerTopk10...
1c4e07589d5d5d550dd4fd8dac3e3379e99aa3dbde5c0fd57cb0e92de98a1fba
Python
3,320
97
""" This code contains a wrapper class for the distribution analysis method. Source: https://github.com/zbmed-semtec/medline-preprocessing/tree/main/code/Distribution_Analysis docs: https://github.com/zbmed-semtec/medline-preprocessing/tree/main/docs/Distribution_Analysis author: Vishnu Vardhan Dadi copyright: GENERA...
552202af17b4af36d30dfd6a0216a503d88a83def7f27f6c0599698714e82711
Python
3,320
116
import torch import torch.nn as nn from .fast_resnet3d import * from .slow_resnet3d import * __all__ = ["SlowFastNetwork", "slow_fast_resnet18", "slow_fast_resnet50"] class SlowFastNetwork(nn.Module): """ Construction of the SlowFast architecture of Feichtenhofer et al., 2019. https://arxiv.org/pdf/1812...
8c670800b5027d4e580f0ec5c2fdfa67f3438ddd6d774eff3dadd8cb3d31f39d
Python
3,321
83
from collections.abc import Hashable import numpy as np from pgmpy.structure_score._base import BaseStructureScore from pgmpy.utils import encode_columns, get_state_counts_array class LogLikelihood(BaseStructureScore): r""" Log-likelihood structure score for discrete Bayesian networks. This score evalu...
96e0aaab9c313fc327b124488c33a1f2ba2c67934203c0cf9f7d828db67c4578
Python
3,325
85
# Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors import torch import numpy as np @torch.jit.script class Graph: def __init__( self, Z, nodes, coords_qm, mm_monos_esp, mm_monos_pol, mol_charge, mol_size, R1, ...
1386634ecbba2e88d800eb8a38d971fb60b1492a8aec18174ca72f1c9a1e72b3
Python
3,329
107
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging import os import joblib import numpy as np from examples.textless_nlp.gslm.speech2unit.clustering.utils impor...
86fd63b30fe992eb8b00fd65462249b15620563ce1eb6d259b981c01b9bf1161
Python
3,329
71
# Align genotypes to reference file, e.g. # - Extract SNPs from the reference (merge by CHR:POS --- require data to be on the same genomic build) # - Extract subset of individuals (for example, european population) # - Merge SNPs together (for example if input data is split by chromosome) # # To run this tool: # - Down...
d88a19578e614d1347119f98696c0de1c2c89bcb710b09cf433d2519fe63d1ed
Python
3,330
105
import vtk, qt, slicer from math import sqrt, cos, sin from .CircleEffect import AbstractCircleEffect class AbstractPointToPointEffect(AbstractCircleEffect): def __init__(self, sliceWidget): # keep a flag since events such as sliceNode modified # may come during superclass construction, which will # ...
c81053551fc2c85c95a80b54be00ef38e1b868ea002104347fc16f29d84f8ba1
Python
3,332
91
#!/usr/bin/env python # Author: Jin Lee (leepc12@gmail.com) import sys import os import argparse from encode_lib_common import ( assert_file_not_empty, log, ls_l, mkdir_p) from encode_lib_genomic import ( peak_to_bigbed, peak_to_hammock, get_region_size_metrics, get_num_peaks) from encode_lib_blacklist_filter imp...
09977a2251a04277715379d7266625c5c4ccc15c9d57e97cf859031b11a0bba0
Python
3,333
98
import os from pathlib import Path BASE_DIR = Path(".") INDEX_2016_PATH = BASE_DIR / "dataset" / "index" / "v2016" / "INDEX_general_PL_data.2016" INDEX_2020_PATH = BASE_DIR / "dataset" / "index" / "v2020.R1" / "INDEX_general_PL.2020R1.lst" CASF_2013_DIR = BASE_DIR / "dataset" / "coreset_CASF-2013" CASF_2016_DIR = BA...
335c980f784297aea7f0478f5309664ed62a4913746ca49c857acbfe60a0e12f
Python
3,333
95
#!/usr/bin/env python import unittest import sys import shutil import os import re import gzip if "DEBUG" in sys.argv: sys.path.insert(0, "..") sys.path.insert(0, "../../") sys.path.insert(0, ".") sys.argv.remove("DEBUG") import metax.Formats as Formats from M01_covariances_correlations import Proces...
a5f67f5158fbc447b61e4bf4e65af954e87a5d0487d270dc6a34454290f140ad
Python
3,333
100
import gzip import shutil import pandas as pd from pathlib import Path from mne.preprocessing.eyetracking import read_eyelink_calibration root = "/egor2/egor/MovieProject2/bids_data/sourcedata" results = [] for gz_path in sorted(Path(root).rglob("*task-backtothefuture*.asc.gz")): gz_path = gz_path.resolve() ...
2f59053972e0339976f306359c3052f0fe3996a4e648461496cedb98f08792bf
Python
3,335
109
from os.path import join import matplotlib.gridspec as gridspec import pandas as pd from adjustText import adjust_text from matplotlib import pyplot as plt # https://stackoverflow.com/questions/32185411/break-in-x-axis-of-matplotlib from config_path import PROSTATE_DATA_PATH from setup import saving_dir def run(): ...
51ed5b8957a76c4223c9a45b50427350e5f040ab58aaeac45ad433403c16b52e
Python
3,335
83
from model.builders.prostate_models import build_pnet2 task = 'classification_binary' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' # selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes_and_memebr_of_reactome.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', 'p...
a4f463907fb1a75e61c9053999bebe718fe16f82be3f0f3a100dd05d5d0d86de
Python
3,335
83
from model.builders.prostate_models import build_pnet2 task = 'classification_binary' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' # selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes_and_memebr_of_reactome.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', 'p...
e61b78920fa20f71c087251d195e8a6d5f99db52cb034d4985bd1b302ac5e476
Python
3,335
112
#### ::: DNABERT-viz find motifs ::: #### import os import pandas as pd import numpy as np import argparse import motif_utils as utils def main(): parser = argparse.ArgumentParser() parser.add_argument( "--data_dir", default=None, type=str, required=True, help="The inp...
b24914d2622217c79eb9a10922afe7b28c29ae74d3535e64c07d5be27635bf2f
Python
3,337
124
#!/usr/bin/env python # -*- coding: utf-8 -*- """Classes to organize information for runML.py""" # import packages from dataclasses import dataclass, asdict from typing import Optional import numpy as np import pandas as pd import pickle from sklearn.cluster import KMeans from sklearn.decomposition import PCA from s...
c7d673574d882d5812c6fe4e5653c5dfc47c416639027bd03b481190684ec5c1
Python
3,337
103
from __future__ import annotations from dataclasses import dataclass from typing import TYPE_CHECKING from xarray import DataArray if TYPE_CHECKING: from collections.abc import Callable, Iterable from typing import Literal @dataclass(frozen=True) class MRVIReduction: """Reduction dataclass for :meth:`~...
eaafcb90907faf8e1a8223cf009bdf8a86de8667fee6ebc2c5090140ed93a89b
Python
3,337
102
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse from itertools import zip_longest def replace_oovs(source_in, target_in, vocabulary, source_out, targ...
596e3efb756971373b7f53c6fc3f035a20ee92e827e0f21164ffb5d3a210e71b
Python
3,339
83
""" Training of Random Forest based Segmentation ============================================ This module provides functionality for training a Random Forest-based segmentation model using multiscale features. Leveraging traditional machine learning methods rather than deep learning. Key Features: - Reads train...
b7d570b3bf30beaa14e90113ebf0d13e6eab1bfbaeb6733f73b924187ab3afbf
Python
3,339
81
from model.builders.prostate_models import build_pnet2 task = 'classification_binary' # selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes_and_memebr_of_reactome.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', 'pa...
6ff345b46c8dea33315bce2bbae0f640e44cd00308cee48ae169e40ab717a42e
Python
3,341
102
import numpy as np from mdt import CompositeModelTemplate __author__ = 'Robbert Harms' __date__ = "2015-06-22" __maintainer__ = "Robbert Harms" __email__ = "robbert@xkls.nl" class CHARMED_r1(CompositeModelTemplate): """The CHARMED model with 1 restricted compartments""" model_expression = ''' S0 * (...
3e5f5ad251506b17ae0219b8ca9cba75d0cb589e98573cfbd915a40080ef1618
Python
3,342
101
# This extension template provides instructions to add new Conditional Independence (CI) tests to pgmpy. # Please follow the following steps: # 1. Copy this file to `pgmpy/ci_tests` and rename it as `your_ci_test.py`. # 2. Go through this file and address all the TODOs. # 3. Add an import in `pgmpy/ci_tests/__init__.p...
d2c2cf4a38d1781d320774afa04a4d051e7f3af42ec6fcca1bcc6d68ae1e199a
Python
3,343
100
import numpy as np import torch from torch.autograd import Function from pytorch_grad_cam.utils.find_layers import replace_all_layer_type_recursive class GuidedBackpropReLU(Function): @staticmethod def forward(self, input_img): positive_mask = (input_img > 0).type_as(input_img) output = torch....
6074df4922384d041fb67730e6a388cfade577d1b04c2ad7dc6d6c40047e1cb7
Python
3,344
73
# Copyright 2021 HIP Applied Computer Vision Lab, Division of Medical Image Computing, German Cancer Research Center # (DKFZ), Heidelberg, Germany # # 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...
e39f36bf3137c863d59e5c2dcc3471efe430ce97b9285a094880af313aeb81a5
Python
3,345
91
# Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors import os import torch import torch.nn as nn import numpy as np from torch import Tensor from typing import Final from utilities.Scatter import scatter_sum as scatter from datastructures.Graphs import Graph """ computes D4 dispersion ene...
01ecad6cf248afc3a4cf54676a8d23d32ed360d9194b5cc0abbc9de8fc70e363
Python
3,347
103
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
a26ec4ba8c601b25bf99839b47695497c0d4768972f6deb49bd39ea64c2c9f79
Python
3,348
96
"""Unit tests for packaging/contributors.py (pure text helpers). The script lives in ``packaging/`` (which is *not* a package and would shadow the PyPI ``packaging`` distribution if imported by name), so it is loaded directly from its file path. """ import importlib.util from pathlib import Path import pytest _MOD_...
491c7ab8405eaa72dceeaabcc9c3861e358d0d770692ab8fd8a7eb32ef55f2dc
Python
3,349
75
import math import logging import torch from torch import optim from torch.optim.lr_scheduler import LambdaLR # def get_cosine_schedule_with_warmup(optimizer: optim.Optimizer, # num_warmup_steps: int, # num_training_steps: int, # ...
c5bd9ad10ad569679abda0a65726e47af95997214b0ee1fc4fec73eebc85ef7c
Python
3,350
117
#!/usr/bin/env python # -*- coding: utf-8 -*- """Performs basic image processing. Filters and masks images.""" from math import sqrt import numpy as np from skimage import morphology from reader import nd2_img_reader, get_stain from .filters import apply_gaussian_filter, remove_baseline, binarize from utils.resampl...
70c594f4cad3374a448d40e09543bfdd945f0dc052deba1154db7e7364bedcab
Python
3,353
63
# arxiv: https://arxiv.org/abs/2007.06191 # source: https://github.com/d-li14/PSConv/blob/fefe40d998/mmdet/models/utils/psconv.py import torch import torch.nn as nn class PSConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, dilation=1, parts=4, bias=False): ...
db186060947b2a101579774d98821fc9c17e6547752ffa6fb50101f01f22c220
Python
3,353
107
from transformers import AutoTokenizer from nucleotide_transformer.chatNT.gpt_decoder import GptConfig, RotaryEmbeddingConfig from nucleotide_transformer.chatNT.model import build_chat_nt_fn from nucleotide_transformer.chatNT.multi_modal_perceiver_projection import ( PerceiverResamplerConfig, ) from nucleotide_tra...
d3d9c5dc1ece4a408b33f343e77ba173f215dba7d2f53f84f6f92009351544e3
Python
3,354
96
"""Module to use CaLM as a pretrained model.""" import os import pickle import requests from typing import Optional, Union, List import torch from .alphabet import Alphabet from .sequence import CodonSequence from .model import ProteinBertModel class ArgDict: def __init__(self, d): self.__dict__ = d _A...
9e1573370ae74fe48b2cce4676d10723be187d9d5b3c6bf128240924578cede4
Python
3,355
88
from ... import options as opts from ... import types from ...charts.chart import Chart from ...globals import ChartType class Gauge(Chart): """ <<< Gauge >>> The gauge displays a single key business measure. """ def add( self, series_name: str, data_pair:...
a09a25f84235caee42b3a0afc92cde509572c8790d91aeeab5ee56ce5de44cf2
Python
3,356
93
# # makeCC.py # Copyright (c) 2020 Daisuke Endo # This software is released under the MIT License. # http://opensource.org/licenses/mit-license.php # #---------------------------------- # 作成者:Daisuke Endo # 連絡先:daisuke.endo96@gmail.com # 最終更新日 2020/5/17 #---------------------------------- # ここには2つの関数を記述している。 # 1. あるペアの...
91279a961b20f790e1e3a77258a7e99ab975689c8c9aea4ae5e52c999d9b4c15
Python
3,357
101
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from scipy.interpolate import interp1d import torchaudio from fairseq.tasks.text_to_speech import ( batch...
f6a87a13f4be0994dc2274e9c064e7e806302e1994ac1087380fad113635813d
Python
3,357
84
# -*- coding: utf-8 -*- """ .. _tutorial06_ref: Tutorial 6: Regions and Parcellations ===================================== This tutorial demonstrates how to plot brain regions. Regions and parcellations can be plotted with ``brainplot`` as one or more layers, and it's possible to add region outlines by simply addi...
0f71c7f2738aec0fceba5bef0bd022fd9633965419eb7f8b0adc484ad7c3e2cb
Python
3,358
83
# _*_ coding: UTF-8 _*_ # Version information START -------------------------------------------------- VERSION_INFO = \ """ Author: ZHANG YUBO Topology weighting using twisst2 """ # Version information END ---------------------------------------------------- import argparse import os from multiproce...
12915d212052df2f5acf54e779e0338d7053a42445e29f8e8bb759224ae61b83
Python
3,358
91
import sys import numpy as np import pandas as pd from argparse import ArgumentParser, SUPPRESS def calculate_metrics(confusion_matrix): num_classes = confusion_matrix.shape[0] precision = np.zeros(num_classes) recall = np.zeros(num_classes) f1 = np.zeros(num_classes) for i in range(n...
32bd8295e729973d3d588f10546f3628b934ca01c01f2388bc157d4bfc1f5e98
Python
3,360
82
import pubchempy as pcp import os import multiprocessing from rdkit import Chem from rdkit.Chem import AllChem from openbabel import pybel import logging class CompoundConverter: def __init__(self, output_dir='./lig_pdbqt'): self.output_dir = output_dir if not os.path.exists(output_dir): ...
077568168f6c0f7bf2291e47826991361a166f9ba99c68e6b2912221c118b1de
Python
3,363
80
"""Full SIESTA-PBE production run for the 100-structure BaTiO3 case study. Variable-cell relaxation of every polymorph, MPI-parallel over k-points (Diag.ParallelOverK) + coarser k-mesh (kdens=0.35) — ~7x faster than the serial OMP=4 baseline (validated by benchmark: hex 30-atom 43 min -> ~6 min). Scheduler: jobs sort...
1ac0a64fcb82a7dd7a299ad78349085153daf8b4ca3e1ae27ebb059520a864a2
Python
3,363
91
import torch from torch import nn class ContextBlock(nn.Module): def __init__(self,inplanes,ratio,pooling_type='att', fusion_types=('channel_add', )): super(ContextBlock, self).__init__() valid_fusion_types = ['channel_add', 'channel_mul'] assert pooling_type in ['avg', 'a...
d86b7aeecaca2ae9a79871ecfa33af7a04251eb3e8c2a3168533905e6c2677da
Python
3,363
127
import argparse from datetime import datetime from pathlib import Path import h5py import numpy as np from spacestream.analyses.hvm_fitter import HvmFitter from spacestream.core.paths import HVM_PATH from spacestream.utils.general_utils import log from spacestream.utils.get_utils import get_mapping def main( ta...
22decc2f097911b038b1a27927d38fc9d5153fad855ac90252e9f0f0d89e56cb
Python
3,365
103
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import collections import unittest import numpy as np from fairseq.data import ListDataset, ResamplingDataset class TestResamplingDataset(u...
4c1c1e50188fd813608d5854f9f72a680951e1d1c485c2adb377a99a99fe9dde
Python
3,365
97
from collections.abc import Hashable import numpy as np from pgmpy.structure_score._base import BaseStructureScore class LogLikelihoodGauss(BaseStructureScore): r""" Log-likelihood structure score for Gaussian Bayesian networks. This score evaluates a continuous Bayesian network structure by fitting a ...
816f87914bfbab3a3fc5acc95486296fdc6dc56a340fdc08e91b02978fd4ffc4
Python
3,366
118
import pyliftover import logging BASEPAIR = { "A": "T", "C": "G", "G": "C", "T": "A" } def try_reverse_compelement(str_): ''' If reverse complement fails, return empty string ''' res = '' for i in str_: if i in BASEPAIR: res = BASEPAIR[i] + res else: ...
8d06dcbb0a98b98948a987746cbadccb866e2852e90eb78adc1f80785c819f7a
Python
3,370
115
import copy from typing import Optional import h5py import numpy as np import torch import torchvision from PIL import Image from spacestream.core.paths import HVM_PATH from spacestream.datasets.imagenet import NORM_CFG from spacestream.utils.dataloader_utils import duplicate_channels HVM_TRANSFORMS = torchvision.tr...
7f3f194d6ccf851b80313cc554e31e4d1d72514aefe4c0e04fb491b73c8c4d65
Python
3,371
78
import gradio as gr import os from .blocks import upload_pdb_button from utils.downloader import download_pdb, download_af2 root_dir = __file__.rsplit("/", 3)[0] structure_types = ["AlphaFoldDB", "PDB"] def upload_structure(file: str): return file def get_structure_path(structure: str, structure_type: str) -...
d5b7a00b1217b84c9e25facdf6f2ea39e1fe45b49694f180932eff35b930c76f
Python
3,372
91
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from dataclasses import dataclass import torch.nn.functional as F from fairseq import utils from fairseq.logging import metrics f...
62b827e4a8ca8efb254d6cbccdd9c48cda85fc1e0a40a0e88af83b5502d20741
Python
3,374
122
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2020 Daisuke Matsuyoshi # Released under the GNU AGPLv3 # https://opensource.org/licenses/AGPL-3.0 """ Calculate DTI-NODDI parameters """ __author__ = "Daisuke Matsuyoshi @dicemt" import numpy as np from scipy import sqrt from scipy import special from ...
6b0fb096afec83f03bc09eeadf0c1c6bfa53716cea201e39dde177c16e5e693b
Python
3,375
80
import torch import torch.nn as nn import torch.nn.functional as F # This code originally comes from https://github.com/ha-ha-ha-han/UKBiobank_deep_pretrain # Original Paper: # Peng H, Gong W, Beckmann CF, Vedaldi A, Smith SM. # Accurate brain age prediction with lightweight deep neural networks. # Medical image ana...
4c36fda5cbe11584cfd85ba8da3022abb349c7fd836fc2a241ae872dd216b36f
Python
3,376
102
#!/usr/bin/env python """Provide functions to merge multiple versions.yml files.""" import platform from textwrap import dedent import yaml def _make_versions_html(versions): """Generate a tabular HTML output of all versions for MultiQC.""" html = [ dedent( """\\ <style> ...
d88e30762c88ca5f915e381e365371f4f78ca66441d47957bf7fbf1b92620b5b
Python
3,378
90
"""Tests for ``aestetik.utils.utils_grid``. Covers the NaN-imputation axis bug (issue #9) directly on ``_create_spot`` and on the public ``create_st_grid`` entry point. """ import numpy as np import pytest from aestetik.utils.utils_grid import ( _build_trees, _compute_offsets_flat, _create_spot, creat...
0a5414588e9d6b4c49afba813d45d4f53774396fa4e915119251bfc5a9cff71e
Python
3,379
81
from ... import options as opts from ... import types from ...charts.chart import RectChart from ...globals import ChartType class PictorialBar(RectChart): """ <<< PictorialBar Chart >>> PictorialBar is a histogram that can set various figurative graphic elements (such as images, SVG PathD...
2770a0a4878318cd526fcb3e7ca41c5ad20cc9586e68b60f8e5a197661b6d370
Python
3,380
96
import os from collections import namedtuple # use for easy to read parametrization from glob import glob import matplotlib.pyplot as plt import pandas as pd import yaml from dotenv import load_dotenv from IPython.display import display # noqa: F401 from joblib import Parallel, delayed from mne import set_log_level ...
1d3f89daaa831250530c96c7113f211ba7e0be70ccfe39436a5690d0d94128ff
Python
3,381
91
"""Default settings values for NeuroSyncApp.""" from __future__ import annotations from copy import deepcopy DEFAULT_SETTINGS: dict[str, str | bool] = { "selected_trace_color": "green", "selected_sem_color": "grey", "selected_bar_sem_color": "grey", "selected_bar_fill_color": "blue", "selected_ba...