forked from 23andMe/yhaplo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcallHaplogroups.py
executable file
·45 lines (38 loc) · 1.37 KB
/
callHaplogroups.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
#!/usr/bin/env python
#
# David Poznik
# 2016.01.08
# callHaplogroups.py
#
# yHaplo driver script
#----------------------------------------------------------------------
from config import Config
from tree import Tree
from sample import Sample
def callHaplogroups(useDefaultCmdLineArgs=False,
suppressOutputAndLog=False,
outDir=None,
residList=None):
'configures run, builds tree, and calls haplogroups'
config = Config(useDefaultCmdLineArgs=useDefaultCmdLineArgs,
suppressOutputAndLog=suppressOutputAndLog,
outDir=outDir,
residList=residList)
tree = Tree(config)
Sample.callHaplogroups(config, tree)
def callHaplogroupsOnResidList(residList):
'''calls haplogroups over a list of 23andMe research IDs.
returns a dictionary: key=resid, value=dictionary of results'''
callHaplogroups(useDefaultCmdLineArgs=True,
suppressOutputAndLog=True,
residList=residList)
resultsDict = dict()
for sample in Sample.sampleList:
resultsDict[sample.ID] = {
'yhaplo:haplogroup': sample.haplogroup,
'yhaplo:hgSNP': sample.hgSNP,
'yhaplo:hgSNPobs': sample.hgSNPobs,
}
return resultsDict
if __name__ == '__main__':
callHaplogroups()