Package org.biojava.bio.alignment
Class AlignmentPair
- java.lang.Object
-
- org.biojava.utils.AbstractChangeable
-
- org.biojava.bio.symbol.AbstractSymbolList
-
- org.biojava.bio.alignment.SimpleAlignment
-
- org.biojava.bio.alignment.AlignmentPair
-
- All Implemented Interfaces:
Serializable
,Alignment
,SymbolList
,Changeable
public class AlignmentPair extends SimpleAlignment
This class stores the result of an alignment procedure that creates a pairwise alignment of two sequences. Currently, these sequences must have the identical length (this may be changed in the future). A format routine produces a BLAST-like output for the sequences but all necessary information to visualize the alignment are contained in this class.- Author:
- Andreas Dräger
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.biojava.bio.symbol.AbstractSymbolList
AbstractSymbolList.EditScreener, AbstractSymbolList.EditTranslater
-
Nested classes/interfaces inherited from interface org.biojava.bio.alignment.Alignment
Alignment.SymbolListIterator
-
-
Field Summary
-
Fields inherited from interface org.biojava.bio.symbol.SymbolList
EDIT, EMPTY_LIST
-
-
Constructor Summary
Constructors Constructor Description AlignmentPair(Sequence query, Sequence subject, int queryStart, int queryEnd, int subjectStart, int subjectEnd, SubstitutionMatrix subMatrix)
AlignmentPair(Sequence query, Sequence subject, SubstitutionMatrix subMatrix)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AlignmentPair
align(Sequence query, Sequence subject, AlignmentAlgorithm algorithm)
String
formatOutput()
String
formatOutput(int width)
This method provides a BLAST-like formated alignment from the givenString
s, in which the sequence coordinates and the information "Query" or "Sbjct", respectively is added to each line.long
getComputationTime()
int
getNumGapsInQuery()
int
getNumGapsInSubject()
int
getNumIdenticals()
int
getNumSimilars()
float
getPercentGapsQuery()
float
getPercentGapsTarget()
float
getPercentIdentityQuery()
float
getPercentIdentitySubject()
float
getPercentSimilarityQuery()
float
getPercentSimilaritySubject()
GappedSequence
getQuery()
Return the query sequence as a gapped sequence.int
getQueryEnd()
int
getQueryLength()
int
getQueryStart()
GappedSequence
getSubject()
Return the subject sequence as a gapped sequence.int
getSubjectEnd()
int
getSubjectLength()
int
getSubjectStart()
SubstitutionMatrix
getSubstitutionMatrix()
-
Methods inherited from class org.biojava.bio.alignment.SimpleAlignment
finalize, getAlphabet, getLabels, getScore, length, setScore, subAlignment, symbolAt, symbolAt, symbolListForLabel, symbolListIterator
-
Methods inherited from class org.biojava.bio.symbol.AbstractSymbolList
edit, equals, hashCode, iterator, seqString, subList, subStr, toList, toString
-
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
-
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
-
-
-
Constructor Detail
-
AlignmentPair
public AlignmentPair(Sequence query, Sequence subject, int queryStart, int queryEnd, int subjectStart, int subjectEnd, SubstitutionMatrix subMatrix) throws IllegalArgumentException, BioException
- Parameters:
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.subjectStart
- These are all the same for the target. Have a look at these above.subjectEnd
-subMatrix
- the subsitution Matrix used for calculating the alignment- Throws:
IllegalArgumentException
BioException
-
AlignmentPair
public AlignmentPair(Sequence query, Sequence subject, SubstitutionMatrix subMatrix) throws IllegalArgumentException, BioException
- Parameters:
query
-subject
-subMatrix
-- Throws:
IllegalArgumentException
BioException
-
-
Method Detail
-
align
public static AlignmentPair align(Sequence query, Sequence subject, AlignmentAlgorithm algorithm) throws Exception
- Parameters:
query
-subject
-algorithm
-- Returns:
- Throws:
Exception
-
getQueryStart
public int getQueryStart()
- Returns:
- the queryStart
-
getQueryEnd
public int getQueryEnd()
- Returns:
- the queryEnd
-
getSubjectStart
public int getSubjectStart()
- Returns:
- the subjectStart
-
getSubjectEnd
public int getSubjectEnd()
- Returns:
- the subjectEnd
-
getComputationTime
public long getComputationTime()
- Returns:
- the time
-
getNumGapsInQuery
public int getNumGapsInQuery()
- Returns:
- the ngapsq
-
getNumGapsInSubject
public int getNumGapsInSubject()
- Returns:
- the ngapst
-
getNumIdenticals
public int getNumIdenticals()
- Returns:
- the identicals
-
getNumSimilars
public int getNumSimilars()
- Returns:
- the similars
-
getPercentIdentityQuery
public float getPercentIdentityQuery()
- Returns:
-
getPercentIdentitySubject
public float getPercentIdentitySubject()
- Returns:
-
getPercentSimilarityQuery
public float getPercentSimilarityQuery()
- Returns:
-
getPercentSimilaritySubject
public float getPercentSimilaritySubject()
- Returns:
-
getQueryLength
public int getQueryLength()
- Returns:
-
getSubjectLength
public int getSubjectLength()
- Returns:
-
getSubstitutionMatrix
public SubstitutionMatrix getSubstitutionMatrix()
- Returns:
- the subMatrix
-
formatOutput
public String formatOutput() throws BioException
- Returns:
- Throws:
BioException
-
formatOutput
public String formatOutput(int width) throws BioException
This method provides a BLAST-like formated alignment from the givenString
s, in which the sequence coordinates and the information "Query" or "Sbjct", respectively is added to each line. Each line containswidth
sequence characters including the gap symbols plus the meta information. There is one white line between two pairs of sequences.- Parameters:
width
- the number of symbols to be displayed per line.- Returns:
- formated String.
- Throws:
BioException
-
getPercentGapsTarget
public float getPercentGapsTarget()
- Returns:
-
getPercentGapsQuery
public float getPercentGapsQuery()
- Returns:
-
getQuery
public GappedSequence getQuery()
Return the query sequence as a gapped sequence.- Returns:
- the query sequence as a gapped sequence
-
getSubject
public GappedSequence getSubject()
Return the subject sequence as a gapped sequence.- Returns:
- the subject sequence as a gapped sequence
-
-