Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ooops, broke it

  • Loading branch information...
commit fde0c8f349ec3e2cf0f89cff0045ae6f2b808a43 1 parent ff29180
@jdoughertyii authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 vcf.py
View
12 vcf.py
@@ -366,7 +366,7 @@ def _parse_samples(self, samples, samp_fmt):
entry_type = 'String'
if entry_type == 'Integer':
- sampdict[fmt] = self._mapper(int, val)
+ sampdict[fmt] = self._mapper(int, vals)
elif entry_type == 'Float' or entry_type == 'Numeric':
sampdict[fmt] = self._mapper(float, vals)
elif sampdict[fmt] == './.' and self.aggro:
@@ -416,6 +416,7 @@ def next(self):
def main():
'''Parse the example VCF file from the specification and print every
record.'''
+ import contextlib
import StringIO
import textwrap
buff = '''\
@@ -443,12 +444,11 @@ def main():
20\t1230237\t.\tT\t.\t47\tPASS\tNS=3;DP=13;AA=T\tGT:GQ:DP:HQ\t0|0:54:7:56,60\t0|0:48:4:51,51\t0/0:61:2
20\t1234567\tmicrosat1\tGTCT\tG,GTACT\t50\tPASS\tNS=3;DP=9;AA=G\tGT:GQ:DP\t./.:35:4\t0/2:17:2\t1/1:40:3
'''
- stream = StringIO.StringIO(textwrap.dedent(buff))
- vcf_file = VCFReader(stream, aggressive=True)
- for record in vcf_file:
- print record
+ with contextlib.closing(StringIO.StringIO(textwrap.dedent(buff))) as sock:
+ vcf_file = VCFReader(sock, aggressive=True)
+ for record in vcf_file:
+ print record
- stream.close()
if __name__ == '__main__':
main()
Please sign in to comment.
Something went wrong with that request. Please try again.