Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_extract(variant_seq_extractor):
variants = [Variant.from_cyvcf(v) for v in VCF(vcf_file)]
interval = Interval('chr1', 2, 9)
seq = variant_seq_extractor.extract(interval, variants, anchor=5)
assert len(seq) == interval.end - interval.start
assert seq == 'CGAACGT'
interval = Interval('chr1', 2, 9, strand='-')
seq = variant_seq_extractor.extract(interval, variants, anchor=5)
assert len(seq) == interval.end - interval.start
assert seq == 'ACGTTCG'
interval = Interval('chr1', 4, 14)
seq = variant_seq_extractor.extract(interval, variants, anchor=7)
assert len(seq) == interval.end - interval.start
assert seq == 'AACGTAACGT'
with pytest.raises(AttributeError):
v.alt = 'asd'
# non-fixed arguments
v.id = 'asd'
v.qual = 10
v.filter = 'asd'
v.source = 2
assert isinstance(Variant("chr1", '10', 'C', 'T').pos, int)
# from cyvcf2
vcf = cyvcf2.VCF('tests/data/test.vcf.gz')
cv = list(vcf)[0]
v2 = Variant.from_cyvcf(cv)
assert isinstance(v2.source, cyvcf2.Variant)
def __next__(self):
return Variant.from_cyvcf(super().__next__())