2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import jalview.datamodel.AlignmentAnnotation;
24 import jalview.datamodel.AlignmentI;
25 import jalview.datamodel.SequenceI;
27 public class AMSAFile extends jalview.io.FastaFile
33 * Creates a new AMSAFile object for output.
35 public AMSAFile(AlignmentI al)
43 * @return DOCUMENT ME!
45 public String print(SequenceI[] sqs, boolean jvsuffix)
47 super.print(sqs, jvsuffix);
49 AlignmentAnnotation aa;
50 if (al.getAlignmentAnnotation() != null)
53 for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
55 aa = al.getAlignmentAnnotation()[i];
57 if (aa.autoCalculated || !aa.visible)
62 out.append(">#_" + aa.label);
63 if (aa.description != null)
65 out.append(" " + aa.description);
70 int nochunks = Math.min(aa.annotations.length, al.getWidth()) / len
73 for (int j = 0; j < nochunks; j++)
76 int end = start + len;
77 if (end > aa.annotations.length)
79 end = aa.annotations.length;
83 for (int k = start; k < end; k++)
85 if (aa.annotations[k] == null)
91 ch = aa.annotations[k].displayCharacter;
95 this.warningMessage = "Truncated column annotation to first letter.";
96 ch = ch.substring(0, 1);
105 return out.toString();