git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
inprogress
[jalview.git]
/
forester
/
java
/
src
/
org
/
forester
/
archaeopteryx
/
tools
/
PhylogeneticInferrer.java
diff --git
a/forester/java/src/org/forester/archaeopteryx/tools/PhylogeneticInferrer.java
b/forester/java/src/org/forester/archaeopteryx/tools/PhylogeneticInferrer.java
index
0f07850
..
10bc95e
100644
(file)
--- a/
forester/java/src/org/forester/archaeopteryx/tools/PhylogeneticInferrer.java
+++ b/
forester/java/src/org/forester/archaeopteryx/tools/PhylogeneticInferrer.java
@@
-21,12
+21,11
@@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
//
// Contact: phylosoft @ gmail . com
// 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;
import java.io.BufferedWriter;
package org.forester.archaeopteryx.tools;
import java.io.BufferedWriter;
-import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
@@
-35,7
+34,6
@@
import java.util.regex.Matcher;
import javax.swing.JOptionPane;
import javax.swing.JOptionPane;
-import org.forester.archaeopteryx.AptxUtil;
import org.forester.archaeopteryx.MainFrameApplication;
import org.forester.evoinference.distance.NeighborJoining;
import org.forester.evoinference.distance.PairwiseDistanceCalculator;
import org.forester.archaeopteryx.MainFrameApplication;
import org.forester.evoinference.distance.NeighborJoining;
import org.forester.evoinference.distance.PairwiseDistanceCalculator;
@@
-46,6
+44,7
@@
import org.forester.msa.BasicMsa;
import org.forester.msa.ClustalOmega;
import org.forester.msa.Mafft;
import org.forester.msa.Msa;
import org.forester.msa.ClustalOmega;
import org.forester.msa.Mafft;
import org.forester.msa.Msa;
+import org.forester.msa.Msa.MSA_FORMAT;
import org.forester.msa.MsaInferrer;
import org.forester.msa.MsaMethods;
import org.forester.msa.ResampleableMsa;
import org.forester.msa.MsaInferrer;
import org.forester.msa.MsaMethods;
import org.forester.msa.ResampleableMsa;
@@
-85,7
+84,7
@@
public class PhylogeneticInferrer extends RunnableProcess {
_options = options;
}
_options = options;
}
- private Msa inferMsa() throws IOException, InterruptedException {
+ private Msa inferMsa( final MSA_PRG msa_prg ) throws IOException, InterruptedException {
// final File temp_seqs_file = File.createTempFile( "__msa__temp__", ".fasta" );
// if ( DEBUG ) {
// System.out.println();
// final File temp_seqs_file = File.createTempFile( "__msa__temp__", ".fasta" );
// if ( DEBUG ) {
// System.out.println();
@@
-96,8
+95,14
@@
public class PhylogeneticInferrer extends RunnableProcess {
// final BufferedWriter writer = new BufferedWriter( new FileWriter( temp_seqs_file ) );
// SequenceWriter.writeSeqs( _seqs, writer, SEQ_FORMAT.FASTA, 100 );
// writer.close();
// final BufferedWriter writer = new BufferedWriter( new FileWriter( temp_seqs_file ) );
// SequenceWriter.writeSeqs( _seqs, writer, SEQ_FORMAT.FASTA, 100 );
// writer.close();
- final List<String> opts = processMafftOptions();
- return runMAFFT( _seqs, opts );
+ switch ( msa_prg ) {
+ case MAFFT:
+ return runMAFFT( _seqs, processMafftOptions() );
+ case CLUSTAL_O:
+ return runClustalOmega( _seqs, processMafftOptions() );
+ default:
+ return null;
+ }
}
private List<String> processMafftOptions() {
}
private List<String> processMafftOptions() {
@@
-159,7
+164,7
@@
public class PhylogeneticInferrer extends RunnableProcess {
if ( _msa == null ) {
Msa msa = null;
try {
if ( _msa == null ) {
Msa msa = null;
try {
- msa = inferMsa();
+ msa = inferMsa( MSA_PRG.MAFFT );
}
catch ( final IOException e ) {
end( _mf );
}
catch ( final IOException e ) {
end( _mf );
@@
-201,7
+206,7
@@
public class PhylogeneticInferrer extends RunnableProcess {
}
if ( DEBUG ) {
System.out.println( msa.toString() );
}
if ( DEBUG ) {
System.out.println( msa.toString() );
- System.out.println( MsaMethods.calcBasicGapinessStatistics( msa ).toString() );
+ System.out.println( MsaMethods.calcGapRatio( msa ) );
}
final MsaMethods msa_tools = MsaMethods.createInstance();
if ( _options.isExecuteMsaProcessing() ) {
}
final MsaMethods msa_tools = MsaMethods.createInstance();
if ( _options.isExecuteMsaProcessing() ) {
@@
-222,7
+227,7
@@
public class PhylogeneticInferrer extends RunnableProcess {
if ( DEBUG ) {
System.out.println( msa_tools.getIgnoredSequenceIds() );
System.out.println( msa.toString() );
if ( DEBUG ) {
System.out.println( msa_tools.getIgnoredSequenceIds() );
System.out.println( msa.toString() );
- System.out.println( MsaMethods.calcBasicGapinessStatistics( msa ).toString() );
+ System.out.println( MsaMethods.calcGapRatio( msa ) );
}
_msa = msa;
}
}
_msa = msa;
}
@@
-274,13
+279,13
@@
public class PhylogeneticInferrer extends RunnableProcess {
return msa;
}
return msa;
}
- private Msa runClustalOmega( final File input_seqs, final List<String> opts ) throws IOException,
+ private Msa runClustalOmega( final List<Sequence> seqs, final List<String> opts ) throws IOException,
InterruptedException {
Msa msa = null;
final MsaInferrer clustalo = ClustalOmega.createInstance( _mf.getInferenceManager().getPathToLocalClustalo()
.getCanonicalPath() );
try {
InterruptedException {
Msa msa = null;
final MsaInferrer clustalo = ClustalOmega.createInstance( _mf.getInferenceManager().getPathToLocalClustalo()
.getCanonicalPath() );
try {
- msa = clustalo.infer( input_seqs, opts );
+ msa = clustalo.infer( seqs, opts );
}
catch ( final IOException e ) {
System.out.println( clustalo.getErrorDescription() );
}
catch ( final IOException e ) {
System.out.println( clustalo.getErrorDescription() );
@@
-293,7
+298,7
@@
public class PhylogeneticInferrer extends RunnableProcess {
try {
final BufferedWriter msa_writer = new BufferedWriter( new FileWriter( _options.getIntermediateFilesBase()
+ MSA_FILE_SUFFIX ) );
try {
final BufferedWriter msa_writer = new BufferedWriter( new FileWriter( _options.getIntermediateFilesBase()
+ MSA_FILE_SUFFIX ) );
- _msa.write( msa_writer );
+ _msa.write( msa_writer, MSA_FORMAT.PHYLIP );
msa_writer.close();
final BufferedWriter pwd_writer = new BufferedWriter( new FileWriter( _options.getIntermediateFilesBase()
+ PWD_FILE_SUFFIX ) );
msa_writer.close();
final BufferedWriter pwd_writer = new BufferedWriter( new FileWriter( _options.getIntermediateFilesBase()
+ PWD_FILE_SUFFIX ) );
@@
-322,19
+327,23
@@
public class PhylogeneticInferrer extends RunnableProcess {
final String seq_name = name_m.group( 3 );
final String tax_sn = name_m.group( 4 );
if ( !ForesterUtil.isEmpty( acc_source ) && !ForesterUtil.isEmpty( acc ) ) {
final String seq_name = name_m.group( 3 );
final String tax_sn = name_m.group( 4 );
if ( !ForesterUtil.isEmpty( acc_source ) && !ForesterUtil.isEmpty( acc ) ) {
- AptxUtil.ensurePresenceOfSequence( node );
+ ForesterUtil.ensurePresenceOfSequence( node );
node.getNodeData().getSequence( 0 ).setAccession( new Accession( acc, acc_source ) );
}
if ( !ForesterUtil.isEmpty( seq_name ) ) {
node.getNodeData().getSequence( 0 ).setAccession( new Accession( acc, acc_source ) );
}
if ( !ForesterUtil.isEmpty( seq_name ) ) {
- AptxUtil.ensurePresenceOfSequence( node );
+ ForesterUtil.ensurePresenceOfSequence( node );
node.getNodeData().getSequence( 0 ).setName( seq_name );
}
if ( !ForesterUtil.isEmpty( tax_sn ) ) {
node.getNodeData().getSequence( 0 ).setName( seq_name );
}
if ( !ForesterUtil.isEmpty( tax_sn ) ) {
- AptxUtil.ensurePresenceOfTaxonomy( node );
+ ForesterUtil.ensurePresenceOfTaxonomy( node );
node.getNodeData().getTaxonomy( 0 ).setScientificName( tax_sn );
}
}
}
}
}
node.getNodeData().getTaxonomy( 0 ).setScientificName( tax_sn );
}
}
}
}
}
+
+ public enum MSA_PRG {
+ MAFFT, CLUSTAL_O;
+ }
}
}