import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import java.util.Random;
-import java.util.Set;
import java.util.Vector;
import javax.swing.JCheckBoxMenuItem;
// TODO Auto-generated method stub
}
});
+ JMenuItem writeFeatures = new JMenuItem(
+ MessageManager.getString("label.create_chimera_attributes"));
+ writeFeatures.setToolTipText(MessageManager
+ .getString("label.create_chimera_attributes_tip"));
+ writeFeatures.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ sendFeaturesToChimera();
+ }
+ });
+ viewerActionMenu.add(writeFeatures);
+ }
+
+ /**
+ * Send a command to Chimera to create residue attributes for Jalview features
+ * <p>
+ * The syntax is: setattr r <attName> <attValue> <atomSpec>
+ * <p>
+ * For example: setattr r jv:chain "Ferredoxin-1, Chloroplastic" #0:94.A
+ */
+ protected void sendFeaturesToChimera()
+ {
+ jmb.sendFeaturesToChimera(getAlignmentPanel());
}
/**
public ChimeraViewFrame(PDBEntry pdbentry, SequenceI[] seq,
String[] chains, final AlignmentPanel ap)
{
- super();
+ this();
String pdbId = pdbentry.getId();
/*
SequenceI[][] seqs)
{
createProgressBar();
+ // FIXME extractChains needs pdbentries to match IDs to PDBEntry(s) on seqs
String[][] chains = extractChains(seqs);
jmb = new JalviewChimeraBindingModel(this,
ap.getStructureSelectionManager(), pdbentrys, seqs, chains,
.getAllPDBEntries();
if (pdbrefs != null && pdbrefs.size() > 0)
{
+ // FIXME: SequenceI.PDBEntry[0] chain mapping used for
+ // ChimeraViewFrame. Is this even used ???
+
chain = pdbrefs.get(0).getChainCode();
}
}
SequenceI[][] seqsArray, boolean colourByChimera,
boolean colourBySequence, String newViewId)
{
- super();
+ this();
setViewId(newViewId);
this.chimeraSessionFile = chimeraSessionFile;
openNewChimera(alignPanel, pdbArray, seqsArray);
public ChimeraViewFrame(PDBEntry[] pe, SequenceI[][] seqs,
AlignmentPanel ap)
{
- super();
+ this();
openNewChimera(ap, pe, seqs);
}
- public ChimeraViewFrame(Map<PDBEntry, List<SequenceI>> toView,
- AlignmentPanel alignPanel)
+ /**
+ * Default constructor
+ */
+ public ChimeraViewFrame()
{
super();
/*
- * Convert the map of sequences per pdb entry into the tied arrays expected
- * by openNewChimera
- *
- * TODO pass the Map down to openNewChimera and its callees instead
+ * closeViewer will decide whether or not to close this frame
+ * depending on whether user chooses to Cancel or not
*/
- final Set<PDBEntry> pdbEntries = toView.keySet();
- PDBEntry[] pdbs = pdbEntries.toArray(new PDBEntry[pdbEntries.size()]);
- SequenceI[][] seqsForPdbs = new SequenceI[pdbEntries.size()][];
- for (int i = 0; i < pdbs.length; i++)
- {
- final List<SequenceI> seqsForPdb = toView.get(pdbs[i]);
- seqsForPdbs[i] = seqsForPdb.toArray(new SequenceI[seqsForPdb.size()]);
- }
-
- openNewChimera(alignPanel, pdbs, seqsForPdbs);
+ setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);
}
/**
prompt = JvSwingUtils.wrapTooltip(true, prompt);
int confirm = JOptionPane.showConfirmDialog(this, prompt,
MessageManager.getString("label.close_viewer"),
- JOptionPane.YES_NO_OPTION);
+ JOptionPane.YES_NO_CANCEL_OPTION);
+ /*
+ * abort closure if user hits escape or Cancel
+ */
+ if (confirm == JOptionPane.CANCEL_OPTION
+ || confirm == JOptionPane.CLOSED_OPTION)
+ {
+ return;
+ }
closeChimera = confirm == JOptionPane.YES_OPTION;
}
jmb.closeViewer(closeChimera);
// TODO: check for memory leaks where instance isn't finalised because jmb
// holds a reference to the window
jmb = null;
+ dispose();
}
/**
{
int pos = filePDBpos.get(num).intValue();
long startTime = startProgressBar("Chimera "
- + MessageManager.getString("status.opening_file"));
+ + MessageManager.getString("status.opening_file_for")
+ + " " + pe.getId());
jmb.openFile(pe);
jmb.addSequence(pos, jmb.getSequence()[pos]);
File fl = new File(pe.getFile());
*/
private String fetchPdbFile(PDBEntry processingEntry) throws Exception
{
+ // FIXME: this is duplicated code with Jmol frame ?
String filePath = null;
Pdb pdbclient = new Pdb();
AlignmentI pdbseq = null;
setChainMenuItems(jmb.getChainNames());
this.setTitle(jmb.getViewerTitle("Chimera", true));
- if (jmb.getPdbFile().length > 1 && jmb.getSequence().length > 1)
- {
+ // if (jmb.getPdbFile().length > 1 && jmb.getSequence().length > 1)
+ // {
viewerActionMenu.setVisible(true);
- }
+ // }
if (!jmb.isLoadingFromArchive())
{
seqColour_actionPerformed(null);