Skip to content

Commit

Permalink
refactor: helper function for getlibtype
Browse files Browse the repository at this point in the history
  • Loading branch information
balajtimate committed Jan 3, 2024
1 parent 455e983 commit 806420d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions htsinfer/get_library_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def _evaluate_mate_relationship(
self.mapping.evaluate()
self._align_mates()

# pylint: disable=R0912
def _align_mates(self):
"""Decide mate relationship by alignment."""

Expand Down Expand Up @@ -187,6 +186,13 @@ def _align_mates(self):
if self._compare_alignments(mate1[read_counter], reads2):
concordant += 1

self._update_relationship(concordant, read_counter)

samfile1.close()
samfile2.close()

def _update_relationship(self, concordant, read_counter):
"""Helper function to update relationship based on alignment."""
try:
if (concordant / read_counter) >= self.cutoff:
self.results.relationship = (
Expand All @@ -205,9 +211,6 @@ def _align_mates(self):
StatesTypeRelationship.not_available
)

samfile1.close()
samfile2.close()

class AlignedSegment:
"""Placeholder class for mypy "Missing attribute"
error in _compare_alignments(), the actual object used
Expand Down

0 comments on commit 806420d

Please sign in to comment.