inprogress
[jalview.git] / forester / java / src / org / forester / surfacing / DomainSimilarity.java
1 // $Id:
2 //
3 // FORESTER -- software libraries and applications
4 // for evolutionary biology research and applications.
5 //
6 // Copyright (C) 2008-2009 Christian M. Zmasek
7 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
8 // All rights reserved
9 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 //
24 // Contact: phylosoft @ gmail . com
25 // WWW: https://sites.google.com/site/cmzmasek/home/software/forester
26
27 package org.forester.surfacing;
28
29 import java.util.Map;
30 import java.util.SortedMap;
31 import java.util.SortedSet;
32
33 import org.forester.species.Species;
34 import org.forester.surfacing.PrintableDomainSimilarity.PRINT_OPTION;
35
36 /*
37  * This is to represent a measure of similarity between two or more domains from
38  * different genomes.
39  */
40 public interface DomainSimilarity extends Comparable<DomainSimilarity> {
41
42     static public enum DomainSimilarityScoring {
43         DOMAINS, PROTEINS, COMBINATIONS;
44     }
45
46     public static enum DomainSimilaritySortField {
47         MIN, MAX, SD, MEAN, ABS_MAX_COUNTS_DIFFERENCE, MAX_COUNTS_DIFFERENCE, MAX_DIFFERENCE, SPECIES_COUNT, DOMAIN_ID,
48     }
49
50     public SortedSet<String> getCombinableDomainIds( final Species species_of_combinable_domain );;
51
52     public String getDomainId();
53
54     /**
55      * For pairwise similarities, this should return the "difference"; for example the difference in counts
56      * for copy number based features (the same as getMaximalDifferenceInCounts(), or the number
57      * of actually different domain combinations. 
58      * For pairwise similarities, this should return the difference,
59      * while for comparisons of more than two domains, this should return the maximal difference
60      * 
61      * 
62      * 
63      * @return
64      */
65     public int getMaximalDifference();
66
67     /**
68      * For pairwise similarities, this should return the difference in counts,
69      * while for comparisons of more than two domains, this should return the maximal difference
70      * in counts
71      * 
72      * 
73      * @return the (maximal) difference in counts
74      */
75     public int getMaximalDifferenceInCounts();
76
77     public double getMaximalSimilarityScore();
78
79     public double getMeanSimilarityScore();
80
81     public double getMinimalSimilarityScore();
82
83     /**
84      * This should return the number of pairwise distances used to calculate
85      * this similarity score
86      * 
87      * @return the number of pairwise distances
88      */
89     public int getN();
90
91     public SortedSet<Species> getSpecies();
92
93     /**
94      * This should return a map, which maps species names to
95      * SpeciesSpecificDomainSimilariyData
96      * 
97      * 
98      * @return SortedMap<String, SpeciesSpecificDomainSimilariyData>
99      */
100     public SortedMap<Species, SpeciesSpecificDomainSimilariyData> getSpeciesData();
101
102     public double getStandardDeviationOfSimilarityScore();
103
104     public StringBuffer toStringBuffer( PRINT_OPTION print_option, Map<String, Integer> tax_code_to_id_map );
105 }