public class GenbankReader<S extends AbstractSequence<C>,C extends Compound>
extends java.lang.Object
GenbankReaderHelper as an example of how to use this class where GenbankReaderHelper should be the
primary class used to read Genbank files| Constructor and Description |
|---|
GenbankReader(java.io.File file,
SequenceHeaderParserInterface<S,C> headerParser,
SequenceCreatorInterface<C> sequenceCreator)
If you are going to use the FileProxyProteinSequenceCreator then you
need to use this constructor because we need details about
the location of the file.
|
GenbankReader(java.io.InputStream is,
SequenceHeaderParserInterface<S,C> headerParser,
SequenceCreatorInterface<C> sequenceCreator)
If you are going to use
FileProxyProteinSequenceCreator then do not use this constructor because we need details about
local file offsets for quick reads. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
isClosed() |
java.util.LinkedHashMap<java.lang.String,S> |
process()
The parsing is done in this method.
This method will return all the available Genbank records in the File or InputStream, closes the underlying resource, and return the results in LinkedHashMap.You don't need to call close() after calling this method. |
java.util.LinkedHashMap<java.lang.String,S> |
process(int max)
This method tries to parse maximum
max records from
the open File or InputStream, and leaves the underlying resource open.Subsequent calls to the same method continue parsing the rest of the file. This is particularly useful when dealing with very big data files, (e.g. |
public GenbankReader(java.io.InputStream is,
SequenceHeaderParserInterface<S,C> headerParser,
SequenceCreatorInterface<C> sequenceCreator)
FileProxyProteinSequenceCreator then do not use this constructor because we need details about
local file offsets for quick reads. InputStream does not give you the name of the stream to access quickly via file seek. A seek in
an InputStream is forced to read all the data so you don't gain anything.is - headerParser - sequenceCreator - public GenbankReader(java.io.File file,
SequenceHeaderParserInterface<S,C> headerParser,
SequenceCreatorInterface<C> sequenceCreator)
throws java.io.FileNotFoundException
file - headerParser - sequenceCreator - java.io.FileNotFoundException - if the file does not exist, is a directory
rather than a regular file, or for some other reason cannot be opened
for reading.java.lang.SecurityException - if a security manager exists and its checkRead
method denies read access to the file.public boolean isClosed()
public java.util.LinkedHashMap<java.lang.String,S> process() throws java.io.IOException, CompoundNotFoundException
LinkedHashMap.close() after calling this method.HashMap containing all the parsed Genbank records
present, starting current fileIndex onwards.java.io.IOExceptionCompoundNotFoundExceptionjava.lang.OutOfMemoryError - if the input resource is larger than the allocated heap.process(int)public java.util.LinkedHashMap<java.lang.String,S> process(int max) throws java.io.IOException, CompoundNotFoundException
max records from
the open File or InputStream, and leaves the underlying resource open.max - maximum number of records to return.HashMap containing maximum max parsed Genbank records
present, starting current fileIndex onwards.java.io.IOExceptionCompoundNotFoundExceptionprocess()public void close()
Copyright © 2000-2020 BioJava. All Rights Reserved.