boolean featuresFile = false;
try
{
- featuresFile = new jalview.io.FeaturesFile(file, type).parse(
- viewport.alignment, alignPanel.seqPanel.seqCanvas
- .getFeatureRenderer().featureColours, featureLinks,
- true);
+ featuresFile = new jalview.io.FeaturesFile(file, type)
+ .parse(viewport.alignment,
+ alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureColours,
+ featureLinks, true);
} catch (Exception ex)
{
ex.printStackTrace();
else if (source == clustalColour)
{
abovePIDThreshold.setState(false);
- changeColour(new ClustalxColourScheme(viewport.alignment
- .getSequences(), viewport.alignment.getWidth()));
+ changeColour(new ClustalxColourScheme(
+ viewport.alignment.getSequences(),
+ viewport.alignment.getWidth()));
}
else if (source == zappoColour)
{
CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);
Frame frame = new Frame();
frame.add(cap);
- jalview.bin.JalviewLite.addFrame(frame, "Alignment output - "
- + e.getActionCommand(), 600, 500);
- cap.setText(new AppletFormatAdapter().formatSequences(e
- .getActionCommand(), viewport.getAlignment(),
+ jalview.bin.JalviewLite.addFrame(frame,
+ "Alignment output - " + e.getActionCommand(), 600, 500);
+ cap.setText(new AppletFormatAdapter().formatSequences(
+ e.getActionCommand(), viewport.getAlignment(),
viewport.showJVSuffix));
}
String features;
if (format.equalsIgnoreCase("Jalview"))
{
- features = new FeaturesFile().printJalviewFormat(viewport.alignment
- .getSequencesArray(), getDisplayedFeatureCols());
+ features = new FeaturesFile().printJalviewFormat(
+ viewport.alignment.getSequencesArray(),
+ getDisplayedFeatureCols());
}
else
{
- features = new FeaturesFile().printGFFFormat(viewport.alignment
- .getSequencesArray(), getDisplayedFeatureCols());
+ features = new FeaturesFile().printGFFFormat(
+ viewport.alignment.getSequencesArray(),
+ getDisplayedFeatureCols());
}
if (displayTextbox)
if (viewport.applet.getParameter("annotations") != null)
{
url.append("&annotations=");
- url
- .append(appendProtocol(viewport.applet
- .getParameter("annotations")));
+ url.append(appendProtocol(viewport.applet.getParameter("annotations")));
}
if (viewport.applet.getParameter("jnetfile") != null)
viewport.setEndSeq(viewport.alignment.getHeight());
viewport.alignment.getWidth();
- viewport.firePropertyChange("alignment", null, viewport.alignment
- .getSequences());
+ viewport.firePropertyChange("alignment", null,
+ viewport.alignment.getSequences());
}
if (viewport.getSelectionGroup() != null)
{
SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom(
- viewport.getSequenceSelection(), viewport.getAlignmentView(
- true).getSequenceStrings(viewport.getGapCharacter()),
+ viewport.getSequenceSelection(),
+ viewport.getAlignmentView(true).getSequenceStrings(
+ viewport.getGapCharacter()),
viewport.alignment.getGroups());
viewport.alignment.deleteAllGroups();
viewport.sequenceColours = null;
// gps[g].setShowunconserved(viewport.getShowUnconserved());
gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());
viewport.alignment.addGroup(gps[g]);
- Color col = new Color((int) (Math.random() * 255), (int) (Math
- .random() * 255), (int) (Math.random() * 255));
+ Color col = new Color((int) (Math.random() * 255),
+ (int) (Math.random() * 255), (int) (Math.random() * 255));
col = col.brighter();
for (Enumeration sq = gps[g].getSequences(null).elements(); sq
.hasMoreElements(); viewport.setSequenceColour(
{
if (!viewport.alignment.getAlignmentAnnotation()[i].autoCalculated)
{
- newal
- .addAnnotation(viewport.alignment
- .getAlignmentAnnotation()[i]);
+ newal.addAnnotation(viewport.alignment.getAlignmentAnnotation()[i]);
}
}
}
newaf.viewport.sequenceSetID = alignPanel.av.getSequenceSetId();
PaintRefresher.Register(alignPanel, alignPanel.av.getSequenceSetId());
- PaintRefresher.Register(newaf.alignPanel, newaf.alignPanel.av
- .getSequenceSetId());
+ PaintRefresher.Register(newaf.alignPanel,
+ newaf.alignPanel.av.getSequenceSetId());
PaintRefresher.Register(newaf.alignPanel.idPanel.idCanvas,
newaf.alignPanel.av.getSequenceSetId());
Alignment al = (Alignment) viewport.alignment;
Conservation c = new Conservation("All",
- ResidueProperties.propHash, 3, al.getSequences(), 0, al
- .getWidth() - 1);
+ ResidueProperties.propHash, 3, al.getSequences(), 0,
+ al.getWidth() - 1);
c.calculate();
c.verdict(false, viewport.ConsPercGaps);
}
if (cs instanceof ClustalxColourScheme)
{
- sg.cs = new ClustalxColourScheme(sg
- .getSequences(viewport.hiddenRepSequences), sg.getWidth());
+ sg.cs = new ClustalxColourScheme(
+ sg.getSequences(viewport.hiddenRepSequences),
+ sg.getWidth());
}
else
{
|| cs instanceof Blosum62ColourScheme)
{
sg.cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());
- sg.cs.setConsensus(AAFrequency.calculate(sg
- .getSequences(viewport.hiddenRepSequences), 0, sg
- .getWidth()));
+ sg.cs.setConsensus(AAFrequency.calculate(
+ sg.getSequences(viewport.hiddenRepSequences), 0,
+ sg.getWidth()));
}
else
{
if (viewport.getConservationSelected())
{
Conservation c = new Conservation("Group",
- ResidueProperties.propHash, 3, sg
- .getSequences(viewport.hiddenRepSequences), 0,
+ ResidueProperties.propHash, 3,
+ sg.getSequences(viewport.hiddenRepSequences), 0,
viewport.alignment.getWidth() - 1);
c.calculate();
c.verdict(false, viewport.ConsPercGaps);
if (viewport.getAbovePIDThreshold()
&& viewport.globalColourScheme != null)
{
- SliderPanel.setPIDSliderSource(alignPanel, viewport
- .getGlobalColourScheme(), "Background");
+ SliderPanel.setPIDSliderSource(alignPanel,
+ viewport.getGlobalColourScheme(), "Background");
SliderPanel.showPIDSlider();
}
}
{
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
AlignmentSorter.sortByLength(viewport.getAlignment());
- addHistoryItem(new OrderCommand("Length Sort", oldOrder, viewport.alignment));
+ addHistoryItem(new OrderCommand("Length Sort", oldOrder,
+ viewport.alignment));
alignPanel.paintAlignment(true);
}
g.setFont(new Font("Helvetica", Font.BOLD, 12));
g.drawString("Build date: " + builddate, x, y += fh);
g.setFont(new Font("Helvetica", Font.PLAIN, 12));
- g
- .drawString(
- "Authors: Andrew Waterhouse, Jim Procter, Michele Clamp, James Cuff, Steve Searle,",
- x, y += fh * 1.5);
+ g.drawString(
+ "Authors: Andrew Waterhouse, Jim Procter, Michele Clamp, James Cuff, Steve Searle,",
+ x, y += fh * 1.5);
g.drawString("David Martin & Geoff Barton.", x + 50, y += fh);
- g
- .drawString(
- "Development managed by The Barton Group, University of Dundee, Scotland, UK.",
- x, y += fh);
- g
- .drawString(
- "For help, see the FAQ at www.jalview.org and/or join the jalview-discuss@jalview.org mailing list",
- x, y += fh);
+ g.drawString(
+ "Development managed by The Barton Group, University of Dundee, Scotland, UK.",
+ x, y += fh);
+ g.drawString(
+ "For help, see the FAQ at www.jalview.org and/or join the jalview-discuss@jalview.org mailing list",
+ x, y += fh);
g.drawString("If you use Jalview, please cite:", x, y += fh + 8);
- g
- .drawString(
- "Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)",
- x, y += fh);
- g
- .drawString(
- "Jalview Version 2 - a multiple sequence alignment editor and analysis workbench",
- x, y += fh);
+ g.drawString(
+ "Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)",
+ x, y += fh);
+ g.drawString(
+ "Jalview Version 2 - a multiple sequence alignment editor and analysis workbench",
+ x, y += fh);
g.drawString("Bioinformatics doi: 10.1093/bioinformatics/btp033",
x, y += fh);
}
{
System.out.println("Show url: " + url);
}
- if (url.indexOf("javascript:")==0)
+ if (url.indexOf("javascript:") == 0)
{
// no target for the javascript context
- viewport.applet.getAppletContext().showDocument(new java.net.URL(url));
- } else{
viewport.applet.getAppletContext().showDocument(
- new java.net.URL(url), target);
+ new java.net.URL(url));
+ }
+ else
+ {
+ viewport.applet.getAppletContext().showDocument(
+ new java.net.URL(url), target);
}
} catch (Exception ex)
{
viewport.applet.setLayout(new BorderLayout());
viewport.applet.add(embeddedMenu, BorderLayout.NORTH);
viewport.applet.add(statusBar, BorderLayout.SOUTH);
- alignPanel.setSize(viewport.applet.getSize().width, viewport.applet
- .getSize().height
- - embeddedMenu.HEIGHT - statusBar.HEIGHT);
+ alignPanel.setSize(viewport.applet.getSize().width,
+ viewport.applet.getSize().height - embeddedMenu.HEIGHT
+ - statusBar.HEIGHT);
viewport.applet.add(alignPanel, BorderLayout.CENTER);
viewport.applet.validate();
}
* this does not open a new Jmol window, or modify the display of the
* structures in the original jmol window. Note
*
- * @param viewer JmolViewer instance
+ * @param viewer
+ * JmolViewer instance
* @param sequenceIds
* - sequence Ids to search for associations
* This method doesn't work. See http://issues.jalview.org/browse/JAL-621
return jmv;
}
- **/
+ **/
public boolean addPdbFile(String sequenceId, String pdbEntryString,
String pdbFile)
{
SequenceI toaddpdb = viewport.getAlignment().findName(sequenceId);
- boolean needtoadd=false;
- if (toaddpdb!=null)
+ boolean needtoadd = false;
+ if (toaddpdb != null)
{
Vector pdbe = toaddpdb.getPDBId();
PDBEntry pdbentry = null;
- if (pdbe!=null && pdbe.size()>0)
+ if (pdbe != null && pdbe.size() > 0)
{
- for (int pe=0,peSize=pdbe.size(); pe<peSize; pe++)
+ for (int pe = 0, peSize = pdbe.size(); pe < peSize; pe++)
{
pdbentry = (PDBEntry) pdbe.elementAt(pe);
- if (!pdbentry.getId().equals(pdbEntryString) && !pdbentry.getFile().equals(pdbFile))
+ if (!pdbentry.getId().equals(pdbEntryString)
+ && !pdbentry.getFile().equals(pdbFile))
{
pdbentry = null;
}
else
{
- continue;
+ continue;
}
}
}
- if (pdbentry==null)
+ if (pdbentry == null)
{
pdbentry = new PDBEntry();
pdbentry.setId(pdbEntryString);
pdbentry.setFile(pdbFile);
- needtoadd=true; // add this new entry to sequence.
+ needtoadd = true; // add this new entry to sequence.
}
// resolve data source
// TODO: this code should be a refactored to an io package
if (needtoadd)
{
// make a note of the access mode and add
+ if (pdbentry.getProperty()==null)
+ {pdbentry.setProperty(new Hashtable());}
pdbentry.getProperty().put("protocol", protocol);
toaddpdb.addPDBId(pdbentry);
}
}
return true;
}
-
- public void newStructureView(JalviewLite applet, PDBEntry pdb, SequenceI[] seqs,
- String[] chains, String protocol)
+ private Object[] cleanSeqChainArrays(SequenceI[] seqs, String[] chains)
{
- if (seqs!=null)
+ if (seqs != null)
{
- Vector sequences=new Vector();
- for (int i=0;i<seqs.length;i++) {
- if (seqs[i]!=null)
- {
- sequences.addElement(seqs[i]);
- }
- }
- seqs = new SequenceI[sequences.size()];
- for (int i=0,isize=sequences.size(); i<isize; i++)
- {
- seqs[i] = (SequenceI) sequences.elementAt(i);
- }
+ Vector sequences = new Vector();
+ for (int i = 0; i < seqs.length; i++)
+ {
+ if (seqs[i] != null)
+ {
+ sequences.addElement(new Object[] { seqs[i], (chains!=null) ? chains[i] : null});
+ }
+ }
+ seqs = new SequenceI[sequences.size()];
+ chains = new String[sequences.size()];
+ for (int i = 0, isize = sequences.size(); i < isize; i++)
+ {
+ Object[] oj = (Object[]) sequences.elementAt(i);
+
+ seqs[i] = (SequenceI) oj[0];
+ chains[i] = (String) oj[1];
+ }
}
- if (seqs==null || seqs.length==0)
+ return new Object[] { seqs, chains};
+
+ }
+ public void newStructureView(JalviewLite applet, PDBEntry pdb,
+ SequenceI[] seqs, String[] chains, String protocol)
+ {
+ // Scrub any null sequences from the array
+ Object[] sqch = cleanSeqChainArrays(seqs, chains);
+ seqs = (SequenceI[]) sqch[0];
+ chains = (String[]) sqch[1];
+ if (seqs == null || seqs.length == 0)
{
- System.err.println("JalviewLite.AlignFrame:newStructureView: No sequence to bind structure to.");
+ System.err
+ .println("JalviewLite.AlignFrame:newStructureView: No sequence to bind structure to.");
}
- if (protocol==null || protocol.trim().length()==0 || protocol.equals("null"))
+ if (protocol == null || protocol.trim().length() == 0
+ || protocol.equals("null"))
{
protocol = (String) pdb.getProperty().get("protocol");
- if (protocol==null)
+ if (protocol == null)
{
- System.err.println("Couldn't work out protocol to open structure: "+pdb.getId());
+ System.err.println("Couldn't work out protocol to open structure: "
+ + pdb.getId());
return;
}
}
+ if (applet.isAlignPdbStructures() && applet.jmolAvailable)
+ {
+ // can only do alignments with Jmol
+ // find the last jmol window assigned to this alignment
+ jalview.appletgui.AppletJmol ajm = null, tajm;
+ Vector jmols = applet
+ .getAppletWindow(jalview.appletgui.AppletJmol.class);
+ for (int i = 0, iSize = jmols.size(); i < iSize; i++)
+ {
+ tajm = (jalview.appletgui.AppletJmol) jmols.elementAt(i);
+ if (tajm.ap.alignFrame == this)
+ {
+ ajm = tajm;
+ break;
+ }
+ }
+ if (ajm!=null)
+ {
+ System.err.println("Incremental adding and aligning structure to existing Jmol view not yet implemented.");
+ // try and add the pdb structure
+ // ajm.addS
+ ajm = null;
+ }
+ }
+ // otherwise, create a new window
if (applet.jmolAvailable)
{
- new jalview.appletgui.AppletJmol(pdb, seqs, chains,
- alignPanel, protocol);
+ new jalview.appletgui.AppletJmol(pdb, seqs, chains, alignPanel,
+ protocol);
applet.lastFrameX += 40;
applet.lastFrameY += 40;
}
else
- new MCview.AppletPDBViewer(pdb, seqs, chains,
- alignPanel, protocol);
+ {
+ new MCview.AppletPDBViewer(pdb, seqs, chains, alignPanel, protocol);
+ }
+
+ }
+
+ public void alignedStructureView(JalviewLite applet, PDBEntry[] pdb,
+ SequenceI[][] seqs, String[][] chains, String[] protocols)
+ {
+ // TODO Auto-generated method stub
+ System.err.println("Aligned Structure View: Not yet implemented.");
}
}