Records

vcfpy.Record

class vcfpy.Record(CHROM, POS, ID, REF, ALT, QUAL, FILTER, INFO, FORMAT, calls)[source]

Represent one record from the VCF file

Record objects are iterators of their calls

ALT = None

A list of alternative allele records of type AltRecord

CHROM = None

A str with the chromosome name

FILTER = None

A list of strings for the FILTER column

FORMAT = None

A list of strings for the FORMAT column

ID = None

A list of the semicolon-separated values of the ID column

INFO = None

An OrderedDict giving the values of the INFO column, flags are mapped to True

POS = None

An int with a 1-based begin position

QUAL = None

The quality value, can be None

REF = None

A str with the REF value

add_filter(label)[source]

Add label to FILTER if not set yet

add_format(key, value=None)[source]

Add an entry to format

The record’s calls data[key] will be set to value if not yet set and value is not None. If key is already in FORMAT then nothing is done.

affected_end

Return affected start position in 0-based coordinates

For SNVs, MNVs, and deletions, the behaviour is based on the start position and the length of the REF. In the case of insertions, the position behind the insert position is returned, yielding a 0-length interval together with :py:method:`affected_start`

affected_start

Return affected start position in 0-based coordinates

For SNVs, MNVs, and deletions, the behaviour is the start position. In the case of insertions, the position behind the insert position is returned, yielding a 0-length interval together with :py:method:`affected_end`

begin = None

An int with a 0-based begin position

call_for_sample = None

A mapping from sample name to entry in self.calls

calls = None

A list of genotype Call objects

end = None

An int with a 0-based end position

is_snv()[source]

Return True if it is a SNV

vcfpy.Call

class vcfpy.Call(sample, data, site=None)[source]

The information for a genotype callable

By VCF, this should always include the genotype information and can contain an arbitrary number of further annotation, e.g., the coverage at the variant position.

called = None

whether or not the variant is fully called

data = None

an OrderedDict with the key/value pair information from the call’s data

gt_alleles = None

the allele numbers (0, 1, ...) in this calls or None for no-call

gt_bases

Return the actual genotype alleles, e.g. if VCF genotype is 0/1, could return A/T

gt_phase_char()[source]

Return character to use for phasing

gt_type

The type of genotype, mapping is

  • hom_ref = 0
  • het = 1
  • hom_alt = 2 (which alt is untracked)
  • uncalled = None
is_filtered

Return True for filtered calls

is_het

Return True for filtered calls

is_phased

Return True for phased calls

is_variant

Return True for filtered calls

phased

Return boolean indicating whether this call is phased

plodity = None

the number of alleles in this sample’s call

sample = None

the name of the sample for which the call was made

site = None

the Record of this Call

vcfpy.AltRecord

class vcfpy.AltRecord(type_=None)[source]

An alternative allele Record

Currently, can be a substitution, an SV placeholder, or breakend

type = None

String describing the type of the variant, could be one of SNV, MNV, could be any of teh types described in the ALT header lines, such as DUP, DEL, INS, ...

vcfpy.Substitution

class vcfpy.Substitution(type_, value)[source]

A basic alternative allele record describing a REF->AltRecord substitution

Note that this subsumes MNVs, insertions, and deletions.

value = None

The alternative base sequence to use in the substitution

vcfpy.SV

class vcfpy.SV(type_, value)[source]

Code for structural variant allele

value = None

The alternative base sequence to use in the substitution

vcfpy.BreakEnd

class vcfpy.BreakEnd(type_, value)[source]

A placeholder for a breakend

value = None

The alternative base sequence to use in the substitution

vcfpy.SingleBreakEnd

class vcfpy.SingleBreakEnd(type_, value)[source]

A placeholder for a single breakend

value = None

The alternative base sequence to use in the substitution

vcfpy.SymbolicAllele

class vcfpy.SymbolicAllele(type_, value)[source]

A placeholder for a symbolic allele

value = None

The alternative base sequence to use in the substitution