phe.utils.reader

Date:3 June, 2016
Author:Public Health England
class ParallelVCFReader(vcfs)[source]

Bases: object

Read multiple VCFs in parallel - one position at the time.

Methods

get_records() Generator of records, one position at the time.
get_samples() Get the list of sample names from the VCFs.
update([ids]) Update records in the readers.
get_records()[source]

Generator of records, one position at the time. If a position has more than 1 record in any of the readers, a list of all records with that position is returned. The user can deal appropriately with the records list.

Returns:
chrom: str

Chromosome

pos: int

Position

records: dict

Records in dictionary of lists for each sample.

{
    "sample1": [record1, record2], 
    "sample2": [record3]
}
get_samples()[source]

Get the list of sample names from the VCFs.

update(ids=None)[source]

Update records in the readers. If ids is not specified, then all readers are updated. Otherwise, only those with the same id are updated.

Parameters:
ids: list, optional

Optional list of IDs to update. If None, all will be updated.