diff --git a/htsinfer/get_library_type.py b/htsinfer/get_library_type.py index cc4bb1e..825a66a 100644 --- a/htsinfer/get_library_type.py +++ b/htsinfer/get_library_type.py @@ -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.""" @@ -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 = ( @@ -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