forked from broadinstitute/pangolin
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from invitae/fix-encoding-error
fix: Fixes issue with unsupported sequences from reference during encoding
- Loading branch information
Showing
4 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CHROM,POS,REF,ALT | ||
chr2,233137476,TG,T |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "pangolin" | ||
version = "1.3.11" | ||
version = "1.3.12" | ||
description = "" | ||
authors = ["Tony Zeng <[email protected]>", "Kevin Kazmierczak <[email protected]>"] | ||
readme = "README.md" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from collections import namedtuple | ||
from unittest.mock import MagicMock | ||
|
||
import pytest | ||
|
||
from pangolin.data_models import Variant | ||
from pangolin.utils import prepare_variant | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"seq, expected", | ||
[ | ||
("ACTGV", True), | ||
("ACTG", False), | ||
("AAAA", False), | ||
("AAUAA", True), | ||
("U", True), | ||
], | ||
) | ||
def test_unsupported_ref_seq(seq, expected): | ||
variant = Variant(lnum=1, chr="chr1", pos=100, ref="C", alt="T") | ||
# Mock out the fasta seq so it returns the passed in sequence | ||
fasta = MagicMock() | ||
fasta.keys = MagicMock(return_value=[variant.chr]) | ||
seq_obj = namedtuple("RefSeq", "seq") | ||
fasta[variant.chr].__getitem__ = MagicMock(return_value=seq_obj(seq)) | ||
|
||
prepped_variant, _ = prepare_variant(variant, None, fasta, 500) | ||
skip_message_contains_text = ( | ||
"Unsupported sequences in ref seq from fasta" in prepped_variant.skip_message | ||
) | ||
assert skip_message_contains_text == expected |