public class Sequence
extends java.lang.Object
implements java.lang.Cloneable
Constructor and Description |
---|
Sequence()
Constructs a new Sequence object
|
Sequence(java.lang.String name)
Constructs a new Sequence object of given name
|
Modifier and Type | Method and Description |
---|---|
void |
addGap()
Adds a new gap to the sequence
|
void |
addPosition(int index,
ResidueType type)
Adds a new position of given index and residue type to the sequence
|
void |
addPosition(int index,
ResidueType type,
java.lang.String annotation)
Adds a new position of given index, residue type and annotation to the sequence
|
void |
addPosition(ResidueType type,
java.lang.String annotation)
Adds a new position of given residue type and annotation to the sequence
|
void |
addPosition(SequencePosition pos)
Adds a new position to the sequence
|
void |
addPositionsFromString(java.lang.String str)
Adds a series of new positions to the sequence taken from a String object
|
java.lang.Object |
clone()
Returns an identical Sequence object
|
Sequence |
concat(Sequence other)
Returns the given sequence concatenated to this sequence
|
boolean |
containsSubSequence(Sequence subsequence)
Returns true if the given subsequence is contained in this sequence
|
boolean |
equals(java.lang.Object other)
Returns true if the two sequences are identical
|
java.lang.String |
getAnnotationOfPosition(int i)
Returns the annotation of sequence position #i
|
java.lang.String |
getAnnotationOfPositionOfIndex(int index)
Returns the annotation of sequence position of given index
|
java.util.ArrayList<SequencePosition> |
getAsArrayList()
Returns sequence as an ArrayList object
|
int |
getIndexOfPosition(int i)
Returns the index of sequence position #i
|
java.lang.String |
getName()
Returns the name of sequence
|
SequencePosition |
getPosition(int i)
Returns sequence position #i
|
SequencePosition |
getPositionByIndex(int index)
Returns sequence position of given index
|
ResidueType |
getResidueTypeOfPosition(int i)
Returns the residue type of sequence position #i
|
ResidueType |
getResidueTypeOfPositionOfIndex(int index)
Returns the residue type of sequence position of given index
|
Sequence |
getReverse()
Returns the reverse sequence
|
int |
getSequenceLength()
Returns the length of sequence (gaps excluded)
|
int |
getSequenceLengthWithGaps()
Returns the length of sequence (gaps included)
|
Sequence |
getSubSequence(int begin,
int end)
Returns subsequence beginning at sequence position #begin and ending at sequence position #end
|
Sequence |
getSubSequenceFrom(int begin)
Returns subsequence beginning at sequence position #begin
|
Sequence |
getSubSequenceTo(int end)
Returns subsequence ending at sequence position #end
|
int |
hashCode()
Returns hash code
|
void |
insertGap(int i)
Inserts a new gap to position #i
|
void |
insertPosition(int i,
int index,
ResidueType type)
Inserts sequence position of given index and residue type to position #i
Note that you may have to re-index sequence positions after using this method
|
void |
insertPosition(int i,
int index,
ResidueType type,
java.lang.String annotation)
Inserts sequence position of given index, residue type and annotation to position #i
Note that you may have to re-index sequence positions after using this method
|
void |
insertPosition(int i,
ResidueType type,
java.lang.String annotation)
Inserts sequence position of given residue type and annotation to position #i
Note that you may have to re-index sequence positions after using this method
|
void |
insertPosition(int i,
SequencePosition pos)
Inserts the given sequence position to position #i
Note that you may have to re-index sequence positions after using this method
|
boolean |
isPositionAGap(int i)
Returns true if sequence position #i is a gap
|
void |
reIndexPositions()
Reindexes all positions in the sequence starting from 1
|
void |
reIndexPositions(int startindex)
Reindexes all positions in the sequence starting from a given index
|
void |
removeGaps()
Removes all gaps from the sequence
|
void |
removePosition(int i)
Removes sequence position #i
|
void |
removePosition(SequencePosition pos)
Removes the given sequence position
|
void |
removePositionByIndex(int index)
Removes the sequence position of given index
|
void |
setName(java.lang.String name)
Sets the name of sequence
|
void |
setPosition(int i,
int index,
ResidueType type)
Replaces position #i with the a sequence position of given index and residue type
|
void |
setPosition(int i,
int index,
ResidueType type,
java.lang.String annotation)
Replaces position #i with the a sequence position of given index, residue type and annotation
|
void |
setPosition(int i,
ResidueType type,
java.lang.String annotation)
Replaces position #i with the a sequence position of given residue type and annotation
|
void |
setPosition(int i,
SequencePosition pos)
Replaces position #i with the given sequence position
|
void |
setPositionByIndex(int index,
ResidueType type)
Replaces the position of given index with the a sequence position of given residue type
|
void |
setPositionByIndex(int index,
ResidueType type,
java.lang.String annotation)
Replaces the position of given index with the a sequence position of given residue type and annotation
|
java.lang.String |
toString()
Returns the String representation of sequence
|
java.lang.String |
toString1Letter()
Returns a String representation in which each residue is represented by its 1 letter code
|
java.lang.String |
toString1Letter(int lengthOfLine)
Returns a String representation in which each residue is represented by its 1 letter code
and the string is split to lines of the given length
|
java.lang.String |
toString3Letter()
Returns a String representation in which each residue is represented by its 3 letter code
|
java.lang.String |
toString3Letter(int lengthOfLine)
Returns a String representation in which each residue is represented by its 3 letter code
and the string is split to lines of the given length
|
java.lang.String |
toStringInfo()
Returns summary information about the sequence
|
public Sequence()
public Sequence(java.lang.String name)
public java.lang.String getName()
public void setName(java.lang.String name)
name
- name of sequencepublic java.util.ArrayList<SequencePosition> getAsArrayList()
public int getSequenceLength()
public int getSequenceLengthWithGaps()
public SequencePosition getPosition(int i)
public SequencePosition getPositionByIndex(int index)
index
- index of positionpublic int getIndexOfPosition(int i)
public ResidueType getResidueTypeOfPosition(int i)
public java.lang.String getAnnotationOfPosition(int i)
public ResidueType getResidueTypeOfPositionOfIndex(int index)
index
- index of positionpublic java.lang.String getAnnotationOfPositionOfIndex(int index)
index
- index of positionpublic void addPosition(SequencePosition pos)
pos
- new sequence positionpublic void addPosition(ResidueType type, java.lang.String annotation)
type
- residue type of new positionannotation
- annotation of new positionpublic void addPosition(int index, ResidueType type)
index
- index of new positiontype
- residue type of new positionpublic void addPosition(int index, ResidueType type, java.lang.String annotation)
index
- index of new positiontype
- residue type of new positionannotation
- annotation of new positionpublic void addPositionsFromString(java.lang.String str)
str
- String object encoding a series of sequence positionspublic void addGap()
public void insertGap(int i)
public void setPosition(int i, SequencePosition pos)
pos
- new sequence positionpublic void setPosition(int i, ResidueType type, java.lang.String annotation)
type
- residue type of new sequence positionannotation
- annotation of new sequence positionpublic void setPosition(int i, int index, ResidueType type)
index
- index of new sequence positiontype
- residue type of new sequence positionpublic void setPosition(int i, int index, ResidueType type, java.lang.String annotation)
index
- index of new sequence positiontype
- residue type of new sequence positionannotation
- annotation of new sequence positionpublic void setPositionByIndex(int index, ResidueType type, java.lang.String annotation)
index
- index of sequence positiontype
- residue type of new sequence positionannotation
- annotation of new sequence positionpublic void setPositionByIndex(int index, ResidueType type)
index
- index of sequence positiontype
- residue type of new sequence positionpublic void removePosition(int i)
public void removePosition(SequencePosition pos)
pos
- sequence position to be removedpublic void removePositionByIndex(int index)
index
- index of sequence position to be removedpublic void removeGaps()
public void reIndexPositions(int startindex)
startindex
- index of position #0public void reIndexPositions()
public void insertPosition(int i, SequencePosition pos)
pos
- new sequence positionpublic void insertPosition(int i, ResidueType type, java.lang.String annotation)
type
- residue type of new sequence positionannotation
- annotation of new sequence positionpublic void insertPosition(int i, int index, ResidueType type)
index
- index of new sequence positiontype
- residue type of new sequence positionpublic void insertPosition(int i, int index, ResidueType type, java.lang.String annotation)
index
- index of new sequence positiontype
- residue type of new sequence positionannotation
- annotation of new sequence positionpublic boolean isPositionAGap(int i)
public Sequence getSubSequence(int begin, int end)
begin
- start position of subsequenceend
- end position of subsequencepublic Sequence getSubSequenceFrom(int begin)
begin
- start position of subsequencepublic Sequence getSubSequenceTo(int end)
end
- end position of subsequencepublic Sequence getReverse()
public Sequence concat(Sequence other)
other
- second sequencepublic boolean containsSubSequence(Sequence subsequence)
subsequence
- subsequence to search forpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString1Letter()
public java.lang.String toString3Letter()
public java.lang.String toString1Letter(int lengthOfLine)
lengthOfLine
- max length of a line in the stringpublic java.lang.String toString3Letter(int lengthOfLine)
lengthOfLine
- max length of a line (number of residues) in the stringpublic java.lang.String toStringInfo()
public java.lang.Object clone()
clone
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- the other sequencepublic int hashCode()
hashCode
in class java.lang.Object