edu.mssm.crover.imports
Class SequenceReaderFactoryImpl

java.lang.Object
  |
  +--edu.mssm.crover.imports.SequenceReaderFactoryImpl
All Implemented Interfaces:
SequenceReaderFactory

public class SequenceReaderFactoryImpl
extends java.lang.Object
implements SequenceReaderFactory

This default implementation of SequenceReaderFactory allows to read sequence files in the following formats:

  • FASTA/Pearson
  • PIR
  • SwissProt with some annotations
  • PDB headers with SEQRES and with secondary structure annotations.


    Constructor Summary
    SequenceReaderFactoryImpl()
               
     
    Method Summary
     void addReader(SequenceReader r)
              This SequenceReaderFactory supports the addition of new SequenceReaders at runtime.
    protected  ReaderType findReaderTypeFromExtension(java.lang.String ext)
               
     ReaderType[] getSupportedTypes()
              Returns the ReaderTypes supported by this factory implementation.
     ReaderType guessReaderType(java.lang.String filename)
              Attempt to determine a ReaderType suitable to parse the sequence encoding from a filename extension.
    static void main(java.lang.String[] args)
              Test of the factory implementation.
     AnnotatedBioSequence[] readSequences(java.io.InputStream seqstream, ReaderType type)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    SequenceReaderFactoryImpl

    public SequenceReaderFactoryImpl()
    Method Detail

    addReader

    public void addReader(SequenceReader r)
    This SequenceReaderFactory supports the addition of new SequenceReaders at runtime. Call this method with the new reader and the factory will be able to read files of the format your reader recognizes.


    getSupportedTypes

    public ReaderType[] getSupportedTypes()
    Description copied from interface: SequenceReaderFactory
    Returns the ReaderTypes supported by this factory implementation. The calls to readSequences should use one of the type returned by this method or the UnregisteredReaderTypeException is likely to be raised.

    Specified by:
    getSupportedTypes in interface SequenceReaderFactory

    readSequences

    public AnnotatedBioSequence[] readSequences(java.io.InputStream seqstream,
                                                ReaderType type)
                                         throws edu.mssm.crover.imports.UnregisteredReaderTypeException,
                                                UnsupportedFileFormatException,
                                                SyntaxErrorException
    Specified by:
    readSequences in interface SequenceReaderFactory
    edu.mssm.crover.imports.UnregisteredReaderTypeException
    UnsupportedFileFormatException
    SyntaxErrorException

    guessReaderType

    public ReaderType guessReaderType(java.lang.String filename)
    Attempt to determine a ReaderType suitable to parse the sequence encoding from a filename extension. Pass "a.sw" to get the swissprot parser for instance. The default readerType returned (when no sensible match can be determined) is FASTA/Pearson).

    Specified by:
    guessReaderType in interface SequenceReaderFactory

    findReaderTypeFromExtension

    protected ReaderType findReaderTypeFromExtension(java.lang.String ext)

    main

    public static void main(java.lang.String[] args)
    Test of the factory implementation.



    Copyright @ 2003 Mount Sinai School of Medicine. All Rights Reserved.