bugfix for vamsas demo and IO rearrangement for AMSAFile output
authorjprocter <Jim Procter>
Wed, 25 Jul 2007 17:13:31 +0000 (17:13 +0000)
committerjprocter <Jim Procter>
Wed, 25 Jul 2007 17:13:31 +0000 (17:13 +0000)
src/jalview/gui/AlignFrame.java

index a8cd23a..e870dea 100755 (executable)
@@ -693,9 +693,9 @@ public class AlignFrame
     JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
         getProperty( "LAST_DIRECTORY"),
         new String[]
-        { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc","jar" },
+        { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc","amsa","jar" },
         new String[]
-        { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview" },
+        { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview" },
         currentFileFormat,
         false);
 
@@ -726,7 +726,7 @@ public class AlignFrame
 
       jalview.bin.Cache.setProperty("LAST_DIRECTORY", fileName);
 
-      saveAlignment(fileName, currentFileFormat);
+      saveAlignment(fileName, currentFileFormat.substring(0,currentFileFormat.indexOf(" ")));
     }
   }
 
@@ -769,11 +769,12 @@ public class AlignFrame
           omitHidden = viewport.getViewAsString(false);
       }
       }
+      FormatAdapter f = new FormatAdapter();
 
-      String output = new FormatAdapter().formatSequences(
+      String output = f.formatSequences(
           format,
-          viewport.alignment.getSequencesArray(),
-          omitHidden);
+          (Alignment) viewport.alignment, // class cast exceptions will occur in the distant future
+          omitHidden, f.getCacheSuffixDefault(format));
 
       if (output == null)
       {
@@ -844,7 +845,7 @@ public class AlignFrame
 
     cap.setText(new FormatAdapter().formatSequences(
         e.getActionCommand(),
-        viewport.alignment.getSequencesArray(),
+        viewport.alignment,
         omitHidden));
   }
 
@@ -3584,6 +3585,7 @@ public class AlignFrame
     try {
       showProducts.removeAll();
       final boolean dna = viewport.getAlignment().isNucleotide();
+      final Alignment ds = dataset;
       String[] ptypes = CrossRef.findSequenceXrefTypes(dna, selection, dataset);
       //Object[] prods = CrossRef.buildXProductsList(viewport.getAlignment().isNucleotide(), selection, dataset, true);
       final SequenceI[] sel = selection;
@@ -3598,7 +3600,7 @@ public class AlignFrame
 
           public void actionPerformed(ActionEvent e)
           {
-            af.showProductsFor(sel, isRegSel, dna, source);
+            af.showProductsFor(sel, ds, isRegSel, dna, source);
           }
           
         });
@@ -3613,9 +3615,8 @@ public class AlignFrame
     }
     return showp;
   }
-protected void showProductsFor(SequenceI[] sel, boolean isRegSel, boolean dna, String source)
+protected void showProductsFor(SequenceI[] sel, Alignment ds, boolean isRegSel, boolean dna, String source)
   {
-  Alignment ds = getViewport().alignment.getDataset();
   Alignment prods = CrossRef.findXrefSequences(sel, dna, source, ds);
   if (prods!=null)
   {