Skip to content

Conversation

@SteffenHeu
Copy link
Member

@SteffenHeu SteffenHeu commented Mar 21, 2025

Runs a batch file, exports a modular .csv and compares it to a expected results table using the CompareModularCsv module

* filename
* @return the batch task if successful or null on error
*/
public static @Nullable BatchTask runBatch(BatchQueue newQueue, @NotNull MZmineProject project,
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 runBatchQueue and the other to runBatchFile - With so many arguments I had to search for the difference.

final TaskStatus status;
// create ThreadPool
if (currentStepTasks.size() > 1) {
logger.finest(() -> "Processing " + currentStepTasks.size() + " tasks in the thread pool.");
Copy link
Member

Choose a reason for hiding this comment

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

maybe remove? also the loggin below?

@NotNull Instant moduleCallDate) {
super(storage, moduleCallDate);

logger.info("Initializing smoothing task");
Copy link
Member

@robinschmid robinschmid Mar 27, 2025

Choose a reason for hiding this comment

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

maybe remove? also the other debug logs in this class?

public static CSVExportModularParameters create(File csvExportFile,
FeatureListRowsFilter rowsFilter, boolean omitEmpty, String idSeparator,
FeatureListsSelection featureListsSelection) {
final ParameterSet parameters = new CSVExportModularParameters().cloneParameterSet();
Copy link
Member

Choose a reason for hiding this comment

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

fieldSeparator is not set. Maybe set it to the default or add argument to metdho

for (Entry<Integer, RowsRelationship> e : corrMap.entrySet()) {
final List<Entry<Integer, RowsRelationship>> entries = corrMap.entrySet().stream()
.sorted(Comparator.comparingInt(Entry::getKey)).toList();
for (Entry<Integer, RowsRelationship> e : entries) {
Copy link
Member

Choose a reason for hiding this comment

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

this is still from the unmerged PR maybe revert to:

for (Entry<Integer, RowsRelationship> e : corrMap.entrySet()) 

static void initMzmine() {
MZmineTestUtil.startMzmineCore();
ProjectService.getProjectManager().clearProject();
ProjectService.getProject().clearSpectralLibrary();
Copy link
Member

Choose a reason for hiding this comment

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

thats maybe a great thing to have in a MZmineTestUtil.clearAll
This way we can use it in other tests as well and makes us remember to clear the libraries as well

* @return a list of CheckResult objects containing the comparison results; the list is empty if
* all comparisons are successful
*/
public static List<CheckResult> runBatchCompareToCsv(URL batchFile, URL baseCsvFile, File tempDir,
Copy link
Member

Choose a reason for hiding this comment

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

unused?

For readability I think it is better to not put very complex ?: stream operations into method calls and constructor calls.
It is quite hard to see what belongs to what.
I think putting the below into a separate line before the call or putting it in a method that describes what happens is better:

overrideDataFiles != null ? Arrays.stream(overrideDataFiles).filter(Objects::nonNull).map(IntegrationTestUtils::urlToFile).toArray(File[]::new) : null

@robinschmid robinschmid self-requested a review March 27, 2025 16:10
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 very nice already.
I think some of the complexity in IntegrationTestUtils could be avoided if an IntegrationTest class is added that configures the test and maybe even the expected results.

.rawFiles("171103_PMA_TK_QC_04-4to5min.mzML", "171103_PMA_TK_QC_05-4to5min.mzML")
.specLibsFullPath("spectral_libraries/integration_tests/massbank_nist_for_tests.msp",
"spectral_libraries/integration_tests/MoNA-export-LC-MS-MS_Spectra.json").build()
.runBatchGetCsvFile();
Copy link
Member

Choose a reason for hiding this comment

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

great addition running the function there and getting the file directly.

@robinschmid robinschmid merged commit ec20348 into mzmine:master Mar 28, 2025
5 checks passed
@SteffenHeu SteffenHeu deleted the integration_test branch May 30, 2025 12:33
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.

2 participants