compbio.data.sequence
Class FastaSequence

java.lang.Object
  extended by compbio.data.sequence.FastaSequence
Direct Known Subclasses:
AnnotatedSequence

@Immutable
public class FastaSequence
extends Object

A FASTA formatted sequence. Please note that this class does not make any assumptions as to what sequence it stores 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

Version:
1.0 September 2009
Author:
pvtroshin

Constructor Summary
FastaSequence(String id, String sequence)
          Upon construction the any whitespace characters are removed from the sequence
 
Method Summary
static int countMatchesInSequence(String theString, String theRegExp)
           
 boolean equals(Object obj)
           
 String getFormatedSequence(int width)
          Format sequence per width letter in one string.
 String getFormattedFasta()
           
 String getId()
          Gets the value of id
 int getLength()
           
 String getOnelineFasta()
           
 String getSequence()
          Gets the value of sequence
 int hashCode()
           
 String toString()
          Same as oneLineFasta
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FastaSequence

public FastaSequence(String id,
                     String sequence)
Upon construction the any whitespace characters are removed from the sequence

Parameters:
id -
sequence -
Method Detail

getId

public String getId()
Gets the value of id

Returns:
the value of id

getSequence

public String getSequence()
Gets the value of sequence

Returns:
the value of sequence

countMatchesInSequence

public static int countMatchesInSequence(String theString,
                                         String theRegExp)

getFormattedFasta

public String getFormattedFasta()

getOnelineFasta

public String getOnelineFasta()
Returns:
one line name, next line sequence, no matter what the sequence length is

getFormatedSequence

public 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 String toString()
Same as oneLineFasta

Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object