-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscg
76 lines (51 loc) · 3.86 KB
/
scg
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
#!/usr/bin/env python
#=======================================================================================================================
# Single Cell Genotyper
# Author : Andrew Roth
#=======================================================================================================================
from scg.run import run_doublet_analysis, run_singlet_analysis
from scg.run_dmm import run_dirichlet_mixture_model_analysis
import argparse
parser = argparse.ArgumentParser(prog='Single Cell Genotyper')
parser.add_argument('--version', action='version', version='0.3.1')
subparsers = parser.add_subparsers()
#=======================================================================================================================
# Shared analysis parser
#=======================================================================================================================
analysis_parser = argparse.ArgumentParser(add_help=False)
analysis_parser.add_argument('--config_file', required=True,
help='''Path to YAML format configuration file.''')
analysis_parser.add_argument('--lower_bound_file', default=None,
help='''Path of file where lower bound will be written.''')
analysis_parser.add_argument('--out_dir', default=None,
help='''Path where output files will be written.''')
analysis_parser.add_argument('--convergence_tolerance', default=1e-4, type=float)
analysis_parser.add_argument('--max_num_iters', default=1000, type=int)
analysis_parser.add_argument('--seed', default=None, type=int,
help='''Set random seed so results can be reproduced. By default a random seed is
chosen.''')
analysis_parser.add_argument('--labels_file', default=None,
help='''Path of file with initial labels to use.''')
#----------------------------------------------------------------------------------------------------------------------
genotyper_parser = argparse.ArgumentParser(add_help=False)
genotyper_parser.add_argument('--use_position_specific_error_rate', action='store_true', default=False,
help='''If an error rate will be estimated for each position.''')
genotyper_parser.add_argument('--samples_file', default=None,
help='''Path mapping cells to samples. If set each sample will have a separate mixing
proportion.''')
#----------------------------------------------------------------------------------------------------------------------
doublet_parser = subparsers.add_parser('run_doublet_model', parents=[analysis_parser, genotyper_parser],
help='''Analyse single cell data using the single cell genotyper model accounting for doublets.''')
doublet_parser.add_argument('--state_map_file', required=True)
doublet_parser.set_defaults(func=run_doublet_analysis)
#----------------------------------------------------------------------------------------------------------------------
singlet_parser = subparsers.add_parser('run_singlet_model', parents=[analysis_parser, genotyper_parser],
help='''Analyse single cell data using the single cell genotyper model.''')
singlet_parser.set_defaults(func=run_singlet_analysis)
#----------------------------------------------------------------------------------------------------------------------
dmm_parser = subparsers.add_parser('run_dirichlet_mixture_model', parents=[analysis_parser],
help='''Analyse single cell data using a mixture of Dirichlet distributions.''')
dmm_parser.set_defaults(func=run_dirichlet_mixture_model_analysis)
#----------------------------------------------------------------------------------------------------------------------
args = parser.parse_args()
args.func(args)