Skip to content

Commit

Permalink
Merge pull request #129 from dyrlund/master
Browse files Browse the repository at this point in the history
Fixed various Eclipse warnings
  • Loading branch information
tomas-pluskal committed Mar 22, 2016
2 parents bac11b8 + 4297c99 commit fa50404
Show file tree
Hide file tree
Showing 29 changed files with 160 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,33 +64,37 @@ public void runModule(@Nonnull MZmineProject project,
@Nonnull ParameterSet parameters,
@Nonnull Collection<Task<?>> tasks) {

// Parameter values
final FeatureTablesSelection featureTables = parameters
.getParameter(JoinAlignerParameters.featureTables).getValue();

final MZTolerance mzTolerance = parameters
.getParameter(JoinAlignerParameters.mzTolerance).getValue();

final RTTolerance rtTolerance = parameters
.getParameter(JoinAlignerParameters.rtTolerance).getValue();

final Integer mzWeight = parameters
Integer mzWeight = parameters
.getParameter(JoinAlignerParameters.mzWeight).getValue();

final Integer rtWeight = parameters
Integer rtWeight = parameters
.getParameter(JoinAlignerParameters.rtWeight).getValue();

final Boolean requireSameAnnotation = parameters
Boolean requireSameAnnotation = parameters
.getParameter(JoinAlignerParameters.requireSameAnnotation)
.getValue();

final Boolean requireSameCharge = parameters
Boolean requireSameCharge = parameters
.getParameter(JoinAlignerParameters.requireSameCharge)
.getValue();

final String featureTableName = parameters
.getParameter(JoinAlignerParameters.featureTableName)
.getValue();

// Default values
if (mzWeight == null)
mzWeight = 1;
if (rtWeight == null)
rtWeight = 1;
if (requireSameAnnotation == null)
requireSameAnnotation = false;
if (requireSameCharge == null)
requireSameCharge = false;

final Boolean removeOldTable = parameters
.getParameter(JoinAlignerParameters.removeOldTable).getValue();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ public void runModule(@Nonnull MZmineProject project,
final MZTolerance mzTolerance = parameters
.getParameter(ChromatogramBuilderParameters.mzTolerance)
.getValue();
final Float noiseLevel = parameters
final Double noiseLevel = parameters
.getParameter(ChromatogramBuilderParameters.noiseLevel)
.getValue().floatValue();
.getValue();
final Double minDuration = parameters
.getParameter(ChromatogramBuilderParameters.minDuration)
.getValue();
Expand All @@ -81,7 +81,8 @@ public void runModule(@Nonnull MZmineProject project,
.getParameter(ChromatogramBuilderParameters.nameSuffix)
.getValue();

if (rawDataFiles.getMatchingRawDataFiles().isEmpty()) {
if (rawDataFiles == null
|| rawDataFiles.getMatchingRawDataFiles().isEmpty()) {
logger.warn(
"Chromatogram builder module started with no raw data files selected");
return;
Expand All @@ -99,8 +100,8 @@ public void runModule(@Nonnull MZmineProject project,
// 2. ChromatogramToFeatureTableMethod
ChromatogramBuilderTask newTask = new ChromatogramBuilderTask(
"Chromatogram builder", rawDataFile.getName(), rawDataFile,
dataStore, mzTolerance, noiseLevel, minDuration, minHeight,
nameSuffix);
dataStore, mzTolerance, noiseLevel,
minDuration, minHeight, nameSuffix);

// Add the feature table to the project
newTask.setOnSucceeded(e -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ public class ChromatogramBuilderTask extends Task<Object>
private String title, message;
private FeatureTable featureTable;

private MSDKMethod<?> chromatogramBuilderMethod;
private MSDKMethod<?> chromatogramToFeatureTableMethod;
private MSDKMethod<List<Chromatogram>> chromatogramBuilderMethod;
private MSDKMethod<FeatureTable> chromatogramToFeatureTableMethod;

public ChromatogramBuilderTask(String title, @Nullable String message,
@Nonnull RawDataFile rawDataFile, @Nonnull DataPointStore dataStore,
@Nonnull MZTolerance mzTolerance, @Nonnull Float noiseLevel,
@Nonnull MZTolerance mzTolerance, @Nonnull Double noiseLevel,
@Nonnull Double minDuration, @Nonnull Double minHeight,
@Nullable String nameSuffix) {
this.rawDataFile = rawDataFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@
import io.github.msdk.datamodel.datastore.DataPointStoreFactory;
import io.github.msdk.datamodel.featuretables.FeatureTable;
import io.github.msdk.datamodel.rawdata.RawDataFile;
import io.github.msdk.featdet.srmdetection.SrmDetectionMethod;
import io.github.mzmine.modules.MZmineProcessingModule;
import io.github.mzmine.modules.featuredetection.chromatogrambuilder.ChromatogramBuilderTask;
import io.github.mzmine.parameters.ParameterSet;
import io.github.mzmine.parameters.parametertypes.selectors.RawDataFilesSelection;
import io.github.mzmine.project.MZmineProject;
import io.github.mzmine.taskcontrol.MSDKTask;
import javafx.concurrent.Task;

/**
Expand Down Expand Up @@ -88,8 +85,8 @@ public void runModule(@Nonnull MZmineProject project,
// 1. SrmDetectionMethod
// 2. ChromatogramToFeatureTableMethod
SrmDetectionTask newTask = new SrmDetectionTask(
"SRM feature detection", rawDataFile.getName(), rawDataFile, dataStore,
nameSuffix);
"SRM feature detection", rawDataFile.getName(), rawDataFile,
dataStore, nameSuffix);

// Add the feature table to the project
newTask.setOnSucceeded(e -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public class SrmDetectionTask extends Task<Object> implements MZmineTask {
private String title, message;
private FeatureTable featureTable;

private MSDKMethod<?> srmDetectionMethod;
private MSDKMethod<?> chromatogramToFeatureTableMethod;
private MSDKMethod<List<Chromatogram>> srmDetectionMethod;
private MSDKMethod<FeatureTable> chromatogramToFeatureTableMethod;

public SrmDetectionTask(String title, @Nullable String message,
@Nonnull RawDataFile rawDataFile, @Nonnull DataPointStore dataStore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void handle(MouseEvent event) {
cm.getItems().add(new SeparatorMenuItem());

// Sample specific columns
for (TreeTableColumn col : tableColumn.getColumns()) {
for (TreeTableColumn<?, ?> col : tableColumn.getColumns()) {
cb = new CheckBox("Sample: " + col.getText());

// Bind to all equal sample specific columns
Expand All @@ -184,7 +184,7 @@ public void handle(MouseEvent event) {
int childrenColumns2 = tableColumn2.getColumns().size();
if (childrenColumns2 != 0) {

for (TreeTableColumn col2 : tableColumn2
for (TreeTableColumn<?, ?> col2 : tableColumn2
.getColumns()) {
if (col.getText().equals(col2.getText())) {
cb.selectedProperty().bindBidirectional(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ public void runModule(@Nonnull MZmineProject project,
TreeItem<FeatureTableRow> treeItem;

// Group rows
FeatureTableColumn groupColoumn = featureTable
FeatureTableColumn<Integer> groupColoumn = featureTable
.getColumn(ColumnName.GROUPID, null);
FeatureTableColumn idColoumn = featureTable.getColumn(ColumnName.ID,
FeatureTableColumn<Integer> idColoumn = featureTable.getColumn(ColumnName.ID,
null);
for (FeatureTableRow row : rows) {
// No group column
Expand All @@ -118,18 +118,18 @@ else if (row.getData(groupColoumn) == null) {
treeItem = new TreeItem<>(row);
treeItem.setExpanded(true);
root.getChildren().add(treeItem);
rowMap.put((int) row.getData(idColoumn), treeItem);
rowMap.put(row.getData(idColoumn), treeItem);
}
// The row has a group id
else {
Integer groupID = (int) row.getData(groupColoumn);
Integer groupID = row.getData(groupColoumn);
TreeItem<FeatureTableRow> parentTreeItem = rowMap.get(groupID);
if (parentTreeItem == null) {
parentTreeItem = root;
}
treeItem = new TreeItem<>(row);
parentTreeItem.getChildren().add(treeItem);
rowMap.put((int) row.getData(idColoumn), treeItem);
rowMap.put(row.getData(idColoumn), treeItem);
}
}

Expand Down Expand Up @@ -172,7 +172,7 @@ public ObservableValue<Object> call(
});

// Set column renderer
Class renderClass = ColumnRenderers
Class<?> renderClass = ColumnRenderers
.getRenderClass(column.getName());
Callback<TreeTableColumn<FeatureTableRow, Object>, TreeTableCell<FeatureTableRow, Object>> rendeder = null;
try {
Expand Down Expand Up @@ -228,7 +228,7 @@ public ObservableValue<Object> call(
});

// Set column renderer
Class renderClass = ColumnRenderers
Class<?> renderClass = ColumnRenderers
.getRenderClass(column.getName());
Callback<TreeTableColumn<FeatureTableRow, Object>, TreeTableCell<FeatureTableRow, Object>> rendeder = null;
try {
Expand Down Expand Up @@ -267,11 +267,11 @@ public void handle(MouseEvent event) {
if (event.isPrimaryButtonDown() && event.getClickCount() == 2) {
// Find feature table row
Node node = ((Node) event.getTarget()).getParent();
TreeTableRow row;
TreeTableRow<?> row;
while (!(node instanceof TreeTableRow)) {
node = node.getParent();
}
row = (TreeTableRow) node;
row = (TreeTableRow<?>) node;
FeatureTableRow featureTableRow = (FeatureTableRow) row
.getItem();

Expand All @@ -281,7 +281,7 @@ public void handle(MouseEvent event) {
.getSelectionModel().getSelectedCells();
for (TreeTablePosition<FeatureTableRow, ?> cell : cells) {
if (cell.getTableColumn().getParentColumn() != null) {
TreeTableColumn parentColumn = (TreeTableColumn) cell
TreeTableColumn<?,?> parentColumn = (TreeTableColumn) cell
.getTableColumn().getParentColumn();
List<Sample> samples = featureTable.getSamples();
for (Sample s : samples) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public void runModule(@Nonnull MZmineProject project,
.getExtension(fileName.getAbsolutePath());
MSDKMethod<?> method = null;
switch (fileExtension.toUpperCase()) {
default:
case "CSV":
method = new CsvFileImportMethod(fileName, dataStore);
break;
Expand All @@ -122,7 +123,7 @@ public void runModule(@Nonnull MZmineProject project,
// Remove common prefix
if (!Strings.isNullOrEmpty(removePrefix)) {
String name = featureTable.getName();
if (name.startsWith(removePrefix))
if (removePrefix != null && name.startsWith(removePrefix))
name = name.substring(removePrefix.length());
featureTable.setName(name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,16 @@ public class FeatureTableImportParameters extends ParameterSet {
src = src.getParent();

}
for (PropertySheet.Item item : sheet.getItems()) {
if (item instanceof FileNamesParameter) {
List<File> fileNames = (List<File>) item.getValue();
if (fileNames == null)
return;
String commonPrefix = FileNameUtil
.findCommonPrefix(fileNames);
editor.setValue(commonPrefix);
if (sheet != null && editor != null) {
for (PropertySheet.Item item : sheet.getItems()) {
if (item instanceof FileNamesParameter) {
List<File> fileNames = (List<File>) item.getValue();
if (fileNames == null)
return;
String commonPrefix = FileNameUtil
.findCommonPrefix(fileNames);
editor.setValue(commonPrefix);
}
}
}
});
Expand All @@ -95,17 +97,19 @@ public class FeatureTableImportParameters extends ParameterSet {
src = src.getParent();

}
for (PropertySheet.Item item : sheet.getItems()) {
if (item instanceof FileNamesParameter) {
List<File> fileNames = (List<File>) item.getValue();
if (fileNames == null)
continue;
String commonSuffix = FileNameUtil
.findCommonSuffix(fileNames);
// If no common suffix then remove file extension
if (Strings.isNullOrEmpty(commonSuffix))
commonSuffix = ".*";
editor.setValue(commonSuffix);
if (sheet != null && editor != null) {
for (PropertySheet.Item item : sheet.getItems()) {
if (item instanceof FileNamesParameter) {
List<File> fileNames = (List<File>) item.getValue();
if (fileNames == null)
continue;
String commonSuffix = FileNameUtil
.findCommonSuffix(fileNames);
// If no common suffix then remove file extension
if (Strings.isNullOrEmpty(commonSuffix))
commonSuffix = ".*";
editor.setValue(commonSuffix);
}
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,38 @@ public void runModule(@Nonnull MZmineProject project,
@Nonnull Collection<Task<?>> tasks) {

// Boolean values
final Boolean filterByDuration = parameters
Boolean filterByDuration = parameters
.getParameter(FeatureFilterParameters.duration).getValue();
final Boolean filterByArea = parameters
Boolean filterByArea = parameters
.getParameter(FeatureFilterParameters.area).getValue();
final Boolean filterByHeight = parameters
Boolean filterByHeight = parameters
.getParameter(FeatureFilterParameters.height).getValue();
final Boolean filterByDataPoints = parameters
Boolean filterByDataPoints = parameters
.getParameter(FeatureFilterParameters.dataPoints).getValue();
final Boolean filterByFWHM = parameters
Boolean filterByFWHM = parameters
.getParameter(FeatureFilterParameters.fwhm).getValue();
final Boolean filterByTailingFactor = parameters
Boolean filterByTailingFactor = parameters
.getParameter(FeatureFilterParameters.tailingFactor).getValue();
final Boolean filterByAsymmetryFactor = parameters
Boolean filterByAsymmetryFactor = parameters
.getParameter(FeatureFilterParameters.asymmetryFactor)
.getValue();

// Default values
if (filterByDuration == null)
filterByDuration = false;
if (filterByArea == null)
filterByArea = false;
if (filterByHeight == null)
filterByHeight = false;
if (filterByDataPoints == null)
filterByDataPoints = false;
if (filterByFWHM == null)
filterByFWHM = false;
if (filterByTailingFactor == null)
filterByTailingFactor = false;
if (filterByAsymmetryFactor == null)
filterByAsymmetryFactor = false;

// Embedded values
final Range<Double> durationRange = parameters
.getParameter(FeatureFilterParameters.duration)
Expand Down
Loading

0 comments on commit fa50404

Please sign in to comment.