Class FileProxyProteinSequenceCreator
java.lang.Object
org.biojava.nbio.core.sequence.io.FileProxyProteinSequenceCreator
- All Implemented Interfaces:
SequenceCreatorInterface<AminoAcidCompound>
public class FileProxyProteinSequenceCreator
extends Object
implements SequenceCreatorInterface<AminoAcidCompound>
This class is a good example of using the SequenceCreatorInterface where during parsing of the stream
the sequence and the offset index are passed to create a Protein sequence that will be loaded in lazily.
This way you can load very large fasta files and store accession id and delay loading the sequence to save
memory. The index is the file stream offset so when a ProteinSequence has a call to getSequence() the
SequenceFileProxyLoader will open the file and offset to the index and retrieve the sequence.
Same approach can be used for genome sequence data stored in a local fasta file, in a database or via http
interface to a remote server
- Author:
- Scooter Willis <willishf at gmail dot com>
-
Constructor Summary
ConstructorDescriptionFileProxyProteinSequenceCreator
(File file, CompoundSet<AminoAcidCompound> compoundSet, SequenceParserInterface sequenceParser) Need File so that we can store full path name in SequenceFileProxyLoader for Random File access as a quick read -
Method Summary
Modifier and TypeMethodDescriptiongetSequence
(String sequence, long index) Even though we are passing in the sequence we really only care about the length of the sequence and the offset index in the fasta file.getSequence
(List<AminoAcidCompound> list) Not sure of use case and currently not supportedgetSequence
(ProxySequenceReader<AminoAcidCompound> proxyLoader, long index) Should be able to extend the same concept to a remote URL call or database connection.
-
Constructor Details
-
FileProxyProteinSequenceCreator
public FileProxyProteinSequenceCreator(File file, CompoundSet<AminoAcidCompound> compoundSet, SequenceParserInterface sequenceParser) Need File so that we can store full path name in SequenceFileProxyLoader for Random File access as a quick read- Parameters:
file
-compoundSet
-
-
-
Method Details
-
getSequence
public AbstractSequence<AminoAcidCompound> getSequence(String sequence, long index) throws CompoundNotFoundException, IOException Even though we are passing in the sequence we really only care about the length of the sequence and the offset index in the fasta file.- Specified by:
getSequence
in interfaceSequenceCreatorInterface<AminoAcidCompound>
- Parameters:
sequence
-index
-- Returns:
- Throws:
CompoundNotFoundException
IOException
-
getSequence
public AbstractSequence<AminoAcidCompound> getSequence(ProxySequenceReader<AminoAcidCompound> proxyLoader, long index) Should be able to extend the same concept to a remote URL call or database connection. Not supported yet- Specified by:
getSequence
in interfaceSequenceCreatorInterface<AminoAcidCompound>
- Parameters:
proxyLoader
-index
-- Returns:
-
getSequence
Not sure of use case and currently not supported- Specified by:
getSequence
in interfaceSequenceCreatorInterface<AminoAcidCompound>
- Parameters:
list
-- Returns:
-