Skip to content

Conversation

@SteffenHeu
Copy link
Member

Need to chat with bruker if this works all the time before we mergen. also check if it makes sense to not import ms2 frame spectra, might have implications on other parts of mzmine

@SteffenHeu
Copy link
Member Author

Ready for review now

@SteffenHeu SteffenHeu requested a review from robinschmid June 21, 2024 12:59
@SteffenHeu SteffenHeu changed the title Fast tdf import Speed up tdf import ~2.5x Jun 22, 2024
robinschmid
robinschmid previously approved these changes Jun 25, 2024
Copy link
Member

@robinschmid robinschmid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

public FrameSummedMobilogramProvider(Frame frame, int binWidth) {
this.frame = frame;
this.binWidth = binWidth;
this.binWidth = Math.max(1, binWidth);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

binWidth is still number of data points right?
maybe you could add some java doc somewhere or even rename the var to dataPointsBinWidth?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

number of scans


final List<BuildingMobilityScan> spectra = tdfUtils.loadSpectraForTIMSFrame(frame, frameTable,
scanProcessorConfig);
if (spectra.isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function is nullable so need to check null or change to NonNull

final List<BuildingMobilityScan> spectra = tdfUtils.loadSpectraForTIMSFrame(frame, frameTable,
scanProcessorConfig);
if (spectra.isEmpty()) {
spectra.add(new BuildingMobilityScan(0, new double[]{}, new double[]{}));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that happening often? Then maybe create a constant for empty frames?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, just as a backup so it does not fail.

* @param scanEnd The last scan index
* @return List of {@link SimpleSpectralArrays}, each represents the data points of one scan
*/
public List<SimpleSpectralArrays> loadDataPointsForFrame_v2(final long frameId,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe rename to loadDataPointsForFrameCached to define how it differs from the v1? but not needed.
You could also deprecate the old method and add some comment that v2 is faster?

}
logger.info("Native TDF library initialised " + tdfLib.toString());
setNumThreads(numThreads);
setNumThreads(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this always need to be 1?
The method is only called from this line so can it be multiple threads even?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be, but its slower. It has to be set though.

SimpleSpectralArrays data = extractCentroidsForFrame(frameId, 0, numScans);
SimpleSpectralArrays data = SimpleSpectralArrays.EMPTY;
if (msLevel < 2 || frameTable.getMsMsTypeColumn().get(frameIndex)
!= 8) { // only load ms2 merged frame for non-pasef
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the !=8 could be extracted into a utils method like TDFUtils.isPasef(frameTable, frameIndex) or directly passing the type in.
Would be at least more descriptive

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good that you mention this, i wasnt sure if we should put this in at all. I'll remvoe it for now, it limits some possibities later on.

@SteffenHeu SteffenHeu merged commit add08c1 into master Jun 27, 2024
@SteffenHeu SteffenHeu deleted the fasttdf branch June 27, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants