import jalview.gui.AlignmentPanel;
import jalview.gui.FeatureRenderer;
import jalview.gui.SequenceRenderer;
+import jalview.io.DataSourceType;
+import jalview.io.StructureFile;
+import jalview.renderer.seqfeatures.FeatureColourFinder;
import jalview.structure.AtomSpec;
import jalview.structure.StructureListener;
import jalview.structure.StructureMapping;
int my = 0;
- public PDBfile pdb;
+ public StructureFile pdb;
PDBEntry pdbentry;
String errorMessage;
void init(PDBEntry pdbentry, SequenceI[] seq, String[] chains,
- AlignmentPanel ap, String protocol)
+ AlignmentPanel ap, DataSourceType protocol)
{
this.ap = ap;
this.pdbentry = pdbentry;
{
pdb = ssm.setMapping(seq, chains, pdbentry.getFile(), protocol);
- if (protocol.equals(jalview.io.AppletFormatAdapter.PASTE))
+ if (protocol.equals(jalview.io.DataSourceType.PASTE))
{
- pdbentry.setFile("INLINE" + pdb.id);
+ pdbentry.setFile("INLINE" + pdb.getId());
}
} catch (Exception ex)
errorMessage = "Error loading file: " + pdbentry.getId();
return;
}
- pdbentry.setId(pdb.id);
+ pdbentry.setId(pdb.getId());
ssm.addStructureViewerListener(this);
colourBySequence();
- int max = -10;
+ float max = -10;
int maxchain = -1;
int pdbstart = 0;
int pdbend = 0;
// JUST DEAL WITH ONE SEQUENCE FOR NOW
SequenceI sequence = seq[0];
- for (int i = 0; i < pdb.chains.size(); i++)
+ for (int i = 0; i < pdb.getChains().size(); i++)
{
- mappingDetails.append("\n\nPDB Sequence is :\nSequence = "
- + pdb.chains.elementAt(i).sequence.getSequenceAsString());
+ mappingDetails
+ .append("\n\nPDB Sequence is :\nSequence = "
+ + pdb.getChains().elementAt(i).sequence
+ .getSequenceAsString());
mappingDetails.append("\nNo of residues = "
- + pdb.chains.elementAt(i).residues.size() + "\n\n");
+ + pdb.getChains().elementAt(i).residues.size() + "\n\n");
// Now lets compare the sequences to get
// the start and end points.
// Align the sequence to the pdb
AlignSeq as = new AlignSeq(sequence,
- pdb.chains.elementAt(i).sequence, "pep");
+ pdb.getChains().elementAt(i).sequence, "pep");
as.calcScoreMatrix();
as.traceAlignment();
PrintStream ps = new PrintStream(System.out)
{
+ @Override
public void print(String x)
{
mappingDetails.append(x);
}
+ @Override
public void println()
{
mappingDetails.append("\n");
mappingDetails.append("\nSEQ start/end " + seqstart + " " + seqend);
}
- mainchain = pdb.chains.elementAt(maxchain);
+ mainchain = pdb.getChains().elementAt(maxchain);
mainchain.pdbstart = pdbstart;
mainchain.pdbend = pdbend;
addKeyListener(new KeyAdapter()
{
+ @Override
public void keyPressed(KeyEvent evt)
{
keyPressed(evt);
// Sort the bonds by z coord
visiblebonds = new Vector<Bond>();
- for (PDBChain chain : pdb.chains)
+ for (PDBChain chain : pdb.getChains())
{
if (chain.isVisible)
{
min[1] = (float) 1e30;
min[2] = (float) 1e30;
- for (PDBChain chain : pdb.chains)
+ for (PDBChain chain : pdb.getChains())
{
if (chain.isVisible)
{
int bsize = 0;
// Find centre coordinate
- for (PDBChain chain : pdb.chains)
+ for (PDBChain chain : pdb.getChains())
{
if (chain.isVisible)
{
centre[2] = ztot / (2 * (float) bsize);
}
+ @Override
public void paintComponent(Graphics g)
{
super.paintComponent(g);
showFeatures = true;
}
+ FeatureColourFinder finder = new FeatureColourFinder(fr);
PDBChain chain;
if (bysequence && pdb != null)
{
- for (int ii = 0; ii < pdb.chains.size(); ii++)
+ for (int ii = 0; ii < pdb.getChains().size(); ii++)
{
- chain = pdb.chains.elementAt(ii);
+ chain = pdb.getChains().elementAt(ii);
for (int i = 0; i < chain.bonds.size(); i++)
{
if (pos > 0)
{
pos = sequence[s].findIndex(pos);
- tmp.startCol = sr.getResidueBoxColour(sequence[s], pos);
- if (showFeatures)
- {
- tmp.startCol = fr.findFeatureColour(tmp.startCol,
- sequence[s], pos);
- }
+ tmp.startCol = sr.getResidueColour(sequence[s], pos,
+ finder);
}
pos = mapping[m].getSeqPos(tmp.at2.resNumber) - 1;
if (pos > 0)
{
pos = sequence[s].findIndex(pos);
- tmp.endCol = sr.getResidueBoxColour(sequence[s], pos);
- if (showFeatures)
- {
- tmp.endCol = fr.findFeatureColour(tmp.endCol,
- sequence[s], pos);
- }
+ tmp.endCol = sr
+ .getResidueColour(sequence[s], pos, finder);
}
}
}
}
+ @Override
public void mousePressed(MouseEvent e)
{
pdbAction = true;
repaint();
if (foundchain != -1)
{
- PDBChain chain = pdb.chains.elementAt(foundchain);
+ PDBChain chain = pdb.getChains().elementAt(foundchain);
if (chain == mainchain)
{
if (fatom.alignmentMapping != -1)
dragging = false;
}
+ @Override
public void mouseMoved(MouseEvent e)
{
pdbAction = true;
PDBChain chain = null;
if (foundchain != -1)
{
- chain = pdb.chains.elementAt(foundchain);
+ chain = pdb.getChains().elementAt(foundchain);
if (chain == mainchain)
{
mouseOverStructure(fatom.resNumber, chain.id);
}
}
+ @Override
public void mouseClicked(MouseEvent e)
{
}
+ @Override
public void mouseEntered(MouseEvent e)
{
}
+ @Override
public void mouseExited(MouseEvent e)
{
}
+ @Override
public void mouseDragged(MouseEvent evt)
{
int x = evt.getX();
}
// Alter the bonds
- for (PDBChain chain : pdb.chains)
+ for (PDBChain chain : pdb.getChains())
{
for (Bond tmpBond : chain.bonds)
{
repaint();
}
+ @Override
public void mouseReleased(MouseEvent evt)
{
dragging = false;
void drawLabels(Graphics g)
{
- for (PDBChain chain : pdb.chains)
+ for (PDBChain chain : pdb.getChains())
{
if (chain.isVisible)
{
foundchain = -1;
- for (int ii = 0; ii < pdb.chains.size(); ii++)
+ for (int ii = 0; ii < pdb.getChains().size(); ii++)
{
- PDBChain chain = pdb.chains.elementAt(ii);
+ PDBChain chain = pdb.getChains().elementAt(ii);
int truex;
Bond tmpBond = null;
if (fatom != null) // )&& chain.ds != null)
{ // dead code? value of chain is either overwritten or discarded
- chain = pdb.chains.elementAt(foundchain);
+ chain = pdb.getChains().elementAt(foundchain);
}
}
public void setAllchainsVisible(boolean b)
{
- for (int ii = 0; ii < pdb.chains.size(); ii++)
+ for (int ii = 0; ii < pdb.getChains().size(); ii++)
{
- PDBChain chain = pdb.chains.elementAt(ii);
+ PDBChain chain = pdb.getChains().elementAt(ii);
chain.isVisible = b;
}
mainchain.isVisible = true;
// ////////////////////////////////
// /StructureListener
+ @Override
public String[] getPdbFile()
{
return new String[] { pdbentry.getFile() };
// return new Color(viewer.getAtomArgb(atomIndex));
}
+ @Override
public void updateColours(Object source)
{
colourBySequence();