try
{
- pdb = ssm.setMapping(seq, chains, pdbentry.getFile(), protocol);
+ pdb = ssm.setMapping(seq, chains, pdbentry.getFile(), protocol, null);
if (protocol.equals(jalview.io.AppletFormatAdapter.PASTE))
{
try
{
- pdb = ssm.setMapping(seq, chains, pdbentry.getFile(), protocol);
+ pdb = ssm.setMapping(seq, chains, pdbentry.getFile(), protocol,
+ ap.alignFrame);
if (protocol.equals(jalview.io.AppletFormatAdapter.PASTE))
{
{
// register the association(s) and quit, don't create any windows.
if (StructureSelectionManager.getStructureSelectionManager(applet)
- .setMapping(seqs, chains, pdb.getFile(), protocol) == null)
+ .setMapping(seqs, chains, pdb.getFile(), protocol, null) == null)
{
System.err.println("Failed to map " + pdb.getFile() + " ("
+ protocol + ") to any sequences");
{
reader = StructureSelectionManager.getStructureSelectionManager(
ap.av.applet).setMapping(seq, chains, pdbentry.getFile(),
- protocol);
+ protocol, null);
// PROMPT USER HERE TO ADD TO NEW OR EXISTING VIEW?
// FOR NOW, LETS JUST OPEN A NEW WINDOW
}
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.ext.jmol.JalviewJmolBinding;
+import jalview.gui.IProgressIndicator;
import jalview.structure.StructureSelectionManager;
import java.awt.Container;
appletJmolBinding.updateTitleAndMenus();
}
+ @Override
public void updateColours(Object source)
{
AlignmentPanel ap = (AlignmentPanel) source;
colourBySequence(ap);
}
+ @Override
public void showUrl(String url)
{
try
// do nothing.
}
+ @Override
public void selectionChanged(BS arg0)
{
// TODO Auto-generated method stub
// TODO Auto-generated method stub
return null;
}
+
+ @Override
+ protected IProgressIndicator getIProgressIndicator()
+ {
+ // no progress indicators on the applet
+ return null;
+ }
}
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.ext.jmol.JalviewJmolBinding;
+import jalview.gui.IProgressIndicator;
import java.awt.Container;
import java.util.ArrayList;
notifyFileLoaded(null, null, null, null, 0);
}
+ @Override
+ protected IProgressIndicator getIProgressIndicator()
+ {
+ // no progress indicators on applet (could access javascript for this)
+ return null;
+ }
+
+ @Override
public void updateColours(Object source)
{
}
+ @Override
public void showUrl(String arg0)
{
showUrl(arg0, "jmol");
}
}
+
@Override
public SequenceRenderer getSequenceRenderer(AlignmentViewPanel alignment)
{
// ignore
}
+ @Override
public void selectionChanged(BS arg0)
{
System.out.println(arg0);
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.gui.IProgressIndicator;
import jalview.io.AppletFormatAdapter;
import jalview.io.StructureFile;
import jalview.schemes.ColourSchemeI;
// see JAL-623 - need method of matching pasted data up
{
pdb = getSsm().setMapping(getSequence()[pe], getChains()[pe],
- pdbfile, AppletFormatAdapter.PASTE);
+ pdbfile, AppletFormatAdapter.PASTE,
+ getIProgressIndicator());
getPdbEntry(modelnum).setFile("INLINE" + pdb.getId());
matches = true;
foundEntry = true;
}
// Explicitly map to the filename used by Jmol ;
pdb = getSsm().setMapping(getSequence()[pe], getChains()[pe],
- fileName, protocol);
+ fileName, protocol, getIProgressIndicator());
// pdbentry[pe].getFile(), protocol);
}
setLoadingFromArchive(false);
}
+ protected abstract IProgressIndicator getIProgressIndicator();
+
public void notifyNewPickingModeMeasurement(int iatom, String strMeasure)
{
notifyAtomPicked(iatom, strMeasure, null);
IProgressIndicator progressBar = null;
+ @Override
+ protected IProgressIndicator getIProgressIndicator()
+ {
+ return progressBar;
+ }
/**
* add a single PDB structure to a new or existing Jmol view
*
}
@Override
+ protected IProgressIndicator getIProgressIndicator()
+ {
+ return appJmolWindow.progressBar;
+ }
+ @Override
public FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment)
{
AlignmentPanel ap = (alignment == null) ? appJmolWindow
// appJmolWindow.repaint();
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
appJmolWindow.updateTitleAndMenus();
});
}
+ @Override
public void updateColours(Object source)
{
AlignmentPanel ap = (AlignmentPanel) source;
// msWalltime);
}
+ @Override
public void showUrl(String url)
{
showUrl(url, "jmol");
}
// Explicitly map to the filename used by Chimera ;
jmb.getSsm().setMapping(jmb.getSequence()[pos],
- jmb.getChains()[pos], pe.getFile(), protocol);
+ jmb.getChains()[pos], pe.getFile(), protocol,
+ progressBar);
} catch (OutOfMemoryError oomerror)
{
new OOMWarning(
/**
* Fetch PDB data and save to a local file. Returns the full path to the file,
- * or null if fetch fails.
+ * or null if fetch fails. TODO: refactor to common with Jmol ? duplication
*
* @param processingEntry
* @return
{
return jmb;
}
+
+ @Override
+ protected IProgressIndicator getIProgressIndicator()
+ {
+ return progressBar;
+ }
}
* is removed with a second call with same ID.
*
* @param message
- * - displayed message for operation
+ * - displayed message for operation. Please ensure message is
+ * internationalised.
* @param id
* - unique handle for this indicator
*/
String pdbFile = filedat.getFilePath();
SequenceI[] seq = filedat.getSeqList().toArray(new SequenceI[0]);
binding.getSsm().setMapping(seq, null, pdbFile,
- jalview.io.AppletFormatAdapter.FILE);
+ jalview.io.AppletFormatAdapter.FILE, null);
binding.addSequenceForStructFile(pdbFile, seq);
}
// and add the AlignmentPanel's reference to the view panel
@Override
public void ok_ActionPerformed()
{
- final long progressSessionId = System.currentTimeMillis();
final StructureSelectionManager ssm = ap.getStructureSelectionManager();
- ssm.setProgressIndicator(this);
- ssm.setProgressSessionId(progressSessionId);
new Thread(new Runnable()
{
@Override
}
SequenceI[] selectedSeqs = selectedSeqsToView
.toArray(new SequenceI[selectedSeqsToView.size()]);
- launchStructureViewer(ssm, pdbEntriesToView, ap, selectedSeqs);
+ launchStructureViewer(ssm, pdbEntriesToView, ap,
+ selectedSeqs);
}
else if (currentView == VIEWS_LOCAL_PDB)
{
}
SequenceI[] selectedSeqs = selectedSeqsToView
.toArray(new SequenceI[selectedSeqsToView.size()]);
- launchStructureViewer(ssm, pdbEntriesToView, ap, selectedSeqs);
+ launchStructureViewer(ssm, pdbEntriesToView, ap,
+ selectedSeqs);
}
else if (currentView == VIEWS_ENTER_ID)
{
jalview.io.AppletFormatAdapter.FILE,
selectedSequence, true, Desktop.instance);
- launchStructureViewer(ssm, new PDBEntry[] { fileEntry }, ap,
+ launchStructureViewer(ssm,
+ new PDBEntry[] { fileEntry }, ap,
new SequenceI[] { selectedSequence });
}
mainFrame.dispose();
final PDBEntry[] pdbEntriesToView,
final AlignmentPanel alignPanel, SequenceI[] sequences)
{
- ssm.setProgressBar(MessageManager
- .getString("status.launching_3d_structure_viewer"));
+ long progressId = sequences.hashCode();
+ setProgressBar(MessageManager
+ .getString("status.launching_3d_structure_viewer"), progressId);
final StructureViewer sViewer = new StructureViewer(ssm);
+ setProgressBar(null, progressId);
if (SiftsSettings.isMapWithSifts())
{
+ // TODO: prompt user if there are lots of sequences without dbrefs.
+ // It can take a long time if we need to fetch all dbrefs for all
+ // sequences!
ArrayList<SequenceI> seqsWithoutSourceDBRef = new ArrayList<SequenceI>();
for (SequenceI seq : sequences)
{
if (!seqsWithoutSourceDBRef.isEmpty())
{
int y = seqsWithoutSourceDBRef.size();
- ssm.setProgressBar(null);
- ssm.setProgressBar(MessageManager.formatMessage(
+ setProgressBar(MessageManager.formatMessage(
"status.fetching_dbrefs_for_sequences_without_valid_refs",
- y));
+ y), progressId);
SequenceI[] seqWithoutSrcDBRef = new SequenceI[y];
int x = 0;
for (SequenceI fSeq : seqsWithoutSourceDBRef)
seqWithoutSrcDBRef[x++] = fSeq;
}
new DBRefFetcher(seqWithoutSrcDBRef).fetchDBRefs(true);
+ setProgressBar("Fetch complete.", progressId); // todo i18n
}
}
if (pdbEntriesToView.length > 1)
seqsMap.add(new SequenceI[] { seq });
}
SequenceI[][] collatedSeqs = seqsMap.toArray(new SequenceI[0][0]);
- ssm.setProgressBar(null);
- ssm.setProgressBar(MessageManager
- .getString("status.fetching_3d_structures_for_selected_entries"));
+ setProgressBar(MessageManager
+ .getString("status.fetching_3d_structures_for_selected_entries"), progressId);
sViewer.viewStructures(pdbEntriesToView, collatedSeqs, alignPanel);
}
else
{
- ssm.setProgressBar(null);
- ssm.setProgressBar(MessageManager.formatMessage(
+ setProgressBar(MessageManager.formatMessage(
"status.fetching_3d_structures_for",
- pdbEntriesToView[0].getId()));
+ pdbEntriesToView[0].getId()),progressId);
sViewer.viewStructures(pdbEntriesToView[0], sequences, alignPanel);
}
+ setProgressBar(null, progressId);
}
/**
this.ap = alp;
}
+ @Override
public AlignmentPanel[] getAllAlignmentPanels()
{
AlignmentPanel[] t, list = new AlignmentPanel[0];
protected abstract AAStructureBindingModel getBindingModel();
+ protected abstract IProgressIndicator getIProgressIndicator();
+
/**
* add a new structure (with associated sequences and chains) to this viewer,
* retrieving it if necessary first.
// queue.
new Thread(new Runnable()
{
+ @Override
public void run()
{
while (worker != null && worker.isAlive() && _started)
* create the mappings
*/
apanel.getStructureSelectionManager().setMapping(seq, chains,
- pdbFilename, AppletFormatAdapter.FILE);
+ pdbFilename, AppletFormatAdapter.FILE, getIProgressIndicator());
/*
* alert the FeatureRenderer to show new (PDB RESNUM) features
private boolean addTempFacAnnot = false;
- private IProgressIndicator progressIndicator;
-
private SiftsClient siftsClient = null;
- private long progressSessionId;
-
/*
* Set of any registered mappings between (dataset) sequences.
*/
* @return null or the structure data parsed as a pdb file
*/
synchronized public StructureFile setMapping(SequenceI[] sequence,
- String[] targetChains, String pdbFile, String protocol)
+ String[] targetChains, String pdbFile, String protocol,
+ IProgressIndicator progress)
{
- return setMapping(true, sequence, targetChains, pdbFile, protocol);
+ return computeMapping(true, sequence, targetChains, pdbFile, protocol,
+ progress);
}
* - one or more sequences to be mapped to pdbFile
* @param targetChainIds
* - optional chain specification for mapping each sequence to pdb
- * (may be nill, individual elements may be nill)
+ * (may be null, individual elements may be null)
* @param pdbFile
* - structure data resource
* @param protocol
String pdbFile,
String protocol)
{
+ return computeMapping(forStructureView, sequenceArray, targetChainIds,
+ pdbFile, protocol, null);
+ }
+
+ synchronized public StructureFile computeMapping(
+ boolean forStructureView, SequenceI[] sequenceArray,
+ String[] targetChainIds, String pdbFile, String protocol,
+ IProgressIndicator progress)
+ {
+ long progressSessionId = System.currentTimeMillis() * 3;
/*
* There will be better ways of doing this in the future, for now we'll use
* the tried and tested MCview pdb mapping
{
pdbFile = "INLINE" + pdb.getId();
}
-
ArrayList<StructureMapping> seqToStrucMapping = new ArrayList<StructureMapping>();
if (isMapUsingSIFTs)
{
- setProgressBar(null);
- setProgressBar(MessageManager
- .getString("status.obtaining_mapping_with_sifts"));
+ if (progress!=null) {
+ progress.setProgressBar(MessageManager
+ .getString("status.obtaining_mapping_with_sifts"),
+ progressSessionId);
+ }
jalview.datamodel.Mapping sqmpping = maxAlignseq
.getMappingFromS1(false);
if (targetChainId != null && !targetChainId.trim().isEmpty())
}
else
{
- setProgressBar(null);
- setProgressBar(MessageManager
- .getString("status.obtaining_mapping_with_nw_alignment"));
+ if (progress != null)
+ {
+ progress.setProgressBar(MessageManager
+ .getString("status.obtaining_mapping_with_nw_alignment"),
+ progressSessionId);
+ }
seqToStrucMapping.add(getNWMappings(seq, pdbFile, maxChainId,
maxChain, pdb, maxAlignseq));
}
-
if (forStructureView)
{
mappings.addAll(seqToStrucMapping);
}
+ if (progress != null)
+ {
+ progress.setProgressBar(null, progressSessionId);
+ }
}
return pdb;
}
return null;
}
- public IProgressIndicator getProgressIndicator()
- {
- return progressIndicator;
- }
-
- public void setProgressIndicator(IProgressIndicator progressIndicator)
- {
- this.progressIndicator = progressIndicator;
- }
-
- public long getProgressSessionId()
- {
- return progressSessionId;
- }
-
- public void setProgressSessionId(long progressSessionId)
- {
- this.progressSessionId = progressSessionId;
- }
-
- public void setProgressBar(String message)
- {
- if (progressIndicator == null)
- {
- return;
- }
- progressIndicator.setProgressBar(message, progressSessionId);
- }
-
public List<AlignedCodonFrame> getSequenceMappings()
{
return seqmappings;
StructureSelectionManager ssm = new StructureSelectionManager();
ssm.setMapping(new SequenceI[] { seq1 }, null, PDB_1,
- AppletFormatAdapter.PASTE);
+ AppletFormatAdapter.PASTE, null);
ssm.setMapping(new SequenceI[] { seq2 }, null, PDB_2,
- AppletFormatAdapter.PASTE);
+ AppletFormatAdapter.PASTE, null);
ssm.setMapping(new SequenceI[] { seq3 }, null, PDB_3,
- AppletFormatAdapter.PASTE);
+ AppletFormatAdapter.PASTE, null);
testee = new AAStructureBindingModel(ssm, pdbFiles, seqs, chains, null)
{