forked from shahcompbio/scvis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scvis
92 lines (63 loc) · 3.19 KB
/
scvis
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
#!/usr/bin/env python
# scvis
# Author : Jiarui Ding <[email protected]>
import argparse
from scvis.run import train, map
parser = argparse.ArgumentParser(prog='scvis')
parser.add_argument('--version', action='version', version='0.1.0')
# The common arguments
analysis_parser = argparse.ArgumentParser(add_help=False)
analysis_parser.add_argument('--data_matrix_file',
required=True,
help='''The high-dimensional data matrix''')
analysis_parser.add_argument('--config_file',
default=None,
help='''Path to a yaml format configuration file''')
analysis_parser.add_argument('--out_dir',
default="output",
help='''Path for output files''')
analysis_parser.add_argument('--data_label_file',
default=None,
help='''Just used for colouring scatter plots''')
# Learning a parametric mapping
subparsers = parser.add_subparsers()
train_parser = subparsers.add_parser('train',
parents=[analysis_parser],
help='''Learning a parametric mapping for high-dimensional single cell data''')
train_parser.add_argument('--pretrained_model_file',
default=None,
help='''A pretrained scvis model, continue to train this model''')
train_parser.add_argument('--normalize',
type=float,
required=False,
help='''The data will be divided by this number if provided (default: the maximum value).''')
train_parser.add_argument('--verbose',
required=False,
action='store_true',
help='''Print running information''')
train_parser.add_argument('--verbose_interval',
default=50,
required=False,
type=int,
help='''Print running information after running # of mini-batches''')
train_parser.add_argument('--show_plot',
required=False,
action='store_true',
help='''Plot intermediate embedding when this parameter is set''')
train_parser.set_defaults(func=train)
# Mapping new data
test_parser = subparsers.add_parser('map',
parents=[analysis_parser],
help='''Mapping high-dimensional single cell data to a low-dimensional space
given a pretrained mapping''')
test_parser.add_argument('--pretrained_model_file',
required=True,
help='''A pretrained scvis model used to map new data''')
test_parser.add_argument('--normalize',
required=False,
type=float,
help='''Data will be divided by this number if provided (default: from the trained model)''')
test_parser.set_defaults(func=map)
# The arguments
args = parser.parse_args()
args.func(args)