private void copyIdentifiers( final int s, final BasicSymmetricalDistanceMatrix d ) { for( int i = 0; i < s; i++ ) { d.setIdentifier( i, _msa.getIdentifier( i ) ); } }
} else alreadySeen.put(id, 1); rmsdDist.setIdentifier(i, id);
/** * Creates a guide tree for use during progressive multiple sequence alignment. * * @param sequences the {@link List} of {@link Sequence}s to align * @param scorers list of sequence pair scorers, one for each pair of sequences given */ public GuideTree(List<S> sequences, List<PairwiseSequenceScorer<S, C>> scorers) { this.sequences = Collections.unmodifiableList(sequences); this.scorers = Collections.unmodifiableList(scorers); distances = new BasicSymmetricalDistanceMatrix(sequences.size()); for (int i = 0, n = 0; i < sequences.size(); i++) { AccessionID id = sequences.get(i).getAccession(); String str = (id == null) ? Integer.toString(i + 1) : id.getID(); distances.setIdentifier(i, str); for (int j = i+1; j < sequences.size(); j++) { double dist = scorers.get(n++).getDistance(); distances.setValue(i, j, dist); } } BasicSymmetricalDistanceMatrix distclone = ForesterWrapper.cloneDM(distances); Phylogeny phylogeny = TreeConstructor.distanceTree(distclone, TreeConstructorType.NJ); newick = phylogeny.toString(); root = new Node(phylogeny.getRoot(), null); }
/** * Creates a guide tree for use during progressive multiple sequence alignment. * * @param sequences the {@link List} of {@link Sequence}s to align * @param scorers list of sequence pair scorers, one for each pair of sequences given */ public GuideTree(List<S> sequences, List<PairwiseSequenceScorer<S, C>> scorers) { this.sequences = Collections.unmodifiableList(sequences); this.scorers = Collections.unmodifiableList(scorers); distances = new BasicSymmetricalDistanceMatrix(sequences.size()); for (int i = 0, n = 0; i < sequences.size(); i++) { AccessionID id = sequences.get(i).getAccession(); String str = (id == null) ? Integer.toString(i + 1) : id.getID(); distances.setIdentifier(i, str); for (int j = i+1; j < sequences.size(); j++) { double dist = scorers.get(n++).getDistance(); distances.setValue(i, j, dist); } } BasicSymmetricalDistanceMatrix distclone = ForesterWrapper.cloneDM(distances); Phylogeny phylogeny = TreeConstructor.distanceTree(distclone, TreeConstructorType.NJ); newick = phylogeny.toString(); root = new Node(phylogeny.getRoot(), null); }
for( int i = 0; i < number_of_genomes; ++i ) { final String species_i = species[ i ].getSpeciesId(); shared_domains_based_distances.setIdentifier( i, species_i ); shared_binary_combinations_based_distances.setIdentifier( i, species_i ); for( int j = 0; j < i; ++j ) { final List<GenomeWideCombinableDomains> genome_pair = new ArrayList<GenomeWideCombinableDomains>( 2 );
/** * Helper function to clone a forester symmetrical DistanceMatrix. * * @param distM * forester symmetrical DistanceMatrix * @return identical copy of the forester symmetrical DistanceMatrix */ public static BasicSymmetricalDistanceMatrix cloneDM( BasicSymmetricalDistanceMatrix distM) { int n = distM.getSize(); BasicSymmetricalDistanceMatrix cloneDM = new BasicSymmetricalDistanceMatrix(n); for (int i = 0; i < n; i++) { cloneDM.setIdentifier(i, distM.getIdentifier(i)); for (int j = i + 1; j < n; j++) { cloneDM.setValue(i, j, distM.getValue(i, j)); } } return cloneDM; }
/** * Helper function to clone a forester symmetrical DistanceMatrix. * * @param distM * forester symmetrical DistanceMatrix * @return identical copy of the forester symmetrical DistanceMatrix */ public static BasicSymmetricalDistanceMatrix cloneDM( BasicSymmetricalDistanceMatrix distM) { int n = distM.getSize(); BasicSymmetricalDistanceMatrix cloneDM = new BasicSymmetricalDistanceMatrix(n); for (int i = 0; i < n; i++) { cloneDM.setIdentifier(i, distM.getIdentifier(i)); for (int j = i + 1; j < n; j++) { cloneDM.setValue(i, j, distM.getValue(i, j)); } } return cloneDM; }
/** * Helper function to clone a forester symmetrical DistanceMatrix. * * @param distM * forester symmetrical DistanceMatrix * @return identical copy of the forester symmetrical DistanceMatrix */ public static BasicSymmetricalDistanceMatrix cloneDM( BasicSymmetricalDistanceMatrix distM) { int n = distM.getSize(); BasicSymmetricalDistanceMatrix cloneDM = new BasicSymmetricalDistanceMatrix(n); for (int i = 0; i < n; i++) { cloneDM.setIdentifier(i, distM.getIdentifier(i)); for (int j = i + 1; j < n; j++) { cloneDM.setValue(i, j, distM.getValue(i, j)); } } return cloneDM; }
domain_distance_scores_means.setIdentifier( i, species_i ); shared_domains_based_distances.setIdentifier( i, species_i ); shared_binary_combinations_based_distances.setIdentifier( i, species_i ); if ( verbose ) { System.out.println( ( i + 1 ) + "/" + number_of_genomes );
final NeighborJoiningR nj0 = NeighborJoiningR.createInstance(); final BasicSymmetricalDistanceMatrix m0 = new BasicSymmetricalDistanceMatrix( 4 ); m0.setIdentifier( 0, "A" ); m0.setIdentifier( 1, "B" ); m0.setIdentifier( 2, "C" ); m0.setIdentifier( 3, "D" ); m0.setRow( "5 ", 1 ); m0.setRow( "3 6 ", 2 ); m1.setRow( "6 9 6 5", 4 ); m1.setRow( "8 11 8 9 8", 5 ); m1.setIdentifier( 0, "A" ); m1.setIdentifier( 1, "B" ); m1.setIdentifier( 2, "C" ); m1.setIdentifier( 3, "D" ); m1.setIdentifier( 4, "E" ); m1.setIdentifier( 5, "F" ); final NeighborJoiningR nj1 = NeighborJoiningR.createInstance(); final Phylogeny p1 = nj1.execute( m1 ); m2.setIdentifier( 0, "Bovine" ); m2.setIdentifier( 1, "Mouse" ); m2.setIdentifier( 2, "Gibbon" ); m2.setIdentifier( 3, "Orang" ); m2.setIdentifier( 4, "Gorilla" ); m2.setIdentifier( 5, "Chimp" ); m2.setIdentifier( 6, "Human" ); m2.setRow( "0.00000 1.68660 1.71980 1.66060 1.52430 1.60430 1.59050", 0 ); m2.setRow( "1.68660 0.00000 1.52320 1.48410 1.44650 1.43890 1.46290", 1 );
NeighborJoining nj = NeighborJoining.createInstance(); final BasicSymmetricalDistanceMatrix m0 = new BasicSymmetricalDistanceMatrix( 4 ); m0.setIdentifier( 0, "A" ); m0.setIdentifier( 1, "B" ); m0.setIdentifier( 2, "C" ); m0.setIdentifier( 3, "D" ); m0.setRow( "5 ", 1 ); m0.setRow( "3 6 ", 2 ); m00.setIdentifier( 0, "A" ); m00.setIdentifier( 1, "B" ); m00.setIdentifier( 2, "C" ); m00.setIdentifier( 3, "D" ); m00.setRow( "2.01 ", 1 ); m00.setRow( "3 3.01 ", 2 ); m.setRow( "6 9 6 5", 4 ); m.setRow( "8 11 8 9 8", 5 ); m.setIdentifier( 0, "A" ); m.setIdentifier( 1, "B" ); m.setIdentifier( 2, "C" ); m.setIdentifier( 3, "D" ); m.setIdentifier( 4, "E" ); m.setIdentifier( 5, "F" ); nj = NeighborJoining.createInstance(); final Phylogeny p1 = nj.execute( m ); m.setIdentifier( 0, "Bovine" ); m.setIdentifier( 1, "Mouse" );