-
Notifications
You must be signed in to change notification settings - Fork 2
/
get_tss.py
54 lines (45 loc) · 1.27 KB
/
get_tss.py
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
#!/usr/bin/env python3
"""
This script calculates TSS position weight matrices from a fit clipnet.py model.
"""
import argparse
import logging
import os
import joblib
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "4"
logging.getLogger("tensorflow").setLevel(logging.FATAL)
import clipnet
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"fasta_fp",
type=str,
default=None,
help="If pyfastx throws an error, try deleting .fxi index files.",
)
parser.add_argument(
"output",
type=str,
help="where should the output be written? Will export a joblib.gz file.",
)
parser.add_argument(
"--model_dir",
type=str,
default="ensemble_models/",
help="directory where to load models from.",
)
parser.add_argument(
"--gpu",
type=int,
default=None,
help="Index of GPU to use (starting at 0). If None, will use CPU.",
)
args = parser.parse_args()
if args.gpu is not None:
nn = clipnet.CLIPNET(n_gpus=1, use_specific_gpu=args.gpu)
else:
nn = clipnet.CLIPNET(n_gpus=0)
tss = nn.compute_tss(args.model_dir, args.fasta_fp)
joblib.dump(tss, args.output)
if __name__ == "__main__":
main()