2 // FORESTER -- software libraries and applications
3 // for evolutionary biology research and applications.
5 // Copyright (C) 2008-2009 Christian M. Zmasek
6 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 // Contact: phylosoft @ gmail . com
24 // WWW: https://sites.google.com/site/cmzmasek/home/software/forester
26 package org.forester.pccx;
28 import org.forester.util.DescriptiveStatistics;
29 import org.forester.util.ForesterUtil;
32 * @author Christian M. Zmasek
34 public class ExternalNodeBasedCoverage implements Coverage {
36 private final double _av_normalized_score;
37 private final double _av_raw_score;
39 private final double _sd;
40 private final double _max;
41 private final double _min;
43 public ExternalNodeBasedCoverage( final DescriptiveStatistics stats,
44 final double average_raw_score,
45 final CoverageCalculationOptions options ) {
46 _av_normalized_score = stats.arithmeticMean();
47 _av_raw_score = average_raw_score;
50 _sd = stats.sampleStandardDeviation();
55 _max = stats.getMax();
56 _min = stats.getMin();
60 public String asString() {
61 final StringBuffer sb = new StringBuffer();
63 sb.append( "Normalized score: " + getScore() + ForesterUtil.getLineSeparator() );
64 sb.append( "Raw score : " + getAvarageRawScore() );
67 sb.append( "Avarage normalized score: " + getScore() + " [sd=" + getSD() + " min=" + getMin() + " max="
68 + getMax() + " n=" + getN() + "]" + ForesterUtil.getLineSeparator() );
69 sb.append( "Avarage raw score : " + getAvarageRawScore() );
74 public double getAvarageNormalizedScore() {
75 return _av_normalized_score;
78 public double getAvarageRawScore() {
82 public double getMax() {
86 public double getMin() {
95 public double getScore() {
96 return getAvarageNormalizedScore();
99 public double getSD() {