-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
259 additions
and
5 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
src/bzh/plealog/blastviewer/actions/summary/ViewQueryIprScanPredictionsAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* Copyright (C) 2021 Patrick G. Durand | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.gnu.org/licenses/agpl-3.0.txt | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
*/ | ||
package bzh.plealog.blastviewer.actions.summary; | ||
|
||
import java.awt.event.ActionEvent; | ||
|
||
import javax.swing.AbstractAction; | ||
import javax.swing.Icon; | ||
import javax.swing.JOptionPane; | ||
import javax.swing.SwingUtilities; | ||
|
||
import com.plealog.genericapp.api.EZEnvironment; | ||
import com.plealog.genericapp.api.log.EZLogger; | ||
|
||
import bzh.plealog.bioinfo.api.data.searchresult.SROutput; | ||
import bzh.plealog.bioinfo.ui.blast.resulttable.SummaryTable; | ||
import bzh.plealog.bioinfo.ui.blast.resulttable.SummaryTableModel; | ||
import bzh.plealog.blastviewer.resources.BVMessages; | ||
import bzh.plealog.blastviewer.summary.ViewQueryIprScanPredictionsDialog; | ||
|
||
/** | ||
* This class implements the action to view Interposcan predictions | ||
* made on a query. | ||
* | ||
* @author Patrick G. Durand | ||
*/ | ||
public class ViewQueryIprScanPredictionsAction extends AbstractAction { | ||
private static final long serialVersionUID = -3984245135396746453L; | ||
private SummaryTable _table; | ||
private boolean _running = false; | ||
|
||
/** | ||
* Action constructor. | ||
* | ||
* @param name | ||
* the name of the action. | ||
*/ | ||
public ViewQueryIprScanPredictionsAction(String name) { | ||
super(name); | ||
} | ||
|
||
/** | ||
* Action constructor. | ||
* | ||
* @param name | ||
* the name of the action. | ||
* @param icon | ||
* the icon of the action. | ||
*/ | ||
public ViewQueryIprScanPredictionsAction(String name, Icon icon) { | ||
super(name, icon); | ||
} | ||
|
||
/** | ||
* Set data object. | ||
*/ | ||
public void setTable(SummaryTable table) { | ||
_table = table; | ||
} | ||
|
||
private void doAction() { | ||
if (_running || _table==null || _table.getSelectedRowCount()!=1) | ||
return; | ||
|
||
_running = true; | ||
|
||
//get selected SROuput | ||
SROutput sro = (SROutput) _table.getValueAt( | ||
_table.getSelectedRow(), | ||
SummaryTableModel.RESULT_DATA_COL); | ||
if (sro.isEmpty()) { | ||
return; | ||
} | ||
|
||
ViewQueryIprScanPredictionsDialog dlg = new ViewQueryIprScanPredictionsDialog( | ||
JOptionPane.getFrameForComponent(_table), sro.getIteration(0).getIterationQueryID()); | ||
|
||
dlg.setData(sro.getIteration(0).getIterationQueryFeatureTable(), sro.getIteration(0).getIterationQueryLength()); | ||
dlg.setVisible(true); | ||
} | ||
|
||
public void actionPerformed(ActionEvent event) { | ||
SwingUtilities.invokeLater(new Runnable() { | ||
@Override | ||
public void run() { | ||
try { | ||
doAction(); | ||
} catch (Throwable t) { | ||
EZLogger.warn(BVMessages.getString("OpenFileAction.err") | ||
+ t.toString()); | ||
} finally { | ||
_running = false; | ||
EZEnvironment.setDefaultCursor(); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
113 changes: 113 additions & 0 deletions
113
src/bzh/plealog/blastviewer/summary/ViewQueryIprScanPredictionsDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* Copyright (C) 2021 Patrick G. Durand | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.gnu.org/licenses/agpl-3.0.txt | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
*/ | ||
package bzh.plealog.blastviewer.summary; | ||
|
||
import java.awt.BorderLayout; | ||
import java.awt.Dimension; | ||
import java.awt.FlowLayout; | ||
import java.awt.Frame; | ||
import java.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
|
||
import javax.swing.JButton; | ||
import javax.swing.JDialog; | ||
import javax.swing.JPanel; | ||
|
||
import bzh.plealog.bioinfo.api.data.feature.FeatureTable; | ||
import bzh.plealog.bioinfo.api.data.sequence.BankSequenceDescriptor; | ||
import bzh.plealog.bioinfo.data.sequence.EmptySequence; | ||
import bzh.plealog.bioinfo.ui.feature.FeatureViewerFactory; | ||
import bzh.plealog.bioinfo.ui.sequence.extended.CombinedAnnotatedSequenceViewer; | ||
import bzh.plealog.bioinfo.util.DAlphabetUtils; | ||
import bzh.plealog.blastviewer.resources.BVMessages; | ||
|
||
/** | ||
* Dialogue box to display Interprosan predictions. | ||
* | ||
* @author Patrick G. Durand | ||
*/ | ||
public class ViewQueryIprScanPredictionsDialog extends JDialog { | ||
private static final long serialVersionUID = 5928719684421848123L; | ||
|
||
private CombinedAnnotatedSequenceViewer _viewer; | ||
private JPanel _resultPanel; | ||
private Dimension _startingSize = new Dimension(840,480); | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param parent parent frame | ||
* @param queryID query ID shown in dialogue header | ||
*/ | ||
public ViewQueryIprScanPredictionsDialog(Frame parent, String queryID) { | ||
super(parent); | ||
setLocationByPlatform(true); | ||
setPreferredSize(_startingSize); | ||
setSize(_startingSize); | ||
setTitle(String.format( | ||
BVMessages.getString("EditQueryClassificationDialog.this.title"), queryID)); | ||
|
||
_resultPanel = new JPanel(new BorderLayout()); | ||
_viewer = new CombinedAnnotatedSequenceViewer( | ||
null, BVMessages.class.getResourceAsStream("featureWebLink.conf"), | ||
false, false, false, false, false, true, false, false, | ||
FeatureViewerFactory.TYPE.COMBO); | ||
_resultPanel.add(_viewer); | ||
getContentPane().add(_resultPanel, BorderLayout.CENTER); | ||
|
||
JPanel panel = new JPanel(); | ||
getContentPane().add(panel, BorderLayout.SOUTH); | ||
panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); | ||
|
||
JButton btnOk = new JButton( | ||
BVMessages.getString("EditQueryClassificationDialog.btnOk.text")); | ||
btnOk.setPreferredSize(new Dimension(65, 23)); | ||
btnOk.setMinimumSize(new Dimension(65, 23)); | ||
btnOk.setMaximumSize(new Dimension(65, 23)); | ||
btnOk.addActionListener(new OkListener()); | ||
panel.add(btnOk); | ||
|
||
this.setModal(true); | ||
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); | ||
// to center | ||
this.setLocationRelativeTo(null); | ||
} | ||
|
||
/** | ||
* Set data. | ||
* | ||
* @param ft feature table | ||
* @param seqsize size of query sequence | ||
*/ | ||
public void setData(FeatureTable ft, int seqsize) { | ||
BankSequenceDescriptor sd = new BankSequenceDescriptor( | ||
ft, null, new EmptySequence(DAlphabetUtils.getIUPAC_DNA_Alphabet(), seqsize)); | ||
_viewer.setData(sd); | ||
} | ||
|
||
private void close() { | ||
dispose(); | ||
} | ||
|
||
private class OkListener implements ActionListener { | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
close(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters