X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fsurfacing%2FDomainLengthsTable.java;h=2b291eb6e296dab5665210a95ce1d15e632bd23c;hb=9c3a223ef0fd72affdb9f4e40845d1e3ebe52f90;hp=f154f1dcc9a9809e0dba0f111499dfdf782f44e6;hpb=eee996a6476a1e3d84c07f8f690dcde3ff4b2ef5;p=jalview.git diff --git a/forester/java/src/org/forester/surfacing/DomainLengthsTable.java b/forester/java/src/org/forester/surfacing/DomainLengthsTable.java index f154f1d..2b291eb 100644 --- a/forester/java/src/org/forester/surfacing/DomainLengthsTable.java +++ b/forester/java/src/org/forester/surfacing/DomainLengthsTable.java @@ -22,7 +22,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA // // Contact: phylosoft @ gmail . com -// WWW: www.phylosoft.org/forester +// WWW: https://sites.google.com/site/cmzmasek/home/software/forester package org.forester.surfacing; @@ -32,36 +32,24 @@ import java.util.List; import java.util.SortedMap; import java.util.TreeMap; +import org.forester.protein.Domain; +import org.forester.protein.Protein; +import org.forester.species.Species; import org.forester.util.BasicDescriptiveStatistics; import org.forester.util.DescriptiveStatistics; import org.forester.util.ForesterUtil; public class DomainLengthsTable { - private final static DecimalFormat DF = new DecimalFormat( "#.0" ); - final SortedMap _domain_lengths; - final List _species; + private final static DecimalFormat DF = new DecimalFormat( "#.0" ); + final SortedMap _domain_lengths; + final List _species; public DomainLengthsTable() { - _domain_lengths = new TreeMap(); + _domain_lengths = new TreeMap(); _species = new ArrayList(); } - private void addDomainLengths( final DomainLengths domain_lengths ) { - if ( getDomainLengths().containsKey( domain_lengths.getDomainId() ) ) { - throw new IllegalArgumentException( "domain lengths for [" + domain_lengths.getDomainId() - + "] already added" ); - } - getDomainLengths().put( domain_lengths.getDomainId(), domain_lengths ); - } - - private void addLength( final DomainId domain_id, final Species species, final int domain_length ) { - if ( !getDomainLengths().containsKey( domain_id ) ) { - addDomainLengths( new DomainLengths( domain_id ) ); - } - getDomainLengths().get( domain_id ).addLength( species, domain_length ); - } - public void addLengths( final List protein_list ) { for( final Protein protein : protein_list ) { final Species species = protein.getSpecies(); @@ -83,7 +71,7 @@ public class DomainLengthsTable { return stats; } - public DescriptiveStatistics calculateMeanBasedStatisticsForDomain( final DomainId domain_id ) { + public DescriptiveStatistics calculateMeanBasedStatisticsForDomain( final String domain_id ) { return getDomainLengths( domain_id ).calculateMeanBasedStatistics(); } @@ -139,11 +127,7 @@ public class DomainLengthsTable { return sb; } - private SortedMap getDomainLengths() { - return _domain_lengths; - } - - public DomainLengths getDomainLengths( final DomainId domain_id ) { + public DomainLengths getDomainLengths( final String domain_id ) { return getDomainLengths().get( domain_id ); } @@ -155,11 +139,30 @@ public class DomainLengthsTable { return list; } - public DescriptiveStatistics getLengthStatistic( final DomainId domain_id, final Species species ) { + public DescriptiveStatistics getLengthStatistic( final String domain_id, final Species species ) { return getDomainLengths( domain_id ).getLengthStatistic( species ); } public List getSpecies() { return _species; } + + private void addDomainLengths( final DomainLengths domain_lengths ) { + if ( getDomainLengths().containsKey( domain_lengths.getDomainId() ) ) { + throw new IllegalArgumentException( "domain lengths for [" + domain_lengths.getDomainId() + + "] already added" ); + } + getDomainLengths().put( domain_lengths.getDomainId(), domain_lengths ); + } + + private void addLength( final String domain_id, final Species species, final int domain_length ) { + if ( !getDomainLengths().containsKey( domain_id ) ) { + addDomainLengths( new DomainLengths( domain_id ) ); + } + getDomainLengths().get( domain_id ).addLength( species, domain_length ); + } + + private SortedMap getDomainLengths() { + return _domain_lengths; + } }