You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Didn't see the question here originally, but will still leave an answer.
You're trying to load the whole file in memory. The original file might be quite well compressed with gzip or MsNumpress, so the resulting size of the whole file in memory might be significantly larger. 1st, of course, try loading only MS1 or only MS2.
If that doesn't help there's another way, which is slower that the standard mode, but won't use much memory for any file size:
try (finalMZMLFilemzml = newMZMLFile("path-to-mzml")) {
// Create data source with auto-loading of spectra setIScanCollectionscans = newScanCollectionDefault(true);
scans.setDataSource(mzml);
// Only load the data structure (i.e. scan meta-data) without spectra.// Set StorageStrategy to SOFT - will allow garbage collector to reclaim spectra// that are dangling in memory but not being used.scans.loadData(LCMSDataSubset.STRUCTURE_ONLY, StorageStrategy.SOFT);
TreeMap<Integer, IScan> index = scans.getMapNum2scan();
for (Entry<Integer, IScan> e : index.entrySet()) {
IScanscan = e.getValue();
// You need to use `fetchSpectrum()`, because the spectrum might have been// garbage collectedISpectrumspectrum = scan.fetchSpectrum();
}
}
chhh
added
the
wiki
Informative questions with answers that might help with lib usage
label
Jul 29, 2019
Hi,
Recent days, I tried to parsing 2GB mzml file by follow codes:
`MZMLFile mzmlFile = new MZMLFile(spectrumFiles.get(0).getAbsolutePath());
And the memory was increasing to 4GB and ending up with memory issue. And BatMass had same problem. Do you have any experience about parsing big file?
Kai
The text was updated successfully, but these errors were encountered: