-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeepFavored.py
More file actions
55 lines (46 loc) · 2.62 KB
/
DeepFavored.py
File metadata and controls
55 lines (46 loc) · 2.62 KB
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
"""
* DeepFavored - A deep learning based method to identify favored(adaptive) mutations in population genomes.
* Copyright (C) 2022 Ji Tang, Hao Zhu
*
* This program is licensed for academic research use only
* unless otherwise stated. Contact jitang1024@outlook.com, zhuhao@smu.edu.cn for
* commercial licensing options.
*
* For use in any publications please cite: Ji Tang, Maosheng Huang, Sha He, Junxiang Zeng, Hao Zhu (2022). Uncovering the extensive trade-off between adaptive evolution and disease susceptibility. Cell Reports, Volume 40, Issue 11, 111351.
"""
import argparse
import sys
from identify import IdentifyWithArgs
from train import TrainWithArgs
def full_parser():
parser = argparse.ArgumentParser(
description="DeepFavored: Deep learning based method identifying favored(adaptive) mutations.")
subparsers = parser.add_subparsers(help="sub-commands")
train_parser = subparsers.add_parser('train', help="train model")
train_parser.add_argument('--hyparams', action='store', type=str,
help="path to the file documenting hyperparameters for training deepfavored")
train_parser.add_argument('--trainData', action='store', type=str,
help="path to the directory loading training data")
train_parser.add_argument('--testData', action='store', type=str, help="path to the directory loading test data")
# train_parser.add_argument('--valid_prop', action='store', type=str, help="proportion of validation data")
train_parser.add_argument('--modelDir', action='store', type=str,
help="path to the directory saving training output")
identify_parser = subparsers.add_parser('identify',
help="run trained model to identify favored mutation sites")
identify_parser.add_argument('--modelDir', action='store', type=str,
help="path to the directory saving training output")
identify_parser.add_argument('--input', action='store', type=str,
help="path to a directory or a file loading sites to be identified")
identify_parser.add_argument('--outDir', action='store', type=str,
help="path to the directory saving identification output")
return parser
if __name__ == '__main__':
runparser = full_parser()
args = runparser.parse_args()
# if called with no arguments, print help
if len(sys.argv) == 1:
runparser.parse_args(['--help'])
if sys.argv[1] == 'train':
TrainWithArgs(args)
if sys.argv[1] == 'identify':
IdentifyWithArgs(args)