-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrunmstmap.py
executable file
·56 lines (38 loc) · 1.16 KB
/
runmstmap.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
#!/usr/bin/python
'''
run MSTmap on map data in an excel file
'''
from rjv.mstmap import *
import sys,os
#sys.tracebacklimit = 0
tmpconf = 'tmp_mstmap_conf'
tmpmap = 'tmp_mstmap_output'
usage = \
'''
upload an excel file (.xls format) and a config file
usage: runmstmap.py <conf_file>
see the example config file for details
note that using the remove_hets option does not remove the Hs
from the resulting output file, it only hides them from mstmap
'''
if len(sys.argv) < 2:
print usage
exit()
#read master config file
conf = read_conf(sys.argv[1])
#read data from excel file
header,data = extract_data2(conf['excel_file'],
conf['sheet_name'],
conf['first_marker'],
conf['first_individual'])
#write data out as mstmap file
export2mstmap(header,data,conf,tmpconf)
os.system('rm %s 2> /dev/null'%tmpmap)
result = os.system('mstmap %s %s 2> err > out'%(tmpconf,tmpmap))
if result != 0:
print 'an mstmap error occurred'
exit()
if not os.path.isfile(tmpmap):
print 'mstmap failed to produce an output file'
exit()
map2excel(conf,tmpmap,header,data)