forked from Illumina/GTCtoVCF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LocusEntry.py
42 lines (34 loc) · 1.28 KB
/
LocusEntry.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class LocusEntry(object):
"""
Container class for BPM records and VCF record for single
locus
Attributes:
bpm_records (list(BPMRecord)): List of BPM records for locus
vcf_record (vcf._Record): VCF record for locus
"""
def __init__(self, bpm_records, vcf_record):
"""
Create new LocusEntry
Args:
bpm_records (list(BPMRecord)): Group of BPM records for a single locus
vcf_record (vcf._Record): VCF record for a locus
Returns:
LocusEntry
"""
self.bpm_records = bpm_records
self.vcf_record = vcf_record
def add_sample(self, call_factory, append):
"""
Update and both LocusInfo and call data from a sample GTC
Args:
call_factory (CallFactory) : CallFactory to generate _Call objects
append (bool) : If false, reset currrent calls beforing adding this sample
Returns:
None
"""
call = call_factory.create_call(self)
if self.vcf_record.samples is None or not append:
self.vcf_record.samples = []
self.vcf_record._sample_indexes = {}
self.vcf_record._sample_indexes[call.sample] = len(self.vcf_record.samples)
self.vcf_record.samples.append(call)