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.*;
25 public class AMSAFile extends jalview.io.FastaFile
31 * Creates a new AMSAFile object for output.
33 public AMSAFile(AlignmentI al)
41 * @return DOCUMENT ME!
45 super.print(getSeqsAsArray());
47 AlignmentAnnotation aa;
48 if (al.getAlignmentAnnotation() != null)
51 for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
53 aa = al.getAlignmentAnnotation()[i];
55 if (aa.autoCalculated || !aa.visible)
60 out.append(">#_" + aa.label);
61 if (aa.description != null)
63 out.append(" " + aa.description);
68 int nochunks = Math.min(aa.annotations.length, al.getWidth()) / len
71 for (int j = 0; j < nochunks; j++)
74 int end = start + len;
75 if (end > aa.annotations.length)
77 end = aa.annotations.length;
81 for (int k = start; k < end; k++)
83 if (aa.annotations[k] == null)
89 ch = aa.annotations[k].displayCharacter;
93 this.warningMessage = "Truncated column annotation to first letter.";
94 ch = ch.substring(0, 1);
103 return out.toString();