in progress....
[jalview.git] / forester / java / src / org / forester / msa_compactor / MsaProperties.java
1 // $Id:
2 // FORESTER -- software libraries and applications
3 // for evolutionary biology research and applications.
4 //
5 // Copyright (C) 2014 Christian M. Zmasek
6 // Copyright (C) 2014 Sanford-Burnham Medical Research Institute
7 // All rights reserved
8 //
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.
13 //
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.
18 //
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
22 //
23 // WWW: https://sites.google.com/site/cmzmasek/home/software/forester
24
25 package org.forester.msa_compactor;
26
27 import org.forester.msa.Msa;
28 import org.forester.msa.MsaMethods;
29
30 public final class MsaProperties {
31
32     final private double _entropy21;
33     final private double _entropy7;
34     final private double _gap_ratio;
35     final private int    _length;
36     final private int    _number_of_sequences;
37     final private double _avg_number_of_gaps;
38     final private String _removed_seq;
39
40     public MsaProperties( final int number_of_sequences,
41                           final int length,
42                           final double gap_ratio,
43                           final double entropy7,
44                           final double entropy21,
45                           final double avg_number_of_gaps,
46                           final String removed_seq ) {
47         _number_of_sequences = number_of_sequences;
48         _length = length;
49         _gap_ratio = gap_ratio;
50         _entropy7 = entropy7;
51         _entropy21 = entropy21;
52         _avg_number_of_gaps = avg_number_of_gaps;
53         _removed_seq = removed_seq;
54     }
55
56     public MsaProperties( final Msa msa, final String removed_seq, final boolean calculate_normalized_shannon_entropy ) {
57         _number_of_sequences = msa.getNumberOfSequences();
58         _length = msa.getLength();
59         _gap_ratio = MsaMethods.calcGapRatio( msa );
60         _removed_seq = removed_seq;
61         _avg_number_of_gaps = MsaMethods.calcNumberOfGapsStats( msa ).arithmeticMean();
62         if ( calculate_normalized_shannon_entropy ) {
63             _entropy7 = MsaMethods.calcNormalizedShannonsEntropy( 7, msa );
64             _entropy21 = MsaMethods.calcNormalizedShannonsEntropy( 21, msa );
65         }
66         else {
67             _entropy7 = -1;
68             _entropy21 = -1;
69         }
70     }
71
72     public final double getEntropy21() {
73         return _entropy21;
74     }
75
76     public final double getEntropy7() {
77         return _entropy7;
78     }
79
80     public final double getGapRatio() {
81         return _gap_ratio;
82     }
83
84     public final double getAvgNumberOfGaps() {
85         return _avg_number_of_gaps;
86     }
87     
88     public final int getLength() {
89         return _length;
90     }
91
92     public final int getNumberOfSequences() {
93         return _number_of_sequences;
94     }
95
96     public final String getRemovedSeq() {
97         return _removed_seq;
98     }
99 }