-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathGiniClust.py
87 lines (63 loc) · 2.74 KB
/
GiniClust.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
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
#!/usr/bin/env python
# GiniClust/src/GiniClust/__main__.py
# Authors: Gregory Giecold; Huidong Chen
# Affiliation: Harvard University
# Contact information: [email protected]; [email protected]
from __future__ import print_function
from os import getcwd, path
import subprocess
try:
import wx
except ImportError:
print('WARNING: GiniClust: Please install wxPython.')
from gooey import Gooey, GooeyParser
@Gooey(
program_name='GiniClust',
advanced=True)
def main():
parser = GooeyParser(
prog='',
description="Detecting rare cell-types from single-cell "
"gene expression data",
epilog="Contributors: Lan Jiang, "
"Qian Zhu and Gregory Giecold.\nFor further help or information, "
"please contact us at [email protected],"
subparsers = parser.add_subparsers(dest='datatype',
help="Type of your input genomics dataset")
qPCR_parser = subparsers.add_parser('qpcr')
qPCR_parser.add_argument('Input', type=str, widget='FileChooser',
help='Select a file to process:')
qPCR_parser.add_argument('-e', '--epsilon', nargs='?',
type=float, const=0.25, default=0.25,
help='DBSCAN epsilon parameter:')
qPCR_parser.add_argument('-m', '--minPts', nargs='?',
type=int, const=5, default=5,
help='DBSCAN minPts parameter:')
qPCR_parser.add_argument('-O', '--Output', nargs='?', type=str,
default=path.join(getcwd(), 'GiniClust_results'),
help="Specify GiniClust's output directory:")
RNASeq_parser = subparsers.add_parser('rna')
RNASeq_parser.add_argument('Input', type=str, widget='FileChooser',
help='Select a file to process:')
RNASeq_parser.add_argument('-e', '--epsilon', nargs='?',
type=float, const=0.5, default=0.5,
help='DBSCAN epsilon parameter:')
RNASeq_parser.add_argument('-m', '--minPts', nargs='?',
type=int, const=3, default=3,
help='DBSCAN minPts parameter:')
RNASeq_parser.add_argument('-O', '--Output', nargs='?', type=str,
default=path.join(getcwd(), 'GiniClust_results'),
help="Specify GiniClust's output directory:")
command = 'Rscript'
path2Rscript = path.join(getcwd(), 'GiniClust_Main.R')
args = parser.parse_args()
if args.datatype == 'qpcr':
datatype_str = 'qPCR'
else:
datatype_str = 'RNA-seq'
cmd = [command, path2Rscript]
cmd += ['-f', args.Input, '-t', datatype_str, '-o', args.Output, '-e', str(args.epsilon), '-m', str(args.minPts)]
subprocess.check_output(cmd, universal_newlines=True)
if __name__ == '__main__':
main()