inprogress
[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 _average_identity_ratio;
33     final private double _gap_ratio;
34     final private int    _length;
35     final private int    _number_of_sequences;
36     final private String _removed_seq;
37
38     public MsaProperties( final int number_of_sequences,
39                           final int length,
40                           final double gap_ratio,
41                           final double average_identity_ratio,
42                           final String removed_seq ) {
43         _number_of_sequences = number_of_sequences;
44         _length = length;
45         _gap_ratio = gap_ratio;
46         _average_identity_ratio = average_identity_ratio;
47         _removed_seq = removed_seq;
48     }
49
50     public MsaProperties( final Msa msa, final String removed_seq, final boolean calculate_aln_mean_identity ) {
51         _number_of_sequences = msa.getNumberOfSequences();
52         _length = msa.getLength();
53         _gap_ratio = MsaMethods.calcGapRatio( msa );
54         _removed_seq = removed_seq;
55         if ( calculate_aln_mean_identity ) {
56             _average_identity_ratio = MsaMethods.calculateIdentityRatio( 0, msa.getLength() - 1, msa ).arithmeticMean();
57         }
58         else {
59             _average_identity_ratio = -1;
60         }
61     }
62
63     public final double getAverageIdentityRatio() {
64         return _average_identity_ratio;
65     }
66
67     public final double getGapRatio() {
68         return _gap_ratio;
69     }
70
71     public final int getLength() {
72         return _length;
73     }
74
75     public final int getNumberOfSequences() {
76         return _number_of_sequences;
77     }
78
79     public final String getRemovedSeq() {
80         return _removed_seq;
81     }
82 }