@@ -80,6 +80,22 @@ def _23andme_ancestry(path):
80
80
row ["genotype" ] = "{}{}" .format (row .pop ("allele1" ), row .pop ("allele2" ))
81
81
yield SNP (** row )
82
82
83
+ def _genes_for_good (path ):
84
+ if vcf is None :
85
+ raise RuntimeError ("PyVCF not available, please 'easy_install' it." )
86
+
87
+ try :
88
+ for r in vcf .VCFReader (open (path , "rb" ), compressed = True ):
89
+ if not r .is_snp :
90
+ continue # XXX Is it even possible?
91
+ for sample in r .samples :
92
+ yield SNP (name = r .ID , chromosome = r .CHROM , position = r .POS ,
93
+ genotype = sample .gt_bases .replace ("/" , "" ))
94
+ except OSError :
95
+ # the gfg format is is likely version 1.1
96
+ yield _23andme (path )
97
+
98
+
83
99
def decodeme (path ):
84
100
handle = csv .DictReader (open (path , "r" ),
85
101
fieldnames = ["name" , "variation" , "chromosome" , "position" ,
@@ -133,6 +149,7 @@ def parse(path, source=None):
133
149
handler = {"23andme" : _23andme ,
134
150
"23andme-exome-vcf" : _23andme_exome ,
135
151
"ancestry" : _23andme_ancestry ,
152
+ "genes-for-good" : _genes_for_good ,
136
153
"ftdna-illumina" : ftdna ,
137
154
"decodeme" : decodeme ,
138
155
"vcf" : _23andme_exome ,
0 commit comments