org.biojava3.alignment
Class SimpleSequencePair<S extends Sequence<C>,C extends Compound>

java.lang.Object
  extended by org.biojava3.alignment.SimpleProfile<S,C>
      extended by org.biojava3.alignment.SimpleSequencePair<S,C>
Type Parameters:
S - each element of the alignment Profile is of type S
C - each element of an AlignedSequence is a Compound of type C
All Implemented Interfaces:
Iterable<AlignedSequence<S,C>>, Profile<S,C>, SequencePair<S,C>

public class SimpleSequencePair<S extends Sequence<C>,C extends Compound>
extends SimpleProfile<S,C>
implements SequencePair<S,C>

Implements a data structure for the results of pairwise sequence alignment.

Author:
Mark Chapman

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.biojava3.alignment.template.Profile
Profile.StringFormat
 
Field Summary
 
Fields inherited from class org.biojava3.alignment.SimpleProfile
matrix
 
Constructor Summary
SimpleSequencePair(AlignedSequence<S,C> query, AlignedSequence<S,C> target)
          Creates a pair profile for the given already aligned sequences.
SimpleSequencePair(S query, S target, List<AlignedSequence.Step> sx, int xb, int xa, List<AlignedSequence.Step> sy, int yb, int ya)
          Creates a pair profile for the given sequences with a local alignment.
SimpleSequencePair(S query, S target, List<AlignedSequence.Step> sx, List<AlignedSequence.Step> sy)
          Creates a pair profile for the given sequences with a global alignment.
 
Method Summary
 C getCompoundInQueryAt(int alignmentIndex)
          Returns the Compound in query sequence at given column index in alignment.
 C getCompoundInTargetAt(int alignmentIndex)
          Returns the Compound in target sequence at given column index in alignment.
 int getIndexInQueryAt(int alignmentIndex)
          Returns the query index corresponding to a given alignment column.
 int getIndexInQueryForTargetAt(int targetIndex)
          Returns the query index corresponding to a given target index.
 int getIndexInTargetAt(int alignmentIndex)
          Returns the target index corresponding to a given alignment column.
 int getIndexInTargetForQueryAt(int queryIndex)
          Returns the target index corresponding to a given query index.
 int getNumIdenticals()
          Returns the number of indices for which both the query and target sequences have an identical Compound.
 int getNumSimilars()
          Returns the number of indices for which both the query and target sequences have a similar Compound.
 AlignedSequence<S,C> getQuery()
          Returns the first AlignedSequence of the pair.
 AlignedSequence<S,C> getTarget()
          Returns the second AlignedSequence of the pair.
 
Methods inherited from class org.biojava3.alignment.SimpleProfile
getAlignedSequence, getAlignedSequence, getAlignedSequences, getAlignedSequences, getAlignedSequences, getCompoundAt, getCompoundAt, getCompoundCountsAt, getCompoundCountsAt, getCompoundsAt, getCompoundSet, getCompoundWeightsAt, getCompoundWeightsAt, getIndexOf, getIndicesAt, getLastIndexOf, getLength, getOriginalSequences, getSize, getSubProfile, hasGap, isCircular, iterator, toString, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.biojava3.alignment.template.Profile
getAlignedSequence, getAlignedSequence, getAlignedSequences, getAlignedSequences, getAlignedSequences, getCompoundAt, getCompoundAt, getCompoundCountsAt, getCompoundCountsAt, getCompoundsAt, getCompoundSet, getCompoundWeightsAt, getCompoundWeightsAt, getIndexOf, getIndicesAt, getLastIndexOf, getLength, getOriginalSequences, getSize, getSubProfile, hasGap, isCircular, toString, toString, toString
 
Methods inherited from interface java.lang.Iterable
iterator
 

Constructor Detail

SimpleSequencePair

public SimpleSequencePair(AlignedSequence<S,C> query,
                          AlignedSequence<S,C> target)
Creates a pair profile for the given already aligned sequences.

Parameters:
query - the first sequence of the pair
target - the second sequence of the pair
Throws:
IllegalArgumentException - if sequences differ in size

SimpleSequencePair

public SimpleSequencePair(S query,
                          S target,
                          List<AlignedSequence.Step> sx,
                          List<AlignedSequence.Step> sy)
Creates a pair profile for the given sequences with a global alignment.

Parameters:
query - the first sequence of the pair
target - the second sequence of the pair
sx - lists whether the query sequence aligns a Compound or gap at each index of the alignment
sy - lists whether the target sequence aligns a Compound or gap at each index of the alignment
Throws:
IllegalArgumentException - if alignments differ in size or given sequences do not fit in alignments

SimpleSequencePair

public SimpleSequencePair(S query,
                          S target,
                          List<AlignedSequence.Step> sx,
                          int xb,
                          int xa,
                          List<AlignedSequence.Step> sy,
                          int yb,
                          int ya)
Creates a pair profile for the given sequences with a local alignment.

Parameters:
query - the first sequence of the pair
target - the second sequence of the pair
sx - lists whether the query sequence aligns a Compound or gap at each index of the alignment
xb - number of Compounds skipped in the query sequence before the aligned region
xa - number of Compounds skipped in the query sequence after the aligned region
sy - lists whether the target sequence aligns a Compound or gap at each index of the alignment
yb - number of Compounds skipped in the target sequence before the aligned region
ya - number of Compounds skipped in the target sequence after the aligned region
Throws:
IllegalArgumentException - if alignments differ in size or given sequences do not fit in alignments
Method Detail

getCompoundInQueryAt

public C getCompoundInQueryAt(int alignmentIndex)
Description copied from interface: SequencePair
Returns the Compound in query sequence at given column index in alignment.

Specified by:
getCompoundInQueryAt in interface SequencePair<S extends Sequence<C>,C extends Compound>
Parameters:
alignmentIndex - column index in alignment
Returns:
the query sequence element

getCompoundInTargetAt

public C getCompoundInTargetAt(int alignmentIndex)
Description copied from interface: SequencePair
Returns the Compound in target sequence at given column index in alignment.

Specified by:
getCompoundInTargetAt in interface SequencePair<S extends Sequence<C>,C extends Compound>
Parameters:
alignmentIndex - column index in alignment
Returns:
the target sequence element

getIndexInQueryAt

public int getIndexInQueryAt(int alignmentIndex)
Description copied from interface: SequencePair
Returns the query index corresponding to a given alignment column.

Specified by:
getIndexInQueryAt in interface SequencePair<S extends Sequence<C>,C extends Compound>
Parameters:
alignmentIndex - column index in alignment
Returns:
index in query Sequence

getIndexInQueryForTargetAt

public int getIndexInQueryForTargetAt(int targetIndex)
Description copied from interface: SequencePair
Returns the query index corresponding to a given target index.

Specified by:
getIndexInQueryForTargetAt in interface SequencePair<S extends Sequence<C>,C extends Compound>
Parameters:
targetIndex - index in target Sequence
Returns:
index in query Sequence

getIndexInTargetAt

public int getIndexInTargetAt(int alignmentIndex)
Description copied from interface: SequencePair
Returns the target index corresponding to a given alignment column.

Specified by:
getIndexInTargetAt in interface SequencePair<S extends Sequence<C>,C extends Compound>
Parameters:
alignmentIndex - column index in alignment
Returns:
index in target Sequence

getIndexInTargetForQueryAt

public int getIndexInTargetForQueryAt(int queryIndex)
Description copied from interface: SequencePair
Returns the target index corresponding to a given query index.

Specified by:
getIndexInTargetForQueryAt in interface SequencePair<S extends Sequence<C>,C extends Compound>
Parameters:
queryIndex - index in query Sequence
Returns:
index in target Sequence

getNumIdenticals

public int getNumIdenticals()
Description copied from interface: SequencePair
Returns the number of indices for which both the query and target sequences have an identical Compound.

Specified by:
getNumIdenticals in interface SequencePair<S extends Sequence<C>,C extends Compound>
Returns:
the number of identical indices

getNumSimilars

public int getNumSimilars()
Description copied from interface: SequencePair
Returns the number of indices for which both the query and target sequences have a similar Compound.

Specified by:
getNumSimilars in interface SequencePair<S extends Sequence<C>,C extends Compound>
Returns:
the number of similar indices

getQuery

public AlignedSequence<S,C> getQuery()
Description copied from interface: SequencePair
Returns the first AlignedSequence of the pair.

Specified by:
getQuery in interface SequencePair<S extends Sequence<C>,C extends Compound>
Returns:
the first AlignedSequence of the pair

getTarget

public AlignedSequence<S,C> getTarget()
Description copied from interface: SequencePair
Returns the second AlignedSequence of the pair.

Specified by:
getTarget in interface SequencePair<S extends Sequence<C>,C extends Compound>
Returns:
the second AlignedSequence of the pair