From cf8b5af23d745a89a22e9de48a07ad57acac8b38 Mon Sep 17 00:00:00 2001 From: Kiran N' Bishwa Date: Tue, 16 May 2017 13:04:40 -0400 Subject: [PATCH] Update model.py Added the method `add_field`. Taken from https://github.com/jamescasbon/PyVCF/blob/wip/82-add-call-data/vcf/model.py --- vcf/model.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vcf/model.py b/vcf/model.py index 34a4d17..73be2be 100644 --- a/vcf/model.py +++ b/vcf/model.py @@ -116,6 +116,10 @@ def is_het(self): if not self.called: return None return self.gt_type == 1 + + def add_field(self, name, value): + new_cls = make_calldata_tuple(list(self.data._fields) + [name]) + self.data = new_cls._make(list(iter(self.data)) + [value]) @property def is_filtered(self):