import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.Annotation;
import jalview.datamodel.HiddenMarkovModel;
+import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.gui.JvOptionPane;
/**
* Exports an alignment, and reference (RF) annotation if present, to the
- * specified file, in Stockholm format
+ * specified file, in Stockholm format, removing all HMM sequences
*
* @param seqs
* @param toFile
writer.close();
}
- public void exportFasta(SequenceI[] seqs, File toFile)
+ /**
+ * Exports the given alignment withotu any anotations to a fasta file
+ *
+ * @param seqs
+ * @param toFile
+ */
+ public void exportFasta(AlignmentI al, File toFile)
{
FastaFile file = new FastaFile();
- String output = file.print(seqs, false);
+
+ String output = file.print(al.getSequencesArray(), false);
PrintWriter writer;
try
{
return path;
}
+
+ /**
+ * A helper method that deletes any HMM consensus sequence from the given
+ * collection, and from the parent alignment if <code>ac</code> is a subgroup
+ *
+ * @param ac
+ */
+ void deleteHmmSequences(AnnotatedCollectionI ac)
+ {
+ List<SequenceI> hmmSeqs = ac.getHmmSequences();
+ for (SequenceI hmmSeq : hmmSeqs)
+ {
+ if (ac instanceof SequenceGroup)
+ {
+ ((SequenceGroup) ac).deleteSequence(hmmSeq, false);
+ AnnotatedCollectionI context = ac.getContext();
+ if (context != null && context instanceof AlignmentI)
+ {
+ ((AlignmentI) context).deleteSequence(hmmSeq);
+ }
+ }
+ else
+ {
+ ((AlignmentI) ac).deleteSequence(hmmSeq);
+ }
+ }
+ }
}