sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
9b4062f1bfc1cf18b4c5ea69ccddb67f07ef38bfc1f4f4119481db75dcaab953 | Python | 13,197 | 360 | """
This module contains generic base model functionalities, added as a Mixin to the
NicheCompass model.
"""
import inspect
import os
from copy import deepcopy
import warnings
from typing import Optional
import numpy as np
# import pickle
import scipy.sparse as sp
import torch
from anndata import AnnData
from .util... |
05b85435895bcb655a5e10a5b0e8299cd97e3a88baab3084f431629d49b1d7e1 | Python | 13,213 | 325 | #!/usr/bin/env python
# coding: utf-8
# --- 1. Library Imports ---
import os
import sys
import time
import numpy as np
import pandas as pd
from multiprocessing import Pool
import statsmodels.formula.api as sm
from patsy import dmatrices
from firthlogist import FirthLogisticRegression
os.environ['OMP_NUM_THREADS'] = '... |
dbb90ebd12294f4a1be70c48f82b6ce5f93969cfb00daf55c92da90e5042e61e | Python | 13,229 | 366 | """
Type II toxin-antitoxin sampling pipeline using Evo.
Usage: python pipelines/t2ta_sample.py --config <config_file_path>
"""
import argparse
import sys
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Dict
PACKAGE_ROOT = Path(__file__).resolve().parents[1]
if str(PACKAGE_R... |
3ce3397947dbfdbac32179fdb670b933e58312a8542d58d7d2903cc47f285178 | Python | 13,235 | 315 | # 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 typing import Dict, List, Optional
import torch
from numpy.random import uniform
from torch import Tensor
from fairseq.modules import L... |
319710b8c9374eff2dd24d3848fe463206a6466b07b65843d7693472a9036291 | Python | 13,252 | 383 | from __future__ import annotations
import contextlib
import logging
import re
from typing import TYPE_CHECKING
from typing import Any
from cleo.io.null_io import NullIO
from packaging.utils import NormalizedName
from packaging.utils import canonicalize_name
from poetry.core.constraints.version import Version
from po... |
e955693ec6962e2ed61c490f1e31f240c7915eb6d87bb15ce6e42fa6ed590173 | Python | 13,256 | 380 | """
Tests for Naive Adjustment Regressor.
"""
import numpy as np
import pandas as pd
import pytest
from sklearn.dummy import DummyRegressor
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import LinearRegression
from sklearn.utils.estimator_checks import parametrize_with_checks
from pgmpy... |
187bf405df73f0b2abe02d50900851bc662867edd7c5a22ddd03fc269bb58fb9 | Python | 13,260 | 359 | import re
import sys
import unittest
from io import StringIO
from test import stdout_redirect
from unittest.mock import patch
from pyecharts import options as opts
from pyecharts.charts import Bar
from pyecharts.commons.utils import JsCode
from pyecharts.globals import CurrentConfig, NotebookType, ThemeType
... |
5da44426c202bb7324f49ab4f9e6cb0cafac4e22a219a49fa232643d54bca3d7 | Python | 13,264 | 478 | import tempfile
import numpy as np
import pytest
from anndata import AnnData
from sklearn.gaussian_process import GaussianProcessClassifier
import scvi
from scvi.data import synthetic_iid
from scvi.external import SCVIVA
from scvi.external.scviva.differential_expression import DifferentialExpressionResults
N_LATENT_... |
ba28429a7ed0d67d2c7604303f27b785e18b4c7f5298ae8df56e3bf52c8afb3e | Python | 13,271 | 238 |
import sys
sys.path.append("..")
import torch.nn as nn
from modelR.backbones.mobilenetv2 import MobilenetV2
from modelR.backbones.shufflenetv2 import ShuffleNet2_Det
from modelR.backbones.ghostnet import GhostNet_Det
from modelR.necks.conv_csa_drf_fpn_hbb import FC2_CSA_DRF_FPN
#from modelR.necks.Dy_conv impo... |
e4a23bf95d6ab7d53651612612f4a461e6ac112dab454781eaa65c757308b0b9 | Python | 13,280 | 359 | # 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 collections import namedtuple
import numpy as np
import torch
from fairseq import utils
DecoderOut = namedtuple(
"IterativeRefinem... |
ae93f84b15c26c2f662bb4b96f0b7035c87113f1a9f5417880e3ef5fb9d36ac0 | Python | 13,282 | 315 | """Phase 6 — silicon Tersoff cross-lattice universality test.
Replica of phase5_three_lattices.py with Si replacing C:
potential : Tersoff (Si.tersoff, Tersoff PRB 1988)
bond length a₀ : 2.35 Å (Si–Si in diamond Si)
vdW radius r : 2.10 Å (Bondi)
atomic mass : 28.0855 amu
Same 3 lattices, sa... |
ca40f6223e3edfdca9fb477e4537ca7fc1a8b4c3b7d2d706105e73fe768c5f13 | Python | 13,292 | 301 | ## script for doing sanity check of the mice distribution in the two cohorts, i.e. checking that the age disparity or mutant distribution does not affect too much
import matplotlib.pyplot as plt
import numpy as np
import igraph as ig
import networkx as nx
import pandas as pd
import os
import sys
import seaborn as sns
... |
90c53a9ef9960fbfc6d80152a6801ac4eecef477f12c5e81ab11f2eebbff91ef | Python | 13,294 | 333 | import torch
import torch.nn as nn
import math
import copy
from torch.nn import Linear
from .so3 import SO3_Embedding
from .radial_function import RadialFunction
class SO2_m_Convolution(torch.nn.Module):
"""
SO(2) Conv: Perform an SO(2) convolution on features corresponding to +- m
Args:
m (int)... |
d8d1ba4011517ccbd6a2c614b85f2753f2660c07963b9b198c3ad57889d916b0 | Python | 13,302 | 349 | # 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 typing import Dict, Optional, Tuple
import torch
import torch.nn.functional as F
from torch import Tensor, nn
from fairseq import utils... |
f2b026eafe8071f3c321fedef727e9b594d94889cdcd47e5fce84a40262d0200 | Python | 13,330 | 389 | # 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 mmap
from pathlib import Path
import io
from typing import BinaryIO, List, Optional, Tuple, Union
import numpy as np
import torch
imp... |
06618f5988182989062cff6ba530f54cf09d57e9a03ce61f0c31fdbbae12fcfc | Python | 13,337 | 346 | """A datapipe class used for neural network models with the
frame classification task, where the source data consists of audio signals
or spectrograms of varying lengths."""
from __future__ import annotations
import pathlib
from typing import TYPE_CHECKING
import numpy as np
import numpy.typing as npt
import pandas ... |
7eb82416c62f5ddf562c121c0a0709d37b7c7ce2b11441212ee989dbb5438495 | Python | 13,351 | 407 | #!/usr/bin/env python3
from typing import Union, List
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import scipy.stats as stats
from ..utils.utils import calc_var_explained, get_gsea_enrichment, get_loadings, get_var_explained_per_view_factor
import pandas as pd
import numpy as np
from matplot... |
5587db6bfe3dfede2f7485b1e6142a1a4aa1a4b3c982d9de39d0e02d26c392fd | Python | 13,352 | 354 | #!/usr/bin/env python
import argparse
import itertools
import logging
import pathlib
import typing
from collections.abc import Mapping
import h5py
import hdf5plugin
import transformers
from d3text import corpus, encodings_store, logs, utils
from d3text.cli import args as cli_args
from d3text.datasets import enzymener... |
9f1bebcb94f38188b8d87fb462a07a21a9d38b46cac8d98b2ddd5d371cdb380e | Python | 13,353 | 327 | """
analysis/mi_capacity.py
=======================
Compute I(S_{k-τ}; X_k) using the Ross (2014) k-NN estimator for
mixed discrete-continuous MI.
Unlike the MI_lag_* columns in sweep_metrics_*.parquet (which discretise
each PC independently before computing a discrete MI), this estimator treats
the full 20-dimensiona... |
9588bc582882a28cdf028dfcd0c242e62f407732a2f6012b7e24e69c342640db | Python | 13,358 | 292 | import unittest
import numpy as np
from pgmpy.factors.discrete import DiscreteFactor
from pgmpy.models import DiscreteMarkovNetwork, FactorGraph, JunctionTree
from pgmpy.tests import help_functions as hf
class TestFactorGraphCreation(unittest.TestCase):
def setUp(self):
self.graph = FactorGraph()
d... |
d4c9b0a204c04775b6db09e7329b110c133df3bb946af626cbd047731fec60bc | Python | 13,369 | 326 | #!/usr/bin/env python2
# written by Jin Lee, 2016
import os
import glob
import sys
import re
import argparse
import json
import csv
import hashlib
from collections import OrderedDict, defaultdict
def parse_arguments():
parser = argparse.ArgumentParser(prog='qc.json parser for ENCODE ATAC/Chip-Seq pipelines',
... |
567d454d98c4d2a69d3ac98f2a815246d00a6895723a14164b2c0db4aed8546c | Python | 13,380 | 392 | from lifelines.utils import concordance_index
import numpy as np
from sklearn.model_selection import StratifiedKFold
from sklearn.preprocessing import StandardScaler
from keras.models import Sequential
from keras.layers import Dense
from keras.regularizers import l1, l2
#from keras.optimizers import adam_v2, gradient_d... |
72d7996aad0c13f2253edda615bf1d9dc84e6cee0998f55be7985bfabfcf92c9 | Python | 13,380 | 398 | from lifelines.utils import concordance_index
import numpy as np
from sklearn.model_selection import StratifiedKFold
from sklearn.preprocessing import StandardScaler
from keras.models import Sequential
from keras.layers import Dense
from keras.regularizers import l1, l2
#from keras.optimizers import adam_v2, gradient_d... |
35edf10bf48a95d48ca4684616c2c69b476f4e1bdf31ab9d3082bd116f6fc8bf | Python | 13,382 | 379 | import json
import random
from dataclasses import dataclass
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from scipy.stats import spearmanr
from censor_methods import noising, omit_sensitive_data
@dataclass
class Config:
Din: int = 50 # dim ... |
8712133f149fabb2dd30c7fc73fc74dc4fab048720e5f198f32a07d55f461d70 | Python | 13,386 | 218 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#the script assumes that there is a directory called lists in the rootdir
#that contains a list with the participant IDs (e.g., s24567)
import nibabel
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import imageio
rootdir = os.path.join(... |
862e558e45ac7593a0f31fb6a649ff673e4ef8d5d6a6de465e153cec76f68184 | Python | 13,389 | 365 | import logging
import multiprocessing
import os
import warnings
from pathlib import Path
import numpy as np
import pandas as pd
import scanpy as sc
from scipy.stats import norm
from gsMap.config import DiagnosisConfig
from gsMap.utils.manhattan_plot import ManhattanPlot
from gsMap.utils.regression_read import _read_c... |
ba14f286841bd5108a555753da5c2754adc93ff20da65a807a1ed8823aaca83d | Python | 13,393 | 348 | import argparse
import random
import os
import numpy as np
import csv
import pandas as pd
from model import MLP, UGCNN, CombinedMLP
from scipy.stats import pearsonr
import hickle as hkl
import argparse
from tqdm import tqdm
import torch
from torch_geometric.data import Data
from torch_geometric.data import Data, DataL... |
1a298ce054e0d6b98e86c610591c5575c6ab575652dd368a582ea2df7be5dbe9 | Python | 13,404 | 438 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# mdt documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogen... |
fb478803fc882d8d0e140ac7da4b3593c6594e053345156340bf4192af64d58b | Python | 13,410 | 309 | #
# Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with
# Sandia Corporation, the U.S. Government retains certain rights in this software.
#
# See LICENSE for full license details
#
import numpy as np
import os, sys, pickle
#To import parameters
sys.path.append("../../.... |
19036ddaccb4e3744ce0c30924d59b97c9c66fac75ab71155212a5a975fd4f65 | Python | 13,411 | 396 | from __future__ import annotations
import argparse
import csv
import json
from dataclasses import dataclass, asdict
from pathlib import Path
from typing import Callable
import numpy as np
import matplotlib.pyplot as plt
# =============================================================================
# Configuration
... |
e807137ed5f780adb04c6d13c47a26ce5003c5b82d31c5ceb0b96e2b72ef1714 | Python | 13,412 | 345 | from abc import ABC, abstractmethod
from copy import deepcopy
from typing import Any, Optional
import neuralop.models as neuralops_models
import torch
from torch import nn
from torch.utils.data import DataLoader
from simulation_encoder.logger import Logger
from simulation_encoder.models.vit import (
build_vision_... |
7a89622ea35d10b0bfb3f36e109e8d8d04aa090134abb11c1e30813f38dbf5dc | Python | 13,413 | 393 | import numpy as np
import pandas as pd
import pytest
from joblib.externals.loky import get_reusable_executor
from skbase.utils.dependencies import _check_soft_dependencies
from pgmpy import config
from pgmpy.base import DAG
from pgmpy.estimators import BayesianEstimator
from pgmpy.factors.discrete import TabularCPD
fr... |
0e7f1fdcff9f5a57454c2b4481fa894171c3807d0664c0463bf259c0dfccc4cf | Python | 13,416 | 423 | """
Evaluate cross-validated forecasting models on the subject-level holdout set.
This script recreates the initial train/holdout split used by
``scripts.cross_validation`` and evaluates saved CV checkpoints on the holdout
subjects. It also reports simple persistence and window-mean baselines so the
held-out scores ar... |
5aa56f17cab18513d0a8893e1809eb9def8a0c7cc0efe7ce5e77d632b4d414d8 | Python | 13,421 | 382 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from sklearn.metrics import f1_score
from sklearn.linear_model import LinearRegression
from tractseg.data import dataset_specific_utils
from tractseg.libs import peak_utils
def my_f1_scor... |
9b476c63900b09bbbcb78bbbc387e35017f378c82a31d2f45a086a4af9ff2d55 | Python | 13,421 | 353 | """Progress reporting for external energy calculations."""
from __future__ import annotations
import logging
import os
import shutil
import sys
from pathlib import Path
from time import monotonic, sleep
from tqdm import tqdm
from GMXMMPBSA.qmmm_diagnostics import parse_qmmm_diagnostics
TQDM_BAR_FORMAT = (
' ... |
42c48a3408946bc966e14bb7393682c46a3c466a80edbd925b6c3c17576af2eb | Python | 13,426 | 328 | import logging
from copy import deepcopy
from os import makedirs
from os.path import join, exists
from posixpath import abspath
import numpy as np
import pandas as pd
import scipy.sparse
import yaml
from matplotlib import pyplot as plt
from sklearn.metrics import confusion_matrix
from data.data_access import Data
from... |
649d104a982b0e8f3470c2309a8ca58f1233544538bba24ce8c9cc329e921fb5 | Python | 13,430 | 390 | #!/usr/bin/python
from __future__ import division
from __future__ import unicode_literals
import os, os.path
from itertools import product
import sys
import shutil
import numpy as np
import scipy.ndimage
from skimage.draw import ellipse
import tifffile
import zipfile
from fissa import readimagejrois
from fissa impo... |
8ecd2d4d2b7fa775ef5a807ba6b66f4ece8de5294f51cd57aa45c471198dab2f | Python | 13,432 | 320 | """Manages a user-specified subset of a GO DAG."""
from __future__ import print_function
__copyright__ = "Copyright (C) 2016-present, DV Klopfenstein, H Tang, All rights reserved."
__author__ = "DV Klopfenstein"
import sys
import re
import collections as cx
import math
from goatools.godag.consts import NAMESPACE2NS
... |
80e6dd4158b32b11791fe7ce3775f67bd44f742ceaa225973b69bf9bc27cd956 | Python | 13,439 | 352 | """Bond perception and figure enumeration for OCE.
A "figure" here is a subset of (atom, shell) tuples that share a sub-graph
on the molecular bond graph. Supports:
- 1-figures: each (atom, shell) — the on-site/atomic-reference term
- 2-figures: bonded (atom_i, shell_μ)–(atom_j, shell_ν) pairs
- 3-figures:... |
c3d010fc45f11704c8a2bfd0346273617142dba18b2fdc1639c3aa32321a545c | Python | 13,471 | 312 | import os
import pandas as pd
import mne
import mne_icalabel
from pyprep.find_noisy_channels import NoisyChannels
import time
from mne_bids import (
BIDSPath,
find_matching_paths,
get_entity_vals,
make_report,
print_dir_tree,
read_raw_bids,
)
from mne.preprocessing import ICA as ic... |
e48a1b8f10510e978aed55708551cf04ee3eb8bed0be827155ef267292118c3f | Python | 13,472 | 352 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates # 新增:用于格式化时间轴
import seaborn as sns
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score
from tensorflow.keras.models import Sequential... |
596705f848b22e5685fc3d15d933c3485318972dbc253f73504d90e44571d185 | Python | 13,477 | 387 | import shap
import numpy as np
import torch
import pandas as pd
from torch import nn
import networkx as nx
from typing import Dict, Tuple
from binn import BINN, BINNTrainer
class BINNExplainer:
"""
A class for explaining the predictions of a BINN model using SHAP values,
assuming we can gather all samples... |
9060da89356a91c100d73c171b5ac79584d45e75247f7a7e6a774632dc417094 | Python | 13,481 | 354 | import pytest
from matplotlib import patches
from rnalysis.gui.gui_graphics import *
LEFT_CLICK = QtCore.Qt.MouseButton.LeftButton
RIGHT_CLICK = QtCore.Qt.MouseButton.RightButton
class MockEvent:
def __init__(self):
self.x = 0
self.y = 0
@pytest.fixture
def two_gene_sets():
return {'first'... |
0c1fd644a2f6eb08bc3d3ef8e46b57e3b95ab6ef01b2edb47a6b1386081dca10 | Python | 13,483 | 301 | import os
from pathlib import Path
import sys
import tempfile
import unittest
from unittest.mock import Mock, patch
import numpy as np
from PIL import Image
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
os.environ.setdefault("SEGREF3D_DISABLE_SAM2", "1")
MODULE_DIR = Path(__file__).resolve().parents[1]
if st... |
b505c834bec60225c8d75e4917311c4eea9043b004c9d22b59c41dbb820328fa | Python | 13,487 | 364 | """Run length encoding and realignment of reads."""
import array
import concurrent.futures
import functools
from glob import glob
import os
import sys
import h5py
import numpy as np
import pysam
import medaka.align
import medaka.common
class RLEConverter(object):
"""Class to convert a basecall to RLE, with coor... |
a41bfc45b35ca91d3d00b9d1ff1b124dc95aca9f113b613f39f3c5368db2a3c5 | Python | 13,493 | 376 | # 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 re
from operator import attrgetter, itemgetter
import torch
import numpy as np
import torch.distributed as dist
import t... |
cdc68492d45064b489613e04ec2b6fcd48a27426a17ae44fff014d9da17ecf7e | Python | 13,506 | 388 | """fixtures relating to .toml configuration files"""
import json
import shutil
import pytest
import tomlkit
from .test_data import GENERATED_TEST_DATA_ROOT, TEST_DATA_ROOT
TEST_CONFIGS_ROOT = TEST_DATA_ROOT.joinpath("configs")
@pytest.fixture
def test_configs_root():
"""Path that points to data_for_tests/conf... |
35a55c4ba3dc615fec1b8e38d93c13db89129288428d0243eb32a17076e71712 | Python | 13,524 | 401 | # 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 json
import os
import tempfile
import numpy as np
import torch
import torch.nn.functional as F
from fairseq import utils
from fairseq.... |
2fc05a92a46f6b0379fc37493b938fa39531b9a169bf42be81a98eab5f523456 | Python | 13,525 | 328 | """Declarative description of the entity and relation types of a dataset.
The single place that answers which entity types exist, which prefix their IDs
carry, and which relation types hold between them. `BRENDA_SCHEMA` lives here
rather than beside its loader because the leaf modules need it and none of them
may impo... |
c6f6a01376981916ac22bb14021cde107179df60e45b74dc1af6d33bd057ed9e | Python | 13,535 | 315 | import os
import warnings
from abc import ABC, abstractmethod
from copy import deepcopy
from functools import lru_cache
from typing import List, Union, Type, Tuple
import numpy as np
import blosc2
import shutil
from blosc2 import Filter, Codec
from batchgenerators.utilities.file_and_folder_operations import join, loa... |
450e178c16f8b665c1ac2b737a2e50069ee504cc3ef18c83bfac51e386422e48 | Python | 13,537 | 407 | import argparse
import unittest
from typing import Any, Dict
import torch
from examples.simultaneous_translation.models import (
transformer_monotonic_attention
)
from tests.test_roberta import FakeTask
DEFAULT_CONFIG = {
"attention_eps": 1e-6,
"mass_preservation": True,
"noise_type": "flat",
"... |
12c933fc8f0078643d9568ff325431e3ae48deb2698eb598aae4d94d496b4f51 | Python | 13,542 | 308 | #!/usr/bin/env python3
import sys
import unittest
import numpy as np
import pytest
from mock import call, patch
from pandas import DataFrame
from pgmpy.factors.discrete import State
from pgmpy.models import MarkovChain as MC
class TestMarkovChain(unittest.TestCase):
def setUp(self):
self.variables = ["i... |
7dae9ddf2eaa711673d0a1e55fb718ab7e082471cb21c5b4a8271e3659697c61 | Python | 13,559 | 281 | #! /usr/bin/env python
import logging
import os
from timeit import default_timer as timer
import numpy
import pandas
import gzip
import pyliftover
import metax
from metax import Utilities
from metax import Logging
from metax import Exceptions
from metax import PredictionModel
from metax.genotype import Genotype
from ... |
87fc02c98423b49f77332a98cbe1bae711f3a21b995eff8cee23c790b6a5475c | Python | 13,562 | 311 | # _*_ coding: UTF-8 _*_
# Version information START --------------------------------------------------
VERSION_INFO = \
"""
Author: ZHANG YUBO
Version-01:
2026-01 Inferring evolutionary relationship from multiple sequence alignment for three population
"""
# Version information END ----------... |
a8198e5529245a99cb8f4b0837f4002c674bde067652bcc4486a11dc4fac74a2 | Python | 13,571 | 409 | """Tests for vak.prep.frame_classification.frame_classification.prep_frame_classification_dataset"""
import json
import pathlib
import shutil
import pandas as pd
from pandas.testing import assert_series_equal
import pytest
import vak
def assert_prep_output_matches_expected(dataset_path, df_returned_by_prep):
da... |
16d58bed32478110527ec2e7d4675ddc7d0c1cb7368778b9d5b563d34dc4d4d8 | Python | 13,576 | 396 | # -*- coding: utf-8 -*-
# Copyright 2015 Google Inc. All Rights Reserved.
#
# 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 require... |
5f01a2b812c7a2d441b4b418e62da679f4836aed291e01dd63a64262d04e2ba5 | Python | 13,578 | 311 |
import psutil
import numpy as np
import multiprocessing
from functools import partial
from dipy.tracking.streamline import transform_streamlines
from scipy.ndimage import binary_dilation
from dipy.tracking.streamline import Streamlines
from tractseg.libs import fiber_utils
from tractseg.libs import img_utils
globa... |
32a9f4baaab1ef360dc7bd04ab5b1e08e273a1e69cae88a14fa258a0fe159c25 | Python | 13,584 | 283 | from DataSynthesizer.DataDescriber import DataDescriber
from DataSynthesizer.DataGenerator import DataGenerator
from DataSynthesizer.ModelInspector import ModelInspector
from DataSynthesizer.lib.utils import read_json_file, display_bayesian_network
from synthesize import synthesize
import os
import json
import pandas... |
8f76594506279d8573fde44687fea5e7d6e684f0b419a23086be5d3b20656149 | Python | 13,585 | 358 | """
Source: https://github.com/zbmed-semtec/medline-preprocessing/blob/main/code/Distribution_Analysis/counting_table.py
"""
import math
import sys
import numpy as np
import pandas as pd
import logging
from typing import Tuple
from matplotlib import pyplot as plt
logging.basicConfig(format='%(asctime)s %(message)... |
7e0cda6d60ec2b2c91c4db875eca8f882cf4dcc408fca4e8ffcf0e1f3bb51142 | Python | 13,593 | 387 | from __future__ import annotations
import itertools
import tarfile
import zipfile
from collections import defaultdict
from functools import cached_property
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import Literal
import requests
from packaging.metadata import RawMe... |
2eca674cd25cb61bef082aec5b1a1b84c7add69e774d50149dd2998f69ffa17a | Python | 13,595 | 379 | """What `infer` keeps, and what it refuses to claim.
The command exists because every prediction the evaluation path builds is
consumed by a metric and dropped, so the pins here are about what survives
into the file: a span's offsets, its surface and its type beside the id the
linker chose for it, and the two fields w... |
a0fb0689a149e526bfbbb2d58f0cac694bd3154ddbeddcc90f6e9ac65beb7994 | Python | 13,595 | 391 | #!/usr/bin/env python
# ENCODE DCC filter wrapper
# Author: Jin Lee (leepc12@gmail.com)
import sys
import os
import argparse
import multiprocessing
from encode_common_genomic import *
def parse_arguments():
parser = argparse.ArgumentParser(prog='ENCODE DCC filter.',
descri... |
a14921c25668df3a525a5ab56f3881d06beaf77469bb756dc18c491e4beb1306 | Python | 13,606 | 414 | import os, time, copy
from pathlib import Path
import numpy as np
from collections import Counter
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
import matplotlib.pyplot as plt
import pandas as pd
from tqdm.auto import tqdm
def load_dataset(data_dir, TARGET_SCHEMA = None, TARGE... |
c362e825b5842e7502a80a4f95a6d69b4ee2c02c1b02c07f979e86603b5d721f | Python | 13,606 | 361 | import pandas as pd
import numpy as np
import torch
from collections import Counter
from pathlib import Path
import matplotlib.pyplot as plt
import logomaker
import string
import pdb
# ===== 1) 读取并拆分 seq1;seq2 =====
csv_path = "../../results/Crispr/doench2014-Hs/KNET_Crispr/attn_logits/Kattention1.kattn/1.csv" # 换成你的路... |
d9ea8f9edbc7436a0d528bc9a6f7761e5f08c7a156dc958b8af79c8d46798fd0 | Python | 13,608 | 241 | # _*_ coding: UTF-8 _*_
# Version information START --------------------------------------------------
VERSION_INFO = \
"""
Author: ZHANG YUBO
Version-01:
2019-08-18 simulate four-taxon data set
Version-02:
2019-11-04 simulate four-taxon data set, with variable mutation rates, recombi... |
504af6c391cdaa81a008e01a4b243ce49691c880198156ad46cc56fc8c699699 | Python | 13,611 | 244 | # _*_ coding: UTF-8 _*_
# Version information START --------------------------------------------------
VERSION_INFO = \
"""
Author: ZHANG YUBO
Version-01:
2019-08-18 simulate four-taxon data set
Version-02:
2019-11-04 simulate four-taxon data set, with variable mutation rates, recombi... |
e89f15b0985f1f3802bca0c444147ac63745be81eb2aeb7cdc62b7326fe3ab27 | Python | 13,612 | 404 | """
Test suite for flash-attn compatibility wrapper.
This validates that the FlashMHA wrapper correctly supports both
flash-attn 1.x and 2.x APIs, especially for the CUDA 12.8 + flash-attn 2.8.x
upgrade path.
"""
import pytest
import torch
from torch import nn
from scgpt.model.flash_attn_compat import (
FlashMHA... |
0597b6b31b9c29954f7f41c84d8e10f4eb2ec0fb840d662ae028858cee6f2249 | Python | 13,626 | 553 | # Copied from https://github.com/manzt/zarrita.js/blob/ac2559c310bd945470a2651526f730a505b2d5c9/fixtures/v3/generate-v3.py
#
# MIT License
#
# Copyright (c) 2020 Trevor Manz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softw... |
55a19a587cd41e944a8853aa70fd6369ff6299ad506ae8009afacfe5dc66f87b | Python | 13,629 | 386 | # Copyright 2015 Google Inc. All Rights Reserved.
#
# 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 a... |
8867e1c5cbc330f9d1525f61c921b9667a4c398780af698e8662c6da130baf7a | Python | 13,647 | 341 | # ==============================================================================
# Script: extra_lpr_m_schematic.py
# Manuscript relevance: Fig. 1
# ==============================================================================
# PURPOSE:
# Generate figures illustrating how within-patient variation
# in the linear ... |
442ab72ec9e78749c9b2dd4b4770c12efba9cb6e6b99d9bceacbf91bff193857 | Python | 13,649 | 335 | # 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, field
from typing import Optional
import torch.nn.functional as F
from fairseq import metrics,... |
981f894da6aeeb86c1c821cfea77762262baa5bdf747d0a42a918920855d3a3b | Python | 13,654 | 377 | # 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 os
from argparse import Namespace
from pathlib import Path
import torch
from fairseq.data import (
encoders,
Dic... |
32ed51142480a92aea411becb81bb2181831b1d8ba0765d4e01faa04f9b0b242 | Python | 13,662 | 277 | # 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 fairseq.dataclass.utils import gen_parser_from_dataclass
from fairseq.models import (
register_model,
register_model_architecture... |
069d47ab26a297f8d1c677148747441d19323bb68754a5e27eaf22e753cb997b | Python | 13,664 | 473 | """
Ablation Study for Weight Parameter (ω) in Connectivity Matrix Construction
This script addresses the reviewer's question:
"When generating the connectivity matrix, the weight (ω) represents the relative
contribution of inter and intra connection. Is ω calculated automatically, or
should it be predefined? If it is... |
c699f13d3408685517a799c53849a7a433f5285fd50f105cb960d22fc12872c5 | Python | 13,664 | 394 | # 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 typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from .multihead_attention import ... |
bae9519f2ce4ba29b02899bc149329f582869d0e6fcb05e20335ef452d662186 | Python | 13,668 | 419 | import pytest
from pgmpy.base.ADMG import ADMG
from pgmpy.base.DAG import DAG
class TestADMGInitialization:
"""Test ADMG initialization and basic setup."""
def test_empty_initialization(self):
"""Test creating an empty ADMG."""
admg = ADMG()
assert len(admg.nodes) == 0
assert... |
57d61ad287e239d2db4c71bfdc85db2649a2a82f23ff7ed2dd51e9d4adda99f6 | Python | 13,669 | 250 | #!/usr/bin/env python3
"""Assemble all donor-level pseudobulk results into one reviewer-ready Excel workbook."""
import pandas as pd, numpy as np, os
from statsmodels.stats.multitest import multipletests
from openpyxl import Workbook
from openpyxl.styles import Font, PatternFill, Alignment, Border, Side
from openpyxl.u... |
b9e9ca3868ee9096f6e1094122896b63832a0e8b3141d618c77b3cb263596e74 | Python | 13,669 | 341 | # 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 re
from dataclasses import dataclass, field, fields
from typing import List, Optional
from omegaconf import II
from fairseq import u... |
cadc7114ea9f686aeb055dad44fe5b09d501a04ec756bdaa3b7889e0cae088b3 | Python | 13,669 | 418 | # 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 functools import partial
import logging
import math
import random
import time
import numpy as np
import os
import torch
from torchvis... |
02a4bc0301568f00078b923f34b9d8dec1f84cb4f6855e456bd9b8c416a96539 | Python | 13,674 | 351 | import functools
import logging
import re
import warnings
from collections import defaultdict
from typing import TYPE_CHECKING, Callable, ParamSpec, Sequence, TypeVar
import jax
import jax.numpy as jnp
import jax.tree_util as jtu
import numpy as np
from jax.core import Atom, Tracer
from jax.typing import ArrayLike
if... |
01dc94713d876a093ce26f4f6bc48f28879db4e3fdfc09580aff66d72fd209a2 | Python | 13,675 | 351 | from tqdm import tqdm, TqdmWarning
import ftplib
from pathlib import Path
import warnings
import itertools
import gzip
import shutil
import requests
from zipfile import ZipFile
import os
import tarfile
import json
import gdown
# Ignore tqdm's clamping warnings
warnings.filterwarnings("ignore", category=TqdmWarning)... |
61d79d0f789b70886072f2a63c059343cb487fd0d568b1a39a1d4ad5b76d0d1a | Python | 13,681 | 250 | #!/usr/bin/env python3
"""figure3_methylation.py — Figure 3 methylation panel, UNIFORM gene-level DMP.
ALL per-stratum methylation panels now use the SAME gene-level limma-DMP method
(x = mean methylation logFC, positive = hypermethylated in MS; y = −log10 BH-FDR),
replacing the earlier mixed mCSEA-NES + gene-level la... |
5b841c5ad369fcc5aff2ba2393863eb34f01ee8603922d3dc9f2d6894b16e197 | Python | 13,682 | 390 | # -*- coding: utf-8 -*-
"""Statistics and plotting helpers for analysis outputs."""
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as st
import seaborn as sns
#%% Functions
def add_norm_values(data, columns=[]):
'''
Adds normalized values to a data frame given the ... |
b81ef133fe645f1d9d59ba716bb41c1b20e4672f9f5f8eec10c8a2c5bbb06d72 | Python | 13,687 | 346 | import torch
import torch.nn as nn
try: # for torchvision<0.4
from torchvision.models.utils import load_state_dict_from_url
except: # for torchvision>=0.4
from torch.hub import load_state_dict_from_url
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152', 'resnext50_32x... |
bdc1683dfebf365d3f418c06f3d62c989e7742f87e027c9ce87ac557505b886f | Python | 13,696 | 408 | from __future__ import annotations
from typing import TYPE_CHECKING
from typing import cast
from cleo.io.null_io import NullIO
from packaging.utils import canonicalize_name
from poetry.installation.executor import Executor
from poetry.puzzle.transaction import Transaction
from poetry.repositories import Repository
f... |
849c2ab67d1f1df5042adec52d02c40b3b91bb0109ba32429e3cdd5ace752c6f | Python | 13,697 | 384 | #!/usr/bin/env python
"""Build the BRENDA-organism -> NCBI-taxid table the linking score reads.
Run once, on a machine that has the NCBI dump; the table it writes is a few
hundred kilobytes of `entity_id -> taxid` that `d3text.identifier_bridge`
reads with no resource and no network anywhere. That split is the point:
... |
c04eb7a29ff833e2b02c23cc5673cb3111fa610c08d5528ada40d8e987ec4526 | Python | 13,697 | 414 | import numpy as np
import pandas as pd
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"])
Subtype_colours = np.array(
... |
9f05f406635fbe71d23f933b6f402802172887d22f0bc69a05dfb598d8ca2bf2 | Python | 13,699 | 416 | import numpy as np
import pandas as pd
import statsmodels.formula.api as smf
from .paper_ANOVA import ANOVAModel
# Colours and types
Types = np.array(["T4", "T5"])
Type_colours = np.array(["#17becf", "#ff7f0e"])
Subtypes = np.array(["T4a", "T4b", "T4c", "T4d", "T5a", "T5b", "T5c", "T5d"])
Subtype_colours = np.array(
... |
e74adf32820b3588b258d958ff4f34e3c22c238efb77e2bfebb72d4b44c93f10 | Python | 13,708 | 324 | import numpy as np, pandas as pd, re, matplotlib.pyplot as plt, os, seaborn as sns, itertools, math, random
from collections import defaultdict
from collections import Counter
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from scipy.ndimage import gaussian_filter1d
from joblib import... |
ee470d97a0f0b33a74e036a5b1ab438779c0122fedfb4a0391f26f52e15d1264 | Python | 13,711 | 348 | import matplotlib.pyplot as plt
import numpy as np
import igraph as ig
import networkx as nx
import os
import sys
import seaborn as sns
from scipy import stats
import pandas as pd
from scipy.stats import sem
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler, MinMaxScaler, MaxAbsScal... |
26406d65b8bee508711f7caede462c1db42c0c92fb3f0a7c395fd07d9338ba5c | Python | 13,714 | 365 | from dataclasses import dataclass, field
import os
import torch
import torch.nn as nn
from fairseq import utils
from fairseq.dataclass import ChoiceEnum, FairseqDataclass
from fairseq.models import (
BaseFairseqModel,
register_model,
)
from fairseq.models.roberta.model import RobertaClassificationHead
from ... |
9da50c82cdf04fc4aaa5a4fa531fd9269950018be5b41bdbf5e2a7d9c2ccb0fe | Python | 13,715 | 414 | """
Pure matplotlib plotting functions for photometry-behaviour graphs.
No UI framework dependencies — callers resolve all widget values before
passing them in. Every function takes an ``ax`` (matplotlib Axes) or
``fig`` (Figure) plus explicit data/style parameters and returns only
plain Python / NumPy / pandas obj... |
373b14024fbd439082a41b61fd14b8576900160df4485c0cc219f244abd9adba | Python | 13,729 | 364 | #!/usr/bin/env python
from collections import defaultdict
import numpy as np
from pgmpy.factors import FactorDict
from pgmpy.factors.discrete import DiscreteFactor
from pgmpy.inference.ExactInference import BeliefPropagation
from pgmpy.utils import build_state_names, get_state_counts, preprocess_data
class BaseEst... |
bf568373cb2effddf76dacf9594c00a4ceea71ca08600798acaf0d91c45faa65 | Python | 13,729 | 341 | """Compare two or more sets of GO IDs. Best done using sections.
Usage:
goatools compare_gos [GO_FILE] ...
goatools compare_gos [GO_FILE] ... [options]
Options:
-h --help show this help message and exit
-s <sections.txt> --sections=<sections.txt> Sections file for grouping
-S <sections module s... |
14e527b499953d2cada7c1d70b3e3d7f9b4d098e3a21216494b67cf38730a143 | Python | 13,733 | 416 | # 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 typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from .multihead_attention import ... |
3e45439c90310775ee7c9178187fcdbaefb4ff4ef80dbc94ab0fd840d0cf0387 | Python | 13,734 | 339 | from rpy2.robjects import r
from rpy2.robjects import pandas2ri
from rpy2.robjects.conversion import localconverter
import rpy2.robjects.packages as rpackages
from rpy2.robjects.vectors import StrVector
import pandas as pd
import numpy as np
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection ... |
a2afb9b5406b82bf75c87c4e0ae7dd23d70aae7ad79a8e4f1e6c272395288606 | Python | 13,737 | 323 | """Phase 11 — theoretical decomposition of ε_V*(bond) / ε_V*(site) ≈ 1.25.
We observed empirically that the ratio of asymptotic energy density between
bond and site percolation is approximately 1.25 ± 0.03 for both C and Si
on all 3 lattices. Here we decompose this into two physical factors:
ε_V* = (−E/N) × ... |
58008da25f88e712fd113542dec0e874eb7c84b21fb6c09f859d1acb5a36aa58 | Python | 13,744 | 341 | """
This module runs RNAErnie pretrain with ad-hoc loss.
Author: wangning(wangning.roci@gmail.com)
Date : 2024/1/26 1:21 PM
"""
# built-in modules
import argparse
import os
import os.path as osp
from functools import partial
# 3rd-party modules
from ahocorapy.keywordtree import KeywordTree
# paddle modules
import pad... |
360b39a09c1cb86873231009af5b09581a87c749e861790d6a64a3609833041a | Python | 13,745 | 387 | # 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
from argparse import Namespace
from copy import deepcopy
from pathlib import Path
from typing import Dict, Optional
from fairs... |
a910590e7bce842f495163f9b4b6863ed459eab8d71966b99e64fee3d5d3d69b | Python | 13,745 | 418 | import pytest
from rnalysis.exceptions import InvalidTypeError, InvalidValueError, RNAlysisInputError
from rnalysis.utils.validation import *
class DummyClass:
def __init__(self):
pass
class DummyClassChild(DummyClass):
def mthd(self):
pass
class DummyClassNotChild(dict):
pass
@pyte... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.