Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(isoslam): Adds functions to extract features from reads #106

Merged
merged 5 commits into from
Dec 12, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
chore: Resolving merge conflict
ns-rse committed Dec 10, 2024
commit 68fdba15331c69e784e9ef1598279772cf692d91
314 changes: 0 additions & 314 deletions tests/test_isoslam.py
Original file line number Diff line number Diff line change
@@ -93,163 +93,6 @@ def test_extract_segment_pairs(bam_file: str | Path, expected_length: int) -> No
assert len(list(alignment_file)) == expected_length


<<<<<<< HEAD
<<<<<<< HEAD
@pytest.mark.parametrize(
("aligned_segment1", "aligned_segment2", "expected"),
[
pytest.param( # type: ignore[misc]
"aligned_segment_28584",
"aligned_segment_17416",
{
"read1": {
"start": 28584,
"end": 28733,
"length": 149,
"status": None,
"transcript": None,
"block_start": (28584, 28704),
"block_end": (28704, 28733),
},
"read2": {
"start": 17416,
"end": 17805,
"length": 389,
"status": None,
"transcript": None,
"block_start": (17416, 17718),
"block_end": (17479, 17805),
},
},
id="28584 and 17416 - Assignment and Transcript are None",
),
],
)
def test_extract_features_from_pair(
aligned_segment1: str,
aligned_segment2: str,
expected: dict[str, dict[str, int | None | str | tuple[int, int]]],
request: pytest.FixtureRequest,
) -> None:
"""Test extract of features from a list of pairs."""
read_pair = isoslam.extract_features_from_pair(
[
request.getfixturevalue(aligned_segment1),
request.getfixturevalue(aligned_segment2),
]
)
assert isinstance(read_pair, dict)
assert read_pair == expected
||||||| parent of 3878e7a (fixup! feature(isoslam): Adds functions to extract features from reads)
# @pytest.mark.parametrize(
# ("aligned_segment", "start", "end", "length", "status", "transcript", "block_start", "block_end"),
# [
# pytest.param( # type: ignore[misc]
# "aligned_segment_28584",
# 28584,
# 28733,
# 149,
# None,
# None,
# (28584, 28704),
# (28704, 28733),
# id="28584 - Assignment and Transcript are None",
# ),
# pytest.param(
# "aligned_segment_17416",
# 17416,
# 17805,
# 389,
# "Assigned",
# "Something",
# (17416, 17718),
# (17479, 17805),
# id="17416 - Assignment and Transcript are None",
# marks=pytest.mark.xfail(reasion="Not getting Assigned or Transcript tags for some reason?"),
# ),
# pytest.param(
# "aligned_segment_18029",
# 18029,
# 18385,
# 356,
# "Assigned",
# "something",
# (18029, 18380),
# (18174, 18385),
# id="17416 - Assignment and Transcript are None",
# marks=pytest.mark.xfail(reasion="Not getting Assigned tag for some reason?"),
# ),
# ],
# )
# def test_extract_features_from_read_param(
# aligned_segment: str,
# start: int,
# end: int,
# length: int,
# status: str,
# transcript: str,
# block_start: tuple[int, int],
# block_end: tuple[int, int],
# request: pytest.FixtureRequest,
# ) -> None:
# """Test extract of features from an aligned segment read."""
# segment = isoslam.extract_features_from_read(request.getfixturevalue(aligned_segment))
# assert isinstance(segment, dict)
# assert segment["start"] == start
# assert segment["end"] == end
# assert segment["length"] == length
# assert segment["status"] == status
# assert segment["transcript"] == transcript
# assert segment["block_start"] == block_start
# assert segment["block_end"] == block_end


