ScriptWindow scriptWindow;
PDBEntry pdbentry;
SequenceI[] sequence;
+ String [] chains;
StructureSelectionManager ssm;
JSplitPane splitPane;
RenderPanel renderPanel;
String fileLoadingError;
boolean colourBySequence = true;
boolean loadingFromArchive = false;
+ Vector atomsPicked = new Vector();
public AppJMol(String file, String id,
SequenceI[] seq,
pdbentry = new PDBEntry();
pdbentry.setFile(file);
pdbentry.setId(id);
+ this.chains = chains;
this.sequence = seq;
this.ap = ap;
this.setBounds(bounds);
});
}
- public AppJMol(PDBEntry pdbentry, SequenceI[] seq, AlignmentPanel ap)
+public synchronized void addSequence(SequenceI [] seq)
+ {
+ Vector v = new Vector();
+ for(int i=0; i<sequence.length; i++)
+ v.addElement(sequence[i]);
+
+ for(int i=0; i<seq.length; i++)
+ if(!v.contains(seq[i]))
+ v.addElement(seq[i]);
+
+ SequenceI [] tmp = new SequenceI[v.size()];
+ v.copyInto(tmp);
+ sequence = tmp;
+ }
+
+ public AppJMol(PDBEntry pdbentry, SequenceI[] seq, String [] chains, AlignmentPanel ap)
{
//////////////////////////////////
//Is the pdb file already loaded?
if (option == JOptionPane.YES_OPTION)
{
StructureSelectionManager.getStructureSelectionManager()
- .setMapping(seq, alreadyMapped, AppletFormatAdapter.FILE);
- ap.seqPanel.seqCanvas.fr.featuresAdded();
- ap.paintAlignment(true);
+ .setMapping(seq, chains, alreadyMapped, AppletFormatAdapter.FILE);
+ if (ap.seqPanel.seqCanvas.fr!=null) {
+ ap.seqPanel.seqCanvas.fr.featuresAdded();
+ ap.paintAlignment(true);
+ }
return;
}
}
});
}
+
void initJmol(String command)
{
renderPanel = new RenderPanel();
}
+ public Color getColour(int atomIndex, int pdbResNum, String chain, String pdbfile)
+ {
+ if (!pdbfile.equals(pdbentry.getFile()))
+ return null;
+
+ return new Color(viewer.getAtomArgb(atomIndex));
+ }
+
public void updateColours(Object source)
{
colourBySequence( (AlignmentPanel) source);
//End StructureListener
////////////////////////////
- FeatureRenderer fr;
+ FeatureRenderer fr=null;
public void colourBySequence(AlignmentPanel ap)
{
if(!colourBySequence)
SequenceRenderer sr = ap.seqPanel.seqCanvas.getSequenceRenderer();
boolean showFeatures = false;
+
if (ap.av.showSequenceFeatures)
{
showFeatures = true;
if (fr == null)
{
- fr = new jalview.gui.FeatureRenderer(ap.av);
+ fr = new jalview.gui.FeatureRenderer(ap);
}
fr.transferSettings(ap.seqPanel.seqCanvas.getFeatureRenderer());
{
for (int m = 0; m < mapping.length; m++)
{
- if (mapping[m].getSequence() == sequence[s])
+ if (mapping[m].getSequence() == sequence[s]
+ && ap.av.alignment.findIndex(sequence[s])>-1)
{
for (int r = 0; r < sequence[s].getLength(); r++)
{
//FILE LOADED OK
ssm = StructureSelectionManager.getStructureSelectionManager();
- MCview.PDBfile pdbFile = ssm.setMapping(sequence, pdbentry.getFile(), AppletFormatAdapter.FILE);
+ MCview.PDBfile pdbFile = ssm.setMapping(sequence,chains,pdbentry.getFile(), AppletFormatAdapter.FILE);
ssm.addStructureViewerListener(this);
-
Vector chains = new Vector();
for(int i=0; i<pdbFile.chains.size(); i++)
{
colourBySequence(ap);
}
+ if (fr!=null)
+ fr.featuresAdded();
loadingFromArchive = false;
}
public void notifyAtomPicked(int atomIndex, String strInfo)
{
+ Matcher matcher = pattern.matcher(strInfo);
+ matcher.find();
+
+ matcher.group(1);
+ String resnum = new String(matcher.group(2));
+ String chainId = matcher.group(3);
+
+ String picked = resnum;
+
+ if (chainId != null)
+ picked+=(":"+chainId.substring(1, chainId.length()));
+
+ picked+=".C";
+
+ if (!atomsPicked.contains(picked))
+ {
+ if(chainId!=null)
+ viewer.evalString("select "+picked+";label %n %r:%c");
+ else
+ viewer.evalString("select "+picked+";label %n %r");
+ atomsPicked.addElement(picked);
+ }
+ else
+ {
+ viewer.evalString("select "+picked+";label off");
+ atomsPicked.removeElement(picked);
+ }
+
if (scriptWindow != null)
{
scriptWindow.sendConsoleMessage(strInfo);