private boolean _taxonomy_colorize_node_shapes = false;
private int _default_bootstrap_samples = -1;
private File _path_to_local_mafft = null;
- private File _path_to_local_kalign = null;
private File _path_to_local_fastme = null;
private File _path_to_local_raxml = null;
private File _path_to_local_clustalo = null;
return _path_to_local_mafft;
}
- public File getPathToLocalKalign() {
- return _path_to_local_kalign;
- }
+
public File getPathToLocalFastme() {
return _path_to_local_fastme;
_path_to_local_mafft = path_to_local_mafft;
}
- private void setPathToLocalKalign( final File path_to_local_kalign ) {
- _path_to_local_kalign = path_to_local_kalign;
- }
+
private void setPathToLocalFastme( final File path_to_local_fastme ) {
_path_to_local_fastme = path_to_local_fastme;
setPathToLocalMafft( new File( str ) );
}
}
- else if ( key.equals( "kalign_local" ) ) {
- final String str = ( ( String ) st.nextElement() ).trim();
- if ( !ForesterUtil.isEmpty( str ) ) {
- setPathToLocalKalign( new File( str ) );
- }
- }
+
else if ( key.equals( "fastme_local" ) ) {
final String str = ( ( String ) st.nextElement() ).trim();
if ( !ForesterUtil.isEmpty( str ) ) {
private final static String DEFAULT_PATHS[] = { "C:\\Program Files\\", "C:\\Program Files (x86)\\", "/bin/",
"/usr/local/bin/", "/usr/bin/" };
private final File _path_to_local_mafft;
- private final File _path_to_local_kalign;
private final File _path_to_local_fastme;
private final File _path_to_local_raxml;
private final File _path_to_local_clustalo;
public static InferenceManager createInstance( final Configuration c ) {
return new InferenceManager( c.getpathToLocalMafft(),
- c.getPathToLocalKalign(),
c.getPathToLocalFastme(),
c.getPathToLocalRaxml(),
c.getPathToLocalClustalOmega() );
}
public boolean canDoMsa() {
- return ( getPathToLocalMafft() != null ) || ( getPathToLocalKalign() != null )
+ return ( getPathToLocalMafft() != null )
|| ( getPathToLocalClustalo() != null );
}
return _path_to_local_mafft;
}
- public File getPathToLocalKalign() {
- return _path_to_local_kalign;
- }
+
public File getPathToLocalFastme() {
return _path_to_local_fastme;
}
private InferenceManager( final File path_to_local_mafft,
- final File path_to_local_kalign,
final File path_to_local_fastme,
final File path_to_local_raxml,
final File path_to_local_clustalo ) {
_path_to_local_mafft = createLocalPath( path_to_local_mafft, "mafft" );
- _path_to_local_kalign = createLocalPath( path_to_local_kalign, "kalign" );
+
_path_to_local_fastme = createLocalPath( path_to_local_fastme, "fastme" );
_path_to_local_raxml = createLocalPath( path_to_local_raxml, "raxml" );
_path_to_local_clustalo = createLocalPath( path_to_local_clustalo, "clustalo" );
private JTextField _input_seqs_min_length_tf;
private JTextField _input_seqs_max_length_tf;
private JTextField _input_seqs_type_tf;
- private JTextField _input_seqs_msa_program_name_tf;
- private JTextField _input_seqs_msa_paramenters_tf;
+
+ private JTextField _mafft_paramenters_tf;
+ private JTextField _clustalo_paramenters_tf;
private JTextField _msa_processing_max_allowed_gap_ratio_tf;
private JTextField _msa_processing_min_allowed_length_tf;
private JTextField _random_seed_tf;
private JCheckBox _execute_msa_processing_cb;
private JCheckBox _msa_processing_remove_all_gap_columns_cb;
+ private JCheckBox _mafft_cb;
+ private JCheckBox _clustalo_cb;
private JCheckBox _save_pwd_file_cb;
private JCheckBox _save_processed_msa_cb;
private JCheckBox _save_original_msa_cb;
final JPanel inputfile_pnl_1 = new JPanel();
final JPanel inputfile_pnl_2 = new JPanel();
final JPanel inputfile_pnl_3 = new JPanel();
+ final JPanel inputfile_pnl_4 = new JPanel();
inputfile_pnl_1.setLayout( new FlowLayout() );
inputfile_pnl_2.setLayout( new FlowLayout() );
inputfile_pnl_3.setLayout( new FlowLayout() );
+ inputfile_pnl_4.setLayout( new FlowLayout() );
inputfile_pnl_1.add( new JLabel( "Input Sequence File:" ) );
inputfile_pnl_1.add( _input_seqs_tf = new JTextField() );
inputfile_pnl_1.add( _select_input_seqs_btn = new JButton( "Select Input File" ) );
inputfile_pnl_2.add( _input_seqs_max_length_tf = new JTextField() );
inputfile_pnl_2.add( new JLabel( "Type:" ) );
inputfile_pnl_2.add( _input_seqs_type_tf = new JTextField() );
- inputfile_pnl_3.add( new JLabel( "Mutiple Sequence Alignment: " ) );
- inputfile_pnl_3.add( new JLabel( "Program: " ) );
- inputfile_pnl_3.add( _input_seqs_msa_program_name_tf = new JTextField() );
+
+
+ inputfile_pnl_3.add( _mafft_cb = new JCheckBox( "MAFFT") );
inputfile_pnl_3.add( new JLabel( "Parameters: " ) );
- inputfile_pnl_3.add( _input_seqs_msa_paramenters_tf = new JTextField() );
+ inputfile_pnl_3.add( _mafft_paramenters_tf = new JTextField() );
+
+ inputfile_pnl_4.add( _clustalo_cb = new JCheckBox( "ClustalO") );
+ inputfile_pnl_4.add( new JLabel( "Parameters: " ) );
+ inputfile_pnl_4.add( _clustalo_paramenters_tf = new JTextField() );
_input_seqs_median_length_tf.setColumns( 4 );
_input_seqs_min_length_tf.setColumns( 4 );
_input_seqs_max_length_tf.setColumns( 4 );
_input_seqs_max_length_tf.setEditable( false );
_input_seqs_number_tf.setEditable( false );
_input_seqs_type_tf.setEditable( false );
- _input_seqs_msa_program_name_tf.setEditable( false );
- _input_seqs_msa_paramenters_tf.setColumns( 26 );
+
+ _mafft_paramenters_tf.setColumns( 26 );
+ _mafft_paramenters_tf.setText( "--maxiterate 1000 --localpair" );
+ _clustalo_paramenters_tf.setColumns( 26 );
+ _clustalo_paramenters_tf.setText( "clustalo options" );
_select_input_seqs_btn.addActionListener( this );
_pnl.add( inputfile_pnl_1 );
_pnl.add( inputfile_pnl_2 );
_pnl.add( inputfile_pnl_3 );
+ _pnl.add( inputfile_pnl_4 );
}
else {
setTitle( "Phylogenetic Inference (from already aligned sequences) " );
_value = JOptionPane.CANCEL_OPTION;
if ( from_unaligned_seqs ) {
updateSeqsItems();
- _input_seqs_msa_program_name_tf.setText( getPhylogeneticInferenceOptions().getMsaPrg() );
- _input_seqs_msa_paramenters_tf.setText( getPhylogeneticInferenceOptions().getMsaPrgParameters() );
- }
+ }
else {
updateMsaItems();
}
}
private void processMsaPrgParameters() {
- if ( _input_seqs_msa_paramenters_tf != null ) {
- getPhylogeneticInferenceOptions().setMsaPrgParameters( _input_seqs_msa_paramenters_tf.getText() );
+ if ( _mafft_paramenters_tf != null ) {
+ getPhylogeneticInferenceOptions().setMsaPrgParameters( _mafft_paramenters_tf.getText() );
}
}
_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 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() {
if ( _msa == null ) {
Msa msa = null;
try {
- msa = inferMsa();
+ msa = inferMsa( MSA_PRG.MAFFT );
}
catch ( final IOException e ) {
end( _mf );
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 {
- msa = clustalo.infer( input_seqs, opts );
+ msa = clustalo.infer( seqs, opts );
}
catch ( final IOException e ) {
System.out.println( clustalo.getErrorDescription() );
}
}
}
+
+ public enum MSA_PRG {
+ MAFFT, CLUSTAL_O;
+ }
}
package org.forester.msa;
+import java.io.BufferedWriter;
import java.io.File;
+import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.forester.io.parsers.FastaParser;
+import org.forester.io.writers.SequenceWriter;
+import org.forester.io.writers.SequenceWriter.SEQ_FORMAT;
import org.forester.sequence.Sequence;
import org.forester.util.SystemCommandExecutor;
return _exit_code;
}
+
+ public Msa infer( final List<Sequence> seqs, final List<String> opts ) throws IOException, InterruptedException {
+ final File file = File.createTempFile( "__clustalo_input_", ".fasta" );
+ file.deleteOnExit();
+ final BufferedWriter writer = new BufferedWriter( new FileWriter( file ) );
+ SequenceWriter.writeSeqs( seqs, writer, SEQ_FORMAT.FASTA, 100 );
+ writer.close();
+ final Msa msa = infer( file, opts );
+ file.delete();
+ return msa;
+ }
+
+
@Override
public Msa infer( final File path_to_input_seqs, final List<String> opts ) throws IOException, InterruptedException {
init();
_exit_code = -100;
}
- @Override
- public Msa infer( final List<Sequence> seqs, final List<String> opts ) throws IOException, InterruptedException {
- // TODO Auto-generated method stub
- return null;
- }
+
}