new AnnotationExporter().exportAnnotations(
alignPanel,
viewport.showAnnotation ? viewport.alignment.getAlignmentAnnotation() : null,
- viewport.alignment.getGroups()
+ viewport.alignment.getGroups(),
+ ((Alignment)viewport.alignment).alignmentProperties
);
}
return;
}
// TODO: preserve the ordering of displayed alignment annotation in any internal paste (particularly sequence associated annotation)
- SequenceI [] seqs = viewport.getSelectionAsNewSequence();
+ SequenceI [] seqs = viewport.getSelectionAsNewSequence();
String[] omitHidden = null;
if (viewport.hasHiddenColumns)
if (newAlignment)
{
-
+
if (Desktop.jalviewClipboard != null)
{
// dataset is inherited
// an existing alignment
Vector newDs = (importDs) ? new Vector() : null; // used to create
// minimum dataset set
-
+
for (int i = 0; i < sequences.length; i++)
{
- if (importDs)
+ if (importDs)
{
newDs.addElement(null);
}
{
if (!newDs.contains(ds))
{
- newDs.setElementAt(ds, i);
+ newDs.setElementAt(ds, i);
ds = new Sequence(ds);
// update with new dataset sequence
sequences[i].setDatasetSequence(ds);
alignment.setAnnotationIndex(sequences[i].getAnnotation()[a], a);
}
-
+
}
}
if (!newAlignment) {
//>>>This is a fix for the moment, until a better solution is found!!<<<
af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().transferSettings(
alignPanel.seqPanel.seqCanvas.getFeatureRenderer());
-
+
// TODO: maintain provenance of an alignment, rather than just make the title a concatenation of operations.
if (!externalPaste) {
if (title.startsWith("Copied sequences"))
alignPanel.setAnnotationVisible(annotationPanelMenuItem.isSelected());
}
+ public void alignmentProperties()
+ {
+ JEditorPane editPane = new JEditorPane("text/html","");
+ editPane.setEditable(false);
+ StringBuffer contents = new StringBuffer("<html>");
+
+ float avg = 0;
+ int min=Integer.MAX_VALUE, max=0;
+ for(int i=0; i<viewport.alignment.getHeight(); i++)
+ {
+ int size = viewport.alignment.getSequenceAt(i).getEnd()
+ -viewport.alignment.getSequenceAt(i).getStart();
+ avg += size;
+ if(size>max)
+ max = size;
+ if(size<min)
+ min = size;
+ }
+ avg = avg/(float)viewport.alignment.getHeight();
+
+ contents.append("<br>Sequences: "+ viewport.alignment.getHeight());
+ contents.append("<br>Minimum Sequence Length: "+min);
+ contents.append("<br>Maximum Sequence Length: "+max);
+ contents.append("<br>Average Length: "+(int)avg);
+
+ if (((Alignment)viewport.alignment).alignmentProperties != null)
+ {
+ Hashtable props = ((Alignment)viewport.alignment).alignmentProperties;
+ Enumeration en = props.keys();
+ contents.append("<br><br><table border=\"1\">");
+ while(en.hasMoreElements())
+ {
+ String key = en.nextElement().toString();
+ contents.append("<tr><td>"+key+"</td><td>"+props.get(key)+"</td></tr>");
+ }
+ contents.append("</table>");
+ }
+ editPane.setText(contents.toString()+"</html>");
+ JInternalFrame frame = new JInternalFrame();
+ frame.getContentPane().add(editPane);
+
+ Desktop.instance.addInternalFrame(frame,"Alignment Properties: "+getTitle(),500,400);
+ }
+
+
/**
* DOCUMENT ME!
*
}
+ /**
+ * empty the web service menu and add any ad-hoc functions
+ * not dynamically discovered.
+ *
+ */
private void resetWebServiceMenu()
{
webService.removeAll();
// Temporary hack - DBRef Fetcher always top level ws entry.
JMenuItem rfetch = new JMenuItem("Fetch DB References");
+ rfetch.setToolTipText("Retrieve and parse uniprot records for the alignment or the currently selected sequences");
webService.add(rfetch);
rfetch.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
new jalview.io.DBRefFetcher(
- alignPanel.av.getAlignment(), alignPanel.alignFrame).fetchDBRefs(false);
+ alignPanel.av.getSequenceSelection(),
+ alignPanel.alignFrame).fetchDBRefs(false);
}
-
+
});
}
///////////////////////////////
// Collect Data to be translated/transferred
- SequenceI [] selection = viewport.getSelectionAsNewSequence();
+ SequenceI [] selection = viewport.getSequenceSelection();
String [] seqstring = viewport.getViewAsString(true);
AlignmentI al = null;
try {