Squil API squil-98 (20130530172026)

edu.cornell.med.icb.parsers
Class ReaderFastaParser

java.lang.Object
  extended by edu.cornell.med.icb.parsers.ReaderFastaParser

public final class ReaderFastaParser
extends Object

A parser for fasta files which supports reading sequences one character at a time. Useful for processing sequences containing entire chromosomes.

Author:
Fabien Campagne Date: Nov 10, 2008 Time: 6:09:57 PM

Constructor Summary
ReaderFastaParser()
          Create a parser to read sequences.
ReaderFastaParser(Reader fastaFileSource)
          Create a parser to read sequences.
 
Method Summary
 Reader getBaseReader()
           
static void guessAccessionCode(CharSequence descriptionLine, MutableString accessionCode)
          Try to extract an accession code from a FASTA description line.
 boolean hasNextSequence()
          Returns true if the reader has at least one more sequence.
 boolean nextSequence(MutableString descriptionLine)
          Obtain the next sequence from the reader over the FASTA formatted content.
 void setReader(Reader reader)
          Repositions this reader on a different file/data content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReaderFastaParser

public ReaderFastaParser(Reader fastaFileSource)
                  throws IOException
Create a parser to read sequences.

Parameters:
fastaFileSource - The reader over the FASTA formatted data.
Throws:
IOException - if the sequence cannot be read using the reader

ReaderFastaParser

public ReaderFastaParser()
Create a parser to read sequences.

Method Detail

setReader

public void setReader(Reader reader)
               throws IOException
Repositions this reader on a different file/data content.

Parameters:
reader - the new reader to use to parse the file
Throws:
IOException - if the sequence cannot be read using the reader

hasNextSequence

public boolean hasNextSequence()
Returns true if the reader has at least one more sequence.

Returns:
True if a call to next will return another sequence.

nextSequence

public boolean nextSequence(MutableString descriptionLine)
Obtain the next sequence from the reader over the FASTA formatted content. This method returns true until there is no more sequence to parse in the input. When the method returns false, the content of the parameters descriptionLine and residues is unspecified.

Parameters:
descriptionLine - Where the raw description line will be written.
Returns:
True if hasNext() is true, False otherwise.

getBaseReader

public Reader getBaseReader()

guessAccessionCode

public static void guessAccessionCode(CharSequence descriptionLine,
                                      MutableString accessionCode)
Try to extract an accession code from a FASTA description line.

Parameters:
descriptionLine - The line of text to parse for the accession code
accessionCode - The location to place the resulting accession code

Squil API squil-98 (20130530172026)

Copyright © 2007-2013 Institute for Computational Biomedicine, All Rights Reserved.