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 import java.io.IOException;
29 public class AMSAFile extends jalview.io.FastaFile
35 * Creates a new AMSAFile object for output.
37 public AMSAFile(AlignmentI al)
42 public AMSAFile(String inFile, DataSourceType sourceType)
45 super(inFile, sourceType);
48 public AMSAFile(FileParse source) throws IOException
56 * @return DOCUMENT ME!
59 public String print(SequenceI[] sqs, boolean jvsuffix)
61 super.print(sqs, jvsuffix);
63 AlignmentAnnotation aa;
64 if (al.getAlignmentAnnotation() != null)
67 for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
69 aa = al.getAlignmentAnnotation()[i];
71 if (aa.autoCalculated || !aa.visible)
76 out.append(">#_" + aa.label);
77 if (aa.description != null)
79 out.append(" " + aa.description);
84 int nochunks = Math.min(aa.annotations.length, al.getWidth()) / len
87 for (int j = 0; j < nochunks; j++)
90 int end = start + len;
91 if (end > aa.annotations.length)
93 end = aa.annotations.length;
97 for (int k = start; k < end; k++)
99 if (aa.annotations[k] == null)
105 ch = aa.annotations[k].displayCharacter;
109 this.warningMessage = "Truncated column annotation to first letter.";
110 ch = ch.substring(0, 1);
119 return out.toString();