X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2Ftools%2FPhylogeneticInferrer.java;h=8b8964628d2cd77ae58887242f40d165ce118c38;hb=bdf2d2a11d720d6457f52866af7ff909afe98db4;hp=f0ed725806f4444b5f662a7740c584d473704e17;hpb=ebabb46561f996b5fcd59bd202defd7b189ea5b6;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/tools/PhylogeneticInferrer.java b/forester/java/src/org/forester/archaeopteryx/tools/PhylogeneticInferrer.java index f0ed725..8b89646 100644 --- a/forester/java/src/org/forester/archaeopteryx/tools/PhylogeneticInferrer.java +++ b/forester/java/src/org/forester/archaeopteryx/tools/PhylogeneticInferrer.java @@ -21,7 +21,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.archaeopteryx.tools; @@ -30,18 +30,15 @@ import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.regex.Matcher; import javax.swing.JOptionPane; import org.forester.archaeopteryx.MainFrameApplication; -import org.forester.evoinference.distance.NeighborJoining; +import org.forester.evoinference.distance.NeighborJoiningF; import org.forester.evoinference.distance.PairwiseDistanceCalculator; import org.forester.evoinference.matrix.distance.BasicSymmetricalDistanceMatrix; import org.forester.evoinference.tools.BootstrapResampler; -import org.forester.io.parsers.FastaParser; import org.forester.msa.BasicMsa; -import org.forester.msa.ClustalOmega; import org.forester.msa.Mafft; import org.forester.msa.Msa; import org.forester.msa.Msa.MSA_FORMAT; @@ -49,9 +46,7 @@ import org.forester.msa.MsaInferrer; import org.forester.msa.MsaMethods; import org.forester.msa.ResampleableMsa; import org.forester.phylogeny.Phylogeny; -import org.forester.phylogeny.PhylogenyNode; -import org.forester.phylogeny.data.Accession; -import org.forester.phylogeny.iterators.PhylogenyNodeIterator; +import org.forester.phylogeny.PhylogenyMethods; import org.forester.sequence.Sequence; import org.forester.tools.ConfidenceAssessor; import org.forester.util.ForesterUtil; @@ -98,8 +93,6 @@ public class PhylogeneticInferrer extends RunnableProcess { switch ( msa_prg ) { case MAFFT: return runMAFFT( _seqs, processMafftOptions() ); - case CLUSTAL_O: - return runClustalOmega( _seqs, processMafftOptions() ); default: return null; } @@ -149,9 +142,10 @@ public class PhylogeneticInferrer extends RunnableProcess { e.printStackTrace(); } } - final NeighborJoining nj = NeighborJoining.createInstance(); + final NeighborJoiningF nj = NeighborJoiningF.createInstance( false, 5 ); final Phylogeny phy = nj.execute( m ); - PhylogeneticInferrer.extractFastaInformation( phy ); + PhylogenyMethods.addMolecularSeqsToTree( phy, msa ); + PhylogenyMethods.extractFastaInformation( phy ); return phy; } @@ -210,7 +204,7 @@ public class PhylogeneticInferrer extends RunnableProcess { } final MsaMethods msa_tools = MsaMethods.createInstance(); if ( _options.isExecuteMsaProcessing() ) { - msa = msa_tools.removeGapColumns( _options.getMsaProcessingMaxAllowedGapRatio(), + msa = msa_tools.deleteGapColumns( _options.getMsaProcessingMaxAllowedGapRatio(), _options.getMsaProcessingMinAllowedLength(), msa ); if ( msa == null ) { @@ -279,20 +273,6 @@ public class PhylogeneticInferrer extends RunnableProcess { return msa; } - private Msa runClustalOmega( final List seqs, final List opts ) throws IOException, - InterruptedException { - Msa msa = null; - final MsaInferrer clustalo = ClustalOmega.createInstance( _mf.getInferenceManager().getPathToLocalClustalo() - .getCanonicalPath() ); - try { - msa = clustalo.infer( seqs, opts ); - } - catch ( final IOException e ) { - System.out.println( clustalo.getErrorDescription() ); - } - return msa; - } - private void writeToFiles( final BasicSymmetricalDistanceMatrix m ) { if ( !ForesterUtil.isEmpty( _options.getIntermediateFilesBase() ) ) { try { @@ -311,39 +291,7 @@ public class PhylogeneticInferrer extends RunnableProcess { } } - public static void extractFastaInformation( final Phylogeny phy ) { - for( final PhylogenyNodeIterator iter = phy.iteratorExternalForward(); iter.hasNext(); ) { - final PhylogenyNode node = iter.next(); - if ( !ForesterUtil.isEmpty( node.getName() ) ) { - final Matcher name_m = FastaParser.FASTA_DESC_LINE.matcher( node.getName() ); - if ( name_m.lookingAt() ) { - System.out.println(); - // System.out.println( name_m.group( 1 ) ); - // System.out.println( name_m.group( 2 ) ); - // System.out.println( name_m.group( 3 ) ); - // System.out.println( name_m.group( 4 ) ); - final String acc_source = name_m.group( 1 ); - final String acc = name_m.group( 2 ); - final String seq_name = name_m.group( 3 ); - final String tax_sn = name_m.group( 4 ); - if ( !ForesterUtil.isEmpty( acc_source ) && !ForesterUtil.isEmpty( acc ) ) { - ForesterUtil.ensurePresenceOfSequence( node ); - node.getNodeData().getSequence( 0 ).setAccession( new Accession( acc, acc_source ) ); - } - if ( !ForesterUtil.isEmpty( seq_name ) ) { - ForesterUtil.ensurePresenceOfSequence( node ); - node.getNodeData().getSequence( 0 ).setName( seq_name ); - } - if ( !ForesterUtil.isEmpty( tax_sn ) ) { - ForesterUtil.ensurePresenceOfTaxonomy( node ); - node.getNodeData().getTaxonomy( 0 ).setScientificName( tax_sn ); - } - } - } - } - } - public enum MSA_PRG { - MAFFT, CLUSTAL_O; + MAFFT; } }