Package jgromacs.data
Class Sequence
- java.lang.Object
-
- jgromacs.data.Sequence
-
- All Implemented Interfaces:
java.lang.Cloneable
public class Sequence extends java.lang.Object implements java.lang.CloneableObjects of this class represent a single amino acid sequence
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGap()Adds a new gap to the sequencevoidaddPosition(int index, ResidueType type)Adds a new position of given index and residue type to the sequencevoidaddPosition(int index, ResidueType type, java.lang.String annotation)Adds a new position of given index, residue type and annotation to the sequencevoidaddPosition(SequencePosition pos)Adds a new position to the sequencevoidaddPosition(ResidueType type, java.lang.String annotation)Adds a new position of given residue type and annotation to the sequencevoidaddPositionsFromString(java.lang.String str)Adds a series of new positions to the sequence taken from a String objectjava.lang.Objectclone()Returns an identical Sequence objectSequenceconcat(Sequence other)Returns the given sequence concatenated to this sequencebooleancontainsSubSequence(Sequence subsequence)Returns true if the given subsequence is contained in this sequencebooleanequals(java.lang.Object other)Returns true if the two sequences are identicaljava.lang.StringgetAnnotationOfPosition(int i)Returns the annotation of sequence position #ijava.lang.StringgetAnnotationOfPositionOfIndex(int index)Returns the annotation of sequence position of given indexjava.util.ArrayList<SequencePosition>getAsArrayList()Returns sequence as an ArrayList objectintgetIndexOfPosition(int i)Returns the index of sequence position #ijava.lang.StringgetName()Returns the name of sequenceSequencePositiongetPosition(int i)Returns sequence position #iSequencePositiongetPositionByIndex(int index)Returns sequence position of given indexResidueTypegetResidueTypeOfPosition(int i)Returns the residue type of sequence position #iResidueTypegetResidueTypeOfPositionOfIndex(int index)Returns the residue type of sequence position of given indexSequencegetReverse()Returns the reverse sequenceintgetSequenceLength()Returns the length of sequence (gaps excluded)intgetSequenceLengthWithGaps()Returns the length of sequence (gaps included)SequencegetSubSequence(int begin, int end)Returns subsequence beginning at sequence position #begin and ending at sequence position #endSequencegetSubSequenceFrom(int begin)Returns subsequence beginning at sequence position #beginSequencegetSubSequenceTo(int end)Returns subsequence ending at sequence position #endinthashCode()Returns hash codevoidinsertGap(int i)Inserts a new gap to position #ivoidinsertPosition(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 methodvoidinsertPosition(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 methodvoidinsertPosition(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 methodvoidinsertPosition(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 methodbooleanisPositionAGap(int i)Returns true if sequence position #i is a gapvoidreIndexPositions()Reindexes all positions in the sequence starting from 1voidreIndexPositions(int startindex)Reindexes all positions in the sequence starting from a given indexvoidremoveGaps()Removes all gaps from the sequencevoidremovePosition(int i)Removes sequence position #ivoidremovePosition(SequencePosition pos)Removes the given sequence positionvoidremovePositionByIndex(int index)Removes the sequence position of given indexvoidsetName(java.lang.String name)Sets the name of sequencevoidsetPosition(int i, int index, ResidueType type)Replaces position #i with the a sequence position of given index and residue typevoidsetPosition(int i, int index, ResidueType type, java.lang.String annotation)Replaces position #i with the a sequence position of given index, residue type and annotationvoidsetPosition(int i, SequencePosition pos)Replaces position #i with the given sequence positionvoidsetPosition(int i, ResidueType type, java.lang.String annotation)Replaces position #i with the a sequence position of given residue type and annotationvoidsetPositionByIndex(int index, ResidueType type)Replaces the position of given index with the a sequence position of given residue typevoidsetPositionByIndex(int index, ResidueType type, java.lang.String annotation)Replaces the position of given index with the a sequence position of given residue type and annotationjava.lang.StringtoString()Returns the String representation of sequencejava.lang.StringtoString1Letter()Returns a String representation in which each residue is represented by its 1 letter codejava.lang.StringtoString1Letter(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 lengthjava.lang.StringtoString3Letter()Returns a String representation in which each residue is represented by its 3 letter codejava.lang.StringtoString3Letter(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 lengthjava.lang.StringtoStringInfo()Returns summary information about the sequence
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the name of sequence- Returns:
- name of sequence
-
setName
public void setName(java.lang.String name)
Sets the name of sequence- Parameters:
name- name of sequence
-
getAsArrayList
public java.util.ArrayList<SequencePosition> getAsArrayList()
Returns sequence as an ArrayList object- Returns:
- sequence as an ArrayList
-
getSequenceLength
public int getSequenceLength()
Returns the length of sequence (gaps excluded)- Returns:
- length of sequence
-
getSequenceLengthWithGaps
public int getSequenceLengthWithGaps()
Returns the length of sequence (gaps included)- Returns:
- length of sequence
-
getPosition
public SequencePosition getPosition(int i)
Returns sequence position #i- Returns:
- sequence position #i
-
getPositionByIndex
public SequencePosition getPositionByIndex(int index)
Returns sequence position of given index- Parameters:
index- index of position- Returns:
- sequence position of given index
-
getIndexOfPosition
public int getIndexOfPosition(int i)
Returns the index of sequence position #i- Returns:
- index of sequence position
-
getResidueTypeOfPosition
public ResidueType getResidueTypeOfPosition(int i)
Returns the residue type of sequence position #i- Returns:
- residue type of sequence position
-
getAnnotationOfPosition
public java.lang.String getAnnotationOfPosition(int i)
Returns the annotation of sequence position #i- Returns:
- annotation of sequence position
-
getResidueTypeOfPositionOfIndex
public ResidueType getResidueTypeOfPositionOfIndex(int index)
Returns the residue type of sequence position of given index- Parameters:
index- index of position- Returns:
- residue type of sequence position
-
getAnnotationOfPositionOfIndex
public java.lang.String getAnnotationOfPositionOfIndex(int index)
Returns the annotation of sequence position of given index- Parameters:
index- index of position- Returns:
- annotation of sequence position
-
addPosition
public void addPosition(SequencePosition pos)
Adds a new position to the sequence- Parameters:
pos- new sequence position
-
addPosition
public void addPosition(ResidueType type, java.lang.String annotation)
Adds a new position of given residue type and annotation to the sequence- Parameters:
type- residue type of new positionannotation- annotation of new position
-
addPosition
public void addPosition(int index, ResidueType type)Adds a new position of given index and residue type to the sequence- Parameters:
index- index of new positiontype- residue type of new position
-
addPosition
public void addPosition(int index, ResidueType type, java.lang.String annotation)Adds a new position of given index, residue type and annotation to the sequence- Parameters:
index- index of new positiontype- residue type of new positionannotation- annotation of new position
-
addPositionsFromString
public void addPositionsFromString(java.lang.String str)
Adds a series of new positions to the sequence taken from a String object- Parameters:
str- String object encoding a series of sequence positions
-
addGap
public void addGap()
Adds a new gap to the sequence
-
insertGap
public void insertGap(int i)
Inserts a new gap to position #i
-
setPosition
public void setPosition(int i, SequencePosition pos)Replaces position #i with the given sequence position- Parameters:
pos- new sequence position
-
setPosition
public void setPosition(int i, ResidueType type, java.lang.String annotation)Replaces position #i with the a sequence position of given residue type and annotation- Parameters:
type- residue type of new sequence positionannotation- annotation of new sequence position
-
setPosition
public void setPosition(int i, int index, ResidueType type)Replaces position #i with the a sequence position of given index and residue type- Parameters:
index- index of new sequence positiontype- residue type of new sequence position
-
setPosition
public 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- Parameters:
index- index of new sequence positiontype- residue type of new sequence positionannotation- annotation of new sequence position
-
setPositionByIndex
public 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- Parameters:
index- index of sequence positiontype- residue type of new sequence positionannotation- annotation of new sequence position
-
setPositionByIndex
public void setPositionByIndex(int index, ResidueType type)Replaces the position of given index with the a sequence position of given residue type- Parameters:
index- index of sequence positiontype- residue type of new sequence position
-
removePosition
public void removePosition(int i)
Removes sequence position #i
-
removePosition
public void removePosition(SequencePosition pos)
Removes the given sequence position- Parameters:
pos- sequence position to be removed
-
removePositionByIndex
public void removePositionByIndex(int index)
Removes the sequence position of given index- Parameters:
index- index of sequence position to be removed
-
removeGaps
public void removeGaps()
Removes all gaps from the sequence
-
reIndexPositions
public void reIndexPositions(int startindex)
Reindexes all positions in the sequence starting from a given index- Parameters:
startindex- index of position #0
-
reIndexPositions
public void reIndexPositions()
Reindexes all positions in the sequence starting from 1
-
insertPosition
public 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- Parameters:
pos- new sequence position
-
insertPosition
public 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- Parameters:
type- residue type of new sequence positionannotation- annotation of new sequence position
-
insertPosition
public 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- Parameters:
index- index of new sequence positiontype- residue type of new sequence position
-
insertPosition
public 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- Parameters:
index- index of new sequence positiontype- residue type of new sequence positionannotation- annotation of new sequence position
-
isPositionAGap
public boolean isPositionAGap(int i)
Returns true if sequence position #i is a gap
-
getSubSequence
public Sequence getSubSequence(int begin, int end)
Returns subsequence beginning at sequence position #begin and ending at sequence position #end- Parameters:
begin- start position of subsequenceend- end position of subsequence- Returns:
- subsequence
-
getSubSequenceFrom
public Sequence getSubSequenceFrom(int begin)
Returns subsequence beginning at sequence position #begin- Parameters:
begin- start position of subsequence- Returns:
- subsequence
-
getSubSequenceTo
public Sequence getSubSequenceTo(int end)
Returns subsequence ending at sequence position #end- Parameters:
end- end position of subsequence- Returns:
- subsequence
-
getReverse
public Sequence getReverse()
Returns the reverse sequence- Returns:
- reverse sequence
-
concat
public Sequence concat(Sequence other)
Returns the given sequence concatenated to this sequence- Parameters:
other- second sequence- Returns:
- concatenated sequence
-
containsSubSequence
public boolean containsSubSequence(Sequence subsequence)
Returns true if the given subsequence is contained in this sequence- Parameters:
subsequence- subsequence to search for
-
toString
public java.lang.String toString()
Returns the String representation of sequence- Overrides:
toStringin classjava.lang.Object- Returns:
- String representation
-
toString1Letter
public java.lang.String toString1Letter()
Returns a String representation in which each residue is represented by its 1 letter code- Returns:
- String representation
-
toString3Letter
public java.lang.String toString3Letter()
Returns a String representation in which each residue is represented by its 3 letter code- Returns:
- String representation
-
toString1Letter
public 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- Parameters:
lengthOfLine- max length of a line in the string- Returns:
- String representation
-
toString3Letter
public 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- Parameters:
lengthOfLine- max length of a line (number of residues) in the string- Returns:
- String representation
-
toStringInfo
public java.lang.String toStringInfo()
Returns summary information about the sequence- Returns:
- summary information
-
clone
public java.lang.Object clone()
Returns an identical Sequence object- Overrides:
clonein classjava.lang.Object- Returns:
- clone of the sequence
-
equals
public boolean equals(java.lang.Object other)
Returns true if the two sequences are identical- Overrides:
equalsin classjava.lang.Object- Parameters:
other- the other sequence
-
hashCode
public int hashCode()
Returns hash code- Overrides:
hashCodein classjava.lang.Object
-
-