Skip to content

Commit

Permalink
refactor get lib type
Browse files Browse the repository at this point in the history
  • Loading branch information
balajtimate committed Jan 8, 2024
1 parent 1e992e1 commit 3fbaceb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 8 additions & 6 deletions htsinfer/get_library_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,13 @@ def _align_mates(self):
def _update_relationship(self, concordant, read_counter):
"""Helper function to update relationship based on alignment."""
try:
if (concordant / read_counter) >= self.cutoff:
ratio = concordant / read_counter
except ZeroDivisionError:
self.results.relationship = (
StatesTypeRelationship.not_available
)
else:
if ratio >= self.cutoff:
self.results.relationship = (
StatesTypeRelationship.split_mates
)
Expand All @@ -218,10 +224,6 @@ def _update_relationship(self, concordant, read_counter):
self.results.relationship = (
StatesTypeRelationship.not_mates
)
except ZeroDivisionError:
self.results.relationship = (
StatesTypeRelationship.not_available
)

class AlignedSegment:
"""Placeholder class for mypy "Missing attribute"
Expand Down Expand Up @@ -331,7 +333,7 @@ def evaluate(self) -> None:

if self.seq_id_format is None:
self.result = StatesType.not_available
LOGGER.warning(
LOGGER.debug(
"Could not determine sequence identifier format."
)
else:
Expand Down
1 change: 0 additions & 1 deletion tests/test_get_library_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
FILE_IDS_NOT_MATCH_2,
FILE_TRANSCRIPTS,
FILE_SINGLE,
FILE_UNKNOWN_SEQ_ID,
RaiseError,
SEQ_ID_DUMMY,
SEQ_ID_MATE_1,
Expand Down

0 comments on commit 3fbaceb

Please sign in to comment.