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.
21 package jalview.datamodel;
24 * A profile for one column of an alignment
29 public class Profile implements ProfileI
32 * an object holding counts of symbols in the profile
34 private ResidueCount counts;
36 private SecondaryStructureCount ssCounts;
39 * the number of sequences (gapped or not) in the profile
44 * the number of non-gapped sequences in the profile
49 * the highest count for any residue in the profile
52 private int maxSSCount;
56 * the residue (e.g. K) or residues (e.g. KQW) with the
57 * highest count in the profile
59 private String modalResidue;
61 private String modalSS;
64 * Constructor which allows derived data to be stored without having to store
68 * the number of sequences in the profile
70 * the number of gapped sequences
72 * the highest count for any residue
74 * the residue (or concatenated residues) with the highest count
76 public Profile(int seqCount, int gaps, int max, String modalRes)
78 this.height = seqCount;
81 this.modalResidue = modalRes;
84 public Profile(String modalSS, int ssCount, int gaps, int maxSSCount)
86 this.height = ssCount;
88 this.maxSSCount = maxSSCount;
89 this.modalSS = modalSS;
93 * @see jalview.datamodel.ProfileI#setCounts(jalview.datamodel.ResidueCount)
96 public void setCounts(ResidueCount residueCounts)
98 this.counts = residueCounts;
102 public void setSSCounts(SecondaryStructureCount secondaryStructureCount)
104 this.ssCounts = secondaryStructureCount;
108 * @see jalview.datamodel.ProfileI#getPercentageIdentity(boolean)
111 public float getPercentageIdentity(boolean ignoreGaps)
118 if (ignoreGaps && gapped < height)
120 pid = (maxCount * 100f) / (height - gapped);
124 pid = (maxCount * 100f) / height;
130 public float getSSPercentageIdentity(boolean ignoreGaps)
137 if (ignoreGaps && gapped < height)
139 ssPid = (maxSSCount * 100f) / (height - gapped);
143 ssPid = (maxSSCount * 100f) / height;
149 * @see jalview.datamodel.ProfileI#getCounts()
152 public ResidueCount getCounts()
158 public SecondaryStructureCount getSSCounts()
164 * @see jalview.datamodel.ProfileI#getHeight()
167 public int getHeight()
173 * @see jalview.datamodel.ProfileI#getGapped()
176 public int getGapped()
182 * @see jalview.datamodel.ProfileI#getMaxCount()
185 public int getMaxCount()
191 public int getMaxSSCount()
197 * @see jalview.datamodel.ProfileI#getModalResidue()
200 public String getModalResidue()
206 public String getModalSS()
212 * @see jalview.datamodel.ProfileI#getNonGapped()
215 public int getNonGapped()
217 return height - gapped;