From c9f102e599fbcaa5cb2d819d7e10e051e753a15b Mon Sep 17 00:00:00 2001 From: Genet Abay Date: Sat, 3 Mar 2018 01:25:47 +0100 Subject: [PATCH] validation + Control refactoring --- .../coss/Controller/MainFrameController.java | 212 +++++++++++------- .../compomics/coss/Controller/Validation.java | 20 +- .../com/compomics/coss/Model/ConfigData.java | 14 +- .../java/com/compomics/coss/View/MainGUI.java | 80 ++----- .../com/compomics/coss/View/RasterPanel.java | 6 +- .../compomics/coss/View/SearchCommandPnl.java | 76 +++++++ .../com/compomics/coss/View/SettingPanel.java | 2 +- .../coss/View/ValidationCommandPanel.java | 87 +++++++ .../coss/View/ValidationHistogramPanel.java | 207 +++++++++++++++++ .../compomics/coss/View/ValidationPanel.java | 192 ---------------- .../coss/View/testvalidationpanel.form | 99 +++++++- .../coss/View/testvalidationpanel.java | 69 +++++- .../java/com/compomics/main/ProjectMain.java | 9 +- .../java/com/compomics/matching/Cascade.java | 4 +- .../java/com/compomics/matching/Matching.java | 2 +- .../com/compomics/matching/UseMsRoben.java | 7 +- 16 files changed, 713 insertions(+), 373 deletions(-) create mode 100644 src/main/java/com/compomics/coss/View/SearchCommandPnl.java create mode 100644 src/main/java/com/compomics/coss/View/ValidationCommandPanel.java create mode 100644 src/main/java/com/compomics/coss/View/ValidationHistogramPanel.java delete mode 100644 src/main/java/com/compomics/coss/View/ValidationPanel.java diff --git a/src/main/java/com/compomics/coss/Controller/MainFrameController.java b/src/main/java/com/compomics/coss/Controller/MainFrameController.java index 6ff9d22..467cf5d 100644 --- a/src/main/java/com/compomics/coss/Controller/MainFrameController.java +++ b/src/main/java/com/compomics/coss/Controller/MainFrameController.java @@ -1,7 +1,6 @@ package com.compomics.coss.Controller; -import com.compomics.coss.Model.ComparisonResult; -import com.compomics.coss.Model.ConfigData; +import com.compomics.coss.Model.*; import java.awt.Dimension; import java.util.ArrayList; import java.util.List; @@ -17,12 +16,7 @@ import org.apache.log4j.PatternLayout; import org.apache.log4j.Priority; import com.compomics.coss.Model.ConfigHolder; -import com.compomics.coss.View.SpecPanel; -import com.compomics.coss.View.MainGUI; -import com.compomics.coss.View.ResultPanel; -import com.compomics.coss.View.SettingPanel; -import com.compomics.coss.View.RasterPanel; -import com.compomics.coss.View.TargetDB_View; +import com.compomics.coss.View.*; import com.compomics.matching.Cascade; import java.io.BufferedWriter; import java.io.File; @@ -37,13 +31,11 @@ import javax.swing.SpinnerNumberModel; import javax.swing.table.DefaultTableModel; //import org.jfree.util.Log; -import com.compomics.ms2io.IndexKey; -import com.compomics.ms2io.Indexer; -import com.compomics.ms2io.MgfReader; -import com.compomics.ms2io.MspReader; -import com.compomics.ms2io.Spectrum; -import com.compomics.ms2io.SpectrumReader; +import com.compomics.ms2io.*; +import java.awt.BorderLayout; import java.util.Collections; +import java.util.Map; +import java.util.TreeMap; /** * Controller class for GUI @@ -60,11 +52,16 @@ public class MainFrameController implements UpdateListener { private MainGUI mainView; private SettingPanel settingsPnl; private ResultPanel resultPnl; + private ValidationHistogramPanel valdHistPnl; private TargetDB_View targetView; + private SearchCommandPnl srchCmdPnl; + private ValidationCommandPanel valdtCmdPnl; // private ConfigHolder config = new ConfigHolder(); Matching matching; - private static List> res; + private static List> resultTarget=null; + private static List> resultDecoy=null; + private static List> resultMerged=null; int cutoff_index; ConfigData configData; public boolean cencelled = false; @@ -87,8 +84,14 @@ public void init() { String libPath = ConfigHolder.getInstance().getString("spectra.library.path"); settingsPnl = new SettingPanel(this, new File(libPath)); resultPnl = new ResultPanel(this); - targetView = new TargetDB_View(this); - mainView = new MainGUI(settingsPnl, resultPnl, targetView, this); + targetView = new TargetDB_View(this); + + srchCmdPnl=new SearchCommandPnl(this); + valdtCmdPnl=new ValidationCommandPanel(this); + + mainView = new MainGUI(settingsPnl, resultPnl, targetView,this); + mainView.pnlCommands.setLayout(new BorderLayout()); + mainView.pnlCommands.add(srchCmdPnl); configData = new ConfigData(); // add gui appender @@ -105,10 +108,10 @@ public void init() { // settingsPnl.txtPrecursorTolerance.setText(Integer.toString(20)); // settingsPnl.txtPrecursorCharge.setText(Integer.toString(3)); final String[] colNamesRes = {"No.", "ID", "Name/Title", "M/Z", "Charge", "Score", "Confidence(%)"}; - final String[] colNamesTar = {"No.", "ID", "Name/Title", "M/Z", "Charge", "No. Peaks"}; + final String[] colNamesExperimental = {"No.", "ID", "Name/Title", "M/Z", "Charge", "No. Peaks"}; tblModelResult = new DefaultTableModel(colNamesRes, 0); - tblModelTarget = new DefaultTableModel(colNamesTar, 0); + tblModelTarget = new DefaultTableModel(colNamesExperimental, 0); spnModel = new SpinnerNumberModel(1, 1, 1, 1); targetView.spnSpectrum.setModel(spnModel); @@ -118,8 +121,8 @@ public void init() { //cmbModel = new DefaultComboBoxModel(); //settingsPnl.cboSpectraLibrary.setModel(cmbModel); - mainView.prgProgress.setStringPainted(true); - mainView.prgProgress.setForeground(Color.BLUE); + srchCmdPnl.prgProgress.setStringPainted(true); + srchCmdPnl.prgProgress.setForeground(Color.BLUE); spectrumDisplay(0); rasterDisplay(); @@ -129,6 +132,22 @@ public void init() { }// + public void cmdViewDisplay(int a){ + if(a==0){ + mainView.pnlCommands.removeAll(); + mainView.pnlCommands.add(srchCmdPnl); + + } + else{ + mainView.pnlCommands.removeAll(); + mainView.pnlCommands.add(valdtCmdPnl, BorderLayout.EAST); + if(valdHistPnl!=null) + mainView.pnlCommands.add(valdHistPnl, BorderLayout.CENTER); + + } + + } + /** * Show the view of this controller. */ @@ -172,9 +191,9 @@ public void startSearch() { this.cencelled = false; this.isBussy = true; - isValidation=false; + isValidation = false; matching = new UseMsRoben(this, configData.getExpSpecReader(), configData.getExpSpectraIndex(), configData.getLibSpecReader(), "target"); - mainView.prgProgress.setValue(0); + srchCmdPnl.prgProgress.setValue(0); SwingWorkerThread workerThread = new SwingWorkerThread(); workerThread.execute(); @@ -192,37 +211,32 @@ public void startSearch() { * start search against decoy database */ private void validateResult(File decoydbFile) { - - SpectrumReader rdDecoy=null; - List decoyindxList=null; + + SpectraReader rdDecoy = null; + List decoyindxList = null; try { - Indexer giExp = new Indexer(decoydbFile); + Indexer giExp = new Indexer(decoydbFile); decoyindxList = giExp.generate(); Collections.sort(decoyindxList); - + //reader for decoy spectrum file - if (decoydbFile.getName().endsWith("mgf")) { rdDecoy = new MgfReader(decoydbFile, decoyindxList); - } else if (decoydbFile.getName().endsWith("msp")) { rdDecoy = new MspReader(decoydbFile, decoyindxList); } - + } catch (IOException ex) { LOG.info(ex); } - - - + isValidation = true; matching = new UseMsRoben(this, configData.getExpSpecReader(), configData.getExpSpectraIndex(), rdDecoy, "decoy"); - mainView.prgProgress.setValue(0); + srchCmdPnl.prgProgress.setValue(0); SwingWorkerThread workerThread = new SwingWorkerThread(); workerThread.execute(); - } @@ -249,9 +263,13 @@ private void ReadInputData() { private void readSpectra() { try { + Map mp = new TreeMap(); + mp.put(1, 1); + mp.put(2, 2); + mp.put(3, 1); LOG.info("Reading Data ...."); - mainView.btnStartSearch.setEnabled(false); + srchCmdPnl.btnStartSearch.setEnabled(false); //Read target and librart spectra // List experimentalSpectra; @@ -282,22 +300,22 @@ private void readSpectra() { //reader for experimental spectrum file if (configData.getExperimentalSpecFile().getName().endsWith("mgf")) { - SpectrumReader rd = new MgfReader(configData.getExperimentalSpecFile(), configData.getExpSpectraIndex()); + SpectraReader rd = new MgfReader(configData.getExperimentalSpecFile(), configData.getExpSpectraIndex()); configData.setExpSpecReader(rd); } else if (configData.getExperimentalSpecFile().getName().endsWith("msp")) { - SpectrumReader rd = new MspReader(configData.getExperimentalSpecFile(), configData.getExpSpectraIndex()); + SpectraReader rd = new MspReader(configData.getExperimentalSpecFile(), configData.getExpSpectraIndex()); configData.setExpSpecReader(rd); } //reader for spectral library file if (configData.getSpecLibraryFile().getName().endsWith("mgf")) { - SpectrumReader rd = new MgfReader(configData.getSpecLibraryFile(), configData.getSpectraLibraryIndex()); + SpectraReader rd = new MgfReader(configData.getSpecLibraryFile(), configData.getSpectraLibraryIndex()); configData.setLibSpecReader(rd); } else if (configData.getSpecLibraryFile().getName().endsWith("msp")) { - SpectrumReader rd = new MspReader(configData.getSpecLibraryFile(), configData.getSpectraLibraryIndex()); + SpectraReader rd = new MspReader(configData.getSpecLibraryFile(), configData.getSpectraLibraryIndex()); configData.setLibSpecReader(rd); } @@ -446,10 +464,10 @@ private void showMessageDialog(final String title, final String message, final i private void displayResult() { try { - if (!res.get(targSpectrumNum).isEmpty()) { + if (!resultTarget.get(targSpectrumNum).isEmpty()) { Spectrum targSpec = configData.getExpSpecReader().readAt(configData.getExpSpectraIndex().get(targSpectrumNum).getPos()); - ArrayList singleResult = res.get(targSpectrumNum); + ArrayList singleResult = resultTarget.get(targSpectrumNum); if (singleResult != null) { ComparisonResult targMatchedResult = singleResult.get(resultNumber); @@ -477,23 +495,23 @@ private void displayResult() { /** * Fill table with target spectra */ - private void fillTargetTable() { + private void fillExpSpectraTable() { tblModelTarget.setRowCount(0); int targetsize = configData.getExpSpectraIndex().size(); - Spectrum tSpec; + Spectrum expSpec; Object[][] rows = new Object[targetsize][6]; for (int p = 0; p < targetsize; p++) { // name = d.getSpectra1().get(p).getSpectrumTitle(); - tSpec = configData.getExpSpecReader().readAt(configData.getExpSpectraIndex().get(p).getPos()); + expSpec = configData.getExpSpecReader().readAt(configData.getExpSpectraIndex().get(p).getPos()); rows[p][0] = p + 1; rows[p][1] = "ID" + Integer.toString(p + 1); - rows[p][2] = tSpec.getTitle(); - rows[p][3] = tSpec.getPCMass(); - rows[p][4] = tSpec.getCharge(); - rows[p][5] = tSpec.getNumPeaks(); + rows[p][2] = expSpec.getTitle(); + rows[p][3] = expSpec.getPCMass(); + rows[p][4] = expSpec.getCharge(); + rows[p][5] = expSpec.getNumPeaks(); tblModelTarget.addRow(rows[p]); } @@ -507,7 +525,7 @@ private void fillTargetTable() { */ public void fillBestmatchTable(int target) { - ArrayList singleResult = res.get(target); + ArrayList singleResult = resultTarget.get(target); targSpectrumNum = target; if (!singleResult.isEmpty()) { @@ -539,6 +557,42 @@ public void fillBestmatchTable(int target) { } + /** + * fill table with best matched spectra + * + * + */ + public void fillBestmatchTable() { + + //ArrayList singleResult = resultTarget.get(target); + + int a = 0; + Object[][] rows = new Object[10][8]; + + for (ArrayList res : resultTarget) { + + if (!res.isEmpty()) { + Long pos = res.get(0).getSpecPosition(); + + rows[a][0] = a + 1; + rows[a][1] = "ID" + Integer.toString(a); + rows[a][2] = res.get(0).getTitle(); + rows[a][3] = res.get(0).getPrecMass(); + rows[a][4] = res.get(0).getCharge(); + rows[a][5] = res.get(0).getScore(); + + double conf = (res.get(0).getScore() / 400) * 100; + rows[a][6] = Math.round(conf); + tblModelResult.addRow(rows[a]); + a++; + } + + } + + updateresultview(0); + + } + /** * Updates progress bar value during the comparison process * @@ -550,8 +604,8 @@ public void updateprogressbar(double percent) { final double PERCENT = percent; SwingUtilities.invokeLater(() -> { int v = (int) (100 * PERCENT); - mainView.prgProgress.setValue(v); - mainView.prgProgress.setString(Integer.toString(v) + "%"); + srchCmdPnl.prgProgress.setValue(v); + srchCmdPnl.prgProgress.setString(Integer.toString(v) + "%"); }); } @@ -617,7 +671,7 @@ public void saveSettings() { */ public void saveResult() throws InterruptedException { - if (res != null) { + if (resultTarget != null) { JFileChooser fileChooser = new JFileChooser("D:/"); fileChooser.setDialogTitle("Specify a file to save"); @@ -630,7 +684,7 @@ public void saveResult() throws InterruptedException { try { writer = new BufferedWriter(new FileWriter(filename)); - for (ArrayList singleTargetResult : res) { + for (ArrayList singleTargetResult : resultTarget) { for (ComparisonResult r : singleTargetResult) { double confidence = (r.getScore() / 400.0) * 100.0;//value of the score confidence = Math.round(confidence); @@ -732,24 +786,26 @@ public void spectrumDisplay(int specIndex) { } - - /** * swing thread to start the search and it runs on background */ private class SwingWorkerThread extends SwingWorker { - - List> tempRes; - @Override protected Void doInBackground() throws Exception { matching.InpArgs(Integer.toString(configData.getMsRobinOption()), Integer.toString(configData.getIntensityOption()), Double.toString(configData.getfragTol())); - tempRes = new ArrayList<>(); - tempRes = matching.compare(LOG); - - + if (!isValidation) { + resultTarget = matching.compare(LOG); + cutoff_index = resultTarget.size() - 1; + } else { + resultDecoy = matching.compare(LOG); + Validation validation = new Validation(); + resultMerged = validation.compareNmerge(resultTarget, resultDecoy); + cutoff_index = validation.validate(resultTarget, 0.01); + isValidation = false; + } + return null; } @@ -760,39 +816,29 @@ protected void done() { if (cencelled) { LOG.info("Process Cancelled."); - mainView.prgProgress.setValue(0); - mainView.prgProgress.setString(Integer.toString(0) + "%"); + srchCmdPnl.prgProgress.setValue(0); + srchCmdPnl.prgProgress.setString(Integer.toString(0) + "%"); } else { LOG.info("Spectrum Similarity Comparison Completed"); - mainView.prgProgress.setValue(100); - mainView.prgProgress.setString(Integer.toString(100) + "%"); + srchCmdPnl.prgProgress.setValue(100); + srchCmdPnl.prgProgress.setString(Integer.toString(100) + "%"); - if (tempRes != null && tempRes.size() > 0) { + if (resultTarget != null && resultTarget.size() > 0) { - if(!isValidation){ - res=tempRes; - cutoff_index=res.size()-1; - } - else{ - Validation validation=new Validation(); - validation.compareNmerge(res, tempRes); - cutoff_index=validation.validate(res, 0.01); - isValidation=false; - } - - fillTargetTable(); + //validationPnl=new ValidationHistogramPanel(resultTarget, resultDecoy); + fillExpSpectraTable(); fillBestmatchTable(0); displayResult(); } else { - LOG.info("No comparison result."); + LOG.info("No comparison result."); } } isBussy = false; - mainView.btnStartSearch.setEnabled(true); + srchCmdPnl.btnStartSearch.setEnabled(true); get(); } catch (InterruptedException | ExecutionException ex) { diff --git a/src/main/java/com/compomics/coss/Controller/Validation.java b/src/main/java/com/compomics/coss/Controller/Validation.java index f67dc04..6e3276f 100644 --- a/src/main/java/com/compomics/coss/Controller/Validation.java +++ b/src/main/java/com/compomics/coss/Controller/Validation.java @@ -10,6 +10,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; +import org.apache.avro.generic.GenericData; /** * @@ -21,27 +22,28 @@ public Validation() { } - public void compareNmerge(List> targetResult, List> decoyResult) { + public List> compareNmerge(List> targetResult, List> decoyResult) { - List> validatedResult = null; + List> validatedResult = new ArrayList<>(); //calculate FDR=Ndecoy/Ntargethits int c = 0; - int decoySSM = 0; - for (ArrayList rTarget : targetResult) { ArrayList rDecoy = decoyResult.get(c++); if (rTarget.get(0).compareTo(rDecoy.get(0)) < 0) { - rTarget.clear(); - rTarget.addAll(rDecoy); - decoySSM++; - + validatedResult.add(rDecoy); + + } + else{ + validatedResult.add(rTarget); } + } - Collections.sort(targetResult, (ArrayList o1, ArrayList o2) -> Double.valueOf(o1.get(0).getScore()).compareTo(o2.get(0).getScore())); + Collections.sort(validatedResult, (ArrayList o1, ArrayList o2) -> Double.valueOf(o1.get(0).getScore()).compareTo(o2.get(0).getScore())); + return validatedResult; } public int validate(List> result, double threshold) { diff --git a/src/main/java/com/compomics/coss/Model/ConfigData.java b/src/main/java/com/compomics/coss/Model/ConfigData.java index 9ba2b1d..94d329d 100644 --- a/src/main/java/com/compomics/coss/Model/ConfigData.java +++ b/src/main/java/com/compomics/coss/Model/ConfigData.java @@ -3,7 +3,7 @@ import com.compomics.ms2io.IndexKey; import java.io.File; -import com.compomics.ms2io.SpectrumReader; +import com.compomics.ms2io.SpectraReader; import java.util.List; /** *this class holds the configuration data for spectral comparison @@ -15,8 +15,8 @@ public class ConfigData { File specLibraryFile; List expIndex; List libIndex; - SpectrumReader rdExperimental; - SpectrumReader rdLibrary; + SpectraReader rdExperimental; + SpectraReader rdLibrary; String outputPath; int ScoringFun;//index @@ -50,19 +50,19 @@ public List getExpSpectraIndex() { return this.expIndex; } - public SpectrumReader getExpSpecReader(){ + public SpectraReader getExpSpecReader(){ return this.rdExperimental; } - public void setExpSpecReader(SpectrumReader rd){ + public void setExpSpecReader(SpectraReader rd){ this.rdExperimental=rd; } - public void setLibSpecReader(SpectrumReader rd){ + public void setLibSpecReader(SpectraReader rd){ this.rdLibrary=rd; } - public SpectrumReader getLibSpecReader(){ + public SpectraReader getLibSpecReader(){ return this.rdLibrary; } diff --git a/src/main/java/com/compomics/coss/View/MainGUI.java b/src/main/java/com/compomics/coss/View/MainGUI.java index c4dcbfe..e3e7ecc 100644 --- a/src/main/java/com/compomics/coss/View/MainGUI.java +++ b/src/main/java/com/compomics/coss/View/MainGUI.java @@ -20,13 +20,15 @@ import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JProgressBar; import javax.swing.JScrollPane; import javax.swing.JTextArea; +import javax.swing.JTextField; import javax.swing.WindowConstants; import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; /** @@ -45,6 +47,7 @@ public class MainGUI extends JFrame { * constructor of the class * @param settings setting panel to be added on the main GUI * @param result result panel to be added on the main GUI + * @param targetView * @param controler controller class responsible for coordinating the process */ public MainGUI(SettingPanel settings, ResultPanel result, TargetDB_View targetView, MainFrameController controler) { @@ -120,35 +123,12 @@ private void initComponents() { pnlLog = new JPanel(new FlowLayout(FlowLayout.LEFT)); pnlLog.setLayout(new BorderLayout()); - btnStartSearch=new JButton("Start Searching"); - btnCancel=new JButton("Cancel"); - prgProgress=new JProgressBar(0, 100); - - - - - JPanel innerControlPanel=new JPanel(new FlowLayout()); - innerControlPanel.add(btnStartSearch); - innerControlPanel.add(btnCancel); - - JPanel pnlValidationControl = new JPanel(new FlowLayout()); - - - pnlCommands.add(innerControlPanel, BorderLayout.NORTH); - pnlCommands.add(prgProgress, BorderLayout.SOUTH); - - txtlog = new JTextArea(); scrLogArea=new JScrollPane(); txtlog.setColumns(20); txtlog.setRows(5); scrLogArea.setViewportView(txtlog); - - - - - - + //this.setSize(dmnsn); this.setExtendedState(JFrame.MAXIMIZED_BOTH); tab = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT); @@ -170,17 +150,7 @@ private void initComponents() { pnlLower.add(pnlCommands); pnlLower.add(pnlLog); - - -// //base panel it is the base panel holding the upper and the lower split panel -// splBase = new JSplitPane(JSplitPane.VERTICAL_SPLIT, pnlUpper, pnlLower); -// splBase.setResizeWeight(0.9); -// splBase.setDividerLocation(0.9); -// splBase.setEnabled(false); -// //splBase.setOneTouchExpandable(true); -// -// - + //SettingPanel settings = new SettingPanel(); pnlsetting.add(settings); @@ -215,30 +185,8 @@ public void windowClosing(final WindowEvent we } } ); - - //start search button listenr - btnStartSearch.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - - - control.startSearch(); - - } - } - ); - - - //cancel button listener - btnCancel.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent ev) { - - control.stopSearch(); - } - } - ); - + save.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { try { @@ -277,10 +225,16 @@ public void actionPerformed(ActionEvent e) { tab.addChangeListener((ChangeEvent e) -> { if (e.getSource() instanceof JTabbedPane) { JTabbedPane pane = (JTabbedPane) e.getSource(); - changeControlView(pane.getSelectedIndex()); + int ind = pane.getSelectedIndex(); + control.cmdViewDisplay(ind); + } }); + + + + setJMenuBar(menuBar); BorderLayout layout=new BorderLayout(); getContentPane().setLayout(layout); @@ -307,15 +261,13 @@ public void actionPerformed(ActionEvent e) { public JPanel pnlsetting; public JPanel pnlresult; - private JPanel pnlCommands; + public JPanel pnlCommands; private JPanel pnlLog; - public JButton btnStartSearch; - private JButton btnCancel; public JTextArea txtlog; private JScrollPane scrLogArea; - public JProgressBar prgProgress; + private void changeControlView(int selectedIndex) { diff --git a/src/main/java/com/compomics/coss/View/RasterPanel.java b/src/main/java/com/compomics/coss/View/RasterPanel.java index 572f177..90d6db9 100644 --- a/src/main/java/com/compomics/coss/View/RasterPanel.java +++ b/src/main/java/com/compomics/coss/View/RasterPanel.java @@ -2,7 +2,7 @@ import com.compomics.ms2io.IndexKey; import com.compomics.ms2io.Spectrum; -import com.compomics.ms2io.SpectrumReader; +import com.compomics.ms2io.SpectraReader; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; @@ -29,7 +29,7 @@ public class RasterPanel extends JPanel implements MouseListener, MouseMotionListener { List iKey; - SpectrumReader rd; + SpectraReader rd; double scale = 1; double retnTime = 0; BufferedImage temp; @@ -49,7 +49,7 @@ public class RasterPanel extends JPanel implements MouseListener, MouseMotionLis * @param key index key to read the spectrum * @param rd spectrum reader object */ - public RasterPanel(List key, SpectrumReader rd) { + public RasterPanel(List key, SpectraReader rd) { this.iKey = key; this.rd=rd; diff --git a/src/main/java/com/compomics/coss/View/SearchCommandPnl.java b/src/main/java/com/compomics/coss/View/SearchCommandPnl.java new file mode 100644 index 0000000..940d1cd --- /dev/null +++ b/src/main/java/com/compomics/coss/View/SearchCommandPnl.java @@ -0,0 +1,76 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.compomics.coss.View; + +import com.compomics.coss.Controller.MainConsolControler; +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import com.compomics.coss.Controller.MainFrameController; + +/** + * + * @author Genet + */ +public class SearchCommandPnl extends JPanel{ + + MainFrameController control; + public SearchCommandPnl(MainFrameController control) { + this.control=control; + init(); + } + + private void init(){ + + + btnStartSearch=new JButton("Start Searching"); + JButton btnCancel=new JButton("Cancel"); + prgProgress=new JProgressBar(0, 100); + + JPanel innerControlPanel=new JPanel(new FlowLayout()); + innerControlPanel.add(btnStartSearch); + innerControlPanel.add(btnCancel); + + //start search button listenr + btnStartSearch.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + + + control.startSearch(); + + } + } + ); + + + //cancel button listener + btnCancel.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ev) { + + control.stopSearch(); + + } + } + ); + + + setLayout(new BorderLayout()); + add(innerControlPanel, BorderLayout.NORTH); + add(prgProgress, BorderLayout.SOUTH); + + + } + + public JButton btnStartSearch; + public JProgressBar prgProgress; + + +} diff --git a/src/main/java/com/compomics/coss/View/SettingPanel.java b/src/main/java/com/compomics/coss/View/SettingPanel.java index ef31a89..eecd33e 100644 --- a/src/main/java/com/compomics/coss/View/SettingPanel.java +++ b/src/main/java/com/compomics/coss/View/SettingPanel.java @@ -252,7 +252,7 @@ public void valueChanged(TreeSelectionEvent e) { ); //End of Matching panel layout - //this panel: the layout + //base input panel layout: panel to hold all the three different panels together javax.swing.GroupLayout pnlMainLayout = new javax.swing.GroupLayout(pnlInputs); pnlInputs.setLayout(pnlMainLayout); diff --git a/src/main/java/com/compomics/coss/View/ValidationCommandPanel.java b/src/main/java/com/compomics/coss/View/ValidationCommandPanel.java new file mode 100644 index 0000000..ee58207 --- /dev/null +++ b/src/main/java/com/compomics/coss/View/ValidationCommandPanel.java @@ -0,0 +1,87 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.compomics.coss.View; + +import com.compomics.coss.Controller.MainFrameController; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +/** + * + * @author Genet + */ +public class ValidationCommandPanel extends JPanel { + + MainFrameController control; + public ValidationCommandPanel(MainFrameController control){ + + this.control=control; + init(); + + } + + private void init(){ + JLabel lblFdr=new JLabel("FDR"); + Object[] fdr = new Object[5]; + fdr[0] = "0.1%"; + fdr[1] = "0.5%"; + fdr[2] = "0.2%"; + fdr[3] = "0.3%"; + fdr[2] = "0.4%"; + + JComboBox cmbFdr=new JComboBox(fdr); + cmbFdr.setSelectedIndex(0); + JLabel lblVaidResul=new JLabel("No. of Valid Result"); + JTextField txtValidResult=new JTextField(Integer.toString(0)); + txtValidResult.setEditable(false); + JButton btnValidate=new JButton("Validate Result"); + // JPanel pnlValdninnerControl = new JPanel(new FlowLayout()); + + javax.swing.GroupLayout pnlValdninnerControlLayout = new javax.swing.GroupLayout(this); + setLayout(pnlValdninnerControlLayout); + pnlValdninnerControlLayout.setHorizontalGroup( + pnlValdninnerControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlValdninnerControlLayout.createSequentialGroup() + .addContainerGap() + .addGroup(pnlValdninnerControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlValdninnerControlLayout.createSequentialGroup() + .addComponent(lblFdr) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(cmbFdr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(38, Short.MAX_VALUE)) + .addGroup(pnlValdninnerControlLayout.createSequentialGroup() + .addGroup(pnlValdninnerControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(btnValidate) + .addGroup(pnlValdninnerControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(lblVaidResul, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(txtValidResult, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(0, 0, Short.MAX_VALUE)))) + ); + pnlValdninnerControlLayout.setVerticalGroup( + pnlValdninnerControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlValdninnerControlLayout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(pnlValdninnerControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(lblFdr) + .addComponent(cmbFdr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lblVaidResul) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtValidResult, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(btnValidate) + .addGap(119, 119, 119)) + ); + + + + + } + +} diff --git a/src/main/java/com/compomics/coss/View/ValidationHistogramPanel.java b/src/main/java/com/compomics/coss/View/ValidationHistogramPanel.java new file mode 100644 index 0000000..7d315ab --- /dev/null +++ b/src/main/java/com/compomics/coss/View/ValidationHistogramPanel.java @@ -0,0 +1,207 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.compomics.coss.View; + +import com.compomics.coss.Controller.MainFrameController; +import com.compomics.coss.Model.ComparisonResult; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import javax.swing.JPanel; + +/** + * + * @author Genet + */ +public class ValidationHistogramPanel extends JPanel { + + private final TreeMap histTarget; + private final TreeMap histDecoy; + BufferedImage tempImage; + Image image; + public ValidationHistogramPanel(List> resultTarget, List> resultDecoy) { + this.histTarget = new TreeMap<>(); + this.histDecoy = new TreeMap<>(); + if(resultTarget!=null || resultDecoy!=null){ + + resultDecoy.stream().map((rt) -> rt.get(0).getScore()).map((score) -> { + histDecoy.computeIfPresent(score, (k, v) -> v + 1); + return score; + }).forEach((score) -> { + histDecoy.putIfAbsent(score, 1); + }); + + resultTarget.stream().map((rt) -> rt.get(0).getScore()).map((score) -> { + histTarget.computeIfPresent(score, (k, v) -> v + 1); + return score; + }).forEach((score) -> { + histTarget.putIfAbsent(score, 1); + }); + } + init(); + } + + private void init() { + + } + + /** + * paint on this panel + * @param g graphics object + */ + @Override + public void paint(Graphics g) { + + super.paint(g); + + if(!this.histDecoy.isEmpty()|| !this.histTarget.isEmpty()){ + Graphics2D g2 = (Graphics2D) g; + + drawDistribution(); + drawCoordinate(g2); + image=(Image)tempImage; + + if (image != null) { + g.drawImage(image, 51, 10, null); + } + + if (image == null ) { + g.drawString("Couldn't get scores", this.getWidth() / 2 - 10, this.getHeight() / 2 - 10); + } + + + g2.dispose(); + } + } + + /** + * Draws the spectrum provided on temporary buffered image, the size of the + * image equals maxMZ by maxIntensity which eliminates the need for floating + * point calculation for each mz and intensity values of the coordinate to + * map on the actual panel. Finally the buffered image is then scaled to fit + * the panel + * + * @param spec the spectrum to be drawn + * @param clr drawing color + */ + private void drawDistribution() { + + double maxScoreT = histTarget.lastEntry().getKey(); + double maxScoreD = histDecoy.lastEntry().getKey(); + int maxHitT=histTarget.lastEntry().getValue(); + int maxHitD=histDecoy.lastEntry().getValue(); + + + double maxScore = maxScoreT > maxScoreD ? maxScoreT : maxScoreD; + int maxHit= maxHitT>maxHitD? maxHitT : maxHitD; + + //int len = this.histDecoy.size(); + + int w =(int)Math.ceil(maxScore)+5; + int h =maxHit+5; + tempImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); + + Graphics2D g = tempImage.createGraphics(); + g.setPaint(new Color(250, 250, 250)); + g.fillRect(0, 0, w, h); + //g.setColor(Color.RED); + + // double x_step=maxScore/(double)w; + //double y_step= maxHit/(double)h; + int xPos; + int yPos; + + //drawing target db scores with green color + g.setColor(Color.green); + for (Map.Entry entry : histTarget.entrySet()) { + xPos = entry.getKey().intValue(); + yPos = h - entry.getValue(); + + g.drawLine(xPos, h, xPos, yPos); + } + + //draing decoy scores with red color + g.setColor(Color.red); + for (Map.Entry entry : histDecoy.entrySet()) { + xPos = entry.getKey().intValue(); + yPos = h - entry.getValue(); + + g.drawLine(xPos, h, xPos, yPos); + } + g.dispose(); + + } + + /** + * Draws the x and y coordinates for spectrum display + * + * @param g2 graphical object of the panel + */ + private void drawCoordinate(Graphics2D g2) { + +// int y; +// int x; +// int xStep; +// int yStep; +// +// double mzPoint = 0; +// int currentX = 0; + + //int picWidth = this.getWidth() - 50; // 50 pixels for left(50) and right(10) margin + int picHeight = this.getHeight() - 50;// 50 pixels for top(10) and bottom(50) margin + + int picLeft = 40;// left margin, 40 pixels + int picRight = this.getWidth() - 10;// right margin,10 pixels + int picTop = 10; // top margin, 10 pixels + int picBottom = this.getHeight() - 40; //lower coordinate position of the picture + int picMid = picHeight / 2 + picTop;//Mid coordinate position of the picture + +// xStep = picWidth / 10; //divide the pcture in 10 steps horizontally +// yStep = picHeight / 5; //divide the picture in 5 steps vertically + + //DrawCoordinate(this.getHeight()-10, this.getWidth()-10, 20, 20, new Point(10, 10), grph); + g2.setColor(Color.black); + //draw vertical coordinate line + g2.drawLine(picLeft - 1, picTop, picLeft - 1, picBottom + 1); + + g2.drawString("Hits", 0, picMid); + //g2.drawString("(%)", 0, picMid + 10); + + //draw horizontal coordinate line, measurements and lable + g2.drawLine(picLeft - 1, picBottom + 1, picRight, picBottom + 1); +// for (x = picLeft - 1; x <= picRight; x += xStep) { +// +// g2.drawLine(x, picBottom, x, picBottom + 5);// horizontal ticks +// mzPoint = currentX * xMap; +// mzPoint = Precision.round(mzPoint, 2); +// g2.drawString(Double.toString(mzPoint), x - 10, picBottom + 17); //10(string size) + 2(gap with ticks) + 5(bottompic pos) = 17 pixels +// currentX += xStep; +// } + g2.drawString("Score", (this.getWidth() / 2) - 5, this.getHeight() - 17); + +// //vertical ticks of the coordinate +// int currentY = 0; +// //int intensityPoint = 0; +// // double percentage=100/(double)picHeight; +// +// for (y = picBottom + 1; y >= picTop; y -= yStep) { +// +// g2.drawLine(picLeft - 1, y, picLeft - 6, y); +// //intensityPoint =(int)( currentY * percentage); +// g2.drawString(Integer.toString(currentY), 20, y + 3); +// currentY += 20; +// +// } + + } + +} diff --git a/src/main/java/com/compomics/coss/View/ValidationPanel.java b/src/main/java/com/compomics/coss/View/ValidationPanel.java deleted file mode 100644 index 24b1c3a..0000000 --- a/src/main/java/com/compomics/coss/View/ValidationPanel.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package com.compomics.coss.View; - -import com.compomics.coss.Model.ComparisonResult; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; -import javax.swing.JPanel; -import org.apache.commons.math3.util.Precision; - -/** - * - * @author Genet - */ -public class ValidationPanel extends JPanel { - - private Map histTarget; - private final Map histDecoy; - - - public ValidationPanel(List> resultTarget, List> resultDecoy) { - this.histTarget = new TreeMap<>(); - this.histDecoy = new TreeMap<>(); - - resultDecoy.stream().map((rt) -> rt.get(0).getScore()).map((score) -> { - histDecoy.computeIfPresent(score, (k, v) -> v + 1); - return score; - }).forEach((score) -> { - histDecoy.putIfAbsent(score, 1); - }); - - - resultTarget.stream().map((rt) -> rt.get(0).getScore()).map((score) -> { - histTarget.computeIfPresent(score, (k, v) -> v + 1); - return score; - }).forEach((score) -> { - histTarget.putIfAbsent(score, 1); - }); - - - init(); - } - - private void init() { - - - } - - /** - * paint on this panel - */ - @Override - public void paint(Graphics g) { - - } - - - /** - * Draws the spectrum provided on temporary buffered image, the size of the - * image equals maxMZ by maxIntensity which eliminates the need for floating - * point calculation for each mz and intensity values of the coordinate to - * map on the actual panel. Finally the buffered image is then scaled to fit - * the panel - * - * @param spec the spectrum to be drawn - * @param clr drawing color - */ - private void drawDistribution(double[] targetScore, double[] decoyscore) { - - - - double maxScoreT=histTarget.lastEntry(); - double maxScoreD=histDecoy.lastEntry(); - - double maxHeight=maxScoreT>maxScoreD?maxScoreT:maxScoreD; - - int totalNum=this.histDecoy.size(); - // double intFactor = 100.0 / maxInt;//normalizing intensity to 100(max) - //int totalPeaks = spec.getPeakList().size(); - //double[] mz = new double[totalPeaks]; - //double[] intensity = new double[totalPeaks]; - for (int p = 0; p < totalNum; p++) { - double x= - mz[p]=spec.getPeakListDouble()[0][p]; - intensity[p]=spec.getPeakListDouble()[1][p]; - - } - - int h = 100; - int w = maxMZ + 5; - tempImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); - - Graphics2D g = tempImage.createGraphics(); - g.setPaint(new Color(250, 250, 250)); - g.fillRect(0, 0, w, h); - //g.setColor(Color.RED); - - int xPos; - int yPos; - int barHeight; - - //int max = 0; - for (int i = 0; i < totalPeaks; i++) { - xPos = (int) mz[i]; - barHeight = (int) (intensity[i] * intFactor); - if (barHeight <= 0) { - barHeight += 3; - } - yPos = h - barHeight; - - g.setColor(clr); - g.drawLine(xPos, yPos, xPos, h); - } - - g.dispose(); - - } - - - - /** - * Draws the x and y coordinates for spectrum display - * - * @param g2 graphical object of the panel - */ - private void drawCoordinate(Graphics2D g2) { - - int y; - int x; - int xStep; - int yStep; - - double mzPoint = 0; - int currentX = 0; - - int picWidth = this.getWidth() - 50; // 60 pixels for left(50) and right(10) margin - int picHeight = this.getHeight() - 50;// 60 pixels for top(10) and bottom(50) margin - - int picLeft = 40;// left margin, 50 pixels - int picRight = this.getWidth() - 10;// right margin,10 pixels - int picTop = 10; // top margin, 10 pixels - int picBottom = this.getHeight() - 40; //lower coordinate position of the picture - int picMid = picHeight / 2 + picTop;//Mid coordinate position of the picture - - xStep = picWidth / 10; //divide the pcture in 10 steps horizontally - yStep = picHeight / 5; //divide the picture in 5 steps vertically - - //DrawCoordinate(this.getHeight()-10, this.getWidth()-10, 20, 20, new Point(10, 10), grph); - g2.setColor(Color.black); - //draw vertical coordinate line - g2.drawLine(picLeft - 1, picTop, picLeft - 1, picBottom + 1); - - g2.drawString("Hits", 0, picMid); - //g2.drawString("(%)", 0, picMid + 10); - - //draw horizontal coordinate line, measurements and lable - g2.drawLine(picLeft - 1, picBottom + 1, picRight, picBottom + 1); - for (x = picLeft - 1; x <= picRight; x += xStep) { - - g2.drawLine(x, picBottom, x, picBottom + 5);// horizontal ticks - mzPoint = currentX * xMap; - mzPoint = Precision.round(mzPoint, 2); - g2.drawString(Double.toString(mzPoint), x - 10, picBottom + 17); //10(string size) + 2(gap with ticks) + 5(bottompic pos) = 17 pixels - currentX += xStep; - } - g2.drawString("m/z", (this.getWidth() / 2) - 5, this.getHeight() - 17); - - //vertical ticks of the coordinate - int currentY = 0; - //int intensityPoint = 0; - // double percentage=100/(double)picHeight; - - for (y = picBottom + 1; y >= picTop; y -= yStep) { - - g2.drawLine(picLeft - 1, y, picLeft - 6, y); - //intensityPoint =(int)( currentY * percentage); - g2.drawString(Integer.toString(currentY), 20, y + 3); - currentY += 20; - - } - - } - -} diff --git a/src/main/java/com/compomics/coss/View/testvalidationpanel.form b/src/main/java/com/compomics/coss/View/testvalidationpanel.form index e71b9b5..17c2643 100644 --- a/src/main/java/com/compomics/coss/View/testvalidationpanel.form +++ b/src/main/java/com/compomics/coss/View/testvalidationpanel.form @@ -23,13 +23,108 @@ - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/compomics/coss/View/testvalidationpanel.java b/src/main/java/com/compomics/coss/View/testvalidationpanel.java index 9277a5a..7cf448d 100644 --- a/src/main/java/com/compomics/coss/View/testvalidationpanel.java +++ b/src/main/java/com/compomics/coss/View/testvalidationpanel.java @@ -27,17 +27,76 @@ public testvalidationpanel() { // //GEN-BEGIN:initComponents private void initComponents() { + pnlValdninnerControl = new javax.swing.JPanel(); + lblfdr = new javax.swing.JLabel(); + cmbfdr = new javax.swing.JComboBox<>(); + lblVaidResul = new javax.swing.JLabel(); + txtValidResult = new javax.swing.JTextField(); + btnValidate = new javax.swing.JButton(); + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + lblfdr.setText("jLabel1"); + + cmbfdr.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + lblVaidResul.setText("jLabel2"); + + txtValidResult.setText("jTextField1"); + + btnValidate.setText("jButton1"); + + javax.swing.GroupLayout pnlValdninnerControlLayout = new javax.swing.GroupLayout(pnlValdninnerControl); + pnlValdninnerControl.setLayout(pnlValdninnerControlLayout); + pnlValdninnerControlLayout.setHorizontalGroup( + pnlValdninnerControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlValdninnerControlLayout.createSequentialGroup() + .addContainerGap() + .addGroup(pnlValdninnerControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlValdninnerControlLayout.createSequentialGroup() + .addComponent(lblfdr) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(cmbfdr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(38, Short.MAX_VALUE)) + .addGroup(pnlValdninnerControlLayout.createSequentialGroup() + .addGroup(pnlValdninnerControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(btnValidate) + .addGroup(pnlValdninnerControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(lblVaidResul, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(txtValidResult, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(0, 0, Short.MAX_VALUE)))) + ); + pnlValdninnerControlLayout.setVerticalGroup( + pnlValdninnerControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pnlValdninnerControlLayout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(pnlValdninnerControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(lblfdr) + .addComponent(cmbfdr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lblVaidResul) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(txtValidResult, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(btnValidate) + .addGap(119, 119, 119)) + ); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 458, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(290, Short.MAX_VALUE) + .addComponent(pnlValdninnerControl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(20, 20, 20)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 197, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(pnlValdninnerControl, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(130, Short.MAX_VALUE)) ); pack(); @@ -79,5 +138,11 @@ public void run() { } // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnValidate; + private javax.swing.JComboBox cmbfdr; + private javax.swing.JLabel lblVaidResul; + private javax.swing.JLabel lblfdr; + private javax.swing.JPanel pnlValdninnerControl; + private javax.swing.JTextField txtValidResult; // End of variables declaration//GEN-END:variables } diff --git a/src/main/java/com/compomics/main/ProjectMain.java b/src/main/java/com/compomics/main/ProjectMain.java index d14fc7f..41fd6ce 100644 --- a/src/main/java/com/compomics/main/ProjectMain.java +++ b/src/main/java/com/compomics/main/ProjectMain.java @@ -25,10 +25,7 @@ public class ProjectMain { private static final String ERROR_MESSAGE = "An error occured during startup, please try again." + System.lineSeparator() + "If the problem persists, contact your administrator or post an issue on the google code page."; - /** - * The GUI main controller. - */ - private MainFrameController controller = new MainFrameController(); + // private DrawRaster visualize=new DrawRaster(); /** @@ -81,6 +78,10 @@ public void run() { private void launch() { try { + /** + * The GUI main controller. + */ + MainFrameController controller = new MainFrameController(); controller.init(); controller.showMainFrame(); diff --git a/src/main/java/com/compomics/matching/Cascade.java b/src/main/java/com/compomics/matching/Cascade.java index b95286a..a1b3775 100644 --- a/src/main/java/com/compomics/matching/Cascade.java +++ b/src/main/java/com/compomics/matching/Cascade.java @@ -24,7 +24,7 @@ import com.compomics.featureExtraction.Wavelet; import com.compomics.ms2io.IndexKey; import com.compomics.ms2io.Spectrum; -import com.compomics.ms2io.SpectrumReader; +import com.compomics.ms2io.SpectraReader; import java.util.Arrays; import java.util.Map; @@ -53,7 +53,7 @@ public void stopMatching() { } @Override - public List> compare(SpectrumReader rdExperiment, List expIndex, SpectrumReader rdLibrary, List libIndex,org.apache.log4j.Logger log) { + public List> compare(SpectraReader rdExperiment, List expIndex, SpectraReader rdLibrary, List libIndex,org.apache.log4j.Logger log) { int specNum = 1; List> simResult = new ArrayList<>(); diff --git a/src/main/java/com/compomics/matching/Matching.java b/src/main/java/com/compomics/matching/Matching.java index b2f6c3f..72cdb26 100644 --- a/src/main/java/com/compomics/matching/Matching.java +++ b/src/main/java/com/compomics/matching/Matching.java @@ -3,7 +3,7 @@ import com.compomics.coss.Model.ComparisonResult; import com.compomics.ms2io.IndexKey; -import com.compomics.ms2io.SpectrumReader; +import com.compomics.ms2io.SpectraReader; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/compomics/matching/UseMsRoben.java b/src/main/java/com/compomics/matching/UseMsRoben.java index d59e12a..1cb1ff2 100644 --- a/src/main/java/com/compomics/matching/UseMsRoben.java +++ b/src/main/java/com/compomics/matching/UseMsRoben.java @@ -13,7 +13,7 @@ import com.compomics.coss.Controller.UpdateListener; import com.compomics.ms2io.Peak; import com.compomics.ms2io.Spectrum; -import com.compomics.ms2io.SpectrumReader; +import com.compomics.ms2io.SpectraReader; import com.compomics.coss.Model.ComparisonResult; import com.compomics.ms2io.IndexKey; @@ -30,7 +30,8 @@ public class UseMsRoben extends Matching { UpdateListener listener; - SpectrumReader rdExperiment, rdLibrary; + SpectraReader rdExperiment; + SpectraReader rdLibrary; List expIndex; String resultType; @@ -39,7 +40,7 @@ public class UseMsRoben extends Matching { double fragTolerance; boolean cancelled = false; - public UseMsRoben(UpdateListener lstner, SpectrumReader rdExperiment, List expIndex, SpectrumReader rdLibrary, String resultType) { + public UseMsRoben(UpdateListener lstner, SpectraReader rdExperiment, List expIndex, SpectraReader rdLibrary, String resultType) { this.listener = lstner; this.rdExperiment=rdExperiment; this.rdLibrary=rdLibrary;