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))
+ if (protocol == DataSourceType.PASTE)
{
pdbentry.setFile("INLINE" + pdb.getId());
}
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))
+ if (protocol.equals(jalview.io.DataSourceType.PASTE))
{
pdbentry.setFile("INLINE" + pdb.getId());
}
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.ext.jmol.JalviewJmolBinding;
+ import jalview.gui.IProgressIndicator;
+import jalview.io.DataSourceType;
import jalview.structure.StructureSelectionManager;
import java.awt.Container;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.ext.jmol.JalviewJmolBinding;
+ import jalview.gui.IProgressIndicator;
+import jalview.io.DataSourceType;
import java.awt.Container;
import java.util.ArrayList;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+ import jalview.gui.IProgressIndicator;
-import jalview.io.AppletFormatAdapter;
+import jalview.io.DataSourceType;
import jalview.io.StructureFile;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ResidueProperties;
// see JAL-623 - need method of matching pasted data up
{
pdb = getSsm().setMapping(getSequence()[pe], getChains()[pe],
- pdbfile, DataSourceType.PASTE);
- pdbfile, AppletFormatAdapter.PASTE,
- getIProgressIndicator());
++ pdbfile, DataSourceType.PASTE, getIProgressIndicator());
getPdbEntry(modelnum).setFile("INLINE" + pdb.getId());
matches = true;
foundEntry = true;
setLoadingFromArchive(false);
}
+ @Override
+ public List<String> getChainNames()
+ {
+ return chainNames;
+ }
+
+ protected abstract IProgressIndicator getIProgressIndicator();
+
public void notifyNewPickingModeMeasurement(int iatom, String strMeasure)
{
notifyAtomPicked(iatom, strMeasure, null);
import javax.swing.JColorChooser;
import javax.swing.JInternalFrame;
import javax.swing.JMenu;
- import javax.swing.JOptionPane;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.MenuEvent;
stopProgressBar("", startTime);
}
// Explicitly map to the filename used by Chimera ;
- jmb.getSsm().setMapping(jmb.getSequence()[pos],
+ pdb = jmb.getSsm().setMapping(jmb.getSequence()[pos],
- jmb.getChains()[pos], pe.getFile(), protocol);
+ jmb.getChains()[pos], pe.getFile(), protocol,
+ progressBar);
+ stashFoundChains(pdb, pe.getFile());
} catch (OutOfMemoryError oomerror)
{
new OOMWarning(
import java.util.jar.JarOutputStream;
import javax.swing.JInternalFrame;
--import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import org.exolab.castor.xml.Marshaller;
StructureData filedat = oldFiles.get(id);
String pdbFile = filedat.getFilePath();
SequenceI[] seq = filedat.getSeqList().toArray(new SequenceI[0]);
- binding.getSsm().setMapping(seq, null, pdbFile, DataSourceType.FILE);
- binding.getSsm().setMapping(seq, null, pdbFile,
- jalview.io.AppletFormatAdapter.FILE, null);
++ binding.getSsm().setMapping(seq, null, pdbFile, DataSourceType.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();
+ final int preferredHeight = pnl_filter.getHeight();
- ssm.setProgressIndicator(this);
- ssm.setProgressSessionId(progressSessionId);
+ ssm.setMappingForPhyre2Model(false);
new Thread(new Runnable()
{
@Override
pdbEntry = getFindEntry(pdbIdStr,
selectedSeq.getAllPDBEntries());
}
- if (pdbEntry == null)
- {
- pdbEntry = new PDBEntry();
- pdbEntry.setId(pdbIdStr);
- pdbEntry.setType(PDBEntry.Type.PDB);
- selectedSeq.getDatasetSequence().addPDBId(pdbEntry);
+ if (pdbEntry == null)
+ {
+ pdbEntry = new PDBEntry();
+ pdbEntry.setId(pdbIdStr);
+ pdbEntry.setType(PDBEntry.Type.PDB);
+ selectedSeq.getDatasetSequence().addPDBId(pdbEntry);
+ }
+ pdbEntriesToView[count++] = pdbEntry;
+ }
+ SequenceI[] selectedSeqs = selectedSeqsToView
+ .toArray(new SequenceI[selectedSeqsToView.size()]);
+ launchStructureViewer(ssm, pdbEntriesToView, ap, selectedSeqs);
}
- pdbEntriesToView[count++] = pdbEntry;
- }
- SequenceI[] selectedSeqs = selectedSeqsToView
- .toArray(new SequenceI[selectedSeqsToView.size()]);
- launchStructureViewer(ssm, pdbEntriesToView, ap,
- selectedSeqs);
- }
- else if (currentView == VIEWS_LOCAL_PDB)
- {
- int[] selectedRows = tbl_local_pdb.getSelectedRows();
- PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
- int count = 0;
+ else if (currentView == VIEWS_LOCAL_PDB)
+ {
+ int[] selectedRows = tbl_local_pdb.getSelectedRows();
+ PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
+ int count = 0;
int pdbIdColIndex = tbl_local_pdb.getColumn("PDB Id")
.getModelIndex();
- int refSeqColIndex = tbl_local_pdb.getColumn("Ref Sequence")
- .getModelIndex();
- ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
- for (int row : selectedRows)
- {
- PDBEntry pdbEntry = (PDBEntry) tbl_local_pdb.getValueAt(row,
- pdbIdColIndex);
- pdbEntriesToView[count++] = pdbEntry;
- SequenceI selectedSeq = (SequenceI) tbl_local_pdb.getValueAt(row,
- refSeqColIndex);
- selectedSeqsToView.add(selectedSeq);
- }
- SequenceI[] selectedSeqs = selectedSeqsToView
- .toArray(new SequenceI[selectedSeqsToView.size()]);
- launchStructureViewer(ssm, pdbEntriesToView, ap,
- selectedSeqs);
- }
- else if (currentView == VIEWS_ENTER_ID)
- {
- SequenceI userSelectedSeq = ((AssociateSeqOptions) idInputAssSeqPanel
- .getCmb_assSeq().getSelectedItem()).getSequence();
- if (userSelectedSeq != null)
- {
- selectedSequence = userSelectedSeq;
- }
+ int refSeqColIndex = tbl_local_pdb.getColumn("Ref Sequence")
+ .getModelIndex();
+ List<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
+ for (int row : selectedRows)
+ {
+ PDBEntry pdbEntry = (PDBEntry) tbl_local_pdb.getValueAt(row,
+ pdbIdColIndex);
+ pdbEntriesToView[count++] = pdbEntry;
+ SequenceI selectedSeq = (SequenceI) tbl_local_pdb.getValueAt(
+ row, refSeqColIndex);
+ selectedSeqsToView.add(selectedSeq);
+ }
+ SequenceI[] selectedSeqs = selectedSeqsToView
+ .toArray(new SequenceI[selectedSeqsToView.size()]);
+ launchStructureViewer(ssm, pdbEntriesToView, ap, selectedSeqs);
+ }
+ else if (currentView == VIEWS_ENTER_ID)
+ {
+ SequenceI userSelectedSeq = ((AssociateSeqOptions) idInputAssSeqPanel
+ .getCmb_assSeq().getSelectedItem()).getSequence();
+ if (userSelectedSeq != null)
+ {
+ selectedSequence = userSelectedSeq;
+ }
- String pdbIdStr = txt_search.getText();
- PDBEntry pdbEntry = selectedSequence.getPDBEntry(pdbIdStr);
- if (pdbEntry == null)
- {
- pdbEntry = new PDBEntry();
++
+ String pdbIdStr = txt_search.getText();
+ PDBEntry pdbEntry = selectedSequence.getPDBEntry(pdbIdStr);
+ if (pdbEntry == null)
+ {
+ pdbEntry = new PDBEntry();
if (pdbIdStr.split(":").length > 1)
{
- pdbEntry.setChainCode(pdbIdStr.split(":")[1]);
+ pdbEntry.setId(pdbIdStr.split(":")[0]);
+ pdbEntry.setChainCode(pdbIdStr.split(":")[1].toUpperCase());
}
- pdbEntry.setId(pdbIdStr);
- pdbEntry.setType(PDBEntry.Type.PDB);
- selectedSequence.getDatasetSequence().addPDBId(pdbEntry);
- }
+ else
+ {
+ pdbEntry.setId(pdbIdStr);
+ }
+ pdbEntry.setType(PDBEntry.Type.PDB);
+ selectedSequence.getDatasetSequence().addPDBId(pdbEntry);
+ }
- PDBEntry[] pdbEntriesToView = new PDBEntry[] { pdbEntry };
+ PDBEntry[] pdbEntriesToView = new PDBEntry[] { pdbEntry };
launchStructureViewer(ssm, pdbEntriesToView, ap,
new SequenceI[] { selectedSequence });
}
{
selectedSequence = userSelectedSeq;
}
- PDBEntry fileEntry = new AssociatePdbFileWithSeq()
- .associatePdbWithSeq(selectedPdbFileName,
- jalview.io.AppletFormatAdapter.FILE,
+ PDBEntry fileEntry = new AssociateStructureFileWithSeq()
+ .associateStructureWithSeq(selectedStructureFileName,
+ DataSourceType.FILE,
selectedSequence, true, Desktop.instance);
- launchStructureViewer(ssm, new PDBEntry[] { fileEntry }, ap,
+ launchStructureViewer(ssm,
+ new PDBEntry[] { fileEntry }, ap,
new SequenceI[] { selectedSequence });
- }
- mainFrame.dispose();
+ }
+ else if (currentView == VIEWS_PHYRE2_PREDICTION)
+ {
+ SequenceI userSelectedSeq = ((AssociateSeqOptions) phyre2InputAssSeqPanel
+ .getCmb_assSeq().getSelectedItem()).getSequence();
+ if (userSelectedSeq != null)
+ {
+ selectedSequence = userSelectedSeq;
+ }
+ int templateColIndex = getPhyreResultTable()
+ .getColumn("Template")
+ .getModelIndex();
+ int[] selectedRows = getPhyreResultTable().getSelectedRows();
+ PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
+ int count = 0;
+ for (int row : selectedRows)
+ {
+ String templateId = getPhyreResultTable().getValueAt(row,
+ templateColIndex).toString();
+ String structureFile = phyre2ResultDirectory + templateId
+ + ".pdb";
+ pdbEntriesToView[count++] = new AssociateStructureFileWithSeq()
+ .associateStructureWithSeq(structureFile,
+ DataSourceType.FILE, selectedSequence, true,
+ Desktop.instance);
+ }
+
+ final StructureSelectionManager ssm = ap
+ .getStructureSelectionManager();
+ ssm.setMappingForPhyre2Model(true);
+ final long progressSessionId = System.currentTimeMillis();
+ ssm.setProgressSessionId(progressSessionId);
+
+ SequenceI[] sequences = new SequenceI[] { selectedSequence };
+
+ ssm.setProgressBar(MessageManager
+ .getString("status.launching_3d_structure_viewer"));
+ final StructureViewer sViewer = new StructureViewer(ssm);
+ if (pdbEntriesToView.length > 1)
+ {
+ ArrayList<SequenceI[]> seqsMap = new ArrayList<SequenceI[]>();
+ for (SequenceI seq : sequences)
+ {
+ 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"));
+ sViewer.viewStructures(pdbEntriesToView, collatedSeqs, ap);
+ }
+ else
+ {
+ ssm.setProgressBar(null);
+ ssm.setProgressBar(MessageManager.formatMessage(
+ "status.fetching_3d_structures_for",
+ pdbEntriesToView[0].getId()));
+ sViewer.viewStructures(pdbEntriesToView[0], sequences, ap);
+ }
+ }
+ closeAction(preferredHeight);
}
}).start();
}
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>();
+ List<SequenceI> seqsWithoutSourceDBRef = new ArrayList<SequenceI>();
+ int p = 0;
+ // TODO: skip PDBEntry:Sequence pairs where PDBEntry doesn't look like a
+ // real PDB ID. For moment, we can also safely do this if there is already
+ // a known mapping between the PDBEntry and the sequence.
++
for (SequenceI seq : sequences)
{
- if (seq.getSourceDBRef() == null && seq.getDBRefs() == null)
+ PDBEntry pdbe = pdbEntriesToView[p++];
+ if (pdbe != null && pdbe.getFile() != null)
{
- seqsWithoutSourceDBRef.add(seq);
- continue;
+ StructureMapping[] smm = ssm.getMapping(pdbe.getFile());
+ if (smm != null && smm.length > 0)
+ {
+ for (StructureMapping sm : smm)
+ {
+ if (sm.getSequence() == seq)
+ {
+ continue;
+ }
+ }
}
+ }
+ if (seq.getPrimaryDBRefs().size() == 0)
+ {
+ seqsWithoutSourceDBRef.add(seq);
+ continue;
+ }
}
if (!seqsWithoutSourceDBRef.isEmpty())
{
import java.util.List;
import java.util.Vector;
+import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenuItem;
--import javax.swing.JOptionPane;
/**
* Base class with common functionality for JMol, Chimera or other structure
* create the mappings
*/
apanel.getStructureSelectionManager().setMapping(seq, chains,
- pdbFilename, DataSourceType.FILE);
- pdbFilename, AppletFormatAdapter.FILE, getIProgressIndicator());
++ pdbFilename, DataSourceType.FILE, getIProgressIndicator());
/*
* alert the FeatureRenderer to show new (PDB RESNUM) features
* @return null or the structure data parsed as a pdb file
*/
synchronized public StructureFile setMapping(SequenceI[] sequence,
- String[] targetChains, String pdbFile, DataSourceType protocol)
- String[] targetChains, String pdbFile, String protocol,
++ String[] targetChains, String pdbFile, DataSourceType protocol,
+ IProgressIndicator progress)
{
- return setMapping(true, sequence, targetChains, pdbFile, protocol);
+ return computeMapping(true, sequence, targetChains, pdbFile, protocol,
+ progress);
}
+
/**
* create sequence structure mappings between each sequence and the given
* pdbFile (retrieved via the given protocol).
*/
synchronized public StructureFile setMapping(boolean forStructureView,
SequenceI[] sequenceArray, String[] targetChainIds,
- String pdbFile, DataSourceType sourceType)
- String pdbFile,
- String protocol)
++ String pdbFile, DataSourceType protocol)
{
+ return computeMapping(forStructureView, sequenceArray, targetChainIds,
+ pdbFile, protocol, null);
+ }
+
+ synchronized public StructureFile computeMapping(
+ boolean forStructureView, SequenceI[] sequenceArray,
- String[] targetChainIds, String pdbFile, String protocol,
++ String[] targetChainIds, String pdbFile, DataSourceType 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
boolean isMapUsingSIFTs = SiftsSettings.isMapWithSifts();
try
{
- pdb = new JmolParser(pdbFile, sourceType);
-
- if (pdbFile != null && isCIFFile(pdbFile))
- {
- pdb = new jalview.ext.jmol.JmolParser(addTempFacAnnot, parseSecStr,
- secStructServices, pdbFile, protocol);
- }
- else
- {
- pdb = new PDBfile(addTempFacAnnot, parseSecStr, secStructServices,
- pdbFile, protocol);
- }
++ pdb = new JmolParser(pdbFile, protocol);
if (pdb.getId() != null && pdb.getId().trim().length() > 0
- && DataSourceType.FILE == sourceType)
- && AppletFormatAdapter.FILE.equals(protocol))
++ && DataSourceType.FILE == protocol)
{
registerPDBFile(pdb.getId().trim(), pdbFile);
}
continue;
}
- if (sourceType == DataSourceType.PASTE)
- if (protocol.equals(jalview.io.AppletFormatAdapter.PASTE))
++ if (protocol.equals(DataSourceType.PASTE))
{
pdbFile = "INLINE" + pdb.getId();
}
- ArrayList<StructureMapping> seqToStrucMapping = new ArrayList<StructureMapping>();
- if (isMapUsingSIFTs)
+
+ List<StructureMapping> seqToStrucMapping = new ArrayList<StructureMapping>();
+ if (!isMappingForPhyre2Model() && isMapUsingSIFTs && seq.isProtein())
{
- 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 if (isMappingForPhyre2Model())
+ {
+ setProgressBar(null);
+ setProgressBar(MessageManager
+ .getString("status.obtaining_mapping_with_phyre2_template_alignment"));
+ StructureMapping phyre2ModelMapping = new Phyre2Client(pdb)
+ .getStructureMapping(seq, pdbFile, " ");
+
+ seqToStrucMapping.add(phyre2ModelMapping);
+ ds.addPDBId(maxChain.sequence.getAllPDBEntries().get(0));
+ }
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"),
++ .getString("status.obtaining_mapping_with_nw_alignment"),
+ progressSessionId);
+ }
- seqToStrucMapping.add(getNWMappings(seq, pdbFile, maxChainId,
- maxChain, pdb, maxAlignseq));
+ StructureMapping nwMapping = getNWMappings(seq, pdbFile,
+ maxChainId, maxChain, pdb, maxAlignseq);
+ seqToStrucMapping.add(nwMapping);
+ ds.addPDBId(maxChain.sequence.getAllPDBEntries().get(0));
+
}
+
if (forStructureView)
{
mappings.addAll(seqToStrucMapping);
seqs[2] = new SequenceI[] { seq3 };
StructureSelectionManager ssm = new StructureSelectionManager();
- ssm.setMapping(new SequenceI[] { seq1 }, null, PDB_1,
- AppletFormatAdapter.PASTE, null);
+ ssm.setMapping(new SequenceI[] { seq1a, seq1b }, null, PDB_1,
- DataSourceType.PASTE);
++ DataSourceType.PASTE, null);
ssm.setMapping(new SequenceI[] { seq2 }, null, PDB_2,
- DataSourceType.PASTE);
- AppletFormatAdapter.PASTE, null);
++ DataSourceType.PASTE, null);
ssm.setMapping(new SequenceI[] { seq3 }, null, PDB_3,
- DataSourceType.PASTE);
- AppletFormatAdapter.PASTE, null);
++ DataSourceType.PASTE, null);
++
- testee = new AAStructureBindingModel(ssm, pdbFiles, seqs, chains, null)
+ testee = new AAStructureBindingModel(ssm, pdbFiles, seqs, null)
{
@Override
public String[] getPdbFile()