Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions gcp_variant_transforms/beam_io/vcf_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ def __lt__(self, other):
if self.sample_id != other.sample_id:
return self.sample_id < other.sample_id
elif self.genotype != other.genotype:
if(type(self.genotype) is list and type(other.genotype) is not list):
return False
if(type(other.genotype) is list and type(self.genotype) is not list):
return True
return self.genotype < other.genotype
elif self.phaseset != other.phaseset:
return self.phaseset < other.phaseset
Expand Down
8 changes: 8 additions & 0 deletions gcp_variant_transforms/beam_io/vcf_parser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ def test_variant_call_order(self):
variant_call_2.phaseset = 1
self.assertGreater(variant_call_2, variant_call_1)

def test_genotype_compare(self):
variant_call_1 = self._default_variant_call()
variant_call_2 = vcfio.VariantCall(
sample_id=hash_name('Sample1'), name='Sample1', genotype=-1,
phaseset=vcfio.DEFAULT_PHASESET_VALUE, info={'GQ': 48})

self.assertLess(variant_call_2, variant_call_1)


if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
Expand Down