solvebio/contrib/vcf_parser/vcf_parser.py
def next(self):
        """
        Expands multiple alleles into one record each
        using an internal buffer (_next).
        """

        def _alt(alt):
            """Parses the VCF row ALT object."""
            # If alt is '.' in VCF, PyVCF returns None, convert back to '.'
            if not alt:
                return '.'
            else:
                return str(alt)

        if not self._next:
            row = next(self.reader)
            alternate_alleles = list(map(_alt, row.ALT))

            for allele in alternate_alleles:
                self._next.append(
                    self.row_to_dict(
                        row,
                        allele=allele,
                        alternate_alleles=alternate_alleles))

            # Source line number, only increment if reading a new row.
            self._line_number += 1

        return self._next.pop()
def next(self):
        """
        Expands multiple alleles into one record each
        using an internal buffer (_next).
        """

        def _alt(alt):
            """Parses the VCF row ALT object."""
            # If alt is '.' in VCF, PyVCF returns None, convert back to '.'
            if not alt:
                return '.'
            else:
                return str(alt)

        if not self._next:
            row = next(self.reader)
            alternate_alleles = list(map(_alt, row.ALT))

            for allele in alternate_alleles:
                self._next.append(
                    self.row_to_dict(
                        row,
                        allele=allele,
                        alternate_alleles=alternate_alleles))

            # Source line number, only increment if reading a new row.
            self._line_number += 1

        return self._next.pop()
def next ( self ) : def _alt ( alt ) : """Parses the VCF row ALT object.""" # If alt is '.' in VCF, PyVCF returns None, convert back to '.' if not alt : return '.' else : return str ( alt ) if not self . _next : row = next ( self . reader ) alternate_alleles = list ( map ( _alt , row . ALT ) ) for allele in alternate_alleles : self . _next . append ( self . row_to_dict ( row , allele = allele , alternate_alleles = alternate_alleles ) ) # Source line number, only increment if reading a new row. self . _line_number += 1 return self . _next . pop ( )
Expands multiple alleles into one record each
        using an internal buffer (_next).
Expands multiple alleles into one record each using an internal buffer ( _next ) .