+ throw new FileFormatException(getSupportedFormats());
+ }
+ }
+
+ /**
+ * boilerplate method to handle data from an AlignFile and construct a new
+ * alignment or import to an existing alignment
+ *
+ * @return AlignmentI instance ready to pass to a UI constructor
+ */
+ private AlignmentI buildAlignmentFromFile()
+ {
+ // Standard boilerplate for creating alignment from parser
+ // alignFile.configureForView(viewpanel);
+
+ AlignmentI al = new Alignment(alignFile.getSeqsAsArray());
+
+ alignFile.addAnnotations(al);
+
+ alignFile.addGroups(al);
+
+ return al;
+ }
+
+ /**
+ * create an alignment flatfile from a Jalview alignment view
+ *
+ * @param format
+ * @param jvsuffix
+ * @param av
+ * @param selectedOnly
+ * @return flatfile in a string
+ */
+ public String formatSequences(FileFormatI format, boolean jvsuffix,
+ AlignmentViewPanel ap, boolean selectedOnly)
+ {
+
+ AlignmentView selvew = ap.getAlignViewport()
+ .getAlignmentView(selectedOnly, false);
+ AlignmentI aselview = selvew
+ .getVisibleAlignment(ap.getAlignViewport().getGapCharacter());
+ List<AlignmentAnnotation> ala = (ap.getAlignViewport()
+ .getVisibleAlignmentAnnotation(selectedOnly));
+ if (ala != null)
+ {
+ for (AlignmentAnnotation aa : ala)
+ {
+ aselview.addAnnotation(aa);
+ }