/
run_vcfTrioDenovo.py
62 lines (46 loc) · 2 KB
/
run_vcfTrioDenovo.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
# -*- coding: utf-8 -*-
"""
Created on Tue May 20 15:17:37 2014
@author: timothyh
"""
import argparse
from tempfile import NamedTemporaryFile
from ped_parser import family, individual, parser
def main():
argparser = argparse.ArgumentParser(description="Call denovo variants on a VCF file containing a trio")
argparser.add_argument('--denovogear',
type=str, nargs=1,
required=True,
help='Path to the denovogear binary for example: /Users/timothyh/home/binHTS/denovogear 0.5.4/bin/denovogear'
)
argparser.add_argument('vcf_file',
type=str, nargs=1,
help='A variant file in VCF format containing the genotypes of the trio'
)
argparser.add_argument('ped_file',
type=str, nargs=1,
help='A pedigree file in .ped format containing the samples to be extracted from the VCF file'
)
print("Hello")
# Check that the PED file only contains a trio and identify sex of child as this is required for calling denovogear correctly
# Check that the VCF file contains the same samples as thePED file
# Run denovogear
#fam_id = '1'
#someFamily = family.Family(family_id = fam_id)
#print(someFamily)
trio_lines = ['#Standard trio\n',
'#FamilyID\tSampleID\tFather\tMother\tSex\tPhenotype\n',
'healthyParentsAffectedSon\tproband\tfather\tmother\t1\t2\n',
'healthyParentsAffectedSon\tmother\t0\t0\t2\t1\n',
'healthyParentsAffectedSon\tfather\t0\t0\t1\t1\n',
'healthyParentsAffectedSon\tdaughter\tfather\tmother\t2\t1\n',
]
trio_file = NamedTemporaryFile(mode='w+t', delete=False, suffix='.vcf')
trio_file.writelines(trio_lines)
trio_file.seek(0)
trio_file.close()
family_parser = parser.FamilyParser(trio_file.name)
trio_family = family_parser.families['healthyParentsAffectedSon']
print(trio_family.)
if __name__ == '__main__':
main()