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;
37 * the number of sequences (gapped or not) in the profile
42 * the number of non-gapped sequences in the profile
47 * the highest count for any residue in the profile
52 * the residue (e.g. K) or residues (e.g. KQW) with the
53 * highest count in the profile
55 private String modalResidue;
58 * Constructor which allows derived data to be stored without having to store
62 * the number of sequences in the profile
64 * the number of gapped sequences
66 * the highest count for any residue
68 * the residue (or concatenated residues) with the highest count
70 public Profile(int seqCount, int gaps, int max, String modalRes)
72 this.height = seqCount;
75 this.modalResidue = modalRes;
79 * @see jalview.datamodel.ProfileI#setCounts(jalview.datamodel.ResidueCount)
82 public void setCounts(ResidueCount residueCounts)
84 this.counts = residueCounts;
88 * @see jalview.datamodel.ProfileI#getPercentageIdentity(boolean)
91 public float getPercentageIdentity(boolean ignoreGaps)
98 if (ignoreGaps && gapped < height)
100 pid = (maxCount * 100f) / (height - gapped);
104 pid = (maxCount * 100f) / height;
110 * @see jalview.datamodel.ProfileI#getCounts()
113 public ResidueCount getCounts()
119 * @see jalview.datamodel.ProfileI#getHeight()
122 public int getHeight()
128 * @see jalview.datamodel.ProfileI#getGapped()
131 public int getGapped()
137 * @see jalview.datamodel.ProfileI#getMaxCount()
140 public int getMaxCount()
146 * @see jalview.datamodel.ProfileI#getModalResidue()
149 public String getModalResidue()
155 * @see jalview.datamodel.ProfileI#getNonGapped()
158 public int getNonGapped()
160 return height - gapped;