Skip to main content
`Ctrl`+`K`

# skbio.alignment.AlignmentStructure

class skbio.alignment.AlignmentStructure

  Wraps the result of an alignment c struct so it is accessible to Python

  Notes

  cigar may be empty depending on parameters used.

  target_begin and query_begin may be -1 depending on parameters used.

  Developer note: read_sequence is an alias for query_sequence used by ssw.c as is reference_sequence for target_sequence

  Attributes

  `aligned_query_sequence` | Returns the query sequence aligned by the cigar
  `aligned_target_sequence` | Returns the target sequence aligned by the cigar
  `cigar` | Cigar formatted string for the optimal alignment
  `optimal_alignment_score` | Optimal alignment score
  `query_begin` | Returns the character index at which the query sequence begins
  `query_end` | Character index at where query sequence ends
  `query_sequence` | Query sequence
  `suboptimal_alignment_score` | Suboptimal alignment score
  `target_begin` | Character index where the target's alignment begins
  `target_end_optimal` | Character index where the target's optimal alignment ends
  `target_end_suboptimal` | Character index where the target's suboptimal alignment ends
  `target_sequence` | Target sequence

  Methods

  `is_zero_based`() | Returns True if alignment inidices start at 0 else False
  `set_zero_based`(is_zero_based) | Set the aligment indices to start at 0 if True else 1 if False

  Special methods

  `__getitem__`(key, /) | Return self[key].
  `__setstate__` |
  `__str__`(/) | Return str(self).

  Special methods (inherited)

  `__eq__`(value, /) | Return self==value.
  `__ge__`(value, /) | Return self>=value.
  `__getstate__`(/) | Helper for pickle.
  `__gt__`(value, /) | Return self>value.
  `__hash__`(/) | Return hash(self).
  `__le__`(value, /) | Return self<=value.
  `__lt__`(value, /) | Return self<value.
  `__ne__`(value, /) | Return self!=value.

  Details

  aligned_query_sequence

    Returns the query sequence aligned by the cigar

    Returns:
      str

        Aligned query sequence

    Notes

    This will return None if suppress_sequences was True when this object was created

  aligned_target_sequence

    Returns the target sequence aligned by the cigar

    Returns:
      str

        Aligned target sequence

    Notes

    This will return None if suppress_sequences was True when this object was created

  cigar

    Cigar formatted string for the optimal alignment

    Returns:
      str

        The cigar string of the optimal alignment

    Notes

    The cigar string format is described in [1] and [2].

    If there is no cigar or optimal alignment, this will return an empty string

    References

    [1]

    http://genome.sph.umich.edu/wiki/SAM

    [2]

    http://samtools.github.io/hts-specs/SAMv1.pdf

  optimal_alignment_score

    Optimal alignment score

    Returns:
      int

        The optimal alignment score

  query_begin

    Returns the character index at which the query sequence begins

    Returns:
      int

        The character index of the query sequence beginning

    Notes

    The result is a 0-based index by default

  query_end

    Character index at where query sequence ends

    Returns:
      int

        The character index of the query sequence ending

    Notes

    The result is a 0-based index by default

  query_sequence

    Query sequence

    Returns:
      str

        The query sequence

  suboptimal_alignment_score

    Suboptimal alignment score

    Returns:
      int

        The suboptimal alignment score

  target_begin

    Character index where the target’s alignment begins

    Returns:
      int

        The character index of the target sequence’s alignment’s beginning

    Notes

    The result is a 0-based index by default

  target_end_optimal

    Character index where the target’s optimal alignment ends

    Returns:
      int
        The character index of the target sequence’s optimal alignment’s

          end

    Notes

    The result is a 0-based index by default

  target_end_suboptimal

    Character index where the target’s suboptimal alignment ends

    Returns:
      int
        The character index of the target sequence’s suboptimal alignment’s

          end

    Notes

    The result is a 0-based index by default

  target_sequence

    Target sequence

    Returns:
      str

        The target sequence

  __getitem__(key, /)

    Return self[key].

  __setstate__()
  __str__(/)

    Return str(self).