package jalview.gui;
+import jalview.bin.Cache;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.io.AppletFormatAdapter;
+import jalview.io.JalviewFileChooser;
+import jalview.io.JalviewFileView;
import jalview.jbgui.GStructureChooser;
import jalview.jbgui.PDBDocFieldPreferences;
import jalview.structure.StructureSelectionManager;
public void run()
{
long startTime = System.currentTimeMillis();
- String msg = MessageManager.getString("status.fetching_db_refs");
- updateProgressIndicator(msg, startTime);
+ updateProgressIndicator(MessageManager
+ .getString("status.loading_cached_pdb_entries"), startTime);
loadLocalCachedPDBEntries();
+ updateProgressIndicator(null, startTime);
+ updateProgressIndicator(MessageManager
+ .getString("status.searching_for_pdb_structures"),
+ startTime);
fetchStructuresMetaData();
populateFilterComboBox();
updateProgressIndicator(null, startTime);
&& !resultList.getSearchSummary().isEmpty())
{
discoveredStructuresSet.addAll(resultList.getSearchSummary());
- updateSequenceDbRef(seq, resultList.getSearchSummary());
+ updateSequencePDBEntries(seq, resultList.getSearchSummary());
}
}
.setTitle("Structure Chooser - Manual association");
if (errors.size() > 0)
{
- StringBuilder errorMsg = new StringBuilder(
- "Operation was unsucessful due to the following: \n");
+ StringBuilder errorMsg = new StringBuilder();
+ // "Operation was unsucessful due to the following: \n");
for (String error : errors)
{
errorMsg.append(error).append("\n");
{
for (PDBEntry pdbEntry : seq.getDatasetSequence().getPDBId())
{
+
String chain = pdbEntry.getChainCode() == null ? "_" : pdbEntry
.getChainCode();
String[] pdbEntryRowData = new String[]
chain,
pdbEntry.getType(),
pdbEntry.getFile() };
- tableModel.addRow(pdbEntryRowData);
+ if (pdbEntry.getFile() != null)
+ {
+ tableModel.addRow(pdbEntryRowData);
+ }
cachedEntryMap.put(pdbEntry.getId().toLowerCase(),
pdbEntry);
}
}
/**
- * Update the DBRef entry for a given sequence with values retrieved from
+ * Update the PDBEntry for a given sequence with values retrieved from
* PDBResponseSummary
*
* @param seq
* @param responseSummaries
* a collection of PDBResponseSummary
*/
- public void updateSequenceDbRef(SequenceI seq,
+ public void updateSequencePDBEntries(SequenceI seq,
Collection<PDBResponseSummary> responseSummaries)
{
for (PDBResponseSummary response : responseSummaries)
{
- PDBEntry newEntry = new PDBEntry();
- newEntry.setId(response.getPdbId());
- newEntry.setType(PDBEntry.Type.PDB);
- seq.getDatasetSequence().addPDBId(newEntry);
+ String pdbIdStr = response.getPdbId();
+ PDBEntry pdbEntry = cachedEntryMap.get(pdbIdStr.toLowerCase());
+ if (pdbEntry == null)
+ {
+ pdbEntry = new PDBEntry();
+ pdbEntry.setId(pdbIdStr);
+ pdbEntry.setType(PDBEntry.Type.PDB);
+ }
+ seq.getDatasetSequence().addPDBId(pdbEntry);
}
}
+ totalTime + ")");
if (errors.size() > 0)
{
- StringBuilder errorMsg = new StringBuilder(
- "Operation unsucessful due to the following: \n");
+ StringBuilder errorMsg = new StringBuilder();
for (String error : errors)
{
errorMsg.append(error).append("\n");
*/
public void pdbFromFile_actionPerformed()
{
- jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
- chooser.setFileView(new jalview.io.JalviewFileView());
+ JalviewFileChooser chooser = new JalviewFileChooser(
+ Cache.getProperty("LAST_DIRECTORY"));
+ chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(MessageManager.formatMessage(
"label.select_pdb_file_for", new String[]
{ selectedSequence.getDisplayId(false) }));
{ selectedSequence.getDisplayId(false) }));
int value = chooser.showOpenDialog(null);
- if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION)
+ if (value == JalviewFileChooser.APPROVE_OPTION)
{
selectedPdbFileName = chooser.getSelectedFile().getPath();
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", selectedPdbFileName);
+ Cache.setProperty("LAST_DIRECTORY", selectedPdbFileName);
validateSelections();
}
}
AssociateSeqOptions assSeqOpt = (AssociateSeqOptions) idInputAssSeqPanel
.getCmb_assSeq().getSelectedItem();
lbl_pdbManualFetchStatus.setIcon(errorImage);
+ lbl_pdbManualFetchStatus.setToolTipText("");
+ if (txt_search.getText().length() > 0)
+ {
+ lbl_pdbManualFetchStatus.setToolTipText(JvSwingUtils.wrapTooltip(
+ true, "No PDB entry found for \'" + txt_search.getText()
+ + "\'"));
+ }
+
+ if (errorWarning.length() > 0)
+ {
+ lbl_pdbManualFetchStatus.setIcon(warningImage);
+ lbl_pdbManualFetchStatus.setToolTipText(JvSwingUtils.wrapTooltip(
+ true, errorWarning.toString()));
+ }
+
if (selectedSequences.length == 1
|| !assSeqOpt.getName().equalsIgnoreCase(
"-Select Associated Seq-"))
if (isValidPBDEntry)
{
btn_view.setEnabled(true);
+ lbl_pdbManualFetchStatus.setToolTipText("");
lbl_pdbManualFetchStatus.setIcon(goodImage);
}
}
}
PDBEntry fileEntry = new AssociatePdbFileWithSeq()
.associatePdbWithSeq(
- selectedPdbFileName, jalview.io.AppletFormatAdapter.FILE,
+ selectedPdbFileName, AppletFormatAdapter.FILE,
selectedSequence, true, Desktop.instance);
launchStructureViewer(ap.getStructureSelectionManager(),
private void launchStructureViewer(StructureSelectionManager ssm,
PDBEntry[] pdbEntriesToView, AlignmentPanel alignPanel,
- SequenceI[] selectedSequences)
+ SequenceI[] sequences)
{
StructureViewer sViewer = new StructureViewer(ssm);
if (pdbEntriesToView.length > 1)
{
- sViewer.viewStructures(alignPanel, pdbEntriesToView,
- alignPanel.av.collateForPDB(pdbEntriesToView));
+ sViewer.viewStructures(pdbEntriesToView, alignPanel.av.collateForPDB(pdbEntriesToView),
+ alignPanel);
}
else
{
- sViewer.viewStructures(pdbEntriesToView[0], selectedSequences, null,
+ sViewer.viewStructures(pdbEntriesToView[0], sequences,
alignPanel);
}
}
@Override
protected void txt_search_ActionPerformed()
{
+ errorWarning.setLength(0);
isValidPBDEntry = false;
if (txt_search.getText().length() > 0)
{
resultList = pdbRestCleint.executeRequest(pdbRequest);
} catch (Exception e)
{
- JOptionPane.showMessageDialog(this, e.getMessage(),
- "PDB Web-service Error", JOptionPane.ERROR_MESSAGE);
+ errorWarning.append(e.getMessage());
return;
} finally
{
- System.out.println(">>>>> executing finally block");
validateSelections();
}
if (resultList.getSearchSummary() != null
}
}
-
}