X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=32a50cfbfa30c359defac13060d2ebab1b8adf1b;hb=e4dca3706ab423352c26ac100f3ca5a3e7c3d2c4;hp=87cd9a967b27b41045cc3cc0be5e3440cdeb742c;hpb=4c5be7222caa476ab4ae8f390dae5720a7f27217;p=jalview.git
diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java
index 87cd9a9..32a50cf 100755
--- a/src/jalview/gui/AlignFrame.java
+++ b/src/jalview/gui/AlignFrame.java
@@ -44,7 +44,7 @@ import java.awt.dnd.*;
* @version $Revision$
*/
public class AlignFrame
- extends GAlignFrame implements ClipboardOwner, DropTargetListener
+ extends GAlignFrame implements DropTargetListener
{
/** DOCUMENT ME!! */
public static final int NEW_WINDOW_WIDTH = 700;
@@ -54,9 +54,6 @@ public class AlignFrame
AlignmentPanel alignPanel;
AlignViewport viewport;
- Vector viewports = new Vector();
- Vector alignPanels = new Vector();
-
/** DOCUMENT ME!! */
public String currentFileFormat = null;
Stack historyList = new Stack();
@@ -72,7 +69,6 @@ public class AlignFrame
public AlignFrame(AlignmentI al)
{
viewport = new AlignViewport(al);
- viewports.add(viewport);
this.setDropTarget(new java.awt.dnd.DropTarget(this, this));
@@ -88,7 +84,6 @@ public class AlignFrame
}
alignPanel = new AlignmentPanel(this, viewport);
- alignPanels.add(alignPanel);
String sortby = jalview.bin.Cache.getDefault("SORT_ALIGNMENT", "No sort");
@@ -130,11 +125,17 @@ public class AlignFrame
});
- if (Desktop.desktop != null)
- {
- addServiceListeners();
- setGUINucleotide(al.isNucleotide());
- }
+ if (Desktop.desktop != null)
+ {
+ addServiceListeners();
+ setGUINucleotide(al.isNucleotide());
+ }
+
+ if(jalview.bin.Cache.getDefault("WRAP_ALIGNMENT", false))
+ {
+ wrapMenuItem.setSelected(true);
+ wrapMenuItem_actionPerformed(null);
+ }
}
/* Set up intrinsic listeners for dynamically generated GUI bits. */
@@ -205,6 +206,22 @@ public class AlignFrame
{
new SequenceFetcher(this);
}
+
+ public void addFromFile_actionPerformed(ActionEvent e)
+ {
+ Desktop.instance.inputLocalFileMenuItem_actionPerformed(viewport);
+ }
+
+ public void addFromText_actionPerformed(ActionEvent e)
+ {
+ Desktop.instance.inputTextboxMenuItem_actionPerformed(viewport);
+ }
+
+ public void addFromURL_actionPerformed(ActionEvent e)
+ {
+ Desktop.instance.inputURLMenuItem_actionPerformed(viewport);
+ }
+
/**
* DOCUMENT ME!
*
@@ -213,19 +230,15 @@ public class AlignFrame
public void saveAlignmentMenu_actionPerformed(ActionEvent e)
{
JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
- getProperty(
- "LAST_DIRECTORY"),
+ getProperty( "LAST_DIRECTORY"),
new String[]
- {
- "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc",
- "jar"
- },
+ { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc","jar" },
new String[]
- {
- "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"
- }, currentFileFormat);
+ { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview" },
+ currentFileFormat,
+ false);
+
- chooser.setAcceptAllFileFilterUsed(false);
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle("Save Alignment to file");
chooser.setToolTipText("Save");
@@ -290,6 +303,7 @@ public class AlignFrame
out.print(output);
out.close();
+ this.setTitle(file);
return true;
}
catch (Exception ex)
@@ -365,6 +379,20 @@ public class AlignFrame
thread.start();
}
+ public void exportFeatures_actionPerformed(ActionEvent e)
+ {
+ new AnnotationExporter().exportFeatures(alignPanel);
+ }
+
+ public void exportAnnotations_actionPerformed(ActionEvent e)
+ {
+ new AnnotationExporter().exportAnnotations(
+ alignPanel,
+ viewport.alignment.getAlignmentAnnotation()
+ );
+ }
+
+
public void associatedData_actionPerformed(ActionEvent e)
{
// Pick the tree file
@@ -547,10 +575,6 @@ public class AlignFrame
alignPanel.repaint();
}
- public void lostOwnership(Clipboard clipboard, Transferable contents)
- {
- Desktop.jalviewClipboard = null;
- }
/**
@@ -631,12 +655,16 @@ public class AlignFrame
seqs[i].setDBRef(seq.getDBRef());
seqs[i].setSequenceFeatures(seq.getSequenceFeatures());
seqs[i].setDatasetSequence(seq.getDatasetSequence());
-
+ if(seq.getAnnotation()!=null)
+ {
+ for(int a=0; a>>This is a fix for the moment, until a better solution is found!!<<<
- af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().transferSettings(
- alignPanel.seqPanel.seqCanvas.getFeatureRenderer());
-
-
- if (title.startsWith("Copied sequences"))
- {
- newtitle = title;
- }
- else
- {
- newtitle = newtitle.concat("- from " + title);
- }
-
- Desktop.addInternalFrame(af, newtitle, NEW_WINDOW_WIDTH,
- NEW_WINDOW_HEIGHT);
}
else
{
+ alignment = viewport.getAlignment();
+
//!newAlignment
for (int i = 0; i < sequences.length; i++)
{
+
Sequence newseq = new Sequence(sequences[i].getName(),
sequences[i].getSequence(), sequences[i].getStart(),
sequences[i].getEnd());
- viewport.alignment.addSequence(newseq);
- if(sequences[i].getDatasetSequence()==null)
- {
- ////////////////////////////
- //Datset needs extension;
- /////////////////////////////
- Sequence ds = new Sequence(sequences[i].getName(),
- AlignSeq.extractGaps("-. ", sequences[i].getSequence()),
- sequences[i].getStart(),
- sequences[i].getEnd());
- newseq.setDatasetSequence(ds);
- viewport.alignment.getDataset().addSequence(ds);
- }
- else
- {
- newseq.setDatasetSequence(sequences[i].getDatasetSequence());
- if(sequences[i].getDatasetSequence().getAnnotation()!=null)
- {
- for(int aa=0; aa>>This is a fix for the moment, until a better solution is found!!<<<
+ af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().transferSettings(
+ alignPanel.seqPanel.seqCanvas.getFeatureRenderer());
+
+
+ if (title.startsWith("Copied sequences"))
+ {
+ newtitle = title;
+ }
+ else
+ {
+ newtitle = newtitle.concat("- from " + title);
+ }
+
+ Desktop.addInternalFrame(af, newtitle, NEW_WINDOW_WIDTH,
+ NEW_WINDOW_HEIGHT);
+
+ }
+
+
}
catch (Exception ex)
{
@@ -1279,7 +1324,7 @@ public class AlignFrame
*
* @param e DOCUMENT ME!
*/
- protected void wrapMenuItem_actionPerformed(ActionEvent e)
+ public void wrapMenuItem_actionPerformed(ActionEvent e)
{
viewport.setWrapAlignment(wrapMenuItem.isSelected());
alignPanel.setWrapAlignment(wrapMenuItem.isSelected());
@@ -1357,14 +1402,11 @@ public class AlignFrame
public void fetchSeqFeatures_actionPerformed(ActionEvent e)
{
- if (!viewport.alignment.isNucleotide())
- {
- new SequenceFeatureFetcher(viewport.
- alignment,
- alignPanel);
+ new DasSequenceFeatureFetcher(viewport.
+ alignment,
+ alignPanel);
viewport.setShowSequenceFeatures(true);
showSeqFeatures.setSelected(true);
- }
}
@@ -1949,6 +1991,10 @@ public class AlignFrame
public void autoCalculate_actionPerformed(ActionEvent e)
{
viewport.autoCalculateConsensus = autoCalculate.isSelected();
+ if(viewport.autoCalculateConsensus)
+ {
+ alignmentChanged();
+ }
}
@@ -2514,42 +2560,42 @@ public void showTranslation_actionPerformed(ActionEvent e)
jalview.datamodel.AlignmentAnnotation[] annotations
= viewport.alignment.getAlignmentAnnotation();
int a, aSize;
- for (int i = 0; i < annotations.length; i++)
+ if(annotations!=null)
{
-
- if (annotations[i].label.equals("Quality") ||
- annotations[i].label.equals("Conservation") ||
- annotations[i].label.equals("Consensus"))
+ for (int i = 0; i < annotations.length; i++)
{
- continue;
- }
-
+ if (annotations[i].label.equals("Quality") ||
+ annotations[i].label.equals("Conservation") ||
+ annotations[i].label.equals("Consensus"))
+ {
+ continue;
+ }
- aSize = viewport.alignment.getWidth()/3;
- jalview.datamodel.Annotation [] anots =
- new jalview.datamodel.Annotation[aSize];
+ aSize = viewport.alignment.getWidth() / 3;
+ jalview.datamodel.Annotation[] anots =
+ new jalview.datamodel.Annotation[aSize];
- for(a=0; a