simplevcf package

Module contents

Simple Pure Python VCF Parser

class simplevcf.Reader(stream: IO[Any])

Bases: object

VCF Reader

Parameters

stream – file-like object

get_header()simplevcf.header.Header

Get header

get_samples() → List[str]

Get sample name list

class simplevcf.Record(CHROM: str, POS: int, ID: Optional[str], REF: str, ALT: List[str], QUAL: Optional[str], FILTER: Optional[str], INFO: Dict[str, Any], FORMAT: List[str], CALL: Dict[str, Dict[str, Any]])

Bases: tuple

VCF Record

Use parse method to parse VCF line

ALT: List[str]

Alternative sequences

CALL: Dict[str, Dict[str, Any]]

Called genotype

CHROM: str

Chromosome name

FILTER: Optional[str]

VCF entry Filter

FORMAT: List[str]

Parsed VCF FORMAT record

ID: Optional[str]

VCF entry ID

INFO: Dict[str, Any]

Parsed VCF INFO record

POS: int

VCF entry position

QUAL: Optional[str]

Quality score

REF: str

Reference sequence

static parse(line: str, samples: Iterable[str])simplevcf.Record

Parse VCF line and convert to Record object

Parameters
  • line – A VCF line

  • samples – A list of sample names

to_line(samples: List[str]) → str

Convert to VCF line

Parameters

samples – Sample names

class simplevcf.Writer(stream: IO[Any], header: simplevcf.header.Header)

Bases: object

VCF Writer

Parameters
  • stream – file-like object

  • headers – A sequence of header lines

  • samples – A list of sample names

write_record(record: simplevcf.Record)

Write VCF record

Parameters

record – VCF record

simplevcf.vcfopen(filename: str)simplevcf.Reader

Open VCF file

Parameters

filename – A VCF file name

Submodules

simplevcf.snpeff module

class simplevcf.snpeff.SnpEff(Allele: str, Annotation: str, Annotation_Impact: str, Gene_Name: str, Gene_ID: str, Feature_Type: str, Feature_ID: str, Transcript_BioType: str, Rank: str, HGVS_c: str, HGVS_p: str, cDNA_pos__cDNA_length: str, CDS_pos__CDS_length: str, AA_pos__AA_length: str, Distance: str, ERRORS: str)

Bases: tuple

SnpEff annotation representation

AA_pos__AA_length: str

Alias for field number 13

Allele: str

Alias for field number 0

Annotation: str

Alias for field number 1

Annotation_Impact: str

Alias for field number 2

CDS_pos__CDS_length: str

Alias for field number 12

Distance: str

Alias for field number 14

ERRORS: str

Alias for field number 15

Feature_ID: str

Alias for field number 6

Feature_Type: str

Alias for field number 5

Gene_ID: str

Alias for field number 4

Gene_Name: str

Alias for field number 3

HGVS_c: str

Alias for field number 9

HGVS_p: str

Alias for field number 10

Rank: str

Alias for field number 8

Transcript_BioType: str

Alias for field number 7

cDNA_pos__cDNA_length: str

Alias for field number 11

static parse(record: simplevcf.Record) → List[simplevcf.snpeff.SnpEff]

Parse VCF record

Parameters

record – A VCF record

simplevcf.header module

class simplevcf.header.Header(header_lines: List[HeaderLine], samples: List[str])

Bases: object

VCF Header

get_contig(info_id: str) → Optional[simplevcf.header.HeaderLine]
get_format(info_id: str) → Optional[simplevcf.header.HeaderLine]
get_header_lines() → List[simplevcf.header.HeaderLine]
get_info(info_id: str) → Optional[simplevcf.header.HeaderLine]
get_samples() → List[str]
static parse_header(lines: List[str])simplevcf.header.Header
class simplevcf.header.HeaderLine(line: str, header_tag: str, header_id: Optional[str], header_number: Optional[str], header_type: Optional[str], header_description: Optional[str], header_contents: Dict[str, str])

Bases: tuple

VCF Header line

header_contents: Dict[str, str]

Dictionary of header contents

header_description: Optional[str]

Description value in INFO/FORMAT

header_id: Optional[str]

ID value in INFO/FORMAT

header_number: Optional[str]

Nubmer value in INFO/FORMAT

header_tag: str

Header tag type (INFO, FORMAT…)

header_type: Optional[str]

Type value in INFO/FORMAT

line: str

Raw header line

static parse(line: str)simplevcf.header.HeaderLine

Parse single VCF Header

Parameters

line – a header line