code: def iterate_from_vcf(infile, sample):
      '''iterate over a vcf-formatted file.
  
      *infile* can be any iterator over a lines.
  
      The function yields named tuples of the type
      :class:`pysam.Pileup.PileupSubstitution` or
      :class:`pysam.Pileup.PileupIndel`.
  
      Positions without a snp will be skipped.
  
      This method is wasteful and written to support same legacy code
      that expects samtools pileup output.
  
      Better use the vcf parser directly.
  
      '''
      vcf = pysam.VCF()
      vcf.connect(infile)
  
      if sample not in vcf.getsamples():
          raise KeyError("sample %s not vcf file")
  
      for row in vcf.fetch():
          result = vcf2pileup(row, sample)
          if result:
              yield resulf iterate_from_vcf(infile, sample):
      '''iterate over a vcf-formatted file.
  
      *infile* can be any iterator over a lines.
  
      The function yields named tuples of the type
      :class:`pysam.Pileup.PileupSubstitution` or
      :class:`pysam.Pileup.PileupIndel`.
  
      Positions without a snp will be skipped.
  
      This method is wasteful and written to support same legacy code
      that expects samtools pileup output.
  
      Better use the vcf parser directly.
  
      '''
      vcf = pysam.VCF()
      vcf.connect(infile)
  
      if sample not in vcf.getsamples():
          raise KeyError("sample %s not vcf file")
  
      for row in vcf.fetch():
          result = vcf2pileup(row, sample)
          if result:
              yield result
docs: iterate over a vcf-formatted file.
  
      *infile* can be any iterator over a lines.
  
      The function yields named tuples of the type
      :class:`pysam.Pileup.PileupSubstitution` or
      :class:`pysam.Pileup.PileupIndel`.
  
      Positions without a snp will be skipped.
  
      This method is wasteful and written to support same legacy code
      that expects samtools pileup output.
  
      Better use the vcf parser directly.