## org.biojava.bio.alignment
Class SequenceAlignment

    java.lang.Object
      org.biojava.bio.alignment.SequenceAlignment

Direct Known Subclasses:
  NeedlemanWunsch

    public abstract class SequenceAlignment

extends Object

This Interface provides methods for the alignment of bio-sequences.

Author:
  Andreas Dräger <andreas.draeger@uni-tuebingen.de>, Mark Schreiber

Constructor Summary
`SequenceAlignment()`

Method Summary
`abstract List` `alignAll(SequenceIterator source, SequenceDB subjectDB)`

`static StringBuffer`

`formatOutput(String queryName, String targetName, String[] align, String path, int queryStart, int queryEnd, long queryLength, int targetStart, int targetEnd, long targetLength, int editdistance, long time)`
This method provides a BLAST-like formated alignment from the given `String`s, in which the sequence coordinates and the information "Query" or "Target", respectively is added to each line.

`abstract Alignment` `getAlignment(SymbolList query, SymbolList subject)` This method also performs a sequence alignment of the two given sequences but it returns an Alignment object instead of the score.
`abstract String` `getAlignmentString()`
`abstract int` `pairwiseAlignment(SymbolList query, SymbolList subject)` Performs a pairwise sequence alignment of the two given sequences.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SequenceAlignment

    public SequenceAlignment()

Method Detail

### getAlignmentString

    public abstract String getAlignmentString()
                                       throws Exception

  Returns:
    a string representation of the alignment
  Throws:
    `BioException`
    `Exception`

### alignAll

    public abstract List alignAll(SequenceIterator source,
                                  SequenceDB subjectDB)
                           throws Exception

  Parameters:
    `source` - a SequenceIterator containing a set of sequences to be aligned with
    `subjectDB` - the SequenceDB containing another set of sequences.
  Returns:
    a list containing the results of all single alignments performed by this method.
  Throws:
    `NoSuchElementException`
    `Exception`

### pairwiseAlignment

    public abstract int pairwiseAlignment(SymbolList query,
                                          SymbolList subject)
                                   throws Exception

  Performs a pairwise sequence alignment of the two given sequences.

  Parameters:
    `query` -
    `subject` -
  Returns:
    score of the alignment or the distance.
  Throws:
    `Exception`

### getAlignment

    public abstract Alignment getAlignment(SymbolList query,
                                           SymbolList subject)
                                    throws Exception

  This method also performs a sequence alignment of the two given sequences but it returns an Alignment object instead of the score.

  Parameters:
    `query` -
    `subject` -
  Returns:
    Alignment
  Throws:
    `Exception`

### formatOutput

    public static StringBuffer formatOutput(String queryName,
                                            String targetName,
                                            String[] align,
                                            String path,
                                            int queryStart,
                                            int queryEnd,
                                            long queryLength,
                                            int targetStart,
                                            int targetEnd,
                                            long targetLength,
                                            int editdistance,
                                            long time)

  This method provides a BLAST-like formated alignment from the given `String`s, in which the sequence coordinates and the information "Query" or "Target", respectively is added to each line. Each line contains 60 sequence characters including the gap symbols plus the meta information. There is one white line between two pairs of sequences.

  Parameters:
    `queryName` - name of the query sequence
    `targetName` - name of the target sequence
    `align` - a `String`-array, where the index 0 is the query sequence and index 1 the target sequence (for instance `new String[] {myQuerySequence.seqString(), myTargetSequence.seqString()}`)
    `path` - the "path", that means a String containing white spaces and pipe ("|") symbols, which makes matches visible. The two strings in `align` have to have the same length and also the same length than this `path`.
    `queryStart` - the start position in the query, where the alignment starts. For example zero for normal Needleman-Wunsch-Alignments.
    `queryEnd` - the end position, that means the sequence coordinate, which is the last symbol of the query sequence. Counting starts at zero!
    `queryLength` - The length of the query sequence without gaps.
    `targetStart` - These are all the same for the target. Have a look at these above.
    `targetEnd` -
    `targetLength` -
    `editdistance` -
    `time` - The time in milliseconds, which was needed to generate the alignment.
  Returns:
    formated String.