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;
25 * A profile for one column of an alignment
30 public class Profile implements ProfileI
33 * an object holding counts of symbols in the profile
35 private ResidueCount counts;
38 * the number of sequences (gapped or not) in the profile
43 * the number of non-gapped sequences in the profile
48 * the highest count for any residue in the profile
53 * the residue (e.g. K) or residues (e.g. KQW) with the
54 * highest count in the profile
56 private String modalResidue;
59 * Constructor which allows derived data to be stored without having to store
63 * the number of sequences in the profile
65 * the number of gapped sequences
67 * the highest count for any residue
69 * the residue (or concatenated residues) with the highest count
71 public Profile(int seqCount, int gaps, int max, String modalRes)
73 this.height = seqCount;
76 this.modalResidue = modalRes;
80 * @see jalview.datamodel.ProfileI#setCounts(jalview.datamodel.ResidueCount)
83 public void setCounts(ResidueCount residueCounts)
85 this.counts = residueCounts;
89 * @see jalview.datamodel.ProfileI#getPercentageIdentity(boolean)
92 public float getPercentageIdentity(boolean ignoreGaps)
99 if (ignoreGaps && gapped < height)
101 pid = (maxCount * 100f) / (height - gapped);
105 pid = (maxCount * 100f) / height;
111 * @see jalview.datamodel.ProfileI#getCounts()
114 public ResidueCount getCounts()
120 * @see jalview.datamodel.ProfileI#getHeight()
123 public int getHeight()
129 * @see jalview.datamodel.ProfileI#getGapped()
132 public int getGapped()
138 * @see jalview.datamodel.ProfileI#getMaxCount()
141 public int getMaxCount()
147 * @see jalview.datamodel.ProfileI#getModalResidue()
150 public String getModalResidue()
156 * @see jalview.datamodel.ProfileI#getNonGapped()
159 public int getNonGapped()
161 return height - gapped;