Skip to content

Commit

Permalink
= ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
yfarjoun committed Jun 26, 2024
1 parent 35eb9e1 commit 0353635
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion fgpyo/sam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ def length_on_target(self) -> int:
"""Returns the length of the alignment on the target sequence."""
return sum([elem.length_on_target for elem in self.elements])

def __getitem__(self, index:int|slice) -> CigarElement|Tuple[CigarElement]:
def __getitem__(self, index: int | slice) -> CigarElement | Tuple[CigarElement]:
"""Returns the cigar element indexed by index
Arguments:
Expand All @@ -579,6 +579,7 @@ def __len__(self) -> int:
"""Returns the number of elements in the cigar"""
return len(self.elements)


@attr.s(frozen=True, auto_attribs=True)
class SupplementaryAlignment:
"""Stores a supplementary alignment record produced by BWA and stored in the SA SAM tag.
Expand Down
3 changes: 2 additions & 1 deletion fgpyo/sam/tests/test_cigar.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

cigar = Cigar.from_cigarstring("1M4D45N37X23I11=")


def test_cigar_length_exists():
assert len(cigar) == len(cigar.elements)


@pytest.mark.parametrize("index", range(-len(cigar),len(cigar)))
@pytest.mark.parametrize("index", range(-len(cigar), len(cigar)))
def test_direct_access(index: int):
assert cigar[index] == cigar.elements[index]
assert cigar[index:] == cigar.elements[index:]
Expand Down

0 comments on commit 0353635

Please sign in to comment.