javagene.seq
Class SeqBig

java.lang.Object
  extended by javagene.seq.SeqBig
All Implemented Interfaces:
SeqI

public class SeqBig
extends java.lang.Object
implements SeqI

A SeqI implementation capable of handling large sequences that do not fit into memory. The sequence data is kept on disk and accessed as a memory-mapped file. The sequence file must be in Fasta format. Assumes all data lines (except last) are of equal length. (This is checked when the file is opened.)


Constructor Summary
SeqBig(java.lang.String filename)
          Construct SeqBig object given Fasta filename.
 
Method Summary
 Location bounds()
          Get the bounding location of this sequence.
 java.lang.String description()
          Get the text description of the sequence.
 java.lang.String id()
          Get the (single-word) identifier of the sequence.
 SeqBig subseq(Location location)
          Create a new sequence containing only the portion specified by the location parameter.
 SeqBig subseq(Location location, java.lang.String id, java.lang.String description)
          Create a new sequence containing only the portion specified by the location parameter, with the specified id and description.
 java.lang.String toString()
          Get the IUPAC character string representation of this entire sequence.
 java.lang.String toString(Location location)
          Get the IUPAC character string representation of the subsequence specified by the location parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SeqBig

public SeqBig(java.lang.String filename)
       throws java.io.IOException
Construct SeqBig object given Fasta filename. This is usually done through the Fasta class.

Parameters:
filename - The path and name of the Fasta file.
Throws:
java.io.IOException - - Check the exception text for details.
Method Detail

bounds

public Location bounds()
Get the bounding location of this sequence. SeqBig objects always start at index 0. To use a coordinate system that starts at a non-zero genomic location, wrap the SeqBig object in a SeqStranded object.

Specified by:
bounds in interface SeqI
Returns:
The bounding location.

description

public java.lang.String description()
Description copied from interface: SeqI
Get the text description of the sequence. This is all the text on the description line of a Fasta file after the id.

Specified by:
description in interface SeqI
Returns:
The text description.

id

public java.lang.String id()
Description copied from interface: SeqI
Get the (single-word) identifier of the sequence. This is the first identifier in a Fasta file.

Specified by:
id in interface SeqI
Returns:
The single-word identifier.

subseq

public SeqBig subseq(Location location)
Create a new sequence containing only the portion specified by the location parameter. Shares the underlying data (does not make a copy).

Specified by:
subseq in interface SeqI
Parameters:
location - The portion of the sequence to get.
Returns:
The subsequence.
Throws:
java.lang.IndexOutOfBoundsException - The location parameter was not within the bounding location of the sequence.

subseq

public SeqBig subseq(Location location,
                     java.lang.String id,
                     java.lang.String description)
Create a new sequence containing only the portion specified by the location parameter, with the specified id and description. Shares the underlying data (does not make a copy).

Specified by:
subseq in interface SeqI
Parameters:
location - The portion of the sequence to get.
id - The new single-word id.
description - The new description line.
Returns:
The subsequence.
Throws:
java.lang.IndexOutOfBoundsException - The location parameter was not within the bounding location of the sequence.

toString

public java.lang.String toString()
Get the IUPAC character string representation of this entire sequence. Makes a copy of the underlying data.

Specified by:
toString in interface SeqI
Overrides:
toString in class java.lang.Object
Returns:
The text string.

toString

public java.lang.String toString(Location location)
Get the IUPAC character string representation of the subsequence specified by the location parameter. Makes a copy of the underlying data.

Specified by:
toString in interface SeqI
Parameters:
location - The portion of the sequence to get.
Returns:
The string.
Throws:
java.lang.IndexOutOfBoundsException - The location parameter was not within the bounding location of the sequence.