public class ScanCollectionDefault extends Object implements IScanCollection
IScanCollection.| Modifier and Type | Field and Description |
|---|---|
protected StorageStrategy |
defaultStorageStrategy |
protected ScanIndexRoot |
index |
protected boolean |
isAutoloadSpectra |
TreeMap<Integer,IntervalST<Double,TreeMap<Integer,IScan>>> |
msLevel2rangeGroups |
LCMSRunInfo |
runInfo |
protected LCMSDataSource<?> |
source |
DEFAULT_STORAGE_STRATEGY, MIN_GROUP_OVERLAP| Constructor and Description |
|---|
ScanCollectionDefault() |
ScanCollectionDefault(boolean isAutoloadSpectra)
With this constructor you can pre-configure the scan collection to automatically load spectra
if they were not parsed in the first place.
|
| Modifier and Type | Method and Description |
|---|---|
IScan |
addScan(IScan scan)
Adds a new scan to this collection, maintains all the proper inside mappings.
|
IScan |
createScanStub(int num)
Creates a scan stub, using the right
StorageStrategy. |
LCMSDataSource<?> |
getDataSource() |
StorageStrategy |
getDefaultStorageStrategy() |
TreeMap<Integer,ScanIndex> |
getMapMsLevel2index()
Get a map which links MS Levels (starting from 1) to maps of (scanNum => scanObject).
|
TreeMap<Integer,IntervalST<Double,TreeMap<Integer,IScan>>> |
getMapMsLevel2rangeGroups()
Get a map, holding spectra groupped by precursor m/z isolation window.
|
TreeMap<Integer,IScan> |
getMapNum2scan()
Get a map which links actual scan numbers to instances of Scan objects.
|
TreeMap<Double,List<IScan>> |
getMapRt2scan()
Maps retention time (in minutes) to lists of Scan objects.
|
IScan |
getNextScan(int scanNum)
Gets the next scan in the collection (by number).
|
IScan |
getNextScanAtMsLevel(int scanNum,
int msLevel)
Finds the next scan at the same MS level, as the scan with scanNum.
|
IScan |
getNextScanAtSameMsLevel(IScan scan)
Convenience method, calls
getNextScanAtMsLevel(int, int) internally |
TreeMap<Integer,IScan> |
getNum2scan()
Deprecated.
This is just a side effect of encapsulating the old Maps into the new ScanIndex.
Use
getMapNum2scan() instead. |
IScan |
getPrevScan(int scanNum)
Gets the previous scan in the collection (by number).
|
IScan |
getPrevScanAtMsLevel(int scanNum,
int msLevel)
Finds the next scan at the same MS level, as the scan with scanNum.
|
IScan |
getPrevScanAtSameMsLevel(IScan scan)
Convenience method, calls
getPrevScanAtMsLevel(int, int) internally |
TreeMap<Double,List<IScan>> |
getRt2scan()
Deprecated.
This is just a side effect of encapsulating the old Maps into the new ScanIndex.
Use
getMapRt2scan() instead. |
Double |
getRtMax()
RT of the last scan in this scan collection.
|
Double |
getRtMin()
RT of the first scan.
|
LCMSRunInfo |
getRunInfo() |
IScan |
getScanByNum(int scanNum)
The name says it all.
|
IScan |
getScanByNumClosest(int scanNum)
Scan with the closest Number is returned.
|
IScan |
getScanByNumLower(int scanNum)
Scan with closest Number STRICTLY less than the provided one is returned.
|
IScan |
getScanByNumUpper(int scanNum)
Scan with the closest Number greater or equal to the provided one is returned.
|
int |
getScanCount()
Get the total number of scans in this ScansCollection.
|
Integer |
getScanCountAtMsLevel(int msLevel)
If the msLevel doesn't exist in this ScanCollectionDefault, returns null
|
TreeMap<Integer,NavigableMap<Integer,IScan>> |
getScansByNumSpan(int numStart,
int numEnd) |
NavigableMap<Integer,IScan> |
getScansByNumSpanAtMsLevel(int numStart,
int numEnd,
int msLevel)
A view(not a copy!) of the original scan map, containing only scans from numStart to numEnd
(inclusive).
|
List<IScan> |
getScansByRt(double rt)
Provided RT MUST be EXACT RT, existing in the map.
|
List<IScan> |
getScansByRtClosest(double rt)
Scans with the closest RT are returned.
|
List<IScan> |
getScansByRtLower(double rt)
Scan List with closest RT less or equal to the provided one are returned.
|
TreeMap<Integer,NavigableMap<Integer,IScan>> |
getScansByRtSpan(double rtStart,
double rtEnd)
Returns a range of scans, whose RT is in the inclusive interval [rtStart; rtEnd].
|
NavigableMap<Integer,IScan> |
getScansByRtSpanAtMsLevel(double rtStart,
double rtEnd,
int msLevel)
Same as
getScansByRtSpan(double, double), but only searches at one MS Level. |
List<IScan> |
getScansByRtUpper(double rt)
Scan List with the closest RT greater or equal to the provided one are returned.
|
boolean |
isAutoloadSpectra()
Decides if spectra should be automatically loaded, when a spectrumRef is requested from a Scan,
but there is no spectrumRef present.
|
void |
isAutoloadSpectra(boolean newVal)
Sets the new configuration for spectra autoloading.
|
boolean |
isEmpty()
Tells if the collection has at least one scan in it.
|
void |
loadData(LCMSDataSubset subset)
IMPLEMENTATIONS MUST BE SYNCHRONIZED
Loads spectra for a subset of scans, or all of them, depending on the configuration.
|
void |
loadData(LCMSDataSubset subset,
StorageStrategy storageStrategy)
IMPLEMENTATIONS MUST BE SYNCHRONIZED
Loads spectra for a subset of scans, or all of them, depending on the configuration.
|
void |
reset()
Bring the collection back to initial empty state.
|
void |
setDataSource(LCMSDataSource<?> source)
Set the data source from which the collection will be filled.
|
void |
setDefaultStorageStrategy(StorageStrategy storageStrategy) |
void |
setRunInfo(LCMSRunInfo runInfo) |
void |
setStorageStrategy(LCMSDataSubset subset,
StorageStrategy storageStrategy) |
void |
setStorageStrategy(LCMSDataSubset subset,
StorageStrategy strategyInSet,
StorageStrategy strategyNotInSet) |
void |
unloadData(LCMSDataSubset subset)
IMPLEMENTATIONS MUST BE SYNCHRONIZED
Unloads SPECTRA from the underlying ScanCollection.
|
void |
unloadData(LCMSDataSubset subset,
Set<LCMSDataSubset> exlude)
IMPLEMENTATIONS MUST BE SYNCHRONIZED
Unloads SPECTRA from the underlying ScanCollection.
|
public volatile LCMSRunInfo runInfo
public TreeMap<Integer,IntervalST<Double,TreeMap<Integer,IScan>>> msLevel2rangeGroups
protected volatile ScanIndexRoot index
protected StorageStrategy defaultStorageStrategy
protected boolean isAutoloadSpectra
protected LCMSDataSource<?> source
public ScanCollectionDefault()
public ScanCollectionDefault(boolean isAutoloadSpectra)
ISpectrum in an IScan returns null), then
the spectrum should be automatically parsed from the file. This will be very slow, if you do it
this was to access all MS1 spectra in a large run, for example.public boolean isEmpty()
IScanCollectionisEmpty in interface IScanCollectionpublic StorageStrategy getDefaultStorageStrategy()
getDefaultStorageStrategy in interface IScanCollectionpublic void setDefaultStorageStrategy(StorageStrategy storageStrategy)
setDefaultStorageStrategy in interface IScanCollectionpublic boolean isAutoloadSpectra()
IScanCollectionisAutoloadSpectra in interface IScanCollectionpublic void isAutoloadSpectra(boolean newVal)
IScanCollectionisAutoloadSpectra in interface IScanCollectionpublic LCMSDataSource<?> getDataSource()
getDataSource in interface IScanCollectionpublic void setDataSource(LCMSDataSource<?> source)
IScanCollectionsetDataSource in interface IScanCollectionpublic IScan addScan(IScan scan)
addScan in interface IScanCollectionscan - scan to be addedpublic TreeMap<Integer,IntervalST<Double,TreeMap<Integer,IScan>>> getMapMsLevel2rangeGroups()
getMapMsLevel2rangeGroups in interface IScanCollectionObject.finalize(). A call to Object.finalize() will be made for you automatically, if you load
scans using an LCMSDataSubset with lo/hi scan nums as null.public TreeMap<Integer,IScan> getMapNum2scan()
getMapNum2scan in interface IScanCollectionpublic TreeMap<Integer,ScanIndex> getMapMsLevel2index()
getMapMsLevel2index in interface IScanCollectionpublic TreeMap<Double,List<IScan>> getMapRt2scan()
getMapRt2scan in interface IScanCollectionpublic LCMSRunInfo getRunInfo()
getRunInfo in interface IScanCollectionpublic void setRunInfo(LCMSRunInfo runInfo)
setRunInfo in interface IScanCollectionpublic Double getRtMax()
getRtMax in interface IScanCollectionpublic Double getRtMin()
getRtMin in interface IScanCollectionpublic IScan getScanByNum(int scanNum)
getScanByNum in interface IScanCollectionscanNum - Scan number as it was in the original MS filepublic IScan getScanByNumLower(int scanNum)
getScanByNumLower in interface IScanCollectionscanNum - scan numberpublic IScan getScanByNumUpper(int scanNum)
getScanByNumUpper in interface IScanCollectionscanNum - scan numberpublic IScan getScanByNumClosest(int scanNum)
getScanByNumClosest in interface IScanCollectionscanNum - scan numberpublic List<IScan> getScansByRt(double rt)
getScansByRt in interface IScanCollectionrt - RT in minutespublic List<IScan> getScansByRtLower(double rt)
getScansByRtLower in interface IScanCollectionpublic List<IScan> getScansByRtUpper(double rt)
getScansByRtUpper in interface IScanCollectionpublic List<IScan> getScansByRtClosest(double rt)
getScansByRtClosest in interface IScanCollectionpublic NavigableMap<Integer,IScan> getScansByNumSpanAtMsLevel(int numStart, int numEnd, int msLevel)
getScansByNumSpanAtMsLevel in interface IScanCollectionpublic TreeMap<Integer,NavigableMap<Integer,IScan>> getScansByNumSpan(int numStart, int numEnd)
getScansByNumSpan in interface IScanCollectionnumStart - Starting scan number (inclusive)numEnd - The last scan number in range (inclusive)public NavigableMap<Integer,IScan> getScansByRtSpanAtMsLevel(double rtStart, double rtEnd, int msLevel)
getScansByRtSpan(double, double), but only searches at one MS Level. If it so
happens, that the RTs are between just 2 consecutive scans, then null is returned. You get a
view of the original scan map, not a copy!getScansByRtSpanAtMsLevel in interface IScanCollectionrtStart - The beginning of RT windowrtEnd - The end of RT windowmsLevel - MS Level at which to get scanspublic TreeMap<Integer,NavigableMap<Integer,IScan>> getScansByRtSpan(double rtStart, double rtEnd)
getScansByRtSpan in interface IScanCollectionrtStart - The beginning of RT windowrtEnd - The end of RT windowpublic int getScanCount()
getScanCount in interface IScanCollectiongetScanCountAtMsLevel(int)public Integer getScanCountAtMsLevel(int msLevel)
getScanCountAtMsLevel in interface IScanCollectionpublic IScan getNextScan(int scanNum)
IScanCollectiongetNextScan in interface IScanCollectionpublic IScan getNextScanAtMsLevel(int scanNum, int msLevel)
getNextScanAtMsLevel in interface IScanCollectionscanNum - Scan numbermsLevel - MS Level at which to search for that scan number. That MS level must be present
in the collection, otherwise an NPE is thrown.public IScan getNextScanAtSameMsLevel(IScan scan)
getNextScanAtMsLevel(int, int) internallygetNextScanAtSameMsLevel in interface IScanCollectionscan - an existing scan from THIS ScanCollectionpublic IScan getPrevScan(int scanNum)
IScanCollectiongetPrevScan in interface IScanCollectionpublic IScan getPrevScanAtMsLevel(int scanNum, int msLevel)
getPrevScanAtMsLevel in interface IScanCollectionscanNum - Scan numbermsLevel - MS Level at which to search for that scan numberpublic IScan getPrevScanAtSameMsLevel(IScan scan)
getPrevScanAtMsLevel(int, int) internallygetPrevScanAtSameMsLevel in interface IScanCollectionpublic void setStorageStrategy(LCMSDataSubset subset, StorageStrategy storageStrategy)
setStorageStrategy in interface IScanCollectionpublic void setStorageStrategy(LCMSDataSubset subset, StorageStrategy strategyInSet, StorageStrategy strategyNotInSet)
setStorageStrategy in interface IScanCollectionpublic void loadData(LCMSDataSubset subset) throws FileParsingException
IScanCollectionloadData in interface IScanCollectionsubset - configuration, for which scans what data should be loaded. Can't be null. Scans
in the range of scan numbers should be loaded, but spectra should be loaded only for the scans,
specified by MS level and m/z ranges.FileParsingExceptionpublic void loadData(LCMSDataSubset subset, StorageStrategy storageStrategy) throws FileParsingException
IScanCollectionloadData in interface IScanCollectionsubset - configuration, for which scans what data should be loaded. Can't be null. Scans
in the range of scan numbers should be loaded, but spectra should be loaded only for the scans,
specified by MS level and m/z ranges.storageStrategy - spectral storage strategy, can be null, in which case the default
storage strategy of the underlying ScanCollection should be usedFileParsingExceptionpublic void unloadData(LCMSDataSubset subset)
IScanCollectionunloadData in interface IScanCollectionpublic void unloadData(LCMSDataSubset subset, Set<LCMSDataSubset> exlude)
IScanCollectionunloadData in interface IScanCollectionsubset - the subset to be unloadedexlude - a set of LCMSDataSubsets to be excluded from the unloading operationpublic IScan createScanStub(int num)
IScanCollectionStorageStrategy.createScanStub in interface IScanCollectionnum - scan number@Deprecated public TreeMap<Integer,IScan> getNum2scan()
getMapNum2scan() instead.@Deprecated public TreeMap<Double,List<IScan>> getRt2scan()
getMapRt2scan() instead.public void reset()
IScanCollectionreset in interface IScanCollectionCopyright © 2017–2018. All rights reserved.