Skip to content

Commit

Permalink
chore: suit review from @nh13
Browse files Browse the repository at this point in the history
  • Loading branch information
clintval committed Nov 28, 2023
1 parent 312a458 commit dc8bef9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fgpyo/fastx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __enter__(self) -> "FastxZipped":
@staticmethod
def _name_minus_ordinal(name: str) -> str:
"""Return the name of the FASTX record minus its ordinal suffix (e.g. "/1" or "/2")."""
return name[:len(name) - 2] if len(name) >= 2 and name[-2] == "/" else name
return name[: len(name) - 2] if len(name) >= 2 and name[-2] == "/" else name

def __next__(self) -> Tuple[FastxRecord, ...]:
"""Return the next set of FASTX records from the zipped FASTX files."""
Expand All @@ -73,7 +73,9 @@ def __next__(self) -> Tuple[FastxRecord, ...]:
sequence_name: str = [record.name for record in records if record is not None][0]
raise ValueError(
f"One or more of the FASTX files is truncated for sequence {sequence_name}:\n\t"
+ "\n\t".join(str(self._paths[i]) for i, record in enumerate(records) if record is None)
+ "\n\t".join(
str(self._paths[i]) for i, record in enumerate(records) if record is None
)
)
else:
records = cast(Tuple[FastxRecord, ...], records)
Expand Down
1 change: 1 addition & 0 deletions fgpyo/fastx/tests/test_fastx_zipped.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def tests_fastx_zipped_handles_sequence_names_with_suffixes(tmp_path: Path) -> N

assert all(fastx.closed for fastx in context_manager._fastx)


def tests_fastx_zipped__name_minus_ordinal_works_with_r1_and_r2_ordinals() -> None:
assert FastxZipped._name_minus_ordinal("seq1") == "seq1"
assert FastxZipped._name_minus_ordinal("seq1/1") == "seq1"
Expand Down

0 comments on commit dc8bef9

Please sign in to comment.