repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
DDOD
DDOD-main/mmdet/datasets/crowdhuman.py
import itertools import logging import os.path as osp import tempfile import warnings from collections import OrderedDict import mmcv import numpy as np from mmcv.utils import print_log from terminaltables import AsciiTable from mmdet.core import eval_recalls from .api_wrappers import COCO, COCOeval from .builder imp...
22,425
40.07326
124
py
DDOD
DDOD-main/mmdet/datasets/cityscapes.py
# Modified from https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/datasets/cityscapes.py # noqa # and https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/evaluation/evalInstanceLevelSemanticLabeling.py # noqa import glob import os import os.path as osp import tempfile fr...
14,288
41.653731
135
py
DDOD
DDOD-main/mmdet/datasets/utils.py
import copy import warnings from mmcv.cnn import VGG from mmcv.runner.hooks import HOOKS, Hook from mmdet.datasets.builder import PIPELINES from mmdet.datasets.pipelines import LoadAnnotations, LoadImageFromFile from mmdet.models.dense_heads import GARPNHead, RPNHead from mmdet.models.roi_heads.mask_heads import Fuse...
6,486
38.554878
78
py
DDOD
DDOD-main/mmdet/datasets/dataset_wrappers.py
import bisect import math from collections import defaultdict import numpy as np from mmcv.utils import print_log from torch.utils.data.dataset import ConcatDataset as _ConcatDataset from .builder import DATASETS from .coco import CocoDataset @DATASETS.register_module() class ConcatDataset(_ConcatDataset): """A...
11,072
38.127208
167
py
DDOD
DDOD-main/mmdet/datasets/xml_style.py
import os.path as osp import xml.etree.ElementTree as ET import mmcv import numpy as np from PIL import Image from .builder import DATASETS from .custom import CustomDataset @DATASETS.register_module() class XMLDataset(CustomDataset): """XML dataset for detection. Args: min_size (int | float, optio...
5,886
33.426901
79
py
DDOD
DDOD-main/mmdet/datasets/__init__.py
from .builder import DATASETS, PIPELINES, build_dataloader, build_dataset from .cityscapes import CityscapesDataset from .coco import CocoDataset from .custom import CustomDataset from .dataset_wrappers import (ClassBalancedDataset, ConcatDataset, RepeatDataset) from .deepfashion import D...
1,219
45.923077
79
py
DDOD
DDOD-main/mmdet/datasets/lvis.py
import itertools import logging import os.path as osp import tempfile import warnings from collections import OrderedDict import numpy as np from mmcv.utils import print_log from terminaltables import AsciiTable from .builder import DATASETS from .coco import CocoDataset @DATASETS.register_module() class LVISV05Dat...
46,136
61.51626
157
py
DDOD
DDOD-main/mmdet/datasets/builder.py
import copy import platform import random from functools import partial import numpy as np from mmcv.parallel import collate from mmcv.runner import get_dist_info from mmcv.utils import Registry, build_from_cfg from torch.utils.data import DataLoader from .samplers import DistributedGroupSampler, DistributedSampler, ...
5,284
35.701389
79
py
DDOD
DDOD-main/mmdet/datasets/coco.py
import itertools import logging import os.path as osp import tempfile import warnings from collections import OrderedDict import mmcv import numpy as np from mmcv.utils import print_log from terminaltables import AsciiTable from mmdet.core import eval_recalls from .api_wrappers import COCO, COCOeval from .builder imp...
23,463
40.974955
124
py
DDOD
DDOD-main/mmdet/datasets/wider_face.py
import os.path as osp import xml.etree.ElementTree as ET import mmcv from .builder import DATASETS from .xml_style import XMLDataset @DATASETS.register_module() class WIDERFaceDataset(XMLDataset): """Reader for the WIDER Face dataset in PASCAL VOC format. Conversion scripts can be found in https://gith...
1,501
27.884615
68
py
DDOD
DDOD-main/mmdet/datasets/api_wrappers/coco_api.py
# This file add snake case alias for coco api import warnings import pycocotools from pycocotools.coco import COCO as _COCO from pycocotools.cocoeval import COCOeval as _COCOeval class COCO(_COCO): """This class is almost the same as official pycocotools package. It implements some snake case function alia...
1,458
30.042553
126
py
DDOD
DDOD-main/mmdet/datasets/api_wrappers/__init__.py
from .coco_api import COCO, COCOeval __all__ = ['COCO', 'COCOeval']
69
16.5
36
py
DDOD
DDOD-main/mmdet/datasets/samplers/group_sampler.py
from __future__ import division import math import numpy as np import torch from mmcv.runner import get_dist_info from torch.utils.data import Sampler class GroupSampler(Sampler): def __init__(self, dataset, samples_per_gpu=1): assert hasattr(dataset, 'flag') self.dataset = dataset self....
5,368
35.033557
78
py
DDOD
DDOD-main/mmdet/datasets/samplers/distributed_sampler.py
import math import torch from torch.utils.data import DistributedSampler as _DistributedSampler class DistributedSampler(_DistributedSampler): def __init__(self, dataset, num_replicas=None, rank=None, shuffle=True, seed=0): ...
1,310
31.775
79
py
DDOD
DDOD-main/mmdet/datasets/samplers/__init__.py
from .distributed_sampler import DistributedSampler from .group_sampler import DistributedGroupSampler, GroupSampler __all__ = ['DistributedSampler', 'DistributedGroupSampler', 'GroupSampler']
194
38
75
py
DDOD
DDOD-main/mmdet/datasets/pipelines/loading.py
import os.path as osp import mmcv import numpy as np import pycocotools.mask as maskUtils from mmdet.core import BitmapMasks, PolygonMasks from ..builder import PIPELINES @PIPELINES.register_module() class LoadImageFromFile: """Load an image from file. Required keys are "img_prefix" and "img_info" (a dict ...
15,860
33.555556
79
py
DDOD
DDOD-main/mmdet/datasets/pipelines/instaboost.py
import numpy as np from ..builder import PIPELINES @PIPELINES.register_module() class InstaBoost: r"""Data augmentation method in `InstaBoost: Boosting Instance Segmentation Via Probability Map Guided Copy-Pasting <https://arxiv.org/abs/1908.07801>`_. Refer to https://github.com/GothicAi/Instaboost ...
3,486
34.222222
79
py
DDOD
DDOD-main/mmdet/datasets/pipelines/compose.py
import collections from mmcv.utils import build_from_cfg from ..builder import PIPELINES @PIPELINES.register_module() class Compose: """Compose multiple transforms sequentially. Args: transforms (Sequence[dict | callable]): Sequence of transform object or config dict to be composed. ...
1,456
27.019231
79
py
DDOD
DDOD-main/mmdet/datasets/pipelines/auto_augment.py
import copy import cv2 import mmcv import numpy as np from ..builder import PIPELINES from .compose import Compose _MAX_LEVEL = 10 def level_to_value(level, max_value): """Map from level to values based on max_value.""" return (level / _MAX_LEVEL) * max_value def enhance_level_to_value(level, a=1.8, b=0....
36,327
39.772166
79
py
DDOD
DDOD-main/mmdet/datasets/pipelines/formating.py
from collections.abc import Sequence import mmcv import numpy as np import torch from mmcv.parallel import DataContainer as DC from ..builder import PIPELINES def to_tensor(data): """Convert objects of various python types to :obj:`torch.Tensor`. Supported types are: :class:`numpy.ndarray`, :class:`torch.T...
11,981
31.827397
79
py
DDOD
DDOD-main/mmdet/datasets/pipelines/__init__.py
from .auto_augment import (AutoAugment, BrightnessTransform, ColorTransform, ContrastTransform, EqualizeTransform, Rotate, Shear, Translate) from .compose import Compose from .formating import (Collect, DefaultFormatBundle, ImageToTensor, ToD...
1,482
53.925926
79
py
DDOD
DDOD-main/mmdet/datasets/pipelines/transforms.py
import copy import inspect import mmcv import numpy as np from numpy import random from mmdet.core import PolygonMasks from mmdet.core.evaluation.bbox_overlaps import bbox_overlaps from ..builder import PIPELINES try: from imagecorruptions import corrupt except ImportError: corrupt = None try: import al...
75,130
38.418153
79
py
DDOD
DDOD-main/mmdet/datasets/pipelines/test_time_aug.py
import warnings import mmcv from ..builder import PIPELINES from .compose import Compose @PIPELINES.register_module() class MultiScaleFlipAug: """Test-time augmentation with multiple scales and flipping. An example configuration is as followed: .. code-block:: img_scale=[(1333, 400), (1333, 8...
4,421
35.545455
78
py
DDOD
DDOD-main/mmdet/utils/contextmanagers.py
import asyncio import contextlib import logging import os import time from typing import List import torch logger = logging.getLogger(__name__) DEBUG_COMPLETED_TIME = bool(os.environ.get('DEBUG_COMPLETED_TIME', False)) @contextlib.asynccontextmanager async def completed(trace_name='', name='', ...
4,077
32.42623
79
py
DDOD
DDOD-main/mmdet/utils/util_mixins.py
"""This module defines the :class:`NiceRepr` mixin class, which defines a ``__repr__`` and ``__str__`` method that only depend on a custom ``__nice__`` method, which you must define. This means you only have to overload one function instead of two. Furthermore, if the object defines a ``__len__`` method, then the ``__...
3,664
33.904762
78
py
DDOD
DDOD-main/mmdet/utils/profiling.py
import contextlib import sys import time import torch if sys.version_info >= (3, 7): @contextlib.contextmanager def profile_time(trace_name, name, enabled=True, stream=None, end_stream=None): """Print time spent by CP...
1,288
31.225
73
py
DDOD
DDOD-main/mmdet/utils/util_random.py
"""Helpers for random number generators.""" import numpy as np def ensure_rng(rng=None): """Coerces input into a random number generator. If the input is None, then a global random state is returned. If the input is a numeric value, then that is used as a seed to construct a random state. Otherwise ...
977
27.764706
119
py
DDOD
DDOD-main/mmdet/utils/logger.py
import logging from mmcv.utils import get_logger def get_root_logger(log_file=None, log_level=logging.INFO): """Get root logger. Args: log_file (str, optional): File path of log. Defaults to None. log_level (int, optional): The level of logger. Defaults to logging.INFO. Retu...
481
23.1
77
py
DDOD
DDOD-main/mmdet/utils/collect_env.py
from mmcv.utils import collect_env as collect_base_env from mmcv.utils import get_git_hash import mmdet def collect_env(): """Collect the information of the running environments.""" env_info = collect_base_env() env_info['MMDetection'] = mmdet.__version__ + '+' + get_git_hash()[:7] return env_info ...
423
23.941176
74
py
DDOD
DDOD-main/mmdet/utils/__init__.py
from .collect_env import collect_env from .logger import get_root_logger __all__ = ['get_root_logger', 'collect_env']
119
23
44
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/utils.py
import os def mkpath(*paths): """Make path.""" path = os.path.join(*[str(path) for path in paths]) path = os.path.realpath(path) return path
151
15.888889
53
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/dataset.py
from __future__ import annotations import torch import torch.nn.functional as F from glob import glob from typing import Literal, List from pedalboard.io import ReadableAudioFile from torch.utils.data import Dataset from tfcrnn.utils import mkpath from tfcrnn.config import Config CLASSES = ['backward', 'bed', 'bird'...
3,763
30.630252
120
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/config.py
import os import argparse import wandb from dataclasses import dataclass, asdict from typing import Literal from tfcrnn.utils import mkpath @dataclass class Config: # Path configurations. dataset_dir: str = mkpath(os.path.dirname(__file__), '../dataset') # Data configurations. input_seconds: float = 1.0 ...
2,099
24.925926
68
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/__init__.py
0
0
0
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/train.py
import wandb from tfcrnn.runners import SpeechCommandsRunner from tfcrnn.config import Config def main(): config = Config() config.init_wandb() config.parse_cli() config.print() runner = SpeechCommandsRunner(config) print(runner.model) print(f'\n=> Num params: {sum([p.numel() for p in runner.model...
1,916
27.191176
84
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/models/__init__.py
from .blocks import * from .skeletons import *
47
15
24
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/models/blocks/tf_blocks.py
import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict from .plain_blocks import BasicBlock class TFBasicBlock(nn.Module): def __init__(self, in_channels, out_channels, hidden_size, amp_rate): super().__init__() self.base_block = BasicBlock(in_channels, out_ch...
3,213
36.372093
87
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/models/blocks/plain_blocks.py
import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict class BasicBlock(nn.Sequential): def __init__(self, in_channels, out_channels): super().__init__() self.add_module('conv', nn.Conv1d(in_channels, out_channels, 3, 1, 1)) self.add_module('norm', nn.BatchNorm1d(out_c...
2,546
35.385714
85
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/models/blocks/__init__.py
from .plain_blocks import * from .tf_blocks import *
53
17
27
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/models/skeletons/crnn.py
from __future__ import annotations import math import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict from tfcrnn.config import Config from ..blocks import BasicBlock, SEBlock, ResSEBlock class CRNN(nn.Module): def __init__(self, config: Config): super(CRNN, sel...
3,438
35.2
106
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/models/skeletons/cnn.py
from __future__ import annotations import math import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict from tfcrnn.config import Config from ..blocks import BasicBlock, SEBlock, ResSEBlock class CNN(nn.Module): def __init__(self, config: Config): super(CNN, self)...
3,175
36.364706
115
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/models/skeletons/tf_crnn.py
from __future__ import annotations import math import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict from tfcrnn.config import Config from ..blocks import TFBasicBlock, TFSEBlock, TFResSEBlock class TFCRNN(nn.Module): def __init__(self, config: Config): super(T...
3,636
35.009901
119
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/models/skeletons/__init__.py
from .cnn import CNN from .crnn import CRNN from .tf_crnn import TFCRNN
72
17.25
27
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/runners/speech_commands_runner.py
from __future__ import annotations import os import wandb import torch import torch.nn.functional as F from collections import OrderedDict from tqdm import tqdm from torch.utils.data import DataLoader from tfcrnn.config import Config from tfcrnn.dataset import SpeechCommandsDataset from .base_runner import BaseRunner...
3,649
28.918033
72
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/runners/__init__.py
from .base_runner import BaseRunner from .speech_commands_runner import SpeechCommandsRunner
93
30.333333
56
py
temporal-feedback-crnn
temporal-feedback-crnn-main/tfcrnn/runners/base_runner.py
from __future__ import annotations import numpy as np import os import abc import wandb import torch import torch.optim as optim import torch.nn.functional as F from torch.optim.lr_scheduler import ReduceLROnPlateau from tfcrnn.models import CNN, CRNN, TFCRNN from tfcrnn.config import Config from tfcrnn.utils import ...
5,233
32.33758
118
py
switchprompt
switchprompt-main/databuilding_script.py
""" Utility classes and functions related to SwitchPrompt (EACL 2023). Copyright (c) 2022 Robert Bosch GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or ...
4,322
41.80198
108
py
switchprompt
switchprompt-main/arguments.py
""" Utility classes and functions related to SwitchPrompt (EACL 2023). Copyright (c) 2022 Robert Bosch GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or ...
8,062
33.021097
119
py
switchprompt
switchprompt-main/app.py
""" Utility classes and functions related to SwitchPrompt (EACL 2023). Copyright (c) 2022 Robert Bosch GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or ...
986
36.961538
72
py
switchprompt
switchprompt-main/run.py
""" Utility classes and functions related to SwitchPrompt (EACL 2023). Copyright (c) 2022 Robert Bosch GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or ...
5,263
34.809524
140
py
switchprompt
switchprompt-main/training/trainer_base.py
""" Utility classes and functions related to SwitchPrompt (EACL 2023). Copyright (c) 2022 Robert Bosch GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or ...
3,691
41.436782
128
py
switchprompt
switchprompt-main/training/trainer_exp.py
""" Utility classes and functions related to SwitchPrompt (EACL 2023). Copyright (c) 2022 Robert Bosch GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or ...
25,340
48.015474
130
py
switchprompt
switchprompt-main/model/sequence_classification.py
""" Utility classes and functions related to SwitchPrompt (EACL 2023). Copyright (c) 2022 Robert Bosch GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or ...
15,176
38.626632
140
py
switchprompt
switchprompt-main/model/utils.py
""" Utility classes and functions related to SwitchPrompt (EACL 2023). Copyright (c) 2022 Robert Bosch GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or ...
6,699
35.612022
131
py
switchprompt
switchprompt-main/model/keyword_extractor.py
""" Utility classes and functions related to SwitchPrompt (EACL 2023). Copyright (c) 2022 Robert Bosch GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or ...
10,273
40.261044
135
py
switchprompt
switchprompt-main/model/prefix_encoder.py
""" Utility classes and functions related to SwitchPrompt (EACL 2023). Copyright (c) 2022 Robert Bosch GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or ...
5,075
51.329897
132
py
switchprompt
switchprompt-main/tasks/utils.py
""" Utility classes and functions related to SwitchPrompt (EACL 2023). Copyright (c) 2022 Robert Bosch GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or ...
1,285
30.365854
72
py
switchprompt
switchprompt-main/tasks/clinic/dataset.py
""" Utility classes and functions related to SwitchPrompt (EACL 2023). Copyright (c) 2022 Robert Bosch GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or ...
5,412
42.304
139
py
switchprompt
switchprompt-main/tasks/clinic/get_trainer.py
""" Utility classes and functions related to SwitchPrompt (EACL 2023). Copyright (c) 2022 Robert Bosch GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or ...
2,474
33.375
86
py
switchprompt
switchprompt-main/tasks/clinic/datasets/clinic.py
""" Utility classes and functions related to SwitchPrompt (EACL 2023). Copyright (c) 2022 Robert Bosch GmbH This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or ...
4,266
34.558333
232
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/draw_crossover.py
from rdkit import Chem from rdkit.Chem import Draw from rdkit.Chem import rdMolHash # smiles0 = "C1CC2=C3C(=CC=C2)C(=CN3C1)[C@H]4[C@@H](C(=O)NC4=O)C5=CNC6=CC=CC=C65" smiles0 = "C1CC2=C3C(=CC=C2)C(=CN3C1)[C]4[C](C(=O)NC4=O)C5=CNC6=CC=CC=C65" smiles1 = "C1CC2=C3C(=CC=C2)N(CN3C1)C4C(Cl)(C(=O)NC4=O)" smiles2 = "C4(S)C(C(=...
1,033
27.722222
111
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/evaluate_baseline.py
# from tdc import utils # names = utils.retrieve_benchmark_names('Docking_Group') # print(names) # pyscreener_path = '/project/molecular_data/graphnn/pyscreener/' # from tdc.benchmark_group import docking_group # group = docking_group(path = 'data/', # file_format='1iep_docking', # pys...
2,944
31.722222
118
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/RGA.py
''' - import and config - policy network - for i in 1,...,generation - crossover - RGA use policy network to select ligand *** - crossover - docking - RGA update policy network *** - mutation - RGA use policy network to select ligand *** - mutation - docking - RGA update policy network *** -...
53,684
42.329298
204
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/RunAutogrow.py
# !/usr/bin/env python """This is the executable file for Autogrow 4.0.3. This script should come first. It should obtain and verify all the parameters work. This than should pass these parameters variables to the main execution function titled AutogrowMainExecute.py found in MainFunctions If you use AutoGrow 4.0.3 i...
25,053
33.942817
107
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/demo_docking.py
import argparse PARSER = argparse.ArgumentParser() # Allows the run commands to be submitted via a .json file. PARSER.add_argument( "--json", "-j", metavar="param.json", help="Name of a json file containing all parameters. \ Overrides other arguments.", ) # Allows the run in debug mode. Doesn't d...
37,208
35.055233
131
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/model.py
import numpy as np import torch from torch import nn import torch.nn.functional as F from rdkit import Chem, DataStructs from rdkit.Chem import AllChem, Descriptors def smiles2fp(smiles_string): mol = Chem.MolFromSmiles(smiles_string) Chem.SanitizeMol(mol) fp = AllChem.GetMorganFingerprintAsBitVect(mol, 2,...
12,570
33.535714
133
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/run.py
import argparse PARSER = argparse.ArgumentParser() # Allows the run commands to be submitted via a .json file. PARSER.add_argument( "--json", "-j", metavar="param.json", help="Name of a json file containing all parameters. \ Overrides other arguments.", ) # Allows the run in debug mode. Doesn't d...
32,721
33.553326
131
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/smiles2dockscore.py
import argparse PARSER = argparse.ArgumentParser() # Allows the run commands to be submitted via a .json file. PARSER.add_argument( "--json", "-j", metavar="param.json", help="Name of a json file containing all parameters. \ Overrides other arguments.", ) # Allows the run in debug mode. Doesn't d...
31,771
36.511216
137
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/demo_GAoperation.py
import argparse PARSER = argparse.ArgumentParser() # Allows the run commands to be submitted via a .json file. PARSER.add_argument( "--json", "-j", metavar="param.json", help="Name of a json file containing all parameters. \ Overrides other arguments.", ) # Allows the run in debug mode. Doesn't d...
26,805
33.994778
137
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/draw_mutation.py
from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem import Draw with open('mutation_example.txt', 'r') as fin: lines = fin.readlines() idx = 0 for line in lines[idx:idx+1]: input_smiles, smart, output_smiles = line.split()[:3] mol = Chem.MolFromSmiles(input_smiles, sanitize=False) Draw.MolToF...
2,257
30.802817
286
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/accessory_scripts/file_concatenate_and_compression.py
""" This script is used to decompress or recompress AutoGrow data. If you use the reduce_files_sizes option AutoGrow will convert concatenate and compress all files in the PDBs directory of each generation. This is useful when doing larger runs as data transfer is faster and data storage is reduced when files are merg...
10,196
32.432787
108
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/accessory_scripts/test_complementary_mol_library.py
""" This script will test a complementary molecule library to ensure all compounds react in all reactions they may be used in. Example submit: python autogrow4/accessory_scripts/test_complementary_mol_library.py \ --rxn_library_file \ autogrow4/autogrow/operators/mutation/smiles_click_chem/reaction_libraries/click_ch...
37,953
38.617954
125
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/accessory_scripts/make_lineage_figures.py
""" This script creates figures for all ligands which parented a given ligand. All compounds for the entire AutoGrow run will be compiled into a dictionary \ which is used to search when tracing lineages. We pickle these dictionaries so \ that if this script is run multiple times these dictionaries do not need to be \...
46,445
40.843243
100
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/accessory_scripts/convert_vina_docked_pdbqt_to_pdbs.py
""" This script will convert a docked .pdbqt.vina file into separate .pdb file. This is done by splitting up a single .pdbqt.vina into separate .pdbqt files for each docked pose. Then it removes a column of the .pdbqt and saves as a .pdb file. If variable --max_num_of_poses is not set it will convert all poses. I...
13,901
39.530612
98
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/accessory_scripts/convert_single_ligand_pdbqt_to_pdb.py
""" This script will convert a pdbqt file into a .pdb file. This is done by removing a column of the PDB file. # Run example: # # output example: # python convert_ligands_pdb_to_smi.py \ # -source_folder $PATH/OF/PDBS/ \ # -output_folder $PATH/TO/OUTPUT/ \ # -number_of_processors -1 """ import __future__ imp...
4,099
31.539683
91
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/accessory_scripts/fragmenter_of_smi_mol.py
""" This script will fragment a .smi Example Run: python fragmenter_of_smi_mol.py \ --smi_file autogrow4/source_compounds/PARPi.smi """ import itertools import copy import random import os import argparse import rdkit import rdkit.Chem as Chem from rdkit.Chem.BRICS import BRICSDecompose from rdkit import RDLogger ...
21,810
30.114123
97
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/accessory_scripts/plot_autogrow_run.py
""" Plots a line plot of the average score for each generation of AutoGrow run. Example submit: python autogrow4/accessory_scripts/plot_autogrow_run.py\ -i $PATH/Run_1/Run_0/ \ --plot_reference_lines [['Olaparib Score',-12.8,'y'],\ ['Niraparib',-10.7,'k'],['NAD/NADH',-10.3,'purple'],\ ...
22,547
35.192616
91
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/accessory_scripts/__init__.py
1
0
0
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/accessory_scripts/convert_directory_ligands_pdb_to_smi.py
""" convert pdbs into smiles This script will take a folder and convert all pdb files into a single texted file. The text file will contain smiles strings of the respective pdb and the name of the file. Run example: output example: python convert_ligands_pdb_to_smi.py \ --source_folder $PATH/OF/PDBS/ \ --output_...
5,274
31.361963
89
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/accessory_scripts/support_scripts/mol_object_handling.py
# Copyright 2018 Jacob D. Durrant # # 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 writ...
10,623
34.531773
130
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/accessory_scripts/support_scripts/__init__.py
1
0
0
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/accessory_scripts/support_scripts/Multiprocess.py
""" Run commands on multiple processors in python. Adapted from examples on https://docs.python.org/2/library/multiprocessing.html """ # These functions are also borrow from the Gypsum-DL script Parallelizer.py # These functions were renamed to be pep8 compliant # ie ) # def multi_threading became def multi_threading...
3,732
24.744828
89
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/user_vars.py
"""user_vars This should contain the functions for defining input variables. Both the default variables and the user input variables. This should also validate them. """ import __future__ import os import copy import datetime import json import sys import platform from shutil import copyfile def program_info(): ...
87,255
38.697907
112
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/model.py
import numpy as np import torch from torch import nn import torch.nn.functional as F from rdkit import Chem, DataStructs from rdkit.Chem import AllChem, Descriptors def smiles2fp(smiles_string): mol = Chem.MolFromSmiles(smiles_string) Chem.SanitizeMol(mol) fp = AllChem.GetMorganFingerprintAsBitVect(mol, 2, nB...
2,365
24.170213
72
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/__init__.py
1
0
0
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/autogrow_main_execute.py
""" Top level for running AutoGrow. Runs all population generation (operations) and docking. Runs plotting at end. """ import __future__ import os import glob import sys import shutil import autogrow.docking.execute_docking as DockingClass import autogrow.operators.operations as operations import autogrow.docking.con...
15,174
40.236413
250
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/plotting/generate_line_plot.py
""" Plots AutoGrow Run""" import __future__ import os import glob import matplotlib import matplotlib.pyplot as plt def get_usable_format(infile): """ This code takes a string for an file which is formatted as an .smi file. It opens the file and reads in the components into a usable list. The .smi ...
15,937
34.896396
89
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/plotting/__init__.py
1
0
0
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/operators/operations1.py
""" Populates an AutoGrow generation via mutation, crossover, and elitism. Also filters and converts SMILES to 3d SDFS. """ import __future__ import os import random import copy import sys import rdkit import rdkit.Chem as Chem # Disable the unnecessary RDKit warnings rdkit.RDLogger.DisableLog("rdApp.*") import aut...
45,015
37.974892
144
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/operators/__init__.py
1
0
0
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/operators/operations.py
""" Populates an AutoGrow generation via mutation, crossover, and elitism. Also filters and converts SMILES to 3d SDFS. """ import __future__ import os import random import copy import sys import rdkit import rdkit.Chem as Chem # Disable the unnecessary RDKit warnings rdkit.RDLogger.DisableLog("rdApp.*") import aut...
42,982
36.970848
114
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/operators/filter/execute_filters.py
""" Top level for running filters. """ import __future__ import copy import rdkit from rdkit import Chem from rdkit.Chem.MolStandardize import rdMolStandardize # Disable the unnecessary RDKit warnings rdkit.RDLogger.DisableLog("rdApp.*") from autogrow.operators.filter.filter_classes.parent_filter_class import Paren...
6,794
30.169725
94
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/operators/filter/__init__.py
1
0
0
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/operators/filter/filter_classes/get_child_filter_class.py
""" An object for auto-detecting and creating jobs with the proper templates. """ # You'll need to import the base class first def get_all_subclasses(base_class): """ Method for getting all child classes from a parent object. Taken from: http://stackoverflow.com/questions/3862310/how-can-i-find-all-subcla...
775
26.714286
102
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/operators/filter/filter_classes/parent_filter_class.py
""" This script holds the parent class for filtering. This is used as the basis for all filter classes. """ import __future__ class ParentFilter(object): """ This is a script containing all of the filters for drug likeliness Filters for orally bio-available drugs: 1) Lipinski Filters for for l...
1,124
24
70
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/operators/filter/filter_classes/__init__.py
0
0
0
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/operators/filter/filter_classes/filter_children_classes/lipinski_lenient_filter.py
"""Lipinski Lenient This runs a Lenient Lipinski filter. Lipinski filter refines for orally available drugs. It filters molecules by Molecular weight (MW), the number of hydrogen donors, the number hydrogen acceptors, and the logP value. To pass the Lipinski filter a molecule must be: MW: Max 500 dalton Number...
3,537
34.029703
85
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/operators/filter/filter_classes/filter_children_classes/mozziconacci_filter.py
"""Mozziconacci Filter This runs a Mozziconacci filter. Mozziconacci filter is a filter for Drug-likeliness which filters molecules by the number of: rotatable bonds, rings, oxygens, and halogens. To pass the filter a molecule must be: # of Rotatable bonds: Max 15 # of Rings: Max 6 # of Oxygens: Min 1 ...
3,265
31.66
85
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/operators/filter/filter_classes/filter_children_classes/lipinski_strict_filter.py
"""Lipinski Strict This runs a Strict Lipinski filter. Lipinski filter refines for orally available drugs. It filters molecules by Molecular weight (MW), the number of hydrogen donors, the number hydrogen acceptors, and the logP value. To pass the Lipinski filter a molecule must be: MW: Max 500 dalton Number o...
3,329
33.6875
85
py
reinforced-genetic-algorithm
reinforced-genetic-algorithm-main/autogrow/operators/filter/filter_classes/filter_children_classes/brenk_filter.py
"""#BRENK filter This will filter a ligand using the BRENK filter for lead-likeliness, by matching common false positive molecules to the current mol.. This script relies on the RDKit predefined FilterCatalog. FilterCatalog is maintained by RDKit. If using the BRENK filter please cite: Brenk R et al. Lessons Learnt f...
2,846
32.104651
86
py