Header¶
Contents
- Header
- vcfpy.OrderedDict
- vcfpy.Header
- vcfpy.HeaderLine
- vcfpy.header_without_lines
- vcfpy.SimpleHeaderFile
- vcfpy.AltAlleleHeaderLine
- vcfpy.MetaHeaderLine
- vcfpy.PedigreeHeaderLine
- vcfpy.SampleHeaderLine
- vcfpy.ContigHeaderLine
- vcfpy.FilterHeaderLine
- vcfpy.CompoundHeaderLine
- vcfpy.InfoHeaderLine
- vcfpy.FormatHeaderLine
- vcfpy.FieldInfo
- vcfpy.SamplesInfos
vcfpy.OrderedDict¶
Convenience export of OrderedDict
.
When available, the cyordereddict
, a Cython-reimplementation of OrderedDict
is used for Python before 3.5 (from 3.5, Python ships with a fast, C implementation of OrderedDict
).
-
class
vcfpy.
OrderedDict
¶ Dictionary that remembers insertion order
-
clear
() → None. Remove all items from od.¶
-
copy
() → a shallow copy of od¶
-
fromkeys
(S[, v]) → New ordered dictionary with keys from S.¶ If not specified, the value defaults to None.
-
items
() → a set-like object providing a view on D's items¶
-
keys
() → a set-like object providing a view on D's keys¶
-
move_to_end
()¶ Move an existing element to the end (or beginning if last==False). Raises KeyError if the element does not exist. When last=True, acts like a fast version of self[key]=self.pop(key).
-
pop
(k[, d]) → v, remove specified key and return the corresponding¶ value. If key is not found, d is returned if given, otherwise KeyError is raised.
-
popitem
() → (k, v), return and remove a (key, value) pair.¶ Pairs are returned in LIFO order if last is true or FIFO order if false.
-
setdefault
(k[, d]) → od.get(k,d), also set od[k]=d if k not in od¶
-
update
([E, ]**F) → None. Update D from mapping/iterable E and F.¶ If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
-
values
() → an object providing a view on D's values¶
-
vcfpy.Header¶
-
class
vcfpy.
Header
(lines=[], samples=None)[source]¶ Represent header of VCF file
While this class allows mutating records, it should not be changed once it has been assigned to
This class provides function for adding lines to a header and updating the supporting index data structures. There is no explicit API for removing header lines, the best way is to reconstruct a new
Header
instance with a filtered list of header lines.-
lines
= None¶ list
of :py:HeaderLine objects
-
samples
= None¶ SamplesInfo
object
-
vcfpy.AltAlleleHeaderLine¶
-
class
vcfpy.
AltAlleleHeaderLine
(key, value, mapping)[source]¶ Alternative allele header line
Mostly used for defining symbolic alleles for structural variants and IUPAC ambiguity codes
-
classmethod
from_mapping
(klass, mapping)[source]¶ Construct from mapping, not requiring the string value
-
id
= None¶ name of the alternative allele
-
classmethod
vcfpy.ContigHeaderLine¶
-
class
vcfpy.
ContigHeaderLine
(key, value, mapping)[source]¶ Contig header line
Most importantly, parses the
'length'
key into an integer-
classmethod
from_mapping
(klass, mapping)[source]¶ Construct from mapping, not requiring the string value
-
id
= None¶ name of the contig
-
length
= None¶ length of the contig,
None
if missing
-
classmethod
vcfpy.InfoHeaderLine¶
-
class
vcfpy.
InfoHeaderLine
(key, value, mapping)[source]¶ Header line for INFO fields
Note that the
Number
field will be parsed into anint
if possible. Otherwise, the constantsHEADER_NUMBER_*
will be used.-
description
= None¶ description, should be given,
None
if not given
-
classmethod
from_mapping
(klass, mapping)[source]¶ Construct from mapping, not requiring the string value
-
id
= None¶ key in the INFO field
-
source
= None¶ source of INFO field,
None
if not given
-
type
= None¶ value type
-
version
= None¶ version of INFO field,
None
if not given
-
vcfpy.FormatHeaderLine¶
-
class
vcfpy.
FormatHeaderLine
(key, value, mapping)[source]¶ Header line for FORMAT fields
-
description
= None¶ description, should be given,
None
if not given
-
classmethod
from_mapping
(klass, mapping)[source]¶ Construct from mapping, not requiring the string value
-
id
= None¶ key in the INFO field
-
source
= None¶ source of INFO field,
None
if not given
-
type
= None¶ value type
-
version
= None¶ version of INFO field,
None
if not given
-