File size: 4,486 Bytes
d05f89f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# -*- coding: utf-8 -*-
# The B3clf library computes the blood-brain barrier (BBB) permeability
# of organic molecules with resampling strategies.
#
# Copyright (C) 2021 The Ayers Lab
#
# This file is part of B3clf.
#
# B3clf is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# B3clf is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>
#
# --

"""Package for BBB predictions."""
import argparse

from .b3clf import b3clf

try:
    from .version import __version__
except ImportError:
    __version__ = "0.0.0.post0"


def main():
    # https://docs.python.org/3/library/argparse.html
    parser = argparse.ArgumentParser(
        description="b3clf predicts if molecules can pass blood-brain barrier with resampling "
                    "strategies.",
    )
    parser.add_argument("-mol",
                        default="input.sdf",
                        type=str,
                        help="Input file with descriptors.")
    parser.add_argument("-sep",
                        type=str,
                        default="\s+|\t+",
                        help="""Separator for input file. Default="\s+|\\t+".""")
    parser.add_argument("-clf",
                        type=str,
                        default="xgb",
                        help="Classification algorithm type. Default=xgb.")
    parser.add_argument("-sampling",
                        type=str,
                        default="classic_ADASYN",
                        help="Resampling method type. Default=classic_ADASYN.")
    parser.add_argument("-output",
                        type=str,
                        default="B3clf_output.xlsx",
                        help="Name of output file, CSV or XLSX format. Default=B3clf_output.xlsx.")
    parser.add_argument("-verbose",
                        type=int,
                        default=1,
                        help="If verbose is not zero, B3clf will print out the predictions. "
                             "Default=1.")
    parser.add_argument("-random_seed",
                        type=int,
                        default=42,
                        help="""Romdom seed to control randonness. If set to be "None", """
                             """it will result in a randomness of the predictions. Default=42.""")
    parser.add_argument("-time_per_mol",
                        type=int,
                        default=-1,
                        help="""Time per molecule in seconds. If set to be -1, no time limit. """
                        """Default=-1.""")
    parser.add_argument("-keep_features",
                        type=str,
                        default="no",
                        help="""To keep computed feature file ("yes") or not ("no"). Default=no.""")
    parser.add_argument("-keep_sdf",
                        type=str,
                        default="no",
                        help="""To keep computed molecular geometries ("yes") or not ("no"). Default=no.""")
    parser.add_argument("-threshold",
                        type=str,
                        default="none",
                        help="""Threshold used for the classification which can be "none", """
                             """"J_threshold" and "F_threshold". "J_threshold" will use """
                             """threshold optimized from Youden’s J statistic. "F_threshold" will """
                             """use threshold optimized from F score. Default="none".""")
    args = parser.parse_args()

    _ = b3clf(mol_in=args.mol,
              sep=args.sep,
              clf=args.clf,
              sampling=args.sampling,
              output=args.output,
              verbose=args.verbose,
              random_seed=args.random_seed,
              time_per_mol=args.time_per_mol,
              keep_features=args.keep_features,
              keep_sdf=args.keep_sdf,
              threshold=args.threshold,
              )


if __name__ == "__main__":
    """B3clf command-line interface."""
    main()