3 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
4 * Copyright (C) 2014 The Jalview Authors
6 * This file is part of Jalview.
8 * Jalview is free software: you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation, either version 3
11 * of the License, or (at your option) any later version.
13 * Jalview is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 * PURPOSE. See the GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
20 * The Jalview Authors are detailed in the 'AUTHORS' file.
25 import jalview.datamodel.DBRefEntry;
26 import jalview.datamodel.PDBEntry;
27 import jalview.datamodel.SequenceI;
28 import jalview.jbgui.GStructureChooser;
29 import jalview.jbgui.PDBDocFieldPreferences;
30 import jalview.structure.StructureSelectionManager;
31 import jalview.util.MessageManager;
32 import jalview.ws.dbsources.PDBRestClient;
33 import jalview.ws.dbsources.PDBRestClient.PDBDocField;
34 import jalview.ws.uimodel.PDBRestRequest;
35 import jalview.ws.uimodel.PDBRestResponse;
36 import jalview.ws.uimodel.PDBRestResponse.PDBResponseSummary;
38 import java.awt.event.ItemEvent;
39 import java.util.ArrayList;
40 import java.util.Collection;
41 import java.util.HashSet;
42 import java.util.Hashtable;
43 import java.util.LinkedHashSet;
44 import java.util.List;
46 import javax.swing.JCheckBox;
47 import javax.swing.JComboBox;
48 import javax.swing.JLabel;
49 import javax.swing.JOptionPane;
50 import javax.swing.table.DefaultTableModel;
54 * Provides the behaviors for the Structure chooser Panel
59 @SuppressWarnings("serial")
60 public class StructureChooser extends GStructureChooser
62 private boolean structuresDiscovered = false;
64 private SequenceI selectedSequence;
66 private SequenceI[] selectedSequences;
68 private IProgressIndicator progressIndicator;
70 private Collection<PDBResponseSummary> discoveredStructuresSet;
72 private PDBRestRequest lastPdbRequest;
74 private PDBRestClient pdbRestCleint;
76 private String selectedPdbFileName;
78 private boolean isValidPBDEntry;
80 private static Hashtable<String, PDBEntry> cachedEntryMap;
82 public StructureChooser(SequenceI[] selectedSeqs, SequenceI selectedSeq,
86 this.selectedSequence = selectedSeq;
87 this.selectedSequences = selectedSeqs;
88 this.progressIndicator = (ap == null) ? null : ap.alignFrame;
93 * Initializes parameters used by the Structure Chooser Panel
97 Thread discoverPDBStructuresThread = new Thread(new Runnable()
102 long startTime = System.currentTimeMillis();
103 updateProgressIndicator(MessageManager
104 .getString("status.loading_cached_pdb_entries"), startTime);
105 loadLocalCachedPDBEntries();
106 updateProgressIndicator(null, startTime);
107 updateProgressIndicator(MessageManager
108 .getString("status.searching_for_pdb_structures"),
110 fetchStructuresMetaData();
111 populateFilterComboBox();
112 updateProgressIndicator(null, startTime);
113 mainFrame.setVisible(true);
117 discoverPDBStructuresThread.start();
121 * Updates the progress indicator with the specified message
124 * displayed message for the operation
126 * unique handle for this indicator
128 public void updateProgressIndicator(String message, long id)
130 if (progressIndicator != null)
132 progressIndicator.setProgressBar(message, id);
137 * Retrieve meta-data for all the structure(s) for a given sequence(s) in a
140 public void fetchStructuresMetaData()
142 long startTime = System.currentTimeMillis();
143 Collection<PDBDocField> wantedFields = PDBDocFieldPreferences
144 .getStructureSummaryFields();
146 discoveredStructuresSet = new LinkedHashSet<PDBResponseSummary>();
147 HashSet<String> errors = new HashSet<String>();
148 for (SequenceI seq : selectedSequences)
150 PDBRestRequest pdbRequest = new PDBRestRequest();
151 pdbRequest.setAllowEmptySeq(false);
152 pdbRequest.setResponseSize(500);
153 pdbRequest.setFieldToSearchBy("(text:");
154 pdbRequest.setWantedFields(wantedFields);
155 pdbRequest.setSearchTerm(buildQuery(seq) + ")");
156 pdbRequest.setAssociatedSequence(seq);
157 pdbRestCleint = new PDBRestClient();
158 PDBRestResponse resultList;
161 resultList = pdbRestCleint.executeRequest(pdbRequest);
162 } catch (Exception e)
165 errors.add(e.getMessage());
168 lastPdbRequest = pdbRequest;
169 if (resultList.getSearchSummary() != null
170 && !resultList.getSearchSummary().isEmpty())
172 discoveredStructuresSet.addAll(resultList.getSearchSummary());
173 updateSequencePDBEntries(seq, resultList.getSearchSummary());
177 int noOfStructuresFound = 0;
178 String totalTime = (System.currentTimeMillis() - startTime)
180 if (discoveredStructuresSet != null
181 && !discoveredStructuresSet.isEmpty())
183 tbl_summary.setModel(PDBRestResponse.getTableModel(lastPdbRequest,
184 discoveredStructuresSet));
185 structuresDiscovered = true;
186 noOfStructuresFound = discoveredStructuresSet.size();
187 mainFrame.setTitle("Structure Chooser - " + noOfStructuresFound
188 + " Found (" + totalTime + ")");
193 .setTitle("Structure Chooser - Manual association");
194 if (errors.size() > 0)
196 StringBuilder errorMsg = new StringBuilder();
197 // "Operation was unsuccessful due to the following: \n");
198 for (String error : errors)
200 errorMsg.append(error).append("\n");
202 JOptionPane.showMessageDialog(this, errorMsg.toString(),
203 "PDB Web-service Error", JOptionPane.ERROR_MESSAGE);
208 public void loadLocalCachedPDBEntries()
210 DefaultTableModel tableModel = new DefaultTableModel();
211 tableModel.addColumn("Sequence");
212 tableModel.addColumn("PDB Id");
213 tableModel.addColumn("Chain");
214 tableModel.addColumn("Type");
215 tableModel.addColumn("File");
216 cachedEntryMap = new Hashtable<String, PDBEntry>();
217 for (SequenceI seq : selectedSequences)
219 if (seq.getDatasetSequence() != null
220 && seq.getDatasetSequence().getPDBId() != null)
222 for (PDBEntry pdbEntry : seq.getDatasetSequence().getPDBId())
225 String chain = pdbEntry.getChainCode() == null ? "_" : pdbEntry
227 String[] pdbEntryRowData = new String[]
228 { seq.getDisplayId(false), pdbEntry.getId(),
231 pdbEntry.getFile() };
232 if (pdbEntry.getFile() != null)
234 tableModel.addRow(pdbEntryRowData);
236 cachedEntryMap.put(pdbEntry.getId().toLowerCase(),
241 tbl_local_pdb.setModel(tableModel);
245 * Update the PDBEntry for a given sequence with values retrieved from
249 * the Sequence to update its DBRef entry
250 * @param responseSummaries
251 * a collection of PDBResponseSummary
253 public void updateSequencePDBEntries(SequenceI seq,
254 Collection<PDBResponseSummary> responseSummaries)
256 for (PDBResponseSummary response : responseSummaries)
258 String pdbIdStr = response.getPdbId();
259 PDBEntry pdbEntry = cachedEntryMap.get(pdbIdStr.toLowerCase());
260 if (pdbEntry == null)
262 pdbEntry = new PDBEntry();
263 pdbEntry.setId(pdbIdStr);
264 pdbEntry.setType(PDBEntry.Type.PDB);
266 seq.getDatasetSequence().addPDBId(pdbEntry);
271 * Builds a query string for a given sequences using its DBRef entries
274 * the sequences to build a query for
275 * @return the built query string
278 public static String buildQuery(SequenceI seq)
280 HashSet<String> seqRefs = new LinkedHashSet<String>();
281 String seqName = seq.getName();
282 String[] names = seqName.toLowerCase().split("\\|");
283 for (String name : names)
285 // System.out.println("Found name : " + name);
287 if (isValidSeqName(name))
293 if (seq.getPDBId() != null)
295 for (PDBEntry entry : seq.getPDBId())
297 if (isValidSeqName(entry.getId()))
299 seqRefs.add(entry.getId());
304 if (seq.getDBRef() != null && seq.getDBRef().length != 0)
307 for (DBRefEntry dbRef : seq.getDBRef())
309 if (isValidSeqName(getDBRefId(dbRef)))
311 seqRefs.add(getDBRefId(dbRef));
321 StringBuilder queryBuilder = new StringBuilder();
322 for (String seqRef : seqRefs)
324 queryBuilder.append("text:").append(seqRef).append(" OR ");
326 int endIndex = queryBuilder.lastIndexOf(" OR ");
327 String query = queryBuilder.toString().substring(5, endIndex);
332 * Ensures sequence ref names are not less than 3 characters and does not
333 * contain a database name
338 public static boolean isValidSeqName(String seqName)
340 // System.out.println("seqName : " + seqName);
341 String ignoreList = "pdb,uniprot,swiss-prot";
342 if (seqName.length() < 3)
346 if (seqName.contains(":"))
350 seqName = seqName.toLowerCase();
351 for (String ignoredEntry : ignoreList.split(","))
353 if (seqName.contains(ignoredEntry))
361 public static String getDBRefId(DBRefEntry dbRef)
363 String ref = dbRef.getAccessionId().replaceAll("GO:", "");
368 * Filters a given list of discovered structures based on supplied argument
370 * @param fieldToFilterBy
371 * the field to filter by
373 public void filterResultSet(final String fieldToFilterBy)
375 Thread filterThread = new Thread(new Runnable()
380 long startTime = System.currentTimeMillis();
381 lbl_loading.setVisible(true);
382 Collection<PDBDocField> wantedFields = PDBDocFieldPreferences
383 .getStructureSummaryFields();
384 Collection<PDBResponseSummary> filteredResponse = new HashSet<PDBResponseSummary>();
385 HashSet<String> errors = new HashSet<String>();
386 for (SequenceI seq : selectedSequences)
388 PDBRestRequest pdbRequest = new PDBRestRequest();
389 pdbRequest.setAllowEmptySeq(false);
390 pdbRequest.setResponseSize(1);
391 pdbRequest.setFieldToSearchBy("(text:");
392 pdbRequest.setFieldToSortBy(fieldToFilterBy,
393 !chk_invertFilter.isSelected());
394 pdbRequest.setSearchTerm(buildQuery(seq) + ")");
395 pdbRequest.setWantedFields(wantedFields);
396 pdbRequest.setAssociatedSequence(seq);
397 pdbRestCleint = new PDBRestClient();
398 PDBRestResponse resultList;
401 resultList = pdbRestCleint.executeRequest(pdbRequest);
402 } catch (Exception e)
405 errors.add(e.getMessage());
408 lastPdbRequest = pdbRequest;
409 if (resultList.getSearchSummary() != null
410 && !resultList.getSearchSummary().isEmpty())
412 filteredResponse.addAll(resultList.getSearchSummary());
416 String totalTime = (System.currentTimeMillis() - startTime)
418 if (!filteredResponse.isEmpty())
420 final int filterResponseCount = filteredResponse.size();
421 Collection<PDBResponseSummary> reorderedStructuresSet = new LinkedHashSet<PDBResponseSummary>();
422 reorderedStructuresSet.addAll(filteredResponse);
423 reorderedStructuresSet.addAll(discoveredStructuresSet);
424 tbl_summary.setModel(PDBRestResponse.getTableModel(
425 lastPdbRequest, reorderedStructuresSet));
427 // Update table selection model here
428 tbl_summary.addRowSelectionInterval(0, filterResponseCount - 1);
430 mainFrame.setTitle("Structure Chooser - Filter time ("
435 mainFrame.setTitle("Structure Chooser - Filter time ("
437 if (errors.size() > 0)
439 StringBuilder errorMsg = new StringBuilder();
440 for (String error : errors)
442 errorMsg.append(error).append("\n");
444 JOptionPane.showMessageDialog(null, errorMsg.toString(),
445 "PDB Web-service Error", JOptionPane.ERROR_MESSAGE);
449 lbl_loading.setVisible(false);
451 validateSelections();
454 filterThread.start();
459 * Handles action event for btn_pdbFromFile
461 public void pdbFromFile_actionPerformed()
463 jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(
464 jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
465 chooser.setFileView(new jalview.io.JalviewFileView());
466 chooser.setDialogTitle(MessageManager.formatMessage(
467 "label.select_pdb_file_for", new String[]
468 { selectedSequence.getDisplayId(false) }));
469 chooser.setToolTipText(MessageManager.formatMessage(
470 "label.load_pdb_file_associate_with_sequence", new String[]
471 { selectedSequence.getDisplayId(false) }));
473 int value = chooser.showOpenDialog(null);
474 if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION)
476 selectedPdbFileName = chooser.getSelectedFile().getPath();
477 jalview.bin.Cache.setProperty("LAST_DIRECTORY", selectedPdbFileName);
478 validateSelections();
483 * Populates the filter combo-box options dynamically depending on discovered
486 protected void populateFilterComboBox()
488 if (isStructuresDiscovered())
490 cmb_filterOption.addItem(new FilterOption("Best Quality",
491 PDBDocField.OVERALL_QUALITY.getCode(), VIEWS_FILTER));
492 cmb_filterOption.addItem(new FilterOption("Best UniProt Coverage",
493 PDBDocField.UNIPROT_COVERAGE.getCode(), VIEWS_FILTER));
494 cmb_filterOption.addItem(new FilterOption("Highest Resolution",
495 PDBDocField.RESOLUTION.getCode(), VIEWS_FILTER));
496 cmb_filterOption.addItem(new FilterOption("Highest Protein Chain",
497 PDBDocField.PROTEIN_CHAIN_COUNT.getCode(), VIEWS_FILTER));
498 cmb_filterOption.addItem(new FilterOption("Highest Bound Molecules",
499 PDBDocField.BOUND_MOLECULE_COUNT.getCode(), VIEWS_FILTER));
500 cmb_filterOption.addItem(new FilterOption("Highest Polymer Residues",
501 PDBDocField.POLYMER_RESIDUE_COUNT.getCode(), VIEWS_FILTER));
503 cmb_filterOption.addItem(new FilterOption("Enter PDB Id", "-",
505 cmb_filterOption.addItem(new FilterOption("From File", "-",
507 cmb_filterOption.addItem(new FilterOption("Cached PDB Entries", "-",
512 * Updates the displayed view based on the selected filter option
514 protected void updateCurrentView()
516 FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
518 layout_switchableViews.show(pnl_switchableViews,
519 selectedFilterOpt.getView());
520 String filterTitle = mainFrame.getTitle();
521 mainFrame.setTitle(frameTitle);
522 chk_invertFilter.setVisible(false);
523 if (selectedFilterOpt.getView() == VIEWS_FILTER)
525 mainFrame.setTitle(filterTitle);
526 chk_invertFilter.setVisible(true);
527 filterResultSet(selectedFilterOpt.getValue());
529 else if (selectedFilterOpt.getView() == VIEWS_ENTER_ID
530 || selectedFilterOpt.getView() == VIEWS_FROM_FILE)
532 mainFrame.setTitle(filterTitle);
533 idInputAssSeqPanel.loadCmbAssSeq();
534 fileChooserAssSeqPanel.loadCmbAssSeq();
536 validateSelections();
540 * Validates user selection and activates the view button if all parameters
543 public void validateSelections()
545 FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
547 btn_view.setEnabled(false);
548 String currentView = selectedFilterOpt.getView();
549 if (currentView == VIEWS_FILTER)
551 if (tbl_summary.getSelectedRows().length > 0)
553 btn_view.setEnabled(true);
556 else if (currentView == VIEWS_LOCAL_PDB)
558 if (tbl_local_pdb.getSelectedRows().length > 0)
560 btn_view.setEnabled(true);
563 else if (currentView == VIEWS_ENTER_ID)
565 validateAssociationEnterPdb();
567 else if (currentView == VIEWS_FROM_FILE)
569 validateAssociationFromFile();
574 * Validates inputs from the Manual PDB entry panel
576 public void validateAssociationEnterPdb()
578 AssociateSeqOptions assSeqOpt = (AssociateSeqOptions) idInputAssSeqPanel
579 .getCmb_assSeq().getSelectedItem();
580 lbl_pdbManualFetchStatus.setIcon(errorImage);
581 lbl_pdbManualFetchStatus.setToolTipText("");
582 if (txt_search.getText().length() > 0)
584 lbl_pdbManualFetchStatus.setToolTipText(JvSwingUtils.wrapTooltip(
585 true, "No PDB entry found for \'" + txt_search.getText()
589 if (errorWarning.length() > 0)
591 lbl_pdbManualFetchStatus.setIcon(warningImage);
592 lbl_pdbManualFetchStatus.setToolTipText(JvSwingUtils.wrapTooltip(
593 true, errorWarning.toString()));
596 if (selectedSequences.length == 1
597 || !assSeqOpt.getName().equalsIgnoreCase(
598 "-Select Associated Seq-"))
600 txt_search.setEnabled(true);
603 btn_view.setEnabled(true);
604 lbl_pdbManualFetchStatus.setToolTipText("");
605 lbl_pdbManualFetchStatus.setIcon(goodImage);
610 txt_search.setEnabled(false);
611 lbl_pdbManualFetchStatus.setIcon(errorImage);
616 * Validates inputs for the manual PDB file selection options
618 public void validateAssociationFromFile()
620 AssociateSeqOptions assSeqOpt = (AssociateSeqOptions) fileChooserAssSeqPanel
621 .getCmb_assSeq().getSelectedItem();
622 lbl_fromFileStatus.setIcon(errorImage);
623 if (selectedSequences.length == 1
624 || (assSeqOpt != null
625 && !assSeqOpt.getName().equalsIgnoreCase(
626 "-Select Associated Seq-")))
628 btn_pdbFromFile.setEnabled(true);
629 if (selectedPdbFileName != null && selectedPdbFileName.length() > 0)
631 btn_view.setEnabled(true);
632 lbl_fromFileStatus.setIcon(goodImage);
637 btn_pdbFromFile.setEnabled(false);
638 lbl_fromFileStatus.setIcon(errorImage);
643 public void cmbAssSeqStateChanged()
645 validateSelections();
649 * Handles the state change event for the 'filter' combo-box and 'invert'
653 protected void stateChanged(ItemEvent e)
655 if (e.getSource() instanceof JCheckBox)
661 if (e.getStateChange() == ItemEvent.SELECTED)
670 * Handles action event for btn_ok
673 public void ok_ActionPerformed()
675 FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
677 String currentView = selectedFilterOpt.getView();
678 if (currentView == VIEWS_FILTER)
680 int pdbIdColIndex = tbl_summary.getColumn(
681 PDBRestClient.PDBDocField.PDB_ID.getName()).getModelIndex();
682 int refSeqColIndex = tbl_summary.getColumn("Ref Sequence")
684 int[] selectedRows = tbl_summary.getSelectedRows();
685 PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
687 ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
688 for (int summaryRow : selectedRows)
690 String pdbIdStr = tbl_summary.getValueAt(summaryRow, pdbIdColIndex)
692 SequenceI selectedSeq = (SequenceI) tbl_summary.getValueAt(
693 summaryRow, refSeqColIndex);
694 selectedSeqsToView.add(selectedSeq);
695 PDBEntry pdbEntry = cachedEntryMap.get(pdbIdStr.toLowerCase());
696 if (pdbEntry == null)
698 pdbEntry = new PDBEntry();
699 pdbEntry.setId(pdbIdStr);
700 pdbEntry.setType(PDBEntry.Type.PDB);
702 pdbEntriesToView[count++] = pdbEntry;
704 SequenceI[] selectedSeqs = selectedSeqsToView
705 .toArray(new SequenceI[selectedSeqsToView.size()]);
706 launchStructureViewer(ap.getStructureSelectionManager(),
707 pdbEntriesToView, ap, selectedSeqs);
709 else if(currentView == VIEWS_LOCAL_PDB){
710 int[] selectedRows = tbl_local_pdb.getSelectedRows();
711 PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
713 for (int row : selectedRows)
715 String entryKey = tbl_local_pdb.getValueAt(row, 1).toString()
717 pdbEntriesToView[count++] = cachedEntryMap.get(entryKey);
719 launchStructureViewer(ap.getStructureSelectionManager(),
720 pdbEntriesToView, ap, selectedSequences);
722 else if (currentView == VIEWS_ENTER_ID)
724 SequenceI userSelectedSeq = ((AssociateSeqOptions) idInputAssSeqPanel
725 .getCmb_assSeq().getSelectedItem()).getSequence();
726 if (userSelectedSeq != null)
728 selectedSequence = userSelectedSeq;
731 String pdbIdStr = txt_search.getText();
732 PDBEntry pdbEntry = cachedEntryMap.get(pdbIdStr.toLowerCase());
733 if (pdbEntry == null)
735 pdbEntry = new PDBEntry();
736 pdbEntry.setId(txt_search.getText());
737 pdbEntry.setType(PDBEntry.Type.PDB);
740 selectedSequence.getDatasetSequence().addPDBId(pdbEntry);
741 PDBEntry[] pdbEntriesToView = new PDBEntry[]
743 launchStructureViewer(ap.getStructureSelectionManager(),
744 pdbEntriesToView, ap, new SequenceI[]
745 { selectedSequence });
747 else if (currentView == VIEWS_FROM_FILE)
749 SequenceI userSelectedSeq = ((AssociateSeqOptions) fileChooserAssSeqPanel
750 .getCmb_assSeq().getSelectedItem()).getSequence();
751 if (userSelectedSeq != null)
753 selectedSequence = userSelectedSeq;
755 PDBEntry fileEntry = new AssociatePdbFileWithSeq()
756 .associatePdbWithSeq(
757 selectedPdbFileName, jalview.io.AppletFormatAdapter.FILE,
758 selectedSequence, true, Desktop.instance);
760 launchStructureViewer(ap.getStructureSelectionManager(),
762 { fileEntry }, ap, new SequenceI[]
763 { selectedSequence });
768 private void launchStructureViewer(StructureSelectionManager ssm,
769 PDBEntry[] pdbEntriesToView, AlignmentPanel alignPanel,
770 SequenceI[] sequences)
772 StructureViewer sViewer = new StructureViewer(ssm);
773 if (pdbEntriesToView.length > 1)
775 sViewer.viewStructures(pdbEntriesToView, alignPanel.av.collateForPDB(pdbEntriesToView),
780 sViewer.viewStructures(pdbEntriesToView[0], sequences,
786 * Populates the combo-box used in associating manually fetched structures to
787 * a unique sequence when more than one sequence selection is made.
789 public void populateCmbAssociateSeqOptions(
790 JComboBox<AssociateSeqOptions> cmb_assSeq, JLabel lbl_associateSeq)
792 cmb_assSeq.removeAllItems();
793 cmb_assSeq.addItem(new AssociateSeqOptions("-Select Associated Seq-",
795 // cmb_assSeq.addItem(new AssociateSeqOptions("Auto Detect", null));
796 lbl_associateSeq.setVisible(false);
797 if (selectedSequences.length > 1)
799 for (SequenceI seq : selectedSequences)
801 cmb_assSeq.addItem(new AssociateSeqOptions(seq));
806 String seqName = selectedSequence.getDisplayId(false);
807 seqName = seqName.length() <= 40 ? seqName : seqName.substring(0, 39);
808 lbl_associateSeq.setText(seqName);
809 lbl_associateSeq.setVisible(true);
810 cmb_assSeq.setVisible(false);
814 public boolean isStructuresDiscovered()
816 return structuresDiscovered;
819 public void setStructuresDiscovered(boolean structuresDiscovered)
821 this.structuresDiscovered = structuresDiscovered;
824 public Collection<PDBResponseSummary> getDiscoveredStructuresSet()
826 return discoveredStructuresSet;
830 protected void txt_search_ActionPerformed()
832 errorWarning.setLength(0);
833 isValidPBDEntry = false;
834 if (txt_search.getText().length() > 0)
836 List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
837 wantedFields.add(PDBDocField.PDB_ID);
838 PDBRestRequest pdbRequest = new PDBRestRequest();
839 pdbRequest.setAllowEmptySeq(false);
840 pdbRequest.setResponseSize(1);
841 pdbRequest.setFieldToSearchBy("(pdb_id:");
842 pdbRequest.setWantedFields(wantedFields);
843 pdbRequest.setSearchTerm(txt_search.getText() + ")");
844 pdbRequest.setAssociatedSequence(selectedSequence);
845 pdbRestCleint = new PDBRestClient();
846 PDBRestResponse resultList;
849 resultList = pdbRestCleint.executeRequest(pdbRequest);
850 } catch (Exception e)
852 errorWarning.append(e.getMessage());
856 validateSelections();
858 if (resultList.getSearchSummary() != null
859 && resultList.getSearchSummary().size() > 0)
861 isValidPBDEntry = true;
864 validateSelections();
868 public void tabRefresh()
870 if (selectedSequences != null)
872 Thread refreshThread = new Thread(new Runnable()
877 fetchStructuresMetaData();
878 filterResultSet(((FilterOption) cmb_filterOption
879 .getSelectedItem()).getValue());
882 refreshThread.start();