sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
61c6aa76bca0cfe117a1ced2a0440f4bf064b4fb4eb7069bf73769cb55dcc302 | Python | 8,350 | 261 | # coding: utf-8
"""
Script to train segmentation model described in paper.
"""
import segmentation_models as sm
sm.set_framework('tf.keras')
from functools import partial
import keras_tuner as kt
import tensorflow as tf
from tensorflow.keras import mixed_precision
from tensorflow.keras.callbacks import ReduceLROnPla... |
e647b04e9309b14661647d9fb891f291ad8a02271a311f8fb2c26fecc93e3b76 | Python | 8,351 | 190 | # -*- coding: utf-8 -*-
import pandas as pd
import os
import copy
import numpy as np
import time
import re
from skimage import io
from scipy import ndimage
from scipy.ndimage import morphology
from matplotlib import pyplot as plt
input_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
... |
8ea1138629936197cd4c8ff43d4c8916e1c9b072d594bedc0b3ee36752206191 | Python | 8,355 | 171 | from __future__ import absolute_import
import argparse
import os,sys,re,h5py
import multiprocessing
from statsmodels import robust
import numpy as np
#import joblib
from tqdm import tqdm
##################################
def get_label_raw(fast5_fn, basecall_group, basecall_subgroup,reverse = False):
##Open file
try:... |
26b979a0e8a5a83a6c23267659df4bc3542e1fe935bbb0d67e09127273088c9f | Python | 8,357 | 225 | """
Some code are adapted from https://github.com/liyaguang/DCRNN
and https://github.com/xlwang233/pytorch-DCRNN, which are
licensed under the MIT License.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import utils
import torch
impo... |
84b80a9fd2e13bef011c2de51bebb2e08d6a5793fd1f1cb1de64e6bb50a1bc88 | Python | 8,357 | 209 | """Manager for a user's favorites: tools, curated tool tags, and EDAM
operations/topics, plus the user-visible ordering across all of them.
The favorites payload is persisted as a JSON document inside
``user.preferences["favorites"]`` (a Text column). This manager owns its
schema — validation, deduplication, and the `... |
240bd1b993f2f2e56827be7c7915108c9f00ddf64e072a94d58e0b3accbbd9fa | Python | 8,365 | 182 | import argparse
import os
import torch.multiprocessing as mp
import torch
import torch.distributed as dist
from torch.utils.data import DataLoader, DistributedSampler
from torch.nn.parallel import DistributedDataParallel
from torch.nn import CrossEntropyLoss
from torchvision.models import resnet34
from torchvision imp... |
0d6d080bd8ecf7139f3878106430f886afb5fcdf854a3af96c22d4aadd7858b0 | Python | 8,366 | 225 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from __future__ import annotations
import math
from typing import TYPE_CHECKING
import numpy as np
from ax.core.batch_trial ... |
138f7b60eee7769d2282ac693b3911d08ef6c06ffd0e23b6a1dd0547da104661 | Python | 8,366 | 265 | import math
import os
import sys
import shutil
from collections import Counter
from pathlib import Path
from tqdm.auto import tqdm
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
import tensorflow as tf
import tensorflow_addons as tfa
from tensorflow.keras import layers
gpu... |
26cd4d0c708d39c0ab0059d6f4028f13e062c59ad2ac91bdd309387b9c1d5f7d | Python | 8,368 | 304 | # MIT License
#
# Copyright (c) 2019-2024 The PyQMC Developers
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... |
ae36496187cef49508c28378908566d0ffe231e96a87ed66f9c2d880258daacd | Python | 8,376 | 226 | # Testing rotated_morphologies
import unittest, os, sys, numpy as np, h5py, test_setup
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from bsb.core import Scaffold, from_hdf5
from bsb.config import JSONConfig
from bsb.models import MorphologySet, PlacementSet
from bsb.output import MorphologyReposit... |
a99ae4f274205e67e3b58e88d98dbf732e76afe50d536c23a89e797025dc160f | Python | 8,377 | 193 | import logging
from sqlalchemy import select
from sqlalchemy.sql.expression import func
# Cannot import galaxy.model b/c it creates a circular import graph.
import galaxy
from galaxy.util import unicodify
log = logging.getLogger(__name__)
class UsesItemRatings:
"""
Mixin for getting and setting item rating... |
2961637fdaed123e807b1f91868604c2b849a4b24dd0fbb0cb70aaa35fb67761 | Python | 8,379 | 177 | import abc
import numpy as np
import optuna
import tensorflow as tf
import joblib
import pathlib
from . import _base_model
class TensorflowModel(_base_model.BaseModel, abc.ABC):
"""
Parent class based on :obj:`~easypheno.model._base_model.BaseModel` for all TensorFlow models to share functionalities.
See... |
4890b46c4d4c17112cdf3407ffbb8854e204674488660a767d404a1c35763d3e | Python | 8,385 | 308 | __doc__ = """
Base IO functions - wrap around cloud backends and local IO
Nicholas Turner <nturner@cs.princeton.edu>, 2018
"""
import os
import warnings
from . import backends as bck
from . import utils
GCLOUD_REGEXP = bck.gcloud.REGEXP
AWS_REGEXP = bck.aws.REGEXP
DB_REGEXPS = bck.sqlalchemy.REGEXPS
def pull_fil... |
994cced2d101240290f39ddd45da23c43fdc8d959e03f5d223535bba41a8e811 | Python | 8,387 | 222 | from __future__ import division
from fanc.config import config
import seaborn as sns
import pandas
import numpy as np
from future.utils import string_types
from genomic_regions import GenomicRegion
from ..hic import LowCoverageFilter
import matplotlib.pyplot as plt
def _prepare_backend(output):
if output is not N... |
85f2e23e585e40c37b306e82191e70ec0b1c29b2eede94cb358452d7748ed17a | Python | 8,389 | 255 | """Functions for computing treewidth decomposition.
Treewidth of an undirected graph is a number associated with the graph.
It can be defined as the size of the largest vertex set (bag) in a tree
decomposition of the graph minus one.
`Wikipedia: Treewidth <https://en.wikipedia.org/wiki/Treewidth>`_
The notions of tr... |
e339261882fb11a81630726b0011aee161b24576c271fd4993b4c2138156eee8 | Python | 8,390 | 251 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 4 11:35:36 2019
@author: aaussel
"""
from cells.RE_mdPul import *
from cells.TC_mdPul import *
from cells.HTC_buffer_mdPul_Destxhe_tests import *
from mdPul_one_column import *
from scipy import signal
prefs.codegen.target = 'numpy'
defaultclock.dt = 0.01*ms
runtim... |
0e232e6d04c5f78eafe382eecb15c1ba5e5356dfd060e01169e7745c9e41af25 | Python | 8,392 | 258 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import csv
import json
import os
import random
import sys
from itertools import product
NAME = "issues"
def read_rules(name):
rules = []
with open(os.path.join(sys.argv[1], f"{name}.csv")) as f:
reader = csv.DictReader(f)
f... |
34b1d178ba1748aa00e8a3c13516e317ce24b60e4f11a6a4b488f60082374836 | Python | 8,392 | 249 | import pytest
import networkx as nx
from networkx.algorithms import flow
from networkx.utils import pairwise
flow_funcs = [
flow.boykov_kolmogorov,
flow.edmonds_karp,
flow.dinitz,
flow.preflow_push,
flow.shortest_augmenting_path,
]
def is_path(G, path):
return all(v in G[u] for u, v in pairw... |
70ffc980b00ab9860c41ed694615be311205278aa091f4206c7d5958cf3bb958 | Python | 8,393 | 197 | """
FSM utility functions for backfilling and managing state transitions.
This module contains reusable functions for FSM state management that are
used across different parts of the codebase.
"""
import logging
from typing import Callable, Optional
from core.current_request import CurrentContext
from core.feature_f... |
a2395f214eb12b6ea9a3fb5ecda8a888cba889ffefb7038095274e1d738783a0 | Python | 8,393 | 272 | """
=======================
Distance-regular graphs
=======================
"""
from collections import defaultdict
from itertools import combinations_with_replacement
from math import log
import networkx as nx
from networkx.utils import not_implemented_for
from .distance_measures import diameter
__all__ = [
"i... |
ba129d57622957437fa9482e465692b38426037fb3a13668b5623591259d4717 | Python | 8,393 | 248 | """Utilities for building up Docker commands...
...using common defaults and configuration mechanisms.
"""
import os
import shlex
import sys
from typing import (
List,
Optional,
TYPE_CHECKING,
Union,
)
if TYPE_CHECKING:
from .container_volumes import DockerVolume
from galaxy.util.commands import... |
03be047acfb7c350db24906c781810176788ee890882d0d0f85d376964705dcf | Python | 8,394 | 185 | """Main script for running simulations (algorithmic level and network)."""
import numpy as np
import pylab as pl
import strinf as si
# Get config
cfgfname = si.import_config(globals())
# Setup logger
si.init_logging(loglevel=cfg['glo']['loglevel'], dryrun=cfg['glo']['DRYRUN'], outdir=cfg['glo']['outdir'])
si.log.inf... |
358de96714d102d310775d091752547763aaba845dec123688d7b2688e452257 | Python | 8,396 | 268 | """
BIDS dataset query and other helper functions
"""
from pathlib import Path
import re
from .errors import (
MixingFileNotFoundError,
NoImagesFoundError,
NoSubjectsFoundError,
NoiseFileNotFoundError,
SubjectNotFoundError,
)
import json
import warnings
import os
from bids import BIDSLayout, BIDS... |
8b78256724a0f405c6e67b8023393ca5efd4439c44e0491ae4d535645e656f36 | Python | 8,401 | 221 | import argparse
def get_args():
parser = argparse.ArgumentParser('Train DCRNN on TUH data.')
# General args
parser.add_argument('--save_dir',
type=str,
default=None,
help='Directory to save the outputs and checkpoints.')
parser.a... |
17e3c5cf82c2b8c8e8dd135c4e1c005b248f30cfb06b12e56c41ccf93d69272c | Python | 8,402 | 131 | import datetime
import pprint
import pathlib
import warnings
from optuna.exceptions import ExperimentalWarning
from easypheno.utils import check_functions, print_functions, helper_functions
from easypheno.preprocess import raw_data_functions, base_dataset
from easypheno.optimization import optuna_optim, paramfree_fitt... |
657103876c45476a1d860ab2481bab422bff526530b6c1c31f69aa0436e3e56f | Python | 8,402 | 216 | # Copyright (c) MONAI Consortium
# 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 agreed to in writing, so... |
7780e6aca21be561b37939c6c0b7003d25f2f41a98c7a387b5362d5ac968750e | Python | 8,402 | 236 | from notears.locally_connected import LocallyConnected
from notears.lbfgsb_scipy import LBFGSBScipy
from notears.trace_expm import trace_expm
import torch
import torch.nn as nn
import numpy as np
import math
class NotearsMLP(nn.Module):
def __init__(self, dims, bias=True):
super(NotearsMLP, self).__init__... |
e9e81490c73d68ed8e63ab8bf487df8c3bcb3b1b562c61db04aead0621c884ca | Python | 8,402 | 190 | # Copyright (c) MONAI Consortium
# 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 agreed to in writing, so... |
be599ce0cb52e6781df4bc0e3275bdf01aaad84f8e470c6cc2503ca6d50eca37 | Python | 8,403 | 199 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from collections.abc import Mapping, Sequence
import numpy as np
from ax.adapter.adapter_utils impor... |
b2bdcb30198d108327c2f59c2850f34d5c1101739dd687038839bc894d506322 | Python | 8,405 | 213 | from collections import defaultdict, Counter
import numpy as np
import struct
import io
import os
from subprocess import run
import pandas as pd
from hickit.reader import get_chrom_sizes, get_headers
from hickit.matrix import CisMatrix
def parsebed(chiafile, res=10000, lower=1, upper=5000000, valid_threshold=1):
... |
8eed1bbfe33587540d8e04fc62082f13aaafa32f7b52f1c3debcbac44e49b190 | Python | 8,409 | 314 | """The "torch" CPU backend, based on PyTorch.
To use this backend, call ``himalaya.backend.set_backend("torch")``.
"""
from functools import partial
try:
import torch
except ImportError as error:
import sys
if "pytest" in sys.modules: # if run through pytest
import pytest
pytest.skip("PyT... |
4133ed69bdba5ad243b87f9659e40498cf84e9b58088a4287457e73df61e5743 | Python | 8,411 | 243 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from __future__ import annotations
import traceback
from collections.abc import Sequence
from logging import Logger
from typ... |
328646499d4bd806dfed496175419801ef367e120a1916979dbfb91d9edf01c1 | Python | 8,413 | 243 | import itertools
import numpy as np
from ._util import obj_str_insert
class _lset(set):
def __hash__(self):
return int.from_bytes(":|\\!#è".join(sorted(self)).encode(), "little")
def __eq__(self, other):
return hash(self) == hash(_lset(other))
def copy(self):
return self.__clas... |
c2216253fe5a0d85274fc1bb4c365276d00eb663c3668f2133bb165f81103651 | Python | 8,413 | 214 | import logging
from typing import Optional
from urllib.parse import unquote_plus
from pydantic import BaseModel
from galaxy.datatypes.display_applications.util import (
decode_dataset_user,
encode_dataset_user,
)
from galaxy.datatypes.registry import Registry
from galaxy.exceptions import MessageException
fro... |
ce74fbe0ba05dad59b507f2c914e1b61a1a656b8457af787dc8f1bf20c46c3b6 | Python | 8,413 | 186 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 21 14:05:37 2019
@author: Rory Boyle rorytboyle@gmail.com github.com/rorytboyle
"""
def linear_reg(y, X, names):
"""
Runs a linear regression using statsmodels, extracts results from the
model. Returns a list of results and the OLS results object.
... |
a39fac7c384a577ceb9f9c0ce85f148e419e1146d335c94e97d117a43270c109 | Python | 8,417 | 231 | import argparse
import os
import numpy as np
import math
import torchvision.transforms as transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch... |
2942a3062917473d3545d0e30fd207aeeb2b3f5a9d7f5a738d2a697d5c55c87d | Python | 8,420 | 200 | # MIT License
#
# Copyright (c) 2019 Lucas K Wagner
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merg... |
c693fee9ca8cc767c55a38b885505f1eb86ea845c40592c9f1388d17108043f5 | Python | 8,421 | 207 | """
Grey reconstruction module
This morphological reconstruction routine was adapted from
`CellProfiler <http://www.cellprofiler.org>`_.
Author
""""""
Original author: Lee Kamentsky
Copyright (c) 2003-2009 Massachusetts Institute of Technology
Copyright (c) 2009-2011 Broad Institute
Modified by Chi... |
d66cc502f0326559429df14b3c7510d000f8d12622794cb4c03099cef7d623e6 | Python | 8,421 | 225 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
32839edb84d1de0b1fc836a262dabd348bc46bbde1e2c4821ac0d5e49ed37f0f | Python | 8,425 | 262 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# fmt: off
#
# Ax documentation build configuration file, created by
# sphinx-quickstart on Sat Mar 2 00:03:32 2019.... |
deb6dcfa5cc0c69ad0165012e86aec22762f42ec9e4325ef406056d408e9e00f | Python | 8,430 | 241 | import argparse
import os
import numpy as np
import math
import itertools
import sys
import datetime
import time
import torchvision.transforms as transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable
from model... |
4c7f75b33692496563354d4e53a73681da7374f0c01bcf15ea9586c0eeb08b8a | Python | 8,432 | 188 | """
Copyright © 2025 Howard Hughes Medical Institute, Authored by Carsen Stringer , Michael Rariden and Marius Pachitariu.
"""
import os, time, datetime
import numpy as np
from scipy.stats import mode
import cv2
import torch
from torch import nn
from torch.nn.functional import conv2d, interpolate
from tqdm import trang... |
1c5ac33d1848d0dcc6a9a8592f3bf047dba850c74d929a8ebac078f0d32df991 | Python | 8,438 | 198 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from collections.abc import Iterable
from logging import Logger
import pandas as pd
from ax.core.data... |
6753a22b300e51a6c739a4d98e9fb38b1093e7b6c75e61c85d7a2545309b00eb | Python | 8,439 | 218 | from typing import Mapping, Union
import numpy as np
from torch import optim
import torch
import logging
import anndata
from torch.utils.tensorboard import SummaryWriter
from scNTImpute.models import BaseCellModel, BatchClassifier
from scNTImpute.logging_utils import log_arguments
from scNTImpute.trainers.Unsupervised... |
9a54b4b03164c7f68410225eae200353490f2f5e412372f75b1a6a472c2ea61e | Python | 8,445 | 219 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from typing import final, Union
import numpy as np
import pandas as pd
from ax.adapter.base import Adapter
from ax.analysis.... |
f760c2973b83729be3dd3102f25574207ac14a25581927d399c3c91bcc4f13b7 | Python | 8,448 | 206 | """Producer-side SSE helper: fans events out across Galaxy processes.
Kept in its own module (separate from ``galaxy.managers.sse``) because the
dispatcher depends on ``galaxy.queue_worker`` and ``galaxy.queues``, while
``queue_worker`` in turn depends on the connection types in ``sse``. Splitting
the producer (``SSEE... |
eee060adfb819ed07694d21c5c07978ef8b54845b97aad0562087f12e5e15466 | Python | 8,463 | 176 | # Copyright (c) MONAI Consortium
# 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 agreed to in writing, so... |
4daf541706f8900ce89b16950416dd45edf726cad71dce87546719406bfa3487 | Python | 8,464 | 261 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import csv
import json
import os
import random
import sys
from itertools import product
NAME = "webhooks"
def read_rules(name):
rules = []
with open(os.path.join(sys.argv[1], f"{name}.csv")) as f:
reader = csv.DictReader(f)
... |
3a08f4b6bffe9b19a6066a65316a5630b7389322e1839c852cbb46048925c51b | Python | 8,470 | 243 | """
Ranking of queries in which a variable precedes another in an atom and
follows it in another, Dalvi & Suciu (J. ACM 2012), Proposition 4.2.
The expected probabilities are computed by enumerating the possible
worlds of the probabilistic facts.
"""
import itertools
import pytest
from nl_expr.exceptions import (
... |
7cadf9b527a41bffbd130af90619756d1770032db8ed9f736787501450d0f71c | Python | 8,471 | 240 | """
Unit tests for bipartite edgelists.
"""
import io
import pytest
import networkx as nx
from networkx.algorithms import bipartite
from networkx.utils import edges_equal, graphs_equal, nodes_equal
class TestEdgelist:
@classmethod
def setup_class(cls):
cls.G = nx.Graph(name="test")
e = [("a... |
1ac8c0b5f8d8e02329c3495657e268589e8aa030a7b0c133d919ff38d73418b9 | Python | 8,476 | 259 | from __future__ import print_function, unicode_literals, absolute_import, division
import numpy as np
from csbdeep.utils import normalize
from ..matching import matching
from .plot import random_label_cmap
def _single_color_integer_cmap(color = (.3,.4,.5)):
from matplotlib.colors import Colormap
assert l... |
f6a77da75c1449f2affad2c91f0f01d275bef6a012902f2aef0e7b94d0dd0b92 | Python | 8,476 | 269 |
import torch
import functools
import numpy as np
from rdkit import Chem
from torch_geometric import data
from MolRep.Evaluations.DatasetWrapper import Graph_data
from MolRep.Featurization.Graph_embeddings import GraphEmbeddings
from MolRep.Featurization.utils.graph_utils import *
from networkx import normalized_lap... |
ff091288945fc08c0ba88222fabaddf263a4dced835d69f957bdc56cbbd77715 | Python | 8,478 | 268 | """View of Graphs as SubGraph, Reverse, Directed, Undirected.
In some algorithms it is convenient to temporarily morph
a graph to exclude some nodes or edges. It should be better
to do that via a view than to remove and then re-add.
In other algorithms it is convenient to temporarily morph
a graph to reverse directed ... |
fe81a8f1b704c65806f2aa034475710158bb4ee25763b57afbafce268b2e03aa | Python | 8,483 | 219 | """Class implementing meta-model for a Conv2D Residual Layer.
That is, a rectangle of Conv2D layers where the first layer is connected
to the last one. This solution reduces the gradient disappearence problem
that is present in deep neural networks.
"""
from typing import Dict
from tensorflow.keras.layers import Add... |
1c0dfcbb2a8ac274cf4c2877293cc298d11de356de37f7d04f25c0e7e038c367 | Python | 8,484 | 179 | # -*- coding: utf-8 -*-
"""
Refresh the automatically collected fields of the Related Software table:
* curated tools (misc/related_software.csv): GitHub stars, last push (YYYY-MM) and archived flag, and
the year, authors, venue and citation count of the tool's paper (OpenAlex);
* curated and citing tools (misc/rela... |
b3e01eb1540574f2bb801b418761d2aad6fb025a2135851ed63ce5a7510203a0 | Python | 8,485 | 188 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from unittest import mock
import numpy as np
import torch
from ax.generators.torch.utils import subse... |
9359042314a5aa96fbc9f588ac479bcd21a407e106b42608f63de15c535a25ab | Python | 8,490 | 206 | from Bio import SeqIO
import re
import pandas as pd
import numpy as np
import time
import pickle
import argparse
from utils import transcript
def get_seeker_df(data_path):
rg4_seq_df = pd.read_csv(data_path, usecols=["sequence_diagram", "GENCODE_coding_regions", "rG4_intervals",
... |
72a558c1314264251e19959597caceccf78ae52623bddaf6b1cdaf7906231076 | Python | 8,493 | 219 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import time
from collections.abc import Callable
from logging import Logger
from queue import Queue
from threading import Eve... |
3ec266d273357649e33eead61d53577a2f007c41f98e86649a55215da312c019 | Python | 8,495 | 211 | import os
import copy
import pandas as pd
import random
from typing import DefaultDict, IO, List, Sequence, Union, Tuple
import logging
from collections import defaultdict
import numpy as np
import anndata
import torch
from torch import nn
from torch.utils.tensorboard import SummaryWriter
from scNTImpute.models impor... |
d0c6c649b50333d252c8da89d84012cea9d98b04e58ecd1e1639085977f1e94a | Python | 8,499 | 208 |
import argparse
import os
import dgl
import numpy as np
import torch
import torch.nn.functional as F
from dgl.data import register_data_args
from nci_model import *
from nci_process import get_network
from pytorch_lightning.metrics.classification import Accuracy
from pytorch_lightning.metrics.functional... |
b5d91518e458ccfbfb8a678af6fd4cb6b8c1e6ce3754f056add89a7a24de27c4 | Python | 8,500 | 273 | """Compute connectivity matrices for each timeseries"""
import os
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from nilearn.connectome import ConnectivityMeasure
from pyriemann.utils.mean import mean_riemann
from pyriemann.utils.base import sqrtm, logm, expm, invsqrtm
from adaptman.confi... |
be2a59eb045c64aacbce9435d2c7adfa6f8dfa46f118ed8646d6b67b8fed578b | Python | 8,501 | 240 | """Betweenness centrality measures for subsets of nodes."""
import networkx as nx
from networkx.algorithms.centrality.betweenness import (
_add_edge_keys,
_rescale,
)
from networkx.algorithms.centrality.betweenness import (
_single_source_dijkstra_path_basic as dijkstra,
)
from networkx.algorithms.centrali... |
49d68856f88415abbdc6cac350a9ae0bdb9c89d2ec3848366a85c851cac58aa0 | Python | 8,503 | 171 | ## Dataset
class CustomDataset(utils.Dataset):
def load_custom(self, dataset_dir, subset):
"""Load a subset of the dataset.
dataset_dir: Root directory of the dataset.
subset: Subset to load: train or val
"""
# Add classes. We have only one class to add.
self.add_cla... |
5bf99e976d5cfed7968f6b0d4c976ade20623dc8a83674ad6949874ae484a8cc | Python | 8,503 | 272 | import collections
import os.path as osp
from itertools import repeat
import numpy as np
import torch.utils.data
from cogdl.data import Adjacency, Graph
from cogdl.utils import makedirs
from cogdl.utils import Accuracy, CrossEntropyLoss
def to_list(x):
if not isinstance(x, collections.Iterable) or isinstance(x... |
850849d9c038eeed6cbfe80b544a7e909ab8f69bd06adf30a7eda53e9a4d7c82 | Python | 8,505 | 242 | from ..exceptions import *
from ..helpers import ConfigurableClass
import abc
from ..exceptions import *
from ..reporting import report, warn
import numpy as np, os
class PlacementStrategy(ConfigurableClass):
def __init__(self, cell_type):
super().__init__()
self.cell_type = cell_type
self... |
8d0120ea8b45967d3e9e3dcc3af410e69381c3b2c8a247c4319e5840a71545ff | Python | 8,508 | 147 | import argparse
import numpy as np
import pandas as pd
import pathlib
import shutil
from ..model import _model_functions
from ..utils import check_functions, helper_functions
from ..preprocess import base_dataset
from ..evaluation import eval_metrics
if __name__ == "__main__":
"""
Rerun inference using best ... |
9ecf937448fa071ac7b9f5f9c9610a4511f7e3a70265ed72d7aab1773a25e018 | Python | 8,510 | 263 | """test utils"""
from pathlib import Path
TEST_PATH = Path(Path(__file__).parent)
import numpy as np
import numpy.testing as npt
import pytest
from voxcell import RegionMap
import atlas_densities.utils as tested
from atlas_densities.exceptions import AtlasDensitiesError
class Test_load_region_map:
def test_wro... |
6de7e204cd718f555a972df36e9cea7b3452a6b12ff87137596638fb4df5bed3 | Python | 8,512 | 215 | #!/usr/bin/env python
# internal libraries
from __future__ import division
from copy import deepcopy
import time
import os
from tkinter import END
from datetime import datetime
# external libraries
import numpy as np
from scipy import stats, cluster, spatial, special
from sklearn.cluster import KMeans
from sklearn imp... |
0e91b536d9b142e20008b07da097424e15ecc735724d1c230f03adcdb413e150 | Python | 8,513 | 221 | from nipype.interfaces import afni as afni
import nipype.utils
from nipype.interfaces import fsl as fsl
from pathlib import Path
import pandas as pd
import os
import glob
import click
from .job_manager import BatchManager, Job
from .config_json_parser import ClpipeConfigParser
import logging
import sys
from .error_hand... |
495bf578cca209b75ba8766827070ed0704284d1bf6fad360c29c07d41136d96 | Python | 8,513 | 246 | """String choices are case-insensitive, and an unknown one names the valid options."""
from __future__ import annotations
import numpy as np
import pytest
import spatialdata as sd
from spatialdata.models import Image2DModel, Labels2DModel
import squidpy as sq
from squidpy.experimental.im import StainFit
from squidpy... |
69bf03662f0f55ea48f5f8f3edcf81c22903285a16b3742210f55a2d356de2db | Python | 8,513 | 173 | import datetime
# Usage: rename this file to experiment_config.py,
# adjust according to your needs,
# and run the experiments with `python run.py --config_file experiment_config.py`
##### variable parameters #####
# variables that define the experiments
# network or data parameters can be varied
# one experiment wil... |
9ea2989259d7ee6ee0482979ef626f3b0c70433eebb4ca740fdf01233b4fc3fc | Python | 8,514 | 221 | from nipype.interfaces import afni as afni
import nipype.utils
from nipype.interfaces import fsl as fsl
from pathlib import Path
import pandas as pd
import os
import glob
import click
from .job_manager import BatchManager, Job
from .config_json_parser import ClpipeConfigParser
import logging
import sys
from .error_hand... |
ddeb7a69ac003d9f5b3cd5aa0032776d037fd8a872a8f7fc54582b0409200014 | Python | 8,514 | 221 | from pytest import approx
import networkx as nx
from networkx import is_connected, neighbors
from networkx.generators.internet_as_graphs import (
AS_graph_generator,
choose_pref_attach,
random_internet_as_graph,
)
class TestInternetASTopology:
@classmethod
def setup_class(cls):
cls.n = 10... |
b10900c6f98f173d69484bcb1059ade5395bd128060d818cd1139e3f16f69139 | Python | 8,516 | 155 | import copy
import numpy as np
from torchvision import transforms
from torch.utils.data import ConcatDataset
from data.manipulate import permutate_image_pixels, SubDataset, TransformedDataset
from data.available import AVAILABLE_DATASETS, AVAILABLE_TRANSFORMS, DATASET_CONFIGS
def get_dataset(name, type='train', downl... |
0878e337f7c162a159257bd6e2fa0d4fa59a111f51ee0ce1bd29235eebc2f5fe | Python | 8,519 | 164 | import re
import sys
import os
import math
from scipy import stats
print("ALL_PPI_mutation_sites_mapping_with_allonco")
output = open(r'E:\OneDrive\学术\PPI article\data\mapped data\3. DNM_complex_mapping\ALL_Complex_PPI_mutation_sites_allonco_newtest.txt','w+')
with open(r'E:\OneDrive\学术\PPI article\data\mapp... |
9976aa7f4debea45c3bd6d0e1ca0bfc5d1c9d1cc0bec0a5eb94a31e3af401c20 | Python | 8,522 | 264 | """ Cleft ID mapping IO for processing tasks """
import os
from sqlalchemy import select
import pandas as pd
from ... import io
from .. import colnames as cn
from . import filenames as fn
ID_MAP_COLUMNS = [cn.src_id, cn.dst_id]
UNIQUE_ID_MAP_COLUMNS = ["id", cn.seg_id]
CHUNKED_ID_MAP_COLUMNS = [cn.seg_id, cn.dst_... |
87a121ea61b978df4b7f6d2c94462486818ad7199aae8e0edd742dc7af2b7dd2 | Python | 8,523 | 204 | try:
import tensorflow as tf
import tensorboard as tb
tf.io.gfile = tb.compat.tensorflow_stub.io.gfile
except:
pass
import psutil
from torch.utils.tensorboard import SummaryWriter
from arg_parser import parser
import torch
import os
import anndata as ad
import scanpy as sc
import anndata
import pandas ... |
9ac41ba9dd6ce9ee300d79aac771eb6a922ebbb370ced1b053a8bbda713800ef | Python | 8,525 | 273 | #!/usr/bin/env python3
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import map
from builtins import zip
from builtins import range
from future import standard_library
standard_library.install_aliases()... |
fc01538521d987015d132cf2c20ad9ff5405253977ca17ca01e425fe42ef246b | Python | 8,528 | 187 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
41509f3ff87989955f1d7fc9856f1086d7ad04e881a2102fced4c4590093d550 | Python | 8,531 | 246 | import argparse
import torch
import torch.nn.functional as F
import torch.utils.data as data
import torchvision
from torch.utils.tensorboard import SummaryWriter
from tqdm import tqdm
from .. import encoding, neuron
parser = argparse.ArgumentParser(description="spikingjelly Tempotron MNIST Training")
parser.add_ar... |
33d2c879de18da2bf2594f7963a2ad2d3d2b63d82580b60f6de6fc47c3e11850 | Python | 8,534 | 238 | import json
import re
from typing import (
Any,
Dict,
List,
)
from pydantic.json_schema import GenerateJsonSchema
from typing_extensions import Literal
MODE = Literal["validation", "serialization"]
DEFAULT_JSON_SCHEMA_MODE: MODE = "validation"
WHEN_ABSENT_RE = re.compile(r"^When_(.+)___absent$")
class ... |
e3720ac0d62c26a6012eb8ce5b99cd01fa15d0991a177fccb52b2cf5c8233afa | Python | 8,535 | 211 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from dataclasses import dataclass, field
from unittest import mock
from ax.core.base_trial import Bas... |
d136cb6eae6b6c485cf52f6c5905c88f38c897318dc5970e93755a46735649f9 | Python | 8,542 | 230 | import numpy as np
import datatable as dt
import pandas as pd
from scipy.sparse import issparse, csr_matrix, find, coo_matrix
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.decomposition import PCA
from scipy.spatial.distance import squareform
from sklearn.neighbors import NearestNeighbors
from sc... |
4f4a8f811b35b831cb6847f337a8ae0e4a3951e686b409bbdc200f987ab36227 | Python | 8,543 | 254 | from __future__ import annotations
from itertools import product
import numpy as np
import pandas as pd
from anndata import AnnData
from scanpy import logging as logg
from spatialdata import SpatialData
from squidpy._compat import old_positionals
from squidpy._docs import d
from squidpy.gr._utils import _save_data, ... |
182be3a450937ed5fa04f1dc60890de14cc0b98531897e50606b3474e4121457 | Python | 8,545 | 202 | """Unit tests for the SQUALL syntax lark parser."""
import pytest
@pytest.fixture
def nl_setup():
"""Minimal fixture — parser tests are stateless."""
return None
def _normalize_fresh(expr):
"""Replace fresh symbol names with canonical placeholders for structural comparison."""
from nl_expr.expressio... |
d46c3d68f4cb1425c4b9ecf156633def1886bc7c2988fabe837cb5d191db62ba | Python | 8,548 | 240 | from pathlib import Path
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from ipfx.dataset.create import create_ephys_data_set
import pyabf
def summary_df(path, suffix='.abf'):
# The following provides a dataframe for all abf files found recursively within a directory
# it outputs the ... |
4fa6d8bdfa829817ea387000240a82bfde5571e4ea753df670def8d07653587d | Python | 8,549 | 248 | import random
import pytest
import networkx as nx
from networkx.algorithms import approximation as approx
from networkx.algorithms import threshold
np = pytest.importorskip("numpy")
progress = 0
# store the random numbers after setting a global seed
np.random.seed(42)
np_rv = np.random.rand()
random.seed(42)
py_rv... |
f363adb04a90f0197d760229dc8d52a89fc52512f4ea1d3c372ef960ecc0ab8c | Python | 8,555 | 202 | import torch
import networkx as nx
import numpy as np
import torch
from torch_geometric.data import Data
from torch_geometric.data import InMemoryDataset
def nx_to_graph_data_obj(g, center_id, allowable_features_downstream=None,
allowable_features_pretrain=None,
node_... |
710eb035dddf6fc9f0f6bdd3e90802e320f7992e7ee8eda4514f98ba4cf53190 | Python | 8,559 | 267 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import pandas as pd
from ax.adapter.base import Adapter
from ax.analysis.analysis import Analysis
from ax.analysis.graphviz.g... |
8b85ddd5a18b279037773ad0795fb7d66d725edae8d42cbf0a403a8857e37eac | Python | 8,561 | 155 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from dataclasses import dataclass, field
from enum import Enum
from logging import INFO
from typing import Any
from ax.early... |
004571cff549080565d87a16d2cdc7d3b4173c6ff18ff1df306570b3e981f67f | Python | 8,565 | 264 | """Stuff that differs in different Python versions and platform
distributions."""
from __future__ import absolute_import, division
import codecs
import locale
import logging
import os
import shutil
import sys
from pip._vendor.six import text_type
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHE... |
189b7643377864a2b3e4e4c7fe88eae76c4152efbc1afecef5024ba890130ab3 | Python | 8,565 | 253 | """
Graph isomorphism functions.
"""
import itertools
from collections import Counter
import networkx as nx
__all__ = [
"could_be_isomorphic",
"fast_could_be_isomorphic",
"faster_could_be_isomorphic",
"is_isomorphic",
]
@nx._dispatchable(graphs={"G1": 0, "G2": 1})
def could_be_isomorphic(G1, G2, *,... |
5483c3df18ae5f5f9b0a55ca277e12fe74ea17bced29e15dab172d84e1554946 | Python | 8,565 | 212 | import re
from typing import (
Optional,
Union,
)
from pydantic import (
BaseModel,
ConfigDict,
model_validator,
RootModel,
ValidationError,
)
from typing_extensions import Self
from galaxy.exceptions import RequestParameterInvalidException
from galaxy.tool_util_models.parameter_validators... |
7a9ab8d66a80932fa2fe11543bc8e2d95850f97b1226549d968f74baab5ade91 | Python | 8,568 | 274 | import torch
CONFIGS = {
"fast_spmm": None,
"csrmhspmm": None,
"csr_edge_softmax": None,
"fused_gat_func": None,
"fast_spmm_cpu": None,
"spmm_flag": False,
"mh_spmm_flag": False,
"fused_gat_flag": False,
"spmm_cpu_flag": False,
}
def check_fused_gat():
return CONFIGS["fused_g... |
7069f1c04a440762b1eead535891f087b870f49a8a7b4d4de51a562bda111fe8 | Python | 8,569 | 194 | def check_func_conn_motion(motion, conn_mx_dir, conn_mx_filename_str):
"""
Creates a dataframe and dict summarising the relationship between motion
(mean framewise displacement) and functional connectivity at the global
level, regional/node level, and edge level.
:param motion: pandas datafra... |
9d89fd5baff3e3f8ed8be6f25ffdfddfb9256a1417bfaf3eb81ec7e0e5ab5cf6 | Python | 8,569 | 279 | #emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
#ex: set sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See the COPYING file distributed along with the smile package for the
# copyright and license terms.
#
### ### ### ### ### ### ### ... |
aee9080d3019769c0cda705cb5a2d7cf225375d5df3a34f0a728ae74dba30b8c | Python | 8,581 | 251 | import numpy as np
import matplotlib.pyplot as plt
import importlib.util
import colorcet as cc
def checkForCupy():
"""
Master function for checking if cupy exists.
Notes:
This function is required for 2 reasons.
1. To keep code agnostic to numpy and cupy - allows to always use "cp", red... |
431fee5b60328d8feabbbf073dbc285c0698b4603a6dc98e7684b634d91d2a1c | Python | 8,584 | 238 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from typing import Any, cast
import numpy as np
import torch
from ax.core import Arm, GeneratorRun, OptimizationConfig
from ... |
6503abd859b5ff1383681cc3e2920a7caa55749d5fec2585099e7d0fe40111a4 | Python | 8,586 | 184 | # -*- coding: utf-8 -*-
import pandas as pd
import os
import seaborn as sns
from matplotlib import pyplot as plt
import numpy as np
import copy
def change_cell_number_to_string(number):
#not needed right now since all cells are just ints
#convert int to string with cellXXXX
#where XXXX is the in... |
18629d5c7011c405a00e351613dd0adbe92d7128c3c4e8e674a493b7f08e1fbc | Python | 8,589 | 221 | import logging
from typing import (
Any,
NamedTuple,
Optional,
Union,
)
from galaxy.exceptions import RequestParameterInvalidException
from galaxy.files.models import (
BaseFileSourceConfiguration,
BaseFileSourceTemplateConfiguration,
FilesSourceRuntimeContext,
RemoteDirectory,
Remo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.