From 81f185ce47ce6b903f49f6cfbe4096ae0a44f256 Mon Sep 17 00:00:00 2001 From: likai Date: Thu, 21 Jan 2021 21:08:42 -0600 Subject: [PATCH] Fix columns selection bug --- .DS_Store | Bin 8196 -> 6148 bytes pom.xml | 2 +- .../PDVGUI/fileimport/FragePipeImport.java | 9 ++++-- .../PDVGUI/fileimport/MzIDFileImport.java | 28 +++++++++++++----- src/main/java/PDVGUI/gui/PDVMainClass.java | 9 +++++- .../PDVGUI/gui/utils/SpectrumMainPanel.java | 12 +++++--- .../gui/utils/TableModel/FrageTableModel.java | 4 +-- 7 files changed, 47 insertions(+), 17 deletions(-) diff --git a/.DS_Store b/.DS_Store index 4c038c872016b81a7ea7598dce095ec7be57f744..962cd90944f925967adb3f6d9655d395bd81ed09 100644 GIT binary patch delta 103 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{Mvv5r;6q~50$jG}fU^g=(?`9r>h0GI6q877r pa0oI36##(%H;`}zsohxkoq009j3-DZ0~5p)kiiU_<9X&V0{~{{5C;GN delta 173 zcmZoMXmOBWU|?W$DortDU;r^WfEYvza8E20o2aMAD6lbLH}hr%jz7$c**Q2SHn1=X zZ02EE$jr^gP{NSNP{feVkUCk6MUfYY&rmXXKidsS6p^yvqP(2^ymXLtn;(d%Fi&jY p5o8APfIxy9NVtM5-7LuQoq009i05Q~9u5vhhPDV PDV jar - 1.7.0 + 1.7.1 PDV https://github.com/wenbostar/PDV An integrative proteomics viewer diff --git a/src/main/java/PDVGUI/fileimport/FragePipeImport.java b/src/main/java/PDVGUI/fileimport/FragePipeImport.java index 7c9c01a..8c69fdc 100644 --- a/src/main/java/PDVGUI/fileimport/FragePipeImport.java +++ b/src/main/java/PDVGUI/fileimport/FragePipeImport.java @@ -27,6 +27,7 @@ import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Statement; +import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -92,6 +93,10 @@ public class FragePipeImport { * Progress dialog */ private ProgressDialogX progressDialog; + /** + * Decimal + */ + DecimalFormat df = new DecimalFormat("####0.000"); /** * Main constructor @@ -271,7 +276,7 @@ private void parseResultMzML() throws IOException, SQLException { peptideSequence = lineSplit[peptideSequenceIndex]; caculatedMZ = Double.valueOf(lineSplit[caculatedMZIndex]); observedMZ = Double.valueOf(lineSplit[observedMZIndex]); - massError = caculatedMZ - observedMZ; + massError = Double.valueOf(df.format(observedMZ - caculatedMZ)); assignedMod = lineSplit[assignenModIndex]; if (count == 0){ @@ -499,7 +504,7 @@ private void parseResultMGF() throws IOException, SQLException, ClassNotFoundExc peptideSequence = lineSplit[peptideSequenceIndex]; caculatedMZ = Double.valueOf(lineSplit[caculatedMZIndex]); observedMZ = Double.valueOf(lineSplit[observedMZIndex]); - massError = caculatedMZ - observedMZ; + massError = observedMZ - caculatedMZ; assignedMod = lineSplit[assignenModIndex]; if (count == 0){ diff --git a/src/main/java/PDVGUI/fileimport/MzIDFileImport.java b/src/main/java/PDVGUI/fileimport/MzIDFileImport.java index 02db1ae..4f4c796 100644 --- a/src/main/java/PDVGUI/fileimport/MzIDFileImport.java +++ b/src/main/java/PDVGUI/fileimport/MzIDFileImport.java @@ -301,8 +301,9 @@ private void parseMzID() throws SQLException, IOException { } ArrayList fileInFactory = spectrumFactory.getMgfFileNames(); + String spectrumFileNotInMzID = ""; - Integer matchFileNum = 0; + int matchFileNum = 0; for(String id: spectrumFileMap.keySet()){ @@ -312,18 +313,27 @@ private void parseMzID() throws SQLException, IOException { matchFileNum++; } - } else if (spectrumFileType.equals("mzml") || spectrumFileType.equals("mzxml")){ + } else if (spectrumFileType.equals("mzml") || spectrumFileType.equals("mzxml")){ matchFileNum++; } } if (matchFileNum == 0){ System.out.println("No matching file"); - JOptionPane.showMessageDialog( - null, "The spectrum file cannot match it in mzIdentML", - "Error Matching", JOptionPane.ERROR_MESSAGE); - Thread.currentThread().interrupt(); - progressDialog.setRunFinished(); + spectrumFileNotInMzID = spectrumFactory.getMgfFileNames().get(0); //No Match mgf in MzID. Select first input mgf of user input + + int value = JOptionPane.showConfirmDialog( + null, "The spectrum file cannot match it in mzIdentML. Do you want to continue?", + "Error Matching", + JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); + + if (value == JOptionPane.YES_OPTION) { + //Nothing + } else if (value == JOptionPane.NO_OPTION) { + Thread.currentThread().interrupt(); + progressDialog.setRunFinished(); + } + } int count = 0; @@ -426,6 +436,10 @@ private void parseMzID() throws SQLException, IOException { currentSpectrumFile = currentSpectrumFile.substring(currentSpectrumFile.lastIndexOf("/") + 1, currentSpectrumFile.length()); } + if (matchFileNum == 0){ + currentSpectrumFile = spectrumFileNotInMzID; + } + currentMatch = new SpectrumMatch(Spectrum.getSpectrumKey(currentSpectrumFile, spectrumIndex)); if (spectrumFileType.equals("mgf")) { diff --git a/src/main/java/PDVGUI/gui/PDVMainClass.java b/src/main/java/PDVGUI/gui/PDVMainClass.java index dfada19..5f4e499 100644 --- a/src/main/java/PDVGUI/gui/PDVMainClass.java +++ b/src/main/java/PDVGUI/gui/PDVMainClass.java @@ -258,7 +258,7 @@ public class PDVMainClass extends JFrame { /** * Version */ - private static final String VERSION = "1.7.0"; + private static final String VERSION = "1.7.1"; /** * Main class @@ -3319,6 +3319,13 @@ private void columnSelectionJMenuItemActionPerformed(ActionEvent evt){ } columnName.addAll(scoreName); + if(columnToSelected == null){ + columnToSelected = new HashMap<>(); + for (String eachColumn: columnName){ + columnToSelected.put(eachColumn, true); + } + } + new ColumnSelectionDialog(this, spectrumJTable, columnName); } diff --git a/src/main/java/PDVGUI/gui/utils/SpectrumMainPanel.java b/src/main/java/PDVGUI/gui/utils/SpectrumMainPanel.java index 16c410b..5799c94 100644 --- a/src/main/java/PDVGUI/gui/utils/SpectrumMainPanel.java +++ b/src/main/java/PDVGUI/gui/utils/SpectrumMainPanel.java @@ -544,8 +544,8 @@ private void initComponents(){ reporterIonsCheckMenuItem.addActionListener(this::reporterIonsCheckMenuItemAction); otherMenu.add(reporterIonsCheckMenuItem); - //glyconsCheckMenuItem.setSelected(true); - glyconsCheckMenuItem.setEnabled(false); + glyconsCheckMenuItem.setEnabled(true); // Just test for YC. This should be false. + //glyconsCheckMenuItem.setEnabled(false); glyconsCheckMenuItem.setText("Glycan"); glyconsCheckMenuItem.setFont(menuFont); glyconsCheckMenuItem.addActionListener(this::glyconsCheckMenuItemAction); @@ -1481,6 +1481,9 @@ public void updateSpectrum(){ } } + // Just for FC test. This should be deleted. + glycanContain = true; + /* Just for FC test. This should be enabled. if (glycanProb >= 1){ glycanContain = true; glyconsCheckMenuItem.setSelected(glycanSelected); @@ -1489,7 +1492,7 @@ public void updateSpectrum(){ glycanContain = false; glyconsCheckMenuItem.setSelected(false); glyconsCheckMenuItem.setEnabled(false); - } + }*/ updateAnnotationSettings(); annotations = peptideSpectrumAnnotator.getSpectrumAnnotationFiter(annotationSettings, specificAnnotationSettings, currentSpectrum, currentPeptide, null, true); @@ -2340,9 +2343,10 @@ private void updateAnnotationSettings() { } } + /* Just test for FC. This should be enabled. if (glycanSelected & glycanContain){ glyconsCheckMenuItem.setSelected(true); - } + }*/ if (glyconsCheckMenuItem.isSelected()){ glycanSelected = true; diff --git a/src/main/java/PDVGUI/gui/utils/TableModel/FrageTableModel.java b/src/main/java/PDVGUI/gui/utils/TableModel/FrageTableModel.java index b676f02..6557515 100644 --- a/src/main/java/PDVGUI/gui/utils/TableModel/FrageTableModel.java +++ b/src/main/java/PDVGUI/gui/utils/TableModel/FrageTableModel.java @@ -103,7 +103,7 @@ public String getColumnName(int column) { }else if(column == 7){ return "m/z"; }else if(column == 8){ - return "Mass error"; + return "m/z error"; } for(int index = 0; index < scoreName.size(); index++){ int newColumn = index + 9; @@ -195,7 +195,7 @@ public Object getValueAt(int row, int column) { if(peptideAssumption.getScore() != null){ return peptideAssumption.getScore(); } else { - return 0.0; + return "-"; } } for(int index = 0; index < scoreName.size(); index++){