Skip to content

Instantly share code, notes, and snippets.

@indapa
Created May 3, 2012 17:06
Show Gist options
  • Save indapa/2587299 to your computer and use it in GitHub Desktop.
Save indapa/2587299 to your computer and use it in GitHub Desktop.
Python generators and itertools.izip
"""http://docs.python.org/library/itertools.html#itertools.izip"""
#thanks Brent Pedersen
vcf_gen1=vcfobj1.yieldVcfRecordwithGenotypes(vcfh1)
vcf_gen2=vcfobj1.yieldVcfRecordwithGenotypes(vcfh2)
for vrec1, vrec2 in itertools.izip(vcf_gen1, vcf_gen2):
print vrec1.toStringwithGenotypes()
print vrec2.toStringwithGenotypes()
@brentp
Copy link

brentp commented May 4, 2012

import itertools

for vrec1, vrec2 in itertools.izip(vcf_gen1, vcf_gen2):
     # do stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment