Package jgromacs.data
Class Sequence
java.lang.Object
jgromacs.data.Sequence
- All Implemented Interfaces:
Cloneable
Objects of this class represent a single amino acid sequence
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addGap()
Adds a new gap to the sequencevoid
addPosition
(int index, ResidueType type) Adds a new position of given index and residue type to the sequencevoid
addPosition
(int index, ResidueType type, String annotation) Adds a new position of given index, residue type and annotation to the sequencevoid
Adds a new position to the sequencevoid
addPosition
(ResidueType type, String annotation) Adds a new position of given residue type and annotation to the sequencevoid
Adds a series of new positions to the sequence taken from a String objectclone()
Returns an identical Sequence objectReturns the given sequence concatenated to this sequenceboolean
containsSubSequence
(Sequence subsequence) Returns true if the given subsequence is contained in this sequenceboolean
Returns true if the two sequences are identicalgetAnnotationOfPosition
(int i) Returns the annotation of sequence position #igetAnnotationOfPositionOfIndex
(int index) Returns the annotation of sequence position of given indexReturns sequence as an ArrayList objectint
getIndexOfPosition
(int i) Returns the index of sequence position #igetName()
Returns the name of sequencegetPosition
(int i) Returns sequence position #igetPositionByIndex
(int index) Returns sequence position of given indexgetResidueTypeOfPosition
(int i) Returns the residue type of sequence position #igetResidueTypeOfPositionOfIndex
(int index) Returns the residue type of sequence position of given indexReturns the reverse sequenceint
Returns the length of sequence (gaps excluded)int
Returns the length of sequence (gaps included)getSubSequence
(int begin, int end) Returns subsequence beginning at sequence position #begin and ending at sequence position #endgetSubSequenceFrom
(int begin) Returns subsequence beginning at sequence position #begingetSubSequenceTo
(int end) Returns subsequence ending at sequence position #endint
hashCode()
Returns hash codevoid
insertGap
(int i) Inserts a new gap to position #ivoid
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 methodvoid
insertPosition
(int i, int index, ResidueType type, 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 methodvoid
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 methodvoid
insertPosition
(int i, ResidueType type, 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 methodboolean
isPositionAGap
(int i) Returns true if sequence position #i is a gapvoid
Reindexes all positions in the sequence starting from 1void
reIndexPositions
(int startindex) Reindexes all positions in the sequence starting from a given indexvoid
Removes all gaps from the sequencevoid
removePosition
(int i) Removes sequence position #ivoid
Removes the given sequence positionvoid
removePositionByIndex
(int index) Removes the sequence position of given indexvoid
Sets the name of sequencevoid
setPosition
(int i, int index, ResidueType type) Replaces position #i with the a sequence position of given index and residue typevoid
setPosition
(int i, int index, ResidueType type, String annotation) Replaces position #i with the a sequence position of given index, residue type and annotationvoid
setPosition
(int i, SequencePosition pos) Replaces position #i with the given sequence positionvoid
setPosition
(int i, ResidueType type, String annotation) Replaces position #i with the a sequence position of given residue type and annotationvoid
setPositionByIndex
(int index, ResidueType type) Replaces the position of given index with the a sequence position of given residue typevoid
setPositionByIndex
(int index, ResidueType type, String annotation) Replaces the position of given index with the a sequence position of given residue type and annotationtoString()
Returns the String representation of sequenceReturns a String representation in which each residue is represented by its 1 letter codetoString1Letter
(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 lengthReturns a String representation in which each residue is represented by its 3 letter codetoString3Letter
(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 lengthReturns summary information about the sequence
-
Constructor Details
-
Sequence
public Sequence()Constructs a new Sequence object -
Sequence
Constructs a new Sequence object of given name
-
-
Method Details
-
getName
Returns the name of sequence- Returns:
- name of sequence
-
setName
Sets the name of sequence- Parameters:
name
- name of sequence
-
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
Returns sequence position #i- Returns:
- sequence position #i
-
getPositionByIndex
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
Returns the residue type of sequence position #i- Returns:
- residue type of sequence position
-
getAnnotationOfPosition
Returns the annotation of sequence position #i- Returns:
- annotation of sequence position
-
getResidueTypeOfPositionOfIndex
Returns the residue type of sequence position of given index- Parameters:
index
- index of position- Returns:
- residue type of sequence position
-
getAnnotationOfPositionOfIndex
Returns the annotation of sequence position of given index- Parameters:
index
- index of position- Returns:
- annotation of sequence position
-
addPosition
Adds a new position to the sequence- Parameters:
pos
- new sequence position
-
addPosition
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
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
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
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
Replaces position #i with the given sequence position- Parameters:
pos
- new sequence position
-
setPosition
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
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
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
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
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
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
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
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
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
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
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
Returns subsequence beginning at sequence position #begin- Parameters:
begin
- start position of subsequence- Returns:
- subsequence
-
getSubSequenceTo
Returns subsequence ending at sequence position #end- Parameters:
end
- end position of subsequence- Returns:
- subsequence
-
getReverse
Returns the reverse sequence- Returns:
- reverse sequence
-
concat
Returns the given sequence concatenated to this sequence- Parameters:
other
- second sequence- Returns:
- concatenated sequence
-
containsSubSequence
Returns true if the given subsequence is contained in this sequence- Parameters:
subsequence
- subsequence to search for
-
toString
Returns the String representation of sequence -
toString1Letter
Returns a String representation in which each residue is represented by its 1 letter code- Returns:
- String representation
-
toString3Letter
Returns a String representation in which each residue is represented by its 3 letter code- Returns:
- String representation
-
toString1Letter
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
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
Returns summary information about the sequence- Returns:
- summary information
-
clone
Returns an identical Sequence object -
equals
Returns true if the two sequences are identical -
hashCode
public int hashCode()Returns hash code
-