# @pytest.mark.parametrize(
# ("aligned_segment1", "aligned_segment2", "expected"),
# [
# pytest.param( # type: ignore[misc]
# "aligned_segment_28584",
# "aligned_segment_17416",
# {
# "read1": {
# "start": 28584,
# "end": 28733,
# "length": 149,
# "status": None,
# "transcript": None,
# "block_start": (28584, 28704),
# "block_end": (28704, 28733),
# },
# "read2": {
# "start": 17416,
# "end": 17805,
# "length": 389,
# "status": None,
# "transcript": None,
# jls_extract_var: (17416, 17718),
# "block_end": (17479, 17805),
# },
# },
# id="28584 and 17416 - Assignment and Transcript are None",
# ),
# ],
# )
# def test_extract_features_from_pair(
# aligned_segment1: str,
# aligned_segment2: str,
# expected: dict[str, dict[str, int | None | str | tuple[int, int]]],
# request: pytest.FixtureRequest,
# ) -> None:
# """Test extract of features from a list of pairs."""
# read_pair = isoslam.extract_features_from_pair(
# [
# request.getfixturevalue(aligned_segment1),
# request.getfixturevalue(aligned_segment2),
# ]
# )
# assert isinstance(read_pair, dict)
# assert read_pair == expected
=======
@pytest.mark.parametrize(
("aligned_segment", "start", "end", "length", "status", "transcript", "block_start", "block_end"),
[
@@ -389,160 +232,3 @@ def test_extract_features_from_pair(
)
assert isinstance(read_pair, dict)
assert read_pair == expected
>>>>>>> 3878e7a (fixup! feature(isoslam): Adds functions to extract features from reads)
||||||| parent of 3ee6aa7 (feature(isoslam): Adds extract_segment_pair() function)
@pytest.mark.parametrize(
("aligned_segment1", "aligned_segment2", "expected"),
[
pytest.param( # type: ignore[misc]
"aligned_segment_28584",
"aligned_segment_17416",
{
"read1": {
"start": 28584,
"end": 28733,
"length": 149,
"status": None,
"transcript": None,
"block_start": (28584, 28704),
"block_end": (28704, 28733),
},
"read2": {
"start": 17416,
"end": 17805,
"length": 389,
"status": None,
"transcript": None,
"block_start": (17416, 17718),
"block_end": (17479, 17805),
},
},
id="28584 and 17416 - Assignment and Transcript are None",
),
],
)
def test_extract_features_from_pair(
aligned_segment1: str,
aligned_segment2: str,
expected: dict[str, dict[str, int | None | str | tuple[int, int]]],
request: pytest.FixtureRequest,
) -> None:
"""Test extract of features from a list of pairs."""
read_pair = isoslam.extract_features_from_pair(
[
request.getfixturevalue(aligned_segment1),
request.getfixturevalue(aligned_segment2),
]
)
assert isinstance(read_pair, dict)
assert read_pair == expected
=======
# @pytest.mark.parametrize(
# ("aligned_segment", "start", "end", "length", "status", "transcript", "block_start", "block_end"),
# [
# pytest.param( # type: ignore[misc]
# "aligned_segment_28584",
# 28584,
# 28733,
# 149,
# None,
# None,
# (28584, 28704),
# (28704, 28733),
# id="28584 - Assignment and Transcript are None",
# ),
# pytest.param(
# "aligned_segment_17416",
# 17416,
# 17805,
# 389,
# "Assigned",
# "Something",
# (17416, 17718),
# (17479, 17805),
# id="17416 - Assignment and Transcript are None",
# marks=pytest.mark.xfail(reasion="Not getting Assigned or Transcript tags for some reason?"),
# ),
# pytest.param(
# "aligned_segment_18029",
# 18029,
# 18385,
# 356,
# "Assigned",
# "something",
# (18029, 18380),
# (18174, 18385),
# id="17416 - Assignment and Transcript are None",
# marks=pytest.mark.xfail(reasion="Not getting Assigned tag for some reason?"),
# ),
# ],
# )
# def test_extract_features_from_read_param(
# aligned_segment: str,
# start: int,
# end: int,
# length: int,
# status: str,
# transcript: str,
# block_start: tuple[int, int],
# block_end: tuple[int, int],
# request: pytest.FixtureRequest,
# ) -> None:
# """Test extract of features from an aligned segment read."""
# segment = isoslam.extract_features_from_read(request.getfixturevalue(aligned_segment))
# assert isinstance(segment, dict)
# assert segment["start"] == start
# assert segment["end"] == end
# assert segment["length"] == length
# assert segment["status"] == status
# assert segment["transcript"] == transcript
# assert segment["block_start"] == block_start
# assert segment["block_end"] == block_end


# @pytest.mark.parametrize(
# ("aligned_segment1", "aligned_segment2", "expected"),
# [
# pytest.param( # type: ignore[misc]
# "aligned_segment_28584",
# "aligned_segment_17416",
# {
# "read1": {
# "start": 28584,
# "end": 28733,
# "length": 149,
# "status": None,
# "transcript": None,
# "block_start": (28584, 28704),
# "block_end": (28704, 28733),
# },
# "read2": {
# "start": 17416,
# "end": 17805,
# "length": 389,
# "status": None,
# "transcript": None,
# jls_extract_var: (17416, 17718),
# "block_end": (17479, 17805),
# },
# },
# id="28584 and 17416 - Assignment and Transcript are None",
# ),
# ],
# )
# def test_extract_features_from_pair(
# aligned_segment1: str,
# aligned_segment2: str,
# expected: dict[str, dict[str, int | None | str | tuple[int, int]]],
# request: pytest.FixtureRequest,
# ) -> None:
# """Test extract of features from a list of pairs."""
# read_pair = isoslam.extract_features_from_pair(
# [
# request.getfixturevalue(aligned_segment1),
# request.getfixturevalue(aligned_segment2),
# ]
# )
# assert isinstance(read_pair, dict)
# assert read_pair == expected
>>>>>>> 3ee6aa7 (feature(isoslam): Adds extract_segment_pair() function)