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.getName());
157 pdbRestCleint = new PDBRestClient();
158 PDBRestResponse resultList;
161 resultList = pdbRestCleint.executeRequest(pdbRequest);
162 } catch (Exception e)
164 errors.add(e.getMessage());
167 lastPdbRequest = pdbRequest;
168 if (resultList.getSearchSummary() != null
169 && !resultList.getSearchSummary().isEmpty())
171 discoveredStructuresSet.addAll(resultList.getSearchSummary());
172 updateSequencePDBEntries(seq, resultList.getSearchSummary());
176 int noOfStructuresFound = 0;
177 String totalTime = (System.currentTimeMillis() - startTime)
179 if (discoveredStructuresSet != null
180 && !discoveredStructuresSet.isEmpty())
182 tbl_summary.setModel(PDBRestResponse.getTableModel(lastPdbRequest,
183 discoveredStructuresSet));
184 structuresDiscovered = true;
185 noOfStructuresFound = discoveredStructuresSet.size();
186 mainFrame.setTitle("Structure Chooser - " + noOfStructuresFound
187 + " Found (" + totalTime + ")");
192 .setTitle("Structure Chooser - Manual association");
193 if (errors.size() > 0)
195 StringBuilder errorMsg = new StringBuilder();
196 // "Operation was unsuccessful due to the following: \n");
197 for (String error : errors)
199 errorMsg.append(error).append("\n");
201 JOptionPane.showMessageDialog(this, errorMsg.toString(),
202 "PDB Web-service Error", JOptionPane.ERROR_MESSAGE);
207 public void loadLocalCachedPDBEntries()
209 DefaultTableModel tableModel = new DefaultTableModel();
210 tableModel.addColumn("Sequence");
211 tableModel.addColumn("PDB Id");
212 tableModel.addColumn("Chain");
213 tableModel.addColumn("Type");
214 tableModel.addColumn("File");
215 cachedEntryMap = new Hashtable<String, PDBEntry>();
216 for (SequenceI seq : selectedSequences)
218 if (seq.getDatasetSequence() != null
219 && seq.getDatasetSequence().getPDBId() != null)
221 for (PDBEntry pdbEntry : seq.getDatasetSequence().getPDBId())
224 String chain = pdbEntry.getChainCode() == null ? "_" : pdbEntry
226 String[] pdbEntryRowData = new String[]
227 { seq.getDisplayId(false), pdbEntry.getId(),
230 pdbEntry.getFile() };
231 if (pdbEntry.getFile() != null)
233 tableModel.addRow(pdbEntryRowData);
235 cachedEntryMap.put(pdbEntry.getId().toLowerCase(),
240 tbl_local_pdb.setModel(tableModel);
244 * Update the PDBEntry for a given sequence with values retrieved from
248 * the Sequence to update its DBRef entry
249 * @param responseSummaries
250 * a collection of PDBResponseSummary
252 public void updateSequencePDBEntries(SequenceI seq,
253 Collection<PDBResponseSummary> responseSummaries)
255 for (PDBResponseSummary response : responseSummaries)
257 String pdbIdStr = response.getPdbId();
258 PDBEntry pdbEntry = cachedEntryMap.get(pdbIdStr.toLowerCase());
259 if (pdbEntry == null)
261 pdbEntry = new PDBEntry();
262 pdbEntry.setId(pdbIdStr);
263 pdbEntry.setType(PDBEntry.Type.PDB);
265 seq.getDatasetSequence().addPDBId(pdbEntry);
270 * Builds a query string for a given sequences using its DBRef entries
273 * the sequences to build a query for
274 * @return the built query string
277 public static String buildQuery(SequenceI seq)
279 HashSet<String> seqRefs = new LinkedHashSet<String>();
280 String seqName = seq.getName();
281 String[] names = seqName.toLowerCase().split("\\|");
282 for (String name : names)
284 // System.out.println("Found name : " + name);
286 if (isValidSeqName(name))
292 if (seq.getPDBId() != null)
294 for (PDBEntry entry : seq.getPDBId())
296 if (isValidSeqName(entry.getId()))
298 seqRefs.add(entry.getId());
303 if (seq.getDBRef() != null && seq.getDBRef().length != 0)
306 for (DBRefEntry dbRef : seq.getDBRef())
308 if (isValidSeqName(getDBRefId(dbRef)))
310 seqRefs.add(getDBRefId(dbRef));
312 // 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.getName());
397 pdbRestCleint = new PDBRestClient();
398 PDBRestResponse resultList;
401 resultList = pdbRestCleint.executeRequest(pdbRequest);
402 } catch (Exception e)
404 errors.add(e.getMessage());
407 lastPdbRequest = pdbRequest;
408 if (resultList.getSearchSummary() != null
409 && !resultList.getSearchSummary().isEmpty())
411 filteredResponse.addAll(resultList.getSearchSummary());
415 String totalTime = (System.currentTimeMillis() - startTime)
417 if (!filteredResponse.isEmpty())
419 final int filterResponseCount = filteredResponse.size();
420 Collection<PDBResponseSummary> reorderedStructuresSet = new LinkedHashSet<PDBResponseSummary>();
421 reorderedStructuresSet.addAll(filteredResponse);
422 reorderedStructuresSet.addAll(discoveredStructuresSet);
423 tbl_summary.setModel(PDBRestResponse.getTableModel(
424 lastPdbRequest, reorderedStructuresSet));
426 // Update table selection model here
427 tbl_summary.addRowSelectionInterval(0, filterResponseCount - 1);
429 mainFrame.setTitle("Structure Chooser - Filter time ("
434 mainFrame.setTitle("Structure Chooser - Filter time ("
436 if (errors.size() > 0)
438 StringBuilder errorMsg = new StringBuilder();
439 for (String error : errors)
441 errorMsg.append(error).append("\n");
443 JOptionPane.showMessageDialog(null, errorMsg.toString(),
444 "PDB Web-service Error", JOptionPane.ERROR_MESSAGE);
448 lbl_loading.setVisible(false);
450 validateSelections();
453 filterThread.start();
458 * Handles action event for btn_pdbFromFile
460 public void pdbFromFile_actionPerformed()
462 jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(
463 jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
464 chooser.setFileView(new jalview.io.JalviewFileView());
465 chooser.setDialogTitle(MessageManager.formatMessage(
466 "label.select_pdb_file_for", new String[]
467 { selectedSequence.getDisplayId(false) }));
468 chooser.setToolTipText(MessageManager.formatMessage(
469 "label.load_pdb_file_associate_with_sequence", new String[]
470 { selectedSequence.getDisplayId(false) }));
472 int value = chooser.showOpenDialog(null);
473 if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION)
475 selectedPdbFileName = chooser.getSelectedFile().getPath();
476 jalview.bin.Cache.setProperty("LAST_DIRECTORY", selectedPdbFileName);
477 validateSelections();
482 * Populates the filter combo-box options dynamically depending on discovered
485 protected void populateFilterComboBox()
487 if (isStructuresDiscovered())
489 cmb_filterOption.addItem(new FilterOption("Best Quality",
490 PDBDocField.OVERALL_QUALITY.getCode(), VIEWS_FILTER));
491 cmb_filterOption.addItem(new FilterOption("Best UniProt Coverage",
492 PDBDocField.UNIPROT_COVERAGE.getCode(), VIEWS_FILTER));
493 cmb_filterOption.addItem(new FilterOption("Highest Resolution",
494 PDBDocField.RESOLUTION.getCode(), VIEWS_FILTER));
495 cmb_filterOption.addItem(new FilterOption("Highest Protein Chain",
496 PDBDocField.PROTEIN_CHAIN_COUNT.getCode(), VIEWS_FILTER));
497 cmb_filterOption.addItem(new FilterOption("Highest Bound Molecules",
498 PDBDocField.BOUND_MOLECULE_COUNT.getCode(), VIEWS_FILTER));
499 cmb_filterOption.addItem(new FilterOption("Highest Polymer Residues",
500 PDBDocField.POLYMER_RESIDUE_COUNT.getCode(), VIEWS_FILTER));
502 cmb_filterOption.addItem(new FilterOption("Enter PDB Id", "-",
504 cmb_filterOption.addItem(new FilterOption("From File", "-",
506 cmb_filterOption.addItem(new FilterOption("Cached PDB Entries", "-",
511 * Updates the displayed view based on the selected filter option
513 protected void updateCurrentView()
515 FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
517 layout_switchableViews.show(pnl_switchableViews,
518 selectedFilterOpt.getView());
519 String filterTitle = mainFrame.getTitle();
520 mainFrame.setTitle(frameTitle);
521 chk_invertFilter.setVisible(false);
522 if (selectedFilterOpt.getView() == VIEWS_FILTER)
524 mainFrame.setTitle(filterTitle);
525 chk_invertFilter.setVisible(true);
526 filterResultSet(selectedFilterOpt.getValue());
528 else if (selectedFilterOpt.getView() == VIEWS_ENTER_ID
529 || selectedFilterOpt.getView() == VIEWS_FROM_FILE)
531 mainFrame.setTitle(filterTitle);
532 idInputAssSeqPanel.loadCmbAssSeq();
533 fileChooserAssSeqPanel.loadCmbAssSeq();
535 validateSelections();
539 * Validates user selection and activates the view button if all parameters
542 public void validateSelections()
544 FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
546 btn_view.setEnabled(false);
547 String currentView = selectedFilterOpt.getView();
548 if (currentView == VIEWS_FILTER)
550 if (tbl_summary.getSelectedRows().length > 0)
552 btn_view.setEnabled(true);
555 else if (currentView == VIEWS_LOCAL_PDB)
557 if (tbl_local_pdb.getSelectedRows().length > 0)
559 btn_view.setEnabled(true);
562 else if (currentView == VIEWS_ENTER_ID)
564 validateAssociationEnterPdb();
566 else if (currentView == VIEWS_FROM_FILE)
568 validateAssociationFromFile();
573 * Validates inputs from the Manual PDB entry panel
575 public void validateAssociationEnterPdb()
577 AssociateSeqOptions assSeqOpt = (AssociateSeqOptions) idInputAssSeqPanel
578 .getCmb_assSeq().getSelectedItem();
579 lbl_pdbManualFetchStatus.setIcon(errorImage);
580 lbl_pdbManualFetchStatus.setToolTipText("");
581 if (txt_search.getText().length() > 0)
583 lbl_pdbManualFetchStatus.setToolTipText(JvSwingUtils.wrapTooltip(
584 true, "No PDB entry found for \'" + txt_search.getText()
588 if (errorWarning.length() > 0)
590 lbl_pdbManualFetchStatus.setIcon(warningImage);
591 lbl_pdbManualFetchStatus.setToolTipText(JvSwingUtils.wrapTooltip(
592 true, errorWarning.toString()));
595 if (selectedSequences.length == 1
596 || !assSeqOpt.getName().equalsIgnoreCase(
597 "-Select Associated Seq-"))
599 txt_search.setEnabled(true);
602 btn_view.setEnabled(true);
603 lbl_pdbManualFetchStatus.setToolTipText("");
604 lbl_pdbManualFetchStatus.setIcon(goodImage);
609 txt_search.setEnabled(false);
610 lbl_pdbManualFetchStatus.setIcon(errorImage);
615 * Validates inputs for the manual PDB file selection options
617 public void validateAssociationFromFile()
619 AssociateSeqOptions assSeqOpt = (AssociateSeqOptions) fileChooserAssSeqPanel
620 .getCmb_assSeq().getSelectedItem();
621 lbl_fromFileStatus.setIcon(errorImage);
622 if (selectedSequences.length == 1
623 || (assSeqOpt != null
624 && !assSeqOpt.getName().equalsIgnoreCase(
625 "-Select Associated Seq-")))
627 btn_pdbFromFile.setEnabled(true);
628 if (selectedPdbFileName != null && selectedPdbFileName.length() > 0)
630 btn_view.setEnabled(true);
631 lbl_fromFileStatus.setIcon(goodImage);
636 btn_pdbFromFile.setEnabled(false);
637 lbl_fromFileStatus.setIcon(errorImage);
642 public void cmbAssSeqStateChanged()
644 validateSelections();
648 * Handles the state change event for the 'filter' combo-box and 'invert'
652 protected void stateChanged(ItemEvent e)
654 if (e.getSource() instanceof JCheckBox)
660 if (e.getStateChange() == ItemEvent.SELECTED)
669 * Handles action event for btn_ok
672 public void ok_ActionPerformed()
674 FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
676 String currentView = selectedFilterOpt.getView();
677 if (currentView == VIEWS_FILTER)
679 int pdbIdCol = PDBRestClient.getPDBIdColumIndex(
680 lastPdbRequest.getWantedFields(), true);
681 int[] selectedRows = tbl_summary.getSelectedRows();
682 PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
684 for (int summaryRow : selectedRows)
686 String pdbIdStr = tbl_summary.getValueAt(summaryRow, pdbIdCol)
689 PDBEntry pdbEntry = cachedEntryMap.get(pdbIdStr.toLowerCase());
690 if (pdbEntry == null)
692 pdbEntry = new PDBEntry();
693 pdbEntry.setId(pdbIdStr);
694 pdbEntry.setType(PDBEntry.Type.PDB);
696 pdbEntriesToView[count++] = pdbEntry;
698 launchStructureViewer(ap.getStructureSelectionManager(),
699 pdbEntriesToView, ap, selectedSequences);
701 else if(currentView == VIEWS_LOCAL_PDB){
702 int[] selectedRows = tbl_local_pdb.getSelectedRows();
703 PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
705 for (int row : selectedRows)
707 String entryKey = tbl_local_pdb.getValueAt(row, 1).toString()
709 pdbEntriesToView[count++] = cachedEntryMap.get(entryKey);
711 launchStructureViewer(ap.getStructureSelectionManager(),
712 pdbEntriesToView, ap, selectedSequences);
714 else if (currentView == VIEWS_ENTER_ID)
716 SequenceI userSelectedSeq = ((AssociateSeqOptions) idInputAssSeqPanel
717 .getCmb_assSeq().getSelectedItem()).getSequence();
718 if (userSelectedSeq != null)
720 selectedSequence = userSelectedSeq;
723 String pdbIdStr = txt_search.getText();
724 PDBEntry pdbEntry = cachedEntryMap.get(pdbIdStr.toLowerCase());
725 if (pdbEntry == null)
727 pdbEntry = new PDBEntry();
728 pdbEntry.setId(txt_search.getText());
729 pdbEntry.setType(PDBEntry.Type.PDB);
732 selectedSequence.getDatasetSequence().addPDBId(pdbEntry);
733 PDBEntry[] pdbEntriesToView = new PDBEntry[]
735 launchStructureViewer(ap.getStructureSelectionManager(),
736 pdbEntriesToView, ap, new SequenceI[]
737 { selectedSequence });
739 else if (currentView == VIEWS_FROM_FILE)
741 SequenceI userSelectedSeq = ((AssociateSeqOptions) fileChooserAssSeqPanel
742 .getCmb_assSeq().getSelectedItem()).getSequence();
743 if (userSelectedSeq != null)
745 selectedSequence = userSelectedSeq;
747 PDBEntry fileEntry = new AssociatePdbFileWithSeq()
748 .associatePdbWithSeq(
749 selectedPdbFileName, jalview.io.AppletFormatAdapter.FILE,
750 selectedSequence, true, Desktop.instance);
752 launchStructureViewer(ap.getStructureSelectionManager(),
754 { fileEntry }, ap, new SequenceI[]
755 { selectedSequence });
760 private void launchStructureViewer(StructureSelectionManager ssm,
761 PDBEntry[] pdbEntriesToView, AlignmentPanel alignPanel,
762 SequenceI[] sequences)
764 StructureViewer sViewer = new StructureViewer(ssm);
765 if (pdbEntriesToView.length > 1)
767 sViewer.viewStructures(pdbEntriesToView, alignPanel.av.collateForPDB(pdbEntriesToView),
772 sViewer.viewStructures(pdbEntriesToView[0], sequences,
778 * Populates the combo-box used in associating manually fetched structures to
779 * a unique sequence when more than one sequence selection is made.
781 public void populateCmbAssociateSeqOptions(
782 JComboBox<AssociateSeqOptions> cmb_assSeq, JLabel lbl_associateSeq)
784 cmb_assSeq.removeAllItems();
785 cmb_assSeq.addItem(new AssociateSeqOptions("-Select Associated Seq-",
787 // cmb_assSeq.addItem(new AssociateSeqOptions("Auto Detect", null));
788 lbl_associateSeq.setVisible(false);
789 if (selectedSequences.length > 1)
791 for (SequenceI seq : selectedSequences)
793 cmb_assSeq.addItem(new AssociateSeqOptions(seq));
798 String seqName = selectedSequence.getDisplayId(false);
799 seqName = seqName.length() <= 40 ? seqName : seqName.substring(0, 39);
800 lbl_associateSeq.setText(seqName);
801 lbl_associateSeq.setVisible(true);
802 cmb_assSeq.setVisible(false);
806 public boolean isStructuresDiscovered()
808 return structuresDiscovered;
811 public void setStructuresDiscovered(boolean structuresDiscovered)
813 this.structuresDiscovered = structuresDiscovered;
816 public Collection<PDBResponseSummary> getDiscoveredStructuresSet()
818 return discoveredStructuresSet;
822 protected void txt_search_ActionPerformed()
824 errorWarning.setLength(0);
825 isValidPBDEntry = false;
826 if (txt_search.getText().length() > 0)
828 List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
829 wantedFields.add(PDBDocField.PDB_ID);
830 PDBRestRequest pdbRequest = new PDBRestRequest();
831 pdbRequest.setAllowEmptySeq(false);
832 pdbRequest.setResponseSize(1);
833 pdbRequest.setFieldToSearchBy("(pdb_id:");
834 pdbRequest.setWantedFields(wantedFields);
835 pdbRequest.setSearchTerm(txt_search.getText() + ")");
836 pdbRequest.setAssociatedSequence(selectedSequence.getName());
837 pdbRestCleint = new PDBRestClient();
838 PDBRestResponse resultList;
841 resultList = pdbRestCleint.executeRequest(pdbRequest);
842 } catch (Exception e)
844 errorWarning.append(e.getMessage());
848 validateSelections();
850 if (resultList.getSearchSummary() != null
851 && resultList.getSearchSummary().size() > 0)
853 isValidPBDEntry = true;
856 validateSelections();
860 public void tabRefresh()
862 if (selectedSequences != null)
864 Thread refreshThread = new Thread(new Runnable()
869 fetchStructuresMetaData();
870 filterResultSet(((FilterOption) cmb_filterOption
871 .getSelectedItem()).getValue());
874 refreshThread.start();