Package org.biojava.nbio.core.alignment
Class SimpleSequencePair<S extends Sequence<C>,C extends Compound>
- java.lang.Object
-
- org.biojava.nbio.core.alignment.SimpleProfile<S,C>
-
- org.biojava.nbio.core.alignment.SimpleSequencePair<S,C>
-
- Type Parameters:
S- each element of the alignmentProfileis of type SC- each element of anAlignedSequenceis aCompoundof type C
- All Implemented Interfaces:
Serializable,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, Paolo Pavan
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.biojava.nbio.core.alignment.template.Profile
Profile.StringFormat
-
-
Field Summary
-
Fields inherited from class org.biojava.nbio.core.alignment.SimpleProfile
matrix
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CgetCompoundInQueryAt(int alignmentIndex)Returns theCompoundin query sequence at given column index in alignment.CgetCompoundInTargetAt(int alignmentIndex)Returns theCompoundin target sequence at given column index in alignment.intgetIndexInQueryAt(int alignmentIndex)Returns the query index corresponding to a given alignment column.intgetIndexInQueryForTargetAt(int targetIndex)Returns the query index corresponding to a given target index.intgetIndexInTargetAt(int alignmentIndex)Returns the target index corresponding to a given alignment column.intgetIndexInTargetForQueryAt(int queryIndex)Returns the target index corresponding to a given query index.intgetNumIdenticals()Returns the number of indices for which both the query and target sequences have an identicalCompound.intgetNumSimilars()Returns the number of indices for which both the query and target sequences have a similarCompound.doublegetPercentageOfIdentity(boolean countGaps)Returns the percentage of identity between the two sequences in the alignment as a fraction between 0 and 1.AlignedSequence<S,C>getQuery()Returns the firstAlignedSequenceof the pair.AlignedSequence<S,C>getTarget()Returns the secondAlignedSequenceof the pair.-
Methods inherited from class org.biojava.nbio.core.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 java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface org.biojava.nbio.core.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
-
-
-
-
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 pairtarget- 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 pairtarget- the second sequence of the pairsx- lists whether the query sequence aligns aCompoundor gap at each index of the alignmentsy- lists whether the target sequence aligns aCompoundor 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 pairtarget- the second sequence of the pairsx- lists whether the query sequence aligns aCompoundor gap at each index of the alignmentxb- number ofCompounds skipped in the query sequence before the aligned regionxa- number ofCompounds skipped in the query sequence after the aligned regionsy- lists whether the target sequence aligns aCompoundor gap at each index of the alignmentyb- number ofCompounds skipped in the target sequence before the aligned regionya- number ofCompounds 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:SequencePairReturns theCompoundin query sequence at given column index in alignment.- Specified by:
getCompoundInQueryAtin interfaceSequencePair<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:SequencePairReturns theCompoundin target sequence at given column index in alignment.- Specified by:
getCompoundInTargetAtin interfaceSequencePair<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:SequencePairReturns the query index corresponding to a given alignment column.- Specified by:
getIndexInQueryAtin interfaceSequencePair<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:SequencePairReturns the query index corresponding to a given target index.- Specified by:
getIndexInQueryForTargetAtin interfaceSequencePair<S extends Sequence<C>,C extends Compound>- Parameters:
targetIndex- index in targetSequence- Returns:
- index in query
Sequence
-
getIndexInTargetAt
public int getIndexInTargetAt(int alignmentIndex)
Description copied from interface:SequencePairReturns the target index corresponding to a given alignment column.- Specified by:
getIndexInTargetAtin interfaceSequencePair<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:SequencePairReturns the target index corresponding to a given query index.- Specified by:
getIndexInTargetForQueryAtin interfaceSequencePair<S extends Sequence<C>,C extends Compound>- Parameters:
queryIndex- index in querySequence- Returns:
- index in target
Sequence
-
getNumIdenticals
public int getNumIdenticals()
Description copied from interface:SequencePairReturns the number of indices for which both the query and target sequences have an identicalCompound.- Specified by:
getNumIdenticalsin interfaceSequencePair<S extends Sequence<C>,C extends Compound>- Returns:
- the number of identical indices
-
getNumSimilars
public int getNumSimilars()
Description copied from interface:SequencePairReturns the number of indices for which both the query and target sequences have a similarCompound.- Specified by:
getNumSimilarsin interfaceSequencePair<S extends Sequence<C>,C extends Compound>- Returns:
- the number of similar indices
-
getQuery
public AlignedSequence<S,C> getQuery()
Description copied from interface:SequencePairReturns the firstAlignedSequenceof the pair.- Specified by:
getQueryin interfaceSequencePair<S extends Sequence<C>,C extends Compound>- Returns:
- the first
AlignedSequenceof the pair
-
getTarget
public AlignedSequence<S,C> getTarget()
Description copied from interface:SequencePairReturns the secondAlignedSequenceof the pair.- Specified by:
getTargetin interfaceSequencePair<S extends Sequence<C>,C extends Compound>- Returns:
- the second
AlignedSequenceof the pair
-
getPercentageOfIdentity
public double getPercentageOfIdentity(boolean countGaps)
Returns the percentage of identity between the two sequences in the alignment as a fraction between 0 and 1.- Specified by:
getPercentageOfIdentityin interfaceSequencePair<S extends Sequence<C>,C extends Compound>- Parameters:
countGaps- If true, gap positions are counted as mismatches, i.e., the percentage is normalized by the alignment length. If false, gap positions are not counted, i.e. the percentage is normalized by the number of aligned residue pairs. See May (2004). "Percent sequence identity: the need to be explicit."- Returns:
- the percentage of sequence identity as a fraction in [0,1]
-
-