import java.util.List;
import org.forester.evoinference.distance.NeighborJoining;
-import org.forester.evoinference.matrix.distance.BasicSymmetricalDistanceMatrix;
import org.forester.evoinference.matrix.distance.DistanceMatrix;
import org.forester.io.parsers.SymmetricalDistanceMatrixParser;
import org.forester.io.writers.PhylogenyWriter;
final NeighborJoining nj = NeighborJoining.createInstance( verbose, 6 );
final long start_time = new Date().getTime();
for( final DistanceMatrix matrix : matrices ) {
- ps.add( nj.execute( ( BasicSymmetricalDistanceMatrix ) matrix ) );
+ ps.add( nj.execute( ( DistanceMatrix ) matrix ) );
}
final long end_time = new Date().getTime();
final PhylogenyWriter w = new PhylogenyWriter();
import org.forester.evoinference.distance.NeighborJoiningF;
import org.forester.evoinference.distance.PairwiseDistanceCalculator;
import org.forester.evoinference.matrix.distance.BasicSymmetricalDistanceMatrix;
+import org.forester.evoinference.matrix.distance.DistanceMatrix;
import org.forester.evoinference.tools.BootstrapResampler;
import org.forester.msa.BasicMsa;
import org.forester.msa.Mafft;
}
private Phylogeny inferPhylogeny( final Msa msa ) {
- BasicSymmetricalDistanceMatrix m = null;
+ DistanceMatrix m = null;
switch ( _options.getPwdDistanceMethod() ) {
case KIMURA_DISTANCE:
m = PairwiseDistanceCalculator.calcKimuraDistances( msa );
return msa;
}
- private void writeToFiles( final BasicSymmetricalDistanceMatrix m ) {
+ private void writeToFiles( final DistanceMatrix m ) {
if ( !ForesterUtil.isEmpty( _options.getIntermediateFilesBase() ) ) {
try {
final BufferedWriter msa_writer = new BufferedWriter( new FileWriter( _options.getIntermediateFilesBase()
try {
final Msa msa0 = GeneralMsaParser.parseMsa( new FileInputStream( test_dir + ForesterUtil.FILE_SEPARATOR
+ "bcl.aln" ) );
- final BasicSymmetricalDistanceMatrix pwd0 = PairwiseDistanceCalculator.calcKimuraDistances( msa0 );
+ final DistanceMatrix pwd0 = PairwiseDistanceCalculator.calcKimuraDistances( msa0 );
if ( pwd0.getSize() != 120 ) {
return false;
}
import java.util.ArrayList;
import java.util.List;
-import org.forester.evoinference.matrix.distance.BasicSymmetricalDistanceMatrix;
import org.forester.evoinference.matrix.distance.DistanceMatrix;
import org.forester.phylogeny.Phylogeny;
import org.forester.phylogeny.PhylogenyNode;
return phylogeny;
}
- public final List<Phylogeny> execute( final List<BasicSymmetricalDistanceMatrix> distances_list ) {
+ public final List<Phylogeny> execute( final List<DistanceMatrix> distances_list ) {
final List<Phylogeny> pl = new ArrayList<Phylogeny>();
- for( final BasicSymmetricalDistanceMatrix distances : distances_list ) {
+ for( final DistanceMatrix distances : distances_list ) {
pl.add( execute( distances ) );
}
return pl;
package org.forester.evoinference.distance;
import org.forester.evoinference.matrix.distance.BasicSymmetricalDistanceMatrix;
+import org.forester.evoinference.matrix.distance.DistanceMatrix;
+import org.forester.evoinference.matrix.distance.DistanceMatrix;
import org.forester.msa.Msa;
public final class PairwiseDistanceCalculator {
return -Math.log( dp );
}
- private BasicSymmetricalDistanceMatrix calcKimuraDistances() {
+ private DistanceMatrix calcKimuraDistances() {
final int s = _msa.getNumberOfSequences();
- final BasicSymmetricalDistanceMatrix d = new BasicSymmetricalDistanceMatrix( s );
+ final DistanceMatrix d = new BasicSymmetricalDistanceMatrix( s );
copyIdentifiers( s, d );
calcKimuraDistances( s, d );
return d;
}
- private BasicSymmetricalDistanceMatrix calcPoissonDistances() {
+ private DistanceMatrix calcPoissonDistances() {
final int s = _msa.getNumberOfSequences();
- final BasicSymmetricalDistanceMatrix d = new BasicSymmetricalDistanceMatrix( s );
+ final DistanceMatrix d = new BasicSymmetricalDistanceMatrix( s );
copyIdentifiers( s, d );
calcPoissonDistances( s, d );
return d;
}
- private BasicSymmetricalDistanceMatrix calcFractionalDissimilarities() {
+ private DistanceMatrix calcFractionalDissimilarities() {
final int s = _msa.getNumberOfSequences();
- final BasicSymmetricalDistanceMatrix d = new BasicSymmetricalDistanceMatrix( s );
+ final DistanceMatrix d = new BasicSymmetricalDistanceMatrix( s );
copyIdentifiers( s, d );
calcFractionalDissimilarities( s, d );
return d;
}
- private void calcKimuraDistances( final int s, final BasicSymmetricalDistanceMatrix d ) {
+ private void calcKimuraDistances( final int s, final DistanceMatrix d ) {
for( int i = 1; i < s; i++ ) {
for( int j = 0; j < i; j++ ) {
d.setValue( i, j, calcKimuraDistance( i, j ) );
}
}
- private void calcPoissonDistances( final int s, final BasicSymmetricalDistanceMatrix d ) {
+ private void calcPoissonDistances( final int s, final DistanceMatrix d ) {
for( int i = 1; i < s; i++ ) {
for( int j = 0; j < i; j++ ) {
d.setValue( i, j, calcPoissonDistance( i, j ) );
}
}
- private void calcFractionalDissimilarities( final int s, final BasicSymmetricalDistanceMatrix d ) {
+ private void calcFractionalDissimilarities( final int s, final DistanceMatrix d ) {
for( int i = 1; i < s; i++ ) {
for( int j = 0; j < i; j++ ) {
d.setValue( i, j, calcFractionalDissimilarity( i, j ) );
throw new CloneNotSupportedException();
}
- private void copyIdentifiers( final int s, final BasicSymmetricalDistanceMatrix d ) {
+ private void copyIdentifiers( final int s, final DistanceMatrix d ) {
for( int i = 0; i < s; i++ ) {
d.setIdentifier( i, _msa.getIdentifier( i ) );
}
}
- public static BasicSymmetricalDistanceMatrix calcFractionalDissimilarities( final Msa msa ) {
+ public static DistanceMatrix calcFractionalDissimilarities( final Msa msa ) {
return new PairwiseDistanceCalculator( msa, DEFAULT_VALUE_FOR_TOO_LARGE_DISTANCE_FOR_KIMURA_FORMULA )
.calcFractionalDissimilarities();
}
- public static BasicSymmetricalDistanceMatrix calcPoissonDistances( final Msa msa ) {
+ public static DistanceMatrix calcPoissonDistances( final Msa msa ) {
return new PairwiseDistanceCalculator( msa, DEFAULT_VALUE_FOR_TOO_LARGE_DISTANCE_FOR_KIMURA_FORMULA )
.calcPoissonDistances();
}
- public static BasicSymmetricalDistanceMatrix calcKimuraDistances( final Msa msa ) {
+ public static DistanceMatrix calcKimuraDistances( final Msa msa ) {
return new PairwiseDistanceCalculator( msa, DEFAULT_VALUE_FOR_TOO_LARGE_DISTANCE_FOR_KIMURA_FORMULA )
.calcKimuraDistances();
}
- public static BasicSymmetricalDistanceMatrix calcKimuraDistances( final Msa msa,
+ public static DistanceMatrix calcKimuraDistances( final Msa msa,
final double value_for_too_large_distance_for_kimura_formula ) {
return new PairwiseDistanceCalculator( msa, value_for_too_large_distance_for_kimura_formula )
.calcKimuraDistances();
import java.util.SortedMap;
import java.util.TreeMap;
-import org.forester.evoinference.matrix.distance.BasicSymmetricalDistanceMatrix;
+import org.forester.evoinference.matrix.distance.DistanceMatrix;
public final class Sset {
return getS( j ).get( key );
}
- final public void initialize( final BasicSymmetricalDistanceMatrix d ) {
+ final public void initialize( final DistanceMatrix d ) {
for( int j = 0; j < d.getSize(); ++j ) {
final TreeMap<Integer, Set<Integer>> map = new TreeMap<Integer, Set<Integer>>();
_data.add( map );
import org.forester.evoinference.distance.PairwiseDistanceCalculator;
import org.forester.evoinference.distance.PairwiseDistanceCalculator.PWD_DISTANCE_METHOD;
import org.forester.evoinference.matrix.distance.BasicSymmetricalDistanceMatrix;
+import org.forester.evoinference.matrix.distance.DistanceMatrix;
import org.forester.evoinference.tools.BootstrapResampler;
import org.forester.io.parsers.nhx.NHXParser.TAXONOMY_EXTRACTION;
import org.forester.io.parsers.phyloxml.PhyloXmlDataFormatException;
}
private final Phylogeny collapse( final Msa msa, final int threshold ) {
- final BasicSymmetricalDistanceMatrix m = PairwiseDistanceCalculator.calcFractionalDissimilarities( msa );
+ final DistanceMatrix m = PairwiseDistanceCalculator.calcFractionalDissimilarities( msa );
//TODO
return null;
}
final Msa msa,
final boolean write_matrix,
final String matrix_name ) {
- BasicSymmetricalDistanceMatrix m = null;
+ DistanceMatrix m = null;
switch ( pwd_distance_method ) {
case KIMURA_DISTANCE:
m = PairwiseDistanceCalculator.calcKimuraDistances( msa );
final boolean calc_similarity_scores,
final Phylogeny phy ) {
init();
- final BasicSymmetricalDistanceMatrix domain_distance_scores_means = new BasicSymmetricalDistanceMatrix( number_of_genomes );
- final BasicSymmetricalDistanceMatrix shared_domains_based_distances = new BasicSymmetricalDistanceMatrix( number_of_genomes );
- final BasicSymmetricalDistanceMatrix shared_binary_combinations_based_distances = new BasicSymmetricalDistanceMatrix( number_of_genomes );
+ final DistanceMatrix domain_distance_scores_means = new BasicSymmetricalDistanceMatrix( number_of_genomes );
+ final DistanceMatrix shared_domains_based_distances = new BasicSymmetricalDistanceMatrix( number_of_genomes );
+ final DistanceMatrix shared_binary_combinations_based_distances = new BasicSymmetricalDistanceMatrix( number_of_genomes );
if ( verbose ) {
System.out.println();
System.out.println( "Pairwise genome distances:" );
final SortedSet<String> domain_ids_to_ignore = randomlyPickDomainIds( all_unique_domain_ids,
jacknife_ratio,
generator );
- final BasicSymmetricalDistanceMatrix shared_domains_based_distances = new BasicSymmetricalDistanceMatrix( number_of_genomes );
- final BasicSymmetricalDistanceMatrix shared_binary_combinations_based_distances = new BasicSymmetricalDistanceMatrix( number_of_genomes );
+ final DistanceMatrix shared_domains_based_distances = new BasicSymmetricalDistanceMatrix( number_of_genomes );
+ final DistanceMatrix shared_binary_combinations_based_distances = new BasicSymmetricalDistanceMatrix( number_of_genomes );
for( int i = 0; i < number_of_genomes; ++i ) {
final String species_i = species[ i ].getSpeciesId();
shared_domains_based_distances.setIdentifier( i, species_i );
import org.forester.evoinference.matrix.character.CharacterStateMatrix.BinaryStates;
import org.forester.evoinference.matrix.character.CharacterStateMatrix.Format;
import org.forester.evoinference.matrix.character.CharacterStateMatrix.GainLossStates;
-import org.forester.evoinference.matrix.distance.BasicSymmetricalDistanceMatrix;
import org.forester.evoinference.matrix.distance.DistanceMatrix;
import org.forester.go.GoId;
import org.forester.go.GoNameSpace;
final DistanceMatrix distance ) {
checkForOutputFileWriteability( nj_tree_outfile );
final NeighborJoining nj = NeighborJoining.createInstance();
- final Phylogeny phylogeny = nj.execute( ( BasicSymmetricalDistanceMatrix ) distance );
+ final Phylogeny phylogeny = nj.execute( ( DistanceMatrix ) distance );
phylogeny.setName( nj_tree_outfile.getName() );
writePhylogenyToFile( phylogeny, nj_tree_outfile.toString() );
return phylogeny;