Class ProteinSequence
- java.lang.Object
-
- edu.rit.compbio.seq.Sequence
-
- edu.rit.compbio.seq.ProteinSequence
-
public class ProteinSequence extends Sequence
Class ProteinSequence encapsulates a protein sequence. A protein sequence object may be constructed from a string or read from a file. Protein sequence objects may also be read from a protein sequence database using class ProteinDatabase.In a file, a protein sequence is stored in FASTA format. A FASTA format protein sequence consists of one description line and one or more sequence lines. The description line consists of an initial '>' character followed by zero or more characters (the protein's description). A sequence line consists of one or more characters 'A' through 'Z', 'a' through 'z', '*', or '-'.
In a program, a protein sequence is represented as a byte array (type byte[]). For a protein sequence of length L, the byte array contains L+1 bytes. The byte at index 0 is unused and contains a value of -1. The bytes at indexes 1 through L contain the amino acids. Amino acids 'A' through 'Z' (case insensitive) are represented by the values 0 through 25; '*' is represented as 26; '-' is represented as 27.
The amino acid letters and values are:
Letter Value Amino Acid A 0 Alanine B 1 Aspartate or asparagine C 2 Cysteine D 3 Aspartate E 4 Glutamate F 5 Phenylalanine G 6 Glycine H 7 Histidine I 8 Isoleucine J 9 unused K 10 Lysine L 11 Leucine M 12 Methionine N 13 Asparagine O 14 unused P 15 Proline Q 16 Glutamine R 17 Arginine S 18 Serine T 19 Threonine U 20 Selenocysteine V 21 Valine W 22 Tryptophan X 23 Any, unknown Y 24 Tyrosine Z 25 Glutamate or glutamine * 26 Translation stop - 27 Gap of indeterminate length
-
-
Constructor Summary
Constructors Constructor and Description ProteinSequence(java.io.File file)Construct a new protein sequence read from the given file.ProteinSequence(java.lang.String description, java.lang.String sequence)Construct a new protein sequence from the given string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description charcharAt(int i)Returns a character version of this protein sequence's element at the given index.java.lang.StringtoString()Returns a string version of this protein sequence.-
Methods inherited from class edu.rit.compbio.seq.Sequence
description, elementsToString, equals, hashCode, length, sequence
-
-
-
-
Constructor Detail
-
ProteinSequence
public ProteinSequence(java.lang.String description, java.lang.String sequence)Construct a new protein sequence from the given string.- Parameters:
description- Description string. Must start with a '>' character.sequence- Sequence string. Must consist of the characters 'A' through 'Z', 'a' through 'z', '*', and '-'.
-
ProteinSequence
public ProteinSequence(java.io.File file) throws java.io.IOExceptionConstruct a new protein sequence read from the given file.- Parameters:
file- File.- Throws:
java.io.IOException- Thrown if an I/O error occurred.
-
-
Method Detail
-
charAt
public char charAt(int i)
Returns a character version of this protein sequence's element at the given index.
-
toString
public java.lang.String toString()
Returns a string version of this protein sequence. The string is "ProteinSequence(description)".- Overrides:
toStringin classjava.lang.Object- Returns:
- String version.
-
-
DMelt 3.0 © DataMelt by jWork.ORG