Skip to content

Commit

Permalink
Fix columns selection bug
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiLiCn committed Jan 22, 2021
1 parent f802b62 commit 81f185c
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 17 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>PDV</groupId>
<artifactId>PDV</artifactId>
<packaging>jar</packaging>
<version>1.7.0</version>
<version>1.7.1</version>
<name>PDV</name>
<url>https://github.com/wenbostar/PDV</url>
<description>An integrative proteomics viewer</description>
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/PDVGUI/fileimport/FragePipeImport.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -92,6 +93,10 @@ public class FragePipeImport {
* Progress dialog
*/
private ProgressDialogX progressDialog;
/**
* Decimal
*/
DecimalFormat df = new DecimalFormat("####0.000");

/**
* Main constructor
Expand Down Expand Up @@ -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){
Expand Down Expand Up @@ -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){
Expand Down
28 changes: 21 additions & 7 deletions src/main/java/PDVGUI/fileimport/MzIDFileImport.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,9 @@ private void parseMzID() throws SQLException, IOException {
}

ArrayList<String> fileInFactory = spectrumFactory.getMgfFileNames();
String spectrumFileNotInMzID = "";

Integer matchFileNum = 0;
int matchFileNum = 0;

for(String id: spectrumFileMap.keySet()){

Expand All @@ -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;
Expand Down Expand Up @@ -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")) {
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/PDVGUI/gui/PDVMainClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down
12 changes: 8 additions & 4 deletions src/main/java/PDVGUI/gui/utils/SpectrumMainPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++){
Expand Down

0 comments on commit 81f185c

Please sign in to comment.