// TODO consider using getSequenceSelection instead here
cap.setText(new jalview.io.AppletFormatAdapter().formatSequences(
- e.getActionCommand(),
- new Alignment(ap.av.getSelectionAsNewSequence()),
- ap.av.showJVSuffix));
+ e.getActionCommand(),
+ ap.av.showJVSuffix, ap.av, true));
}
// or we simply trust the user wants
// wysiwig behaviour
- AlignmentView selvew = ap.av.getAlignmentView(true, false);
- AlignmentI aselview = selvew.getVisibleAlignment(ap.av
- .getGapCharacter());
- List<AlignmentAnnotation> ala = (ap.av
- .getVisibleAlignmentAnnotation(true));
- if (ala != null)
- {
- for (AlignmentAnnotation aa : ala)
- {
- aselview.addAnnotation(aa);
- }
- }
- cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(),
- aselview, null, null, null));
+ cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(), ap.av, true));
}
public void pdbFromFile_actionPerformed()
import java.io.File;
import java.io.InputStream;
+import java.util.List;
+import jalview.api.AlignViewportI;
import jalview.datamodel.*;
/**
}
}
+
+ /**
+ * 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(String format, boolean jvsuffix,
+ AlignViewportI av, boolean selectedOnly)
+ {
+
+ AlignmentView selvew = av.getAlignmentView(selectedOnly, false);
+ AlignmentI aselview = selvew.getVisibleAlignment(av
+ .getGapCharacter());
+ List<AlignmentAnnotation> ala = (av
+ .getVisibleAlignmentAnnotation(selectedOnly));
+ if (ala != null)
+ {
+ for (AlignmentAnnotation aa : ala)
+ {
+ aselview.addAnnotation(aa);
+ }
+ }
+
+ return formatSequences(format, aselview, jvsuffix);
+ }
+
/**
* Construct an output class for an alignment in a particular filetype TODO:
* allow caller to detect errors and warnings encountered when generating
*/
package jalview.io;
+import jalview.api.AlignViewportI;
import jalview.datamodel.*;
/**
}
return AppletFormatAdapter.isValidFormat(format, forwriting);
}
+
+ /**
+ * Create a flat file representation of a given view or selected region of a view
+ * @param format
+ * @param av
+ * @return String containing flat file
+ */
+ public String formatSequences(String format, AlignViewportI av, boolean selectedOnly)
+ {
+ return formatSequences(format, getCacheSuffixDefault(format), av, selectedOnly);
+ }
+
}