diff --git a/fgpyo/sam/__init__.py b/fgpyo/sam/__init__.py index 4c04fa8..81cebc6 100644 --- a/fgpyo/sam/__init__.py +++ b/fgpyo/sam/__init__.py @@ -1196,6 +1196,7 @@ class AuxAlignment(ABC, DataclassInstance): Args: reference_name: The reference sequence name. reference_start: The 0-based start position of the alignment. + is_forward: If the alignment is in the forward orientation or not. cigar: The Cigar sequence representing the alignment. mapq: The aligner-reported probability of an incorrect mapping, if available. edit_distance: The number of mismatches between the query and the target, if available. @@ -1369,13 +1370,15 @@ def many_sam_from_primary(cls, primary: AlignedSegment) -> Iterator[AlignedSegme # Finally, set a tag that marks this alignment as a reconstituted auxiliary alignment. aux.set_tag("rh", True) - yield hit.after_sam_from_primary(aux=aux, primary=primary) + yield hit._after_sam_from_primary(aux=aux, primary=primary) - def after_sam_from_primary( + def _after_sam_from_primary( self, aux: AlignedSegment, primary: AlignedSegment ) -> AlignedSegment: """Post-processes the reconstituted auxiliary alignment specific to this implementation. + Override this function to provide implementation-specific behavior. + Args: aux: The reconstituted auxiliary alignment. primary: The primary alignment that reconstituted the auxiliary alignment. @@ -1429,6 +1432,7 @@ class SecondaryAlignment(AuxAlignment): Args: reference_name: The reference sequence name. reference_start: The 0-based start position of the alignment. + is_forward: If the alignment is in the forward orientation or not. cigar: The Cigar sequence representing the alignment. mapq: The aligner-reported probability of an incorrect mapping, if available. edit_distance: The number of mismatches between the query and the target, if available. @@ -1487,7 +1491,7 @@ def from_tag_item(cls, item: str) -> Self: ) @override - def after_sam_from_primary( + def _after_sam_from_primary( self, aux: AlignedSegment, primary: AlignedSegment ) -> AlignedSegment: """Post-processes the reconstituted auxiliary alignment as a secondary alignment. @@ -1499,7 +1503,7 @@ def after_sam_from_primary( Raises: ValueError: If the primary record is a secondary or supplementary alignment. """ - aux = super().after_sam_from_primary(aux=aux, primary=primary) + aux = super()._after_sam_from_primary(aux=aux, primary=primary) aux.is_secondary = True aux.is_supplementary = False aux.is_proper_pair = False @@ -1525,6 +1529,7 @@ class SupplementaryAlignment(AuxAlignment): Args: reference_name: The reference sequence name. reference_start: The 0-based start position of the alignment. + is_forward: If the alignment is in the forward orientation or not. cigar: The Cigar sequence representing the alignment. mapq: The aligner-reported probability of an incorrect mapping, if available. edit_distance: The number of mismatches between the query and the target, if available. @@ -1571,7 +1576,7 @@ def from_tag_item(cls, item: str) -> Self: ) @override - def after_sam_from_primary( + def _after_sam_from_primary( self, aux: AlignedSegment, primary: AlignedSegment ) -> AlignedSegment: """Post-processes the reconstituted auxiliary alignment as a supplementary alignment. @@ -1583,7 +1588,7 @@ def after_sam_from_primary( Raises: ValueError: If the primary record is a secondary or supplementary alignment. """ - aux = super().after_sam_from_primary(aux=aux, primary=primary) + aux = super()._after_sam_from_primary(aux=aux, primary=primary) aux.is_secondary = False aux.is_supplementary = True aux.is_proper_pair = primary.is_proper_pair