Skip to content

Commit

Permalink
fix test, and run all tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
manulera committed Jul 27, 2023
1 parent 435fe3b commit 4310ecd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ jobs:
poetry config virtualenvs.create false
poetry install --no-dev
- name: Run tests
# Here other tests could be added, for now just the api entrypoints
run: |
python -m unittest test_api.py
python -m unittest -v
15 changes: 12 additions & 3 deletions allele_fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,29 @@ def old_coords_fix(coordinate_changes, targets):
# We now remap from old coordinates to new ones. It may return None if the position in the old sequence
# does not exist in the new one.
target_remapped = change_to_new_indexes_from_old_coordinates(old_alignment, new_alignment, t)

# Special case where the given position is matched in the old sequence, but there is not an equivalent
# position in the new sequence. Example:
#
# > current sequence
# ----------------MLQRLEQL
# ^
# > old sequence
# MPGSPSQEPLAEAESNMLQRLEQL
# ^
#
# For instance, S4 is matched in the old sequence, but there is no equivalent position in the new sequence.
#
# This does not have to necessarily on a dash, it can be on a different aminoacid, e.g.:
#
# > current sequence
# MAAA------------MLQRLEQL
# ^
# > old sequence
# MPGSPSQEPLAEAESNMLQRLEQL
# ^

if target_remapped is None:
if target_remapped is None or not position_or_index_exists(target_remapped, new_sequence):
this_revision['values'].append('?')
# For now, we also break in this case
# break
else:
this_revision['values'].append(target_remapped)
Expand Down
4 changes: 3 additions & 1 deletion test_coordinate_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def test_old_coords_fix(self):
]

solutions = old_coords_fix(coordinate_changes, ['A1', 'P2'])
self.assertEqual(len(solutions), 2)
self.assertEqual(len(solutions), 4)
self.assertEqual(solutions[0]['values'], 'A1,P4')
self.assertEqual(solutions[1]['values'], 'A1,P3')
self.assertEqual(solutions[2]['values'], '?,P4')
self.assertEqual(solutions[3]['values'], '?,P3')

0 comments on commit 4310ecd

Please sign in to comment.