Skip to content

Commit bafe32b

Browse files
Merge pull request #1 from robinschmid/isotoprefinement
Update master, simplify isotope scorer
2 parents dd3fadc + 45c5242 commit bafe32b

File tree

12 files changed

+266
-169
lines changed

12 files changed

+266
-169
lines changed

Dockerfile

Whitespace-only changes.

src/main/java/io/github/mzmine/datamodel/features/types/numbers/PotentialType.java

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,42 @@
2525

2626
package io.github.mzmine.datamodel.features.types.numbers;
2727

28-
import io.github.mzmine.datamodel.features.types.numbers.abstr.FloatType;
28+
import io.github.mzmine.datamodel.MZmineProject;
29+
import io.github.mzmine.datamodel.RawDataFile;
30+
import io.github.mzmine.datamodel.features.ModularFeature;
31+
import io.github.mzmine.datamodel.features.ModularFeatureList;
32+
import io.github.mzmine.datamodel.features.ModularFeatureListRow;
33+
import io.github.mzmine.datamodel.features.types.numbers.abstr.IntegerType;
2934
import java.text.DecimalFormat;
3035
import java.text.NumberFormat;
36+
import javax.xml.stream.XMLStreamException;
37+
import javax.xml.stream.XMLStreamReader;
3138
import org.jetbrains.annotations.NotNull;
39+
import org.jetbrains.annotations.Nullable;
3240

33-
public class PotentialType extends FloatType {
41+
public class PotentialType extends IntegerType {
3442

35-
private static final DecimalFormat format = new DecimalFormat("0.00");
43+
private static final DecimalFormat format = new DecimalFormat("0");
3644

3745
public PotentialType() {
38-
super(format);
46+
super();
47+
}
48+
49+
@Override
50+
public Object loadFromXML(@NotNull XMLStreamReader reader, @NotNull MZmineProject project,
51+
@NotNull ModularFeatureList flist, @NotNull ModularFeatureListRow row,
52+
@Nullable ModularFeature feature, @Nullable RawDataFile file) throws XMLStreamException {
53+
String str = reader.getElementText();
54+
if (str == null || str.isEmpty()) {
55+
return null;
56+
}
57+
try {
58+
return Integer.parseInt(str);
59+
} catch (NumberFormatException e) {
60+
// silent, still V value from old projects.
61+
}
62+
63+
return (int) (Float.parseFloat(str) * 1000);
3964
}
4065

4166
@Override
@@ -45,7 +70,7 @@ public PotentialType() {
4570

4671
@Override
4772
public @NotNull String getHeaderString() {
48-
return "Potential / V";
73+
return "Potential / mV";
4974
}
5075

5176
@Override

src/main/java/io/github/mzmine/modules/dataprocessing/id_ecmscalcpotential/CalcEcmsPotentialParameters.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,9 @@ public class CalcEcmsPotentialParameters extends SimpleParameterSet {
3636

3737
public static final FeatureListsParameter flists = new FeatureListsParameter();
3838

39-
public static final DoubleParameter tubingLengthMM = new DoubleParameter("Tubing length / mm",
40-
"Tubing length between EC-Cell and ESI-Needle.", new DecimalFormat("0.0"), 750d);
41-
42-
public static final DoubleParameter tubingIdMM = new DoubleParameter("Tubing inner diameter / mm",
43-
"Inner diameter of the tubing.", new DecimalFormat("0.000"), 0.127d);
44-
45-
public static final DoubleParameter flowRateMicroLiterPerMin = new DoubleParameter(
46-
"Flow rate / μL/min", "Tubing length between EC-Cell and ESI-Needle.", new DecimalFormat("0.0"));
39+
public static final DoubleParameter delayTime = new DoubleParameter("Delay Time / s",
40+
"Delay time before analytes from the EC cell reach the mass spectrometer",
41+
new DecimalFormat("0.0"), 30d);
4742

4843
public static final DoubleParameter potentialRampSpeed = new DoubleParameter(
4944
"Potential ramp / mV/s", "Potential ramp speed in mV/s.");
@@ -53,7 +48,7 @@ public class CalcEcmsPotentialParameters extends SimpleParameterSet {
5348
"Percentage of the maximum metabolite intensity that will be used to assign the formation potential to a metabolite.");
5449

5550
public CalcEcmsPotentialParameters() {
56-
super(new Parameter[]{flists, tubingLengthMM, tubingIdMM, flowRateMicroLiterPerMin, potentialRampSpeed,
51+
super(new Parameter[]{flists, delayTime, potentialRampSpeed,
5752
potentialAssignmentIntensityPercentage});
5853
}
5954
}

src/main/java/io/github/mzmine/modules/dataprocessing/id_ecmscalcpotential/CalcEcmsPotentialTask.java

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,10 @@
4343

4444
public class CalcEcmsPotentialTask extends AbstractTask {
4545

46-
/**
47-
* tubing length in mm
48-
*/
49-
private final double tubingLength;
50-
/**
51-
* tubing id in mm
52-
*/
53-
private final double tubingId;
54-
/**
55-
* flow rate in uL/min
56-
*/
57-
private final double flowRate;
58-
/**
59-
* potential ramp speed in mV/s
60-
*/
46+
6147
private final double potentialRampSpeed;
6248
private final double potentialAssignmentPercentage;
49+
private final double delayTimeSeconds;
6350
private final ModularFeatureList[] flists;
6451

6552
private final ParameterSet parameters;
@@ -74,11 +61,10 @@ protected CalcEcmsPotentialTask(@NotNull MZmineProject project, @NotNull Paramet
7461
this.project = project;
7562

7663
flists = parameters.getValue(CalcEcmsPotentialParameters.flists).getMatchingFeatureLists();
77-
tubingLength = parameters.getValue(CalcEcmsPotentialParameters.tubingLengthMM);
78-
tubingId = parameters.getValue(CalcEcmsPotentialParameters.tubingIdMM);
79-
flowRate = parameters.getValue(CalcEcmsPotentialParameters.flowRateMicroLiterPerMin);
64+
delayTimeSeconds = parameters.getValue(CalcEcmsPotentialParameters.delayTime);
8065
potentialRampSpeed = parameters.getValue(CalcEcmsPotentialParameters.potentialRampSpeed);
81-
potentialAssignmentPercentage = parameters.getValue(CalcEcmsPotentialParameters.potentialAssignmentIntensityPercentage);
66+
potentialAssignmentPercentage = parameters.getValue(
67+
CalcEcmsPotentialParameters.potentialAssignmentIntensityPercentage);
8268
numRows = Arrays.stream(flists).mapToInt(ModularFeatureList::getNumberOfRows).sum();
8369
}
8470

@@ -96,9 +82,6 @@ public double getFinishedPercentage() {
9682
public void run() {
9783
setStatus(TaskStatus.PROCESSING);
9884

99-
final double tubingVolumeMicroL = EcmsUtils.getTubingVolume(tubingLength, tubingId);
100-
final double delayTimeSeconds = EcmsUtils.getDelayTime(flowRate / 60d, tubingVolumeMicroL);
101-
10285
for (ModularFeatureList flist : flists) {
10386
for (FeatureListRow row : flist.getRows()) {
10487
final Feature f = row.getBestFeature();
@@ -126,7 +109,7 @@ public void run() {
126109
// potential in mV
127110
final double potential = EcmsUtils.getPotentialAtRt(eic.getRetentionTime(i),
128111
delayTimeSeconds, potentialRampSpeed);
129-
row.set(PotentialType.class, (float) potential / 1000);
112+
row.set(PotentialType.class, (int) potential);
130113
break;
131114
}
132115
}

src/main/java/io/github/mzmine/modules/dataprocessing/id_ecmscalcpotential/EcmsUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static double getDelayTime(final double flowRate, final double volume) {
5050
* @param rt Retention time in minutes.
5151
* @param potentialRampSpeed Potential ramp speed in mV/s.
5252
* @param delayTime Delay time in s.
53-
* @return The potential at the given retention time.
53+
* @return The potential at the given retention time in mV.
5454
*/
5555
public static double getPotentialAtRt(final float rt, final double delayTime,
5656
final double potentialRampSpeed) {

0 commit comments

Comments
 (0)