Skip to content

Commit

Permalink
Don't include empty positions in VariantCalls.
Browse files Browse the repository at this point in the history
  • Loading branch information
donkirkby committed Jan 26, 2018
1 parent 774bb04 commit ce92d45
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
9 changes: 9 additions & 0 deletions pyvdrm/tests/test_vcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,15 @@ def test_init_multiple_sequences(self):

self.assertEqual(expected_calls, calls)

def test_init_empty_sequence(self):
reference = 'ACHE'
sample = ['IN', 'C', '', 'E']
expected_calls = VariantCalls('A1IN C2C E4E')

calls = VariantCalls(reference=reference, sample=sample)

self.assertEqual(expected_calls, calls)

def test_init_bad_length(self):
reference = 'ACHE'
sample = 'ICREL'
Expand Down
3 changes: 2 additions & 1 deletion pyvdrm/vcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def __new__(cls, text=None, reference=None, sample=None):
mutation_sets = {MutationSet(pos=i, variants=alt, wildtype=ref)
for i, (alt, ref) in enumerate(zip(sample,
reference),
1)}
1)
if alt}
positions = set()
for mutation_set in mutation_sets:
if mutation_set.pos in positions:
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='pyvdrm',
version='0.3.0',
version='0.3.1',
description='',

url='',
Expand All @@ -14,5 +14,4 @@
install_requires=['pyparsing'],

setup_requires=['pytest-runner'],
tests_require=['pytest']
)
tests_require=['pytest'])

0 comments on commit ce92d45

Please sign in to comment.