Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
robinschmid authored Sep 18, 2022
2 parents 3c5f7bc + bb498d0 commit bef89ac
Show file tree
Hide file tree
Showing 82 changed files with 442 additions and 1,711 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,15 @@ javafx {

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.compilerArgs += ['--enable-preview']
// options.compilerArgs += ['--enable-preview']
}

tasks.withType(Test) {
jvmArgs += "--enable-preview"
// jvmArgs += "--enable-preview"
}

tasks.withType(JavaExec) {
jvmArgs += '--enable-preview'
// jvmArgs += '--enable-preview'
}

/*
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/io/github/mzmine/datamodel/Frame.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ default int getFrameId() {

@NotNull MobilityType getMobilityType();

/**
* @return Unsorted set of sub spectrum numbers.
*/
// Set<Integer> getMobilityScanNumbers();
@NotNull Range<Double> getMobilityRange();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ public BinningMobilogramDataAccess(@NotNull final IMSRawDataFile rawDataFile,

@NotNull
public static int getRecommendedBinWidth(IMSRawDataFile file) {
final Frame frame = file.getFrame(0);
// timsTOF data can be empty in the early scans, so we use one from the middle
final Frame frame = file.getFrame(file.getNumberOfFrames() / 2);
switch (frame.getMobilityType()) {
case NONE, DRIFT_TUBE, TRAVELING_WAVE, FAIMS -> {
return 1;
Expand All @@ -183,30 +184,24 @@ public static Integer getPreviousBinningWith(@NotNull final ModularFeatureList f
if (method.getModule()
.equals(MZmineCore.getModuleInstance(IonMobilityTraceBuilderModule.class))) {
final ParameterSet parameterSet = method.getParameters();
final var advancedParam = parameterSet
.getParameter(IonMobilityTraceBuilderParameters.advancedParameters).getValue();
final var advancedParam = parameterSet.getParameter(
IonMobilityTraceBuilderParameters.advancedParameters).getValue();
binWidth = switch (mt) {
case TIMS ->
advancedParam.getParameter(AdvancedImsTraceBuilderParameters.timsBinningWidth)
.getValue() ? advancedParam
.getParameter(AdvancedImsTraceBuilderParameters.timsBinningWidth)
.getEmbeddedParameter().getValue()
: getRecommendedBinWidth(
(IMSRawDataFile) flist.getRawDataFile(0));
.getValue() ? advancedParam.getParameter(
AdvancedImsTraceBuilderParameters.timsBinningWidth).getEmbeddedParameter()
.getValue() : getRecommendedBinWidth((IMSRawDataFile) flist.getRawDataFile(0));
case DRIFT_TUBE ->
advancedParam.getParameter(AdvancedImsTraceBuilderParameters.dtimsBinningWidth)
.getValue() ? advancedParam
.getParameter(AdvancedImsTraceBuilderParameters.dtimsBinningWidth)
.getEmbeddedParameter().getValue()
: getRecommendedBinWidth(
(IMSRawDataFile) flist.getRawDataFile(0));
.getValue() ? advancedParam.getParameter(
AdvancedImsTraceBuilderParameters.dtimsBinningWidth).getEmbeddedParameter()
.getValue() : getRecommendedBinWidth((IMSRawDataFile) flist.getRawDataFile(0));
case TRAVELING_WAVE ->
advancedParam.getParameter(AdvancedImsTraceBuilderParameters.twimsBinningWidth)
.getValue() ? advancedParam
.getParameter(AdvancedImsTraceBuilderParameters.twimsBinningWidth)
.getEmbeddedParameter().getValue()
: getRecommendedBinWidth(
(IMSRawDataFile) flist.getRawDataFile(0));
.getValue() ? advancedParam.getParameter(
AdvancedImsTraceBuilderParameters.twimsBinningWidth).getEmbeddedParameter()
.getValue() : getRecommendedBinWidth((IMSRawDataFile) flist.getRawDataFile(0));
default -> null;
};
break;
Expand All @@ -215,30 +210,24 @@ public static Integer getPreviousBinningWith(@NotNull final ModularFeatureList f
if (method.getModule()
.equals(MZmineCore.getModuleInstance(RecursiveIMSBuilderModule.class))) {
final ParameterSet parameterSet = method.getParameters();
final var advancedParam = parameterSet
.getParameter(RecursiveIMSBuilderParameters.advancedParameters).getValue();
final var advancedParam = parameterSet.getParameter(
RecursiveIMSBuilderParameters.advancedParameters).getValue();
binWidth = switch (mt) {
case TIMS ->
advancedParam.getParameter(RecursiveIMSBuilderAdvancedParameters.timsBinningWidth)
.getValue() ? advancedParam
.getParameter(RecursiveIMSBuilderAdvancedParameters.timsBinningWidth)
.getEmbeddedParameter().getValue()
: getRecommendedBinWidth(
(IMSRawDataFile) flist.getRawDataFile(0));
.getValue() ? advancedParam.getParameter(
RecursiveIMSBuilderAdvancedParameters.timsBinningWidth).getEmbeddedParameter()
.getValue() : getRecommendedBinWidth((IMSRawDataFile) flist.getRawDataFile(0));
case DRIFT_TUBE ->
advancedParam.getParameter(RecursiveIMSBuilderAdvancedParameters.dtimsBinningWidth)
.getValue() ? advancedParam
.getParameter(RecursiveIMSBuilderAdvancedParameters.dtimsBinningWidth)
.getEmbeddedParameter().getValue()
: getRecommendedBinWidth(
(IMSRawDataFile) flist.getRawDataFile(0));
.getValue() ? advancedParam.getParameter(
RecursiveIMSBuilderAdvancedParameters.dtimsBinningWidth).getEmbeddedParameter()
.getValue() : getRecommendedBinWidth((IMSRawDataFile) flist.getRawDataFile(0));
case TRAVELING_WAVE ->
advancedParam.getParameter(RecursiveIMSBuilderAdvancedParameters.twimsBinningWidth)
.getValue() ? advancedParam
.getParameter(RecursiveIMSBuilderAdvancedParameters.twimsBinningWidth)
.getEmbeddedParameter().getValue()
: getRecommendedBinWidth(
(IMSRawDataFile) flist.getRawDataFile(0));
.getValue() ? advancedParam.getParameter(
RecursiveIMSBuilderAdvancedParameters.twimsBinningWidth).getEmbeddedParameter()
.getValue() : getRecommendedBinWidth((IMSRawDataFile) flist.getRawDataFile(0));
default -> null;
};
break;
Expand All @@ -247,23 +236,23 @@ public static Integer getPreviousBinningWith(@NotNull final ModularFeatureList f
if (method.getModule().equals(MZmineCore.getModuleInstance(MobilogramBinningModule.class))) {
final ParameterSet parameterSet = method.getParameters();
binWidth = switch (mt) {
case TIMS -> parameterSet.getParameter(MobilogramBinningParameters.timsBinningWidth)
.getValue();
case DRIFT_TUBE -> parameterSet
.getParameter(MobilogramBinningParameters.dtimsBinningWidth).getValue();
case TRAVELING_WAVE -> parameterSet
.getParameter(MobilogramBinningParameters.twimsBinningWidth).getValue();
case TIMS ->
parameterSet.getParameter(MobilogramBinningParameters.timsBinningWidth).getValue();
case DRIFT_TUBE ->
parameterSet.getParameter(MobilogramBinningParameters.dtimsBinningWidth).getValue();
case TRAVELING_WAVE ->
parameterSet.getParameter(MobilogramBinningParameters.twimsBinningWidth).getValue();
default -> null;
};
break;
}

if (method.getModule().equals(MZmineCore.getModuleInstance(ImsExpanderModule.class))) {
final ParameterSet parameterSet = method.getParameters();
binWidth = parameterSet.getParameter(ImsExpanderParameters.mobilogramBinWidth)
.getValue() ? parameterSet.getParameter(ImsExpanderParameters.mobilogramBinWidth)
.getEmbeddedParameter().getValue() : getRecommendedBinWidth(
(IMSRawDataFile) flist.getRawDataFile(0));
binWidth = parameterSet.getParameter(ImsExpanderParameters.mobilogramBinWidth).getValue()
? parameterSet.getParameter(ImsExpanderParameters.mobilogramBinWidth)
.getEmbeddedParameter().getValue()
: getRecommendedBinWidth((IMSRawDataFile) flist.getRawDataFile(0));
break;
}
}
Expand All @@ -281,8 +270,8 @@ private void clearIntensities() {

/**
* Re-bins an already summed mobilogram. Note that re-binning an already binned mobilogram with a
* lower binnign width than before will lead to 0-intensity values. Consider using {@link
* #setMobilogram(List)} instead.
* lower binnign width than before will lead to 0-intensity values. Consider using
* {@link #setMobilogram(List)} instead.
*
* @param summedMobilogram
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import io.github.mzmine.project.impl.ProjectChangeEvent;
import io.github.mzmine.util.CorrelationGroupingUtils;
import io.github.mzmine.util.DataTypeUtils;
import io.github.mzmine.util.FeatureListRowSorter;
import io.github.mzmine.util.MemoryMapStorage;
import io.github.mzmine.util.files.FileAndPathUtil;
import java.text.DateFormat;
Expand Down Expand Up @@ -490,10 +491,16 @@ public List<FeatureListRow> getRowsInsideScanRange(Range<Float> rtRange) {
@Override
public List<FeatureListRow> getRowsInsideScanAndMZRange(Range<Float> rtRange,
Range<Double> mzRange) {
// TODO handle if mz or rt is not present
return modularStream().filter(
row -> rtRange.contains(row.getAverageRT()) && mzRange.contains(row.getAverageMZ()))
.collect(Collectors.toCollection(FXCollections::observableArrayList));
List<FeatureListRow> rows = new ArrayList<>();
for(var row : getRows()) {
Float rt = row.getAverageRT();
if(rt==null || (rtRange.contains(rt) && mzRange.contains(row.getAverageMZ()))) {
rows.add(row);
} else if(rt>rtRange.upperEndpoint()) {
break;
}
}
return rows;
}

@Override
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/io/github/mzmine/datamodel/impl/SimpleFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.logging.Logger;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand All @@ -46,6 +47,8 @@
*/
public class SimpleFrame extends SimpleScan implements Frame {

private static Logger logger = Logger.getLogger(SimpleFrame.class.getName());

private final MobilityType mobilityType;

@NotNull
Expand Down Expand Up @@ -177,9 +180,17 @@ public List<MobilityScan> getSortedMobilityScans() {
}

public int setMobilities(double[] mobilities) {
if (mobilities.length == 0) {
logger.info(
() -> String.format("No mobilities detected in frame #%d of file %s.", getFrameId(),
getDataFile().getName()));
mobilities = new double[]{1d};
mobilityRange = Range.openClosed(1d, 1d); // empty range
} else {
mobilityRange = Range.singleton(mobilities[0]);
mobilityRange = mobilityRange.span(Range.singleton(mobilities[mobilities.length - 1]));
}
mobilitySegment = ((IMSRawDataFile) getDataFile()).addMobilityValues(mobilities);
mobilityRange = Range.singleton(mobilities[0]);
mobilityRange = mobilityRange.span(Range.singleton(mobilities[mobilities.length - 1]));
return mobilitySegment;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import java.util.List;
import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.labels.XYToolTipGenerator;
Expand All @@ -41,6 +44,7 @@
*/

public class EICPlot extends EChartViewer {
private static java.util.logging.Logger logger = Logger.getLogger(EICPlot.class.getName());
private final XYSeriesCollection xyDataset;
private final List<Double> colorDataset;
private final List<String> toolTips;
Expand Down Expand Up @@ -149,7 +153,7 @@ public void updateData(List<List<NavigableMap<Double, Double>>> clusters, List<D
xyDataset.addSeries(series);
}
catch(Exception e) {
System.out.println(e.getMessage());
logger.log(Level.WARNING, e.getMessage(), e);
}
finally {
colorDataset.add(color);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,9 @@
import javafx.scene.control.Label;
import javafx.scene.control.Separator;

import javax.swing.*;

/**
* @author Du-Lab Team <dulab.binf@gmail.com>
*/

public class ADAP3DecompositionV2SetupDialog extends ParameterSetupDialog {
/**
* Minimum dimensions of plots
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class ADAP3AlignerParameters extends SimpleParameterSet {
public static final DoubleParameter SAMPLE_COUNT_RATIO = new DoubleParameter(
"Min confidence (between 0 and 1)",
"A fraction of the total number of samples. An aligned feature must be detected at "
+ "least in several samples. This parameter determines the minimum number of samples where a "
+ "least in several samples.\nThis parameter determines the minimum number of samples where a "
+ "feature must be detected.",
NumberFormat.getInstance(), 0.7, 0.0, 1.0);

Expand All @@ -71,6 +71,7 @@ public class ADAP3AlignerParameters extends SimpleParameterSet {

public ADAP3AlignerParameters() {
super(new Parameter[] {PEAK_LISTS, SAMPLE_COUNT_RATIO, RET_TIME_RANGE, MZ_RANGE,
SCORE_TOLERANCE, SCORE_WEIGHT, EIC_SCORE, NEW_PEAK_LIST_NAME});
SCORE_TOLERANCE, SCORE_WEIGHT, EIC_SCORE, NEW_PEAK_LIST_NAME},
"https://mzmine.github.io/mzmine_documentation/module_docs/align_adap/align_adap_gc.html");
}
}
Loading

0 comments on commit bef89ac

Please sign in to comment.