// Copyright (C) 2008-2009 Christian M. Zmasek
// Copyright (C) 2008-2009 Burnham Institute for Medical Research
// All rights reserved
// Copyright (C) 2008-2009 Christian M. Zmasek
// Copyright (C) 2008-2009 Burnham Institute for Medical Research
// All rights reserved
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
//
// Contact: phylosoft @ gmail . com
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
//
// Contact: phylosoft @ gmail . com
public class DomainArchitectureBasedGenomeSimilarityCalculator {
public static final double MAX_SIMILARITY_SCORE = 1.0;
public static final double MIN_SIMILARITY_SCORE = 0.0;
final private GenomeWideCombinableDomains _combinable_domains_genome_0;
final private GenomeWideCombinableDomains _combinable_domains_genome_1;
public class DomainArchitectureBasedGenomeSimilarityCalculator {
public static final double MAX_SIMILARITY_SCORE = 1.0;
public static final double MIN_SIMILARITY_SCORE = 0.0;
final private GenomeWideCombinableDomains _combinable_domains_genome_0;
final private GenomeWideCombinableDomains _combinable_domains_genome_1;
- private Set<DomainId> _all_domains;
- private Set<DomainId> _shared_domains;
- private Set<DomainId> _domains_specific_to_0;
- private Set<DomainId> _domains_specific_to_1;
+ private Set<String> _all_domains;
+ private Set<String> _shared_domains;
+ private Set<String> _domains_specific_to_0;
+ private Set<String> _domains_specific_to_1;
private Set<BinaryDomainCombination> _all_binary_domain_combinations;
private Set<BinaryDomainCombination> _shared_binary_domain_combinations;
private Set<BinaryDomainCombination> _binary_domain_combinations_specific_to_0;
private Set<BinaryDomainCombination> _all_binary_domain_combinations;
private Set<BinaryDomainCombination> _shared_binary_domain_combinations;
private Set<BinaryDomainCombination> _binary_domain_combinations_specific_to_0;
all.addAll( getCombinableDomainsGenome0().getAllDomainIds() );
all.addAll( getCombinableDomainsGenome1().getAllDomainIds() );
if ( isAllowDomainsToBeIgnored() && !getDomainIdsToIgnore().isEmpty() ) {
all.addAll( getCombinableDomainsGenome0().getAllDomainIds() );
all.addAll( getCombinableDomainsGenome1().getAllDomainIds() );
if ( isAllowDomainsToBeIgnored() && !getDomainIdsToIgnore().isEmpty() ) {
- private Set<DomainId> getDomainsSpecificToGenome( final boolean specific_to_genome_0 ) {
- final Set<DomainId> specific = new HashSet<DomainId>();
- final Set<DomainId> d0 = getCombinableDomainsGenome0().getAllDomainIds();
- final Set<DomainId> d1 = getCombinableDomainsGenome1().getAllDomainIds();
+ private Set<String> getDomainsSpecificToGenome( final boolean specific_to_genome_0 ) {
+ final Set<String> specific = new HashSet<String>();
+ final Set<String> d0 = getCombinableDomainsGenome0().getAllDomainIds();
+ final Set<String> d1 = getCombinableDomainsGenome1().getAllDomainIds();
if ( _domains_specific_to_0 == null ) {
_domains_specific_to_0 = getDomainsSpecificToGenome( true );
}
return _domains_specific_to_0;
}
if ( _domains_specific_to_0 == null ) {
_domains_specific_to_0 = getDomainsSpecificToGenome( true );
}
return _domains_specific_to_0;
}
if ( _domains_specific_to_1 == null ) {
_domains_specific_to_1 = getDomainsSpecificToGenome( false );
}
if ( _domains_specific_to_1 == null ) {
_domains_specific_to_1 = getDomainsSpecificToGenome( false );
}
- final Set<DomainId> shared = new HashSet<DomainId>();
- final Set<DomainId> d0 = getCombinableDomainsGenome0().getAllDomainIds();
- final Set<DomainId> d1 = getCombinableDomainsGenome1().getAllDomainIds();
- for( final DomainId domain0 : d0 ) {
+ final Set<String> shared = new HashSet<String>();
+ final Set<String> d0 = getCombinableDomainsGenome0().getAllDomainIds();
+ final Set<String> d1 = getCombinableDomainsGenome1().getAllDomainIds();
+ for( final String domain0 : d0 ) {
- private Set<DomainId> pruneDomains( final Set<DomainId> all ) {
- final Set<DomainId> pruned = new HashSet<DomainId>();
- for( final DomainId d : all ) {
+ private Set<String> pruneDomains( final Set<String> all ) {
+ final Set<String> pruned = new HashSet<String>();
+ for( final String d : all ) {