Clover icon

Coverage Report

  1. Project Clover database Thu Nov 7 2024 17:01:39 GMT
  2. Package jalview.io

File AMSAFile.java

 

Coverage histogram

../../img/srcFileCovDistChart0.png
0% of files have more coverage

Code metrics

18
31
4
1
121
76
14
0.45
7.75
4
3.5

Classes

Class Line # Actions
AMSAFile 29 31 14
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
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.
11    *
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.
16    *
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.
20    */
21    package jalview.io;
22   
23    import jalview.datamodel.AlignmentAnnotation;
24    import jalview.datamodel.AlignmentI;
25    import jalview.datamodel.SequenceI;
26   
27    import java.io.IOException;
28   
 
29    public class AMSAFile extends jalview.io.FastaFile
30    {
31   
32    AlignmentI al;
33   
34    /**
35    * Creates a new AMSAFile object for output.
36    */
 
37  0 toggle public AMSAFile(AlignmentI al)
38    {
39  0 this.al = al;
40    }
41   
 
42  0 toggle public AMSAFile(String inFile, DataSourceType sourceType)
43    throws IOException
44    {
45  0 super(inFile, sourceType);
46    }
47   
 
48  0 toggle public AMSAFile(FileParse source) throws IOException
49    {
50  0 super(source);
51    }
52   
53    /**
54    * DOCUMENT ME!
55    *
56    * @return DOCUMENT ME!
57    */
 
58  0 toggle @Override
59    public String print(SequenceI[] sqs, boolean jvsuffix)
60    {
61  0 super.print(sqs, jvsuffix);
62   
63  0 AlignmentAnnotation aa;
64  0 if (al.getAlignmentAnnotation() != null)
65    {
66   
67  0 for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
68    {
69  0 aa = al.getAlignmentAnnotation()[i];
70   
71  0 if (aa.autoCalculated || !aa.visible)
72    {
73  0 continue;
74    }
75   
76  0 out.append(">#_" + aa.label);
77  0 if (aa.description != null)
78    {
79  0 out.append(" " + aa.description);
80    }
81   
82  0 out.append(newline);
83   
84  0 int nochunks = Math.min(aa.annotations.length, al.getWidth()) / len
85    + 1;
86   
87  0 for (int j = 0; j < nochunks; j++)
88    {
89  0 int start = j * len;
90  0 int end = start + len;
91  0 if (end > aa.annotations.length)
92    {
93  0 end = aa.annotations.length;
94    }
95   
96  0 String ch;
97  0 for (int k = start; k < end; k++)
98    {
99  0 if (aa.annotations[k] == null)
100    {
101  0 ch = " ";
102    }
103    else
104    {
105  0 ch = aa.annotations[k].displayCharacter;
106    }
107  0 if (ch.length() > 1)
108    {
109  0 this.warningMessage = "Truncated column annotation to first letter.";
110  0 ch = ch.substring(0, 1);
111    }
112  0 out.append(ch);
113   
114    }
115  0 out.append(newline);
116    }
117    }
118    }
119  0 return out.toString();
120    }
121    }