I - the type of indexE - The type of elements in the indexpublic abstract class AbstractXMLBasedDataSource<E extends XMLBasedIndexElement,I extends Index<E>> extends AbstractLCMSDataSource<I>
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.pool2.ObjectPool<javolution.xml.internal.stream.XMLStreamReaderImpl> |
readerPool |
long |
time_reading |
excludeEmptyScans, parsingTimeout, runInfo, tasksPerCpuPerBatchBUF_SIZE, path| Constructor and Description |
|---|
AbstractXMLBasedDataSource(String path) |
| Modifier and Type | Method and Description |
|---|---|
I |
buildIndex(I idx)
Be careful with this method, it will go over the whole file, building index from scans that it can find.
|
protected int[] |
distributeParseLoad(int numWorkers,
ArrayList<OffsetLength> readTasks) |
protected I |
fixIndex(I idx)
The index as it is built by index builder contains offsets of "scan" tags, and their lengths.
|
abstract IndexBuilder<E> |
getIndexBuilder(IndexBuilder.Info info) |
String |
getName()
Some identifier for the source, that can be used as its name.
|
abstract MultiSpectraParser |
getSpectraParser(InputStream inputStream,
LCMSDataSubset subset,
org.apache.commons.pool2.ObjectPool<javolution.xml.internal.stream.XMLStreamReaderImpl> readerPool,
Integer numSpectra)
File type specific parser.
|
protected org.apache.commons.pool2.ObjectPool<javolution.xml.internal.stream.XMLStreamReaderImpl> |
instantiateReaderPool() |
List<IScan> |
parse(LCMSDataSubset subset)
Parse a range of scan numbers.
|
List<IScan> |
parse(List<Integer> scanNums)
Deprecated.
this method has not been updated to the new parsing version
|
IScan |
parseScan(int num,
boolean parseSpectrum)
Parse a single scan from file on disk by it's number.
|
ISpectrum |
parseSpectrum(int num)
Parse a single spectrumRef from file on disk by it's number.
|
protected byte[] |
readContinuousBatchOfSpectra(Iterator<? extends Map.Entry<Integer,? extends XMLBasedIndexElement>> entries,
RandomAccessFile file,
byte[] readBuf,
ArrayList<OffsetLength> readTasks,
int maxScansToReadInBatch) |
protected byte[] |
readListOfSpectra(ListIterator<Integer> scanNumsIter,
int maxScansToReadInBatch,
ArrayList<OffsetLength> readTasks,
NavigableMap<Integer,? extends XMLBasedIndexElement> index,
RandomAccessFile file,
byte[] readBuf)
Reads up to (@code maxScansToRead) scans from the iterator, checking for continuity of scans in the
original file, so it could do sequential reads.
|
void |
releaseMemory()
The intent is to be able to free the memory, e.g.
|
protected abstract void |
releaseResources()
This method will be called by
releaseMemory() in addition to cleaning up resources,
used by this abstract implementation. |
protected ArrayList<Future<List<IScan>>> |
submitParseTasks(LCMSDataSubset subset,
LCMSRunInfo info,
int numWorkers,
ExecutorService exec,
byte[] readBuf1,
ArrayList<OffsetLength> readTasks,
int[] workerScanCounts,
boolean areScansContinuous) |
fetchRunInfo, getNumThreadsForParsing, getParsingTimeout, getRunInfo, getTasksPerCpuPerBatch, isExcludeEmptyScans, setExcludeEmptyScans, setNumThreadsForParsing, setParsingTimeout, setTasksPerCpuPerBatchclose, getBufferedInputStream, getPath, getRandomAccessFileclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfetchIndex, getIndex, parseIndex, parseRunInfoprotected transient org.apache.commons.pool2.ObjectPool<javolution.xml.internal.stream.XMLStreamReaderImpl> readerPool
public transient volatile long time_reading
public AbstractXMLBasedDataSource(String path)
public String getName()
LCMSDataSourcepublic void releaseMemory()
LCMSDataSourceprotected abstract void releaseResources()
releaseMemory() in addition to cleaning up resources,
used by this abstract implementation.
Clean up here anything additional, that your subclass has created, such as a file-type-specific index.protected org.apache.commons.pool2.ObjectPool<javolution.xml.internal.stream.XMLStreamReaderImpl> instantiateReaderPool()
public List<IScan> parse(LCMSDataSubset subset) throws FileParsingException
LCMSDataSourceStorageStrategy.STRONG,
the receiver then can set it to whatever it needs.subset - the region of LC/MS data to be parsed as scansFileParsingExceptionprotected int[] distributeParseLoad(int numWorkers,
ArrayList<OffsetLength> readTasks)
protected I fixIndex(I idx)
idx - protected ArrayList<Future<List<IScan>>> submitParseTasks(LCMSDataSubset subset, LCMSRunInfo info, int numWorkers, ExecutorService exec, byte[] readBuf1, ArrayList<OffsetLength> readTasks, int[] workerScanCounts, boolean areScansContinuous)
public abstract MultiSpectraParser getSpectraParser(InputStream inputStream, LCMSDataSubset subset, org.apache.commons.pool2.ObjectPool<javolution.xml.internal.stream.XMLStreamReaderImpl> readerPool, Integer numSpectra)
inputStream - a stream, from which the parser will parse the actual scan. If this stream is some sort of a
FileStream, make sure you use buffering, because reading from the stream in the parser is
normally unbuffered.subset - the only purpose of this subset object is to identify scans, for which spectra should be parsedreaderPool - can be null, then a new reader will be created every time. It is highly recommended to provide
a valid poolnumSpectra - can be null. If you know how many spectra can be parsed from the inputStream, then
pass it here. If set, and this number of spectra was not reached when parsing, an exception will
be thrown.protected byte[] readContinuousBatchOfSpectra(Iterator<? extends Map.Entry<Integer,? extends XMLBasedIndexElement>> entries, RandomAccessFile file, byte[] readBuf, ArrayList<OffsetLength> readTasks, int maxScansToReadInBatch) throws IOException
IOExceptionprotected byte[] readListOfSpectra(ListIterator<Integer> scanNumsIter, int maxScansToReadInBatch, ArrayList<OffsetLength> readTasks, NavigableMap<Integer,? extends XMLBasedIndexElement> index, RandomAccessFile file, byte[] readBuf) throws IOException
scanNumsIter - iterator over scan numbers to be readmaxScansToReadInBatch - max number of scans to read from the provided iteratorreadTasks - a list, where scan index elements, that were read in this call, will be placedindex - the index of XML filesfile - random acccess file to read fromreadBuf - the buffer to read to, might be changed and grown, new instance will be returned by this methodIOException@Deprecated public List<IScan> parse(List<Integer> scanNums) throws FileParsingException
LCMSDataSourceStorageStrategy.STRONG,
the receiver then can set it to whatever it needs.scanNums - List of scan numbers to be parsed. All scan numbers MUST be present in the file.FileParsingExceptionpublic IScan parseScan(int num, boolean parseSpectrum) throws FileParsingException
LCMSDataSourceStorageStrategy.STRONG,
the receiver then can set it to whatever it needs.num - scan numberparseSpectrum - if false, the spectrumRef should not be parsed. Can provide significant speed and memory
benefits if you only need scan metadataFileParsingExceptionpublic ISpectrum parseSpectrum(int num) throws FileParsingException
LCMSDataSourcenum - scan numberFileParsingExceptionpublic I buildIndex(I idx) throws FileParsingException
LCMSDataSource.fetchIndex() and the file contained
no index.idx - index instance to add parsed index elements to, this index will be modified.FileParsingExceptionpublic abstract IndexBuilder<E> getIndexBuilder(IndexBuilder.Info info)
Copyright © 2017. All rights reserved.