The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

GenOO::Data::File::SAM::Cigar - Role that corresponds to the SAM file CIGAR string

SYNOPSIS

    This role when consumed requires specific attributes and provides
    methods to extract information from the CIGAR string as defined in
    the SAM format specifications.

DESCRIPTION

    The cigar string describes the alignment of a query on a reference sequence.
    This role offers methods that can extract information from the CIGAR string
    directly such as the positions on insertions, the total number of deletions, etc
    
    The CIGAR operations are given in the following table (set `*' if unavailable):
    Op   BAM  Description
    M    0    alignment match (can be a sequence match or mismatch)
    I    1    insertion to the reference
    D    2    deletion from the reference
    N    3    skipped region from the reference
    S    4    soft clipping (clipped sequences present in SEQ)
    H    5    hard clipping (clipped sequences NOT present in SEQ)
    P    6    padding (silent deletion from padded reference)
    =    7    sequence match
    X    8    sequence mismatch
    
    * H can only be present as the first and/or last operation.
    * S may only have H operations between them and the ends of the CIGAR string.
    * For mRNA-to-genome alignment, an N operation represents an intron. For other types of
      alignments, the interpretation of N is not defined.
    * Sum of lengths of the M/I/S/=/X operations shall equal the length of SEQ.

EXAMPLES

    # Get the location information on the reference sequence
    $obj_with_role->deletion_positions_on_query;   # (10, 19, ...)
    $obj_with_role->insertion_count;    # 3
    $obj_with_role->deletion_positions_on_reference;  # (43534511, 43534522, ...)