3 // FORESTER -- software libraries and applications
4 // for evolutionary biology research and applications.
6 // Copyright (C) 2008-2009 Christian M. Zmasek
7 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 // Contact: phylosoft @ gmail . com
25 // WWW: https://sites.google.com/site/cmzmasek/home/software/forester
27 package org.forester.archaeopteryx.tools;
31 import org.forester.archaeopteryx.Configuration;
32 import org.forester.evoinference.distance.PairwiseDistanceCalculator.PWD_DISTANCE_METHOD;
33 import org.forester.msa.Mafft;
35 public final class PhylogeneticInferenceOptions {
37 private static final int BOOTSTRAP_RESAMPLES_DEFAULT = 100;
38 private static final PWD_DISTANCE_METHOD PWD_DISTANCE_METHOD_DEFAULT = PWD_DISTANCE_METHOD.KIMURA_DISTANCE;
39 public static final long RANDOM_NUMBER_SEED_DEFAULT = 42L;
40 private static final boolean PERFORM_BOOTSTRAP_RESAMPLING_DEFAULT = false;
41 private static final double msa_processing_max_allowed_gap_ratio_default = 0.5;
42 private static final int msa_processing_min_allowed_length_default = 50;
43 private int _bootstrap_samples;
44 private PWD_DISTANCE_METHOD _pwd_distance_method;
45 private long _random_number_generator_seed;
46 private boolean _perform_bootstrap_resampling;
47 private String _intermediate_files_base;
48 private String _msa_prg_parameters;
49 private boolean _execute_msa_processing;
50 private boolean _msa_processing_remove_all_gap_columns;
51 private double _msa_processing_max_allowed_gap_ratio;
52 private int _msa_processing_min_allowed_length;
53 private boolean _save_pwd_file;
54 private boolean _save_processed_msa;
55 private boolean _save_original_msa;
56 private File _pwd_outfile;
57 private File _processed_msa_outfile;
58 private File _original_msa_outfile;
60 public synchronized String getMsaPrgParameters() {
61 return _msa_prg_parameters;
64 public synchronized void setMsaPrgParameters( final String msa_prg_parameters ) {
65 _msa_prg_parameters = new String( msa_prg_parameters );
68 public synchronized String getIntermediateFilesBase() {
69 return _intermediate_files_base;
72 public synchronized String getMsaPrg() {
76 public synchronized void setIntermediateFilesBase( final String intermediate_files_base ) {
77 _intermediate_files_base = new String( intermediate_files_base );
80 public PhylogeneticInferenceOptions() {
85 public synchronized PhylogeneticInferenceOptions copy() {
86 final PhylogeneticInferenceOptions o = new PhylogeneticInferenceOptions();
87 o._bootstrap_samples = _bootstrap_samples;
88 o._pwd_distance_method = _pwd_distance_method;
89 o._random_number_generator_seed = _random_number_generator_seed;
90 o._perform_bootstrap_resampling = _perform_bootstrap_resampling;
91 o._intermediate_files_base = new String( _intermediate_files_base );
92 o._msa_prg_parameters = new String( _msa_prg_parameters );
93 o._msa_processing_max_allowed_gap_ratio = _msa_processing_max_allowed_gap_ratio;
94 o._msa_processing_min_allowed_length = _msa_processing_min_allowed_length;
95 o._execute_msa_processing = _execute_msa_processing;
96 o._msa_processing_remove_all_gap_columns = _msa_processing_remove_all_gap_columns;
97 o._save_pwd_file = _save_pwd_file;
98 o._save_processed_msa = _save_processed_msa;
99 o._save_original_msa = _save_original_msa;
100 if ( _pwd_outfile != null ) {
101 o._pwd_outfile = new File( _pwd_outfile.toString() );
103 if ( _processed_msa_outfile != null ) {
104 o._processed_msa_outfile = new File( _processed_msa_outfile.toString() );
106 if ( _original_msa_outfile != null ) {
107 o._original_msa_outfile = new File( _original_msa_outfile.toString() );
112 private synchronized void init() {
113 _bootstrap_samples = BOOTSTRAP_RESAMPLES_DEFAULT;
114 _pwd_distance_method = PWD_DISTANCE_METHOD_DEFAULT;
115 _random_number_generator_seed = RANDOM_NUMBER_SEED_DEFAULT;
116 _perform_bootstrap_resampling = PERFORM_BOOTSTRAP_RESAMPLING_DEFAULT;
117 _intermediate_files_base = "";
118 _msa_prg_parameters = Mafft.getDefaultParameters();
119 _msa_processing_max_allowed_gap_ratio = msa_processing_max_allowed_gap_ratio_default;
120 _msa_processing_min_allowed_length = msa_processing_min_allowed_length_default;
121 _execute_msa_processing = false;
122 _msa_processing_remove_all_gap_columns = false;
123 _save_pwd_file = false;
124 _save_processed_msa = false;
125 _save_original_msa = false;
127 _processed_msa_outfile = null;
128 _original_msa_outfile = null;
131 public synchronized void setBootstrapSamples( final int bootstrap_samples ) {
132 _bootstrap_samples = bootstrap_samples;
135 public synchronized int getBootstrapSamples() {
136 return _bootstrap_samples;
139 public synchronized void setPwdDistanceMethod( final PWD_DISTANCE_METHOD pwd_distance_method ) {
140 _pwd_distance_method = pwd_distance_method;
143 public synchronized PWD_DISTANCE_METHOD getPwdDistanceMethod() {
144 return _pwd_distance_method;
147 public synchronized void setRandomNumberGeneratorSeed( final long random_number_generator_seed ) {
148 _random_number_generator_seed = random_number_generator_seed;
151 public synchronized long getRandomNumberGeneratorSeed() {
152 return _random_number_generator_seed;
155 public synchronized void setPerformBootstrapResampling( final boolean perform_bootstrap_resampling ) {
156 _perform_bootstrap_resampling = perform_bootstrap_resampling;
159 public synchronized boolean isPerformBootstrapResampling() {
160 return _perform_bootstrap_resampling;
163 public static PhylogeneticInferenceOptions createInstance( final Configuration configuration ) {
164 final PhylogeneticInferenceOptions o = new PhylogeneticInferenceOptions();
165 if ( configuration.getDefaultBootstrapSamples() >= 0 ) {
166 o.setBootstrapSamples( configuration.getDefaultBootstrapSamples() );
171 public File getTempDir() {
173 return new File( "/Users/zma/Desktop/tmp/" );
176 public void setMsaProcessingMaxAllowedGapRatio( final double msa_processing_max_allowed_gap_ratio ) {
177 _msa_processing_max_allowed_gap_ratio = msa_processing_max_allowed_gap_ratio;
180 public double getMsaProcessingMaxAllowedGapRatio() {
181 return _msa_processing_max_allowed_gap_ratio;
184 public void setMsaProcessingMinAllowedLength( final int msa_processing_min_allowed_length ) {
185 _msa_processing_min_allowed_length = msa_processing_min_allowed_length;
188 public int getMsaProcessingMinAllowedLength() {
189 return _msa_processing_min_allowed_length;
192 boolean isExecuteMsaProcessing() {
193 return _execute_msa_processing;
196 void setExecuteMsaProcessing( final boolean execute_msa_processing ) {
197 _execute_msa_processing = execute_msa_processing;
200 boolean isMsaProcessingRemoveAllGapColumns() {
201 return _msa_processing_remove_all_gap_columns;
204 void setMsaProcessingRemoveAllGapColumns( final boolean msa_processing_remove_all_gap_columns ) {
205 _msa_processing_remove_all_gap_columns = msa_processing_remove_all_gap_columns;
208 boolean isSavePwdFile() {
209 return _save_pwd_file;
212 void setSavePwdFile( final boolean save_pwd_file ) {
213 _save_pwd_file = save_pwd_file;
216 boolean isSaveProcessedMsa() {
217 return _save_processed_msa;
220 void setSaveProcessedMsa( final boolean save_processed_msa ) {
221 _save_processed_msa = save_processed_msa;
224 boolean isSaveOriginalMsa() {
225 return _save_original_msa;
228 void setSaveOriginalMsa( final boolean save_original_msa ) {
229 _save_original_msa = save_original_msa;
232 File getPwdOutfile() {
236 void setPwdOutfile( final File pwd_outfile ) {
237 _pwd_outfile = pwd_outfile;
240 File getProcesseMsaOutfile() {
241 return _processed_msa_outfile;
244 void setProcesseMsaOutfile( final File processed_msa_outfile ) {
245 _processed_msa_outfile = processed_msa_outfile;
248 File getOriginalMsaOutfile() {
249 return _original_msa_outfile;
252 void setOriginalMsaOutfile( final File original_msa_outfile ) {
253 _original_msa_outfile = original_msa_outfile;