solvebio/contrib/vcf_parser/vcf_parser.py
def row_to_dict(self, row, allele, alternate_alleles):
        """Return a parsed dictionary for JSON."""

        def _variant_sbid(**kwargs):
            """Generates a SolveBio variant ID (SBID)."""
            return '{build}-{chromosome}-{start}-{stop}-{allele}'\
                .format(**kwargs).upper()

        if allele == '.':
            # Try to use the ref, if '.' is supplied for alt.
            allele = row.REF or allele

        genomic_coordinates = {
            'build': self.genome_build,
            'chromosome': row.CHROM,
            'start': row.POS,
            'stop': row.POS + len(row.REF) - 1
        }

        # SolveBio standard variant format
        variant_sbid = _variant_sbid(allele=allele,
                                     **genomic_coordinates)

        return {
            'genomic_coordinates': genomic_coordinates,
            'variant': variant_sbid,
            'allele': allele,
            'row_id': row.ID,
            'reference_allele': row.REF,
            'alternate_alleles': alternate_alleles,
            'info': self._parse_info(row.INFO),
            'qual': row.QUAL,
            'filter': row.FILTER
        }
def row_to_dict(self, row, allele, alternate_alleles):
        def _variant_sbid(**kwargs):
            """Generates a SolveBio variant ID (SBID)."""
            return '{build}-{chromosome}-{start}-{stop}-{allele}'\
                .format(**kwargs).upper()

        if allele == '.':
            # Try to use the ref, if '.' is supplied for alt.
            allele = row.REF or allele

        genomic_coordinates = {
            'build': self.genome_build,
            'chromosome': row.CHROM,
            'start': row.POS,
            'stop': row.POS + len(row.REF) - 1
        }

        # SolveBio standard variant format
        variant_sbid = _variant_sbid(allele=allele,
                                     **genomic_coordinates)

        return {
            'genomic_coordinates': genomic_coordinates,
            'variant': variant_sbid,
            'allele': allele,
            'row_id': row.ID,
            'reference_allele': row.REF,
            'alternate_alleles': alternate_alleles,
            'info': self._parse_info(row.INFO),
            'qual': row.QUAL,
            'filter': row.FILTER
        }
def row_to_dict ( self , row , allele , alternate_alleles ) : def _variant_sbid ( * * kwargs ) : """Generates a SolveBio variant ID (SBID).""" return '{build}-{chromosome}-{start}-{stop}-{allele}' . format ( * * kwargs ) . upper ( ) if allele == '.' : # Try to use the ref, if '.' is supplied for alt. allele = row . REF or allele genomic_coordinates = { 'build' : self . genome_build , 'chromosome' : row . CHROM , 'start' : row . POS , 'stop' : row . POS + len ( row . REF ) - 1 } # SolveBio standard variant format variant_sbid = _variant_sbid ( allele = allele , * * genomic_coordinates ) return { 'genomic_coordinates' : genomic_coordinates , 'variant' : variant_sbid , 'allele' : allele , 'row_id' : row . ID , 'reference_allele' : row . REF , 'alternate_alleles' : alternate_alleles , 'info' : self . _parse_info ( row . INFO ) , 'qual' : row . QUAL , 'filter' : row . FILTER }
Return a parsed dictionary for JSON.
Return a parsed dictionary for JSON .