Package org.biojava.nbio.data.sequence
Class FastaSequence
- java.lang.Object
-
- org.biojava.nbio.data.sequence.FastaSequence
-
- All Implemented Interfaces:
java.lang.Comparable<FastaSequence>
public final class FastaSequence extends java.lang.Object implements java.lang.Comparable<FastaSequence>
A FASTA formatted sequence. Please note that this class does not make any assumptions as to what sequence it store e.g. it could be nucleotide, protein or even gapped alignment sequence! The only guarantee it makes is that the sequence does not contain white space characters e.g. spaces, new lines etc- Since:
- 3.0.2
- Version:
- 1.0
- Author:
- pvtroshin
-
-
Constructor Summary
Constructors Constructor Description FastaSequence(java.lang.String id, java.lang.String sequence)
Upon construction the any whitespace characters are removed from the sequence
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(FastaSequence o)
static int
countMatchesInSequence(java.lang.String theString, java.lang.String theRegExp)
boolean
equals(java.lang.Object obj)
java.lang.String
getFormatedSequence(int width)
Format sequence per width letter in one string.java.lang.String
getFormattedFasta()
java.lang.String
getId()
Gets the value of idint
getLength()
java.lang.String
getOnelineFasta()
java.lang.String
getSequence()
Gets the value of sequenceint
hashCode()
java.lang.String
toString()
Same as oneLineFasta
-
-
-
Method Detail
-
getId
public java.lang.String getId()
Gets the value of id- Returns:
- the value of id
-
getSequence
public java.lang.String getSequence()
Gets the value of sequence- Returns:
- the value of sequence
-
countMatchesInSequence
public static int countMatchesInSequence(java.lang.String theString, java.lang.String theRegExp)
-
getFormattedFasta
public java.lang.String getFormattedFasta()
-
getOnelineFasta
public java.lang.String getOnelineFasta()
- Returns:
- one line name, next line sequence, no matter what the sequence length is
-
getFormatedSequence
public java.lang.String getFormatedSequence(int width)
Format sequence per width letter in one string. Without spaces.- Returns:
- multiple line formated sequence, one line width letters length
-
getLength
public int getLength()
- Returns:
- sequence length
-
toString
public java.lang.String toString()
Same as oneLineFasta- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
compareTo
public int compareTo(FastaSequence o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<FastaSequence>
-
-