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: www.phylosoft.org/forester
27 package org.forester.archaeopteryx;
31 import org.forester.evoinference.distance.PairwiseDistanceCalculator.PWD_DISTANCE_METHOD;
32 import org.forester.msa.Mafft;
34 public final class PhylogeneticInferenceOptions {
36 private static final int BOOTSTRAP_RESAMPLES_DEFAULT = 100;
37 private static final PWD_DISTANCE_METHOD PWD_DISTANCE_METHOD_DEFAULT = PWD_DISTANCE_METHOD.KIMURA_DISTANCE;
38 public static final long RANDOM_NUMBER_SEED_DEFAULT = 42L;
39 private static final boolean PERFORM_BOOTSTRAP_RESAMPLING_DEFAULT = false;
40 private static final double msa_processing_max_allowed_gap_ratio_default = 0.5;
41 private static final int msa_processing_min_allowed_length_default = 50;
42 private int _bootstrap_samples;
43 private PWD_DISTANCE_METHOD _pwd_distance_method;
44 private long _random_number_generator_seed;
45 private boolean _perform_bootstrap_resampling;
46 private String _intermediate_files_base;
47 private String _msa_prg_parameters;
48 private boolean _execute_msa_processing;
49 private boolean _msa_processing_remove_all_gap_columns;
50 private double _msa_processing_max_allowed_gap_ratio;
51 private int _msa_processing_min_allowed_length;
52 private boolean _save_pwd_file;
53 private boolean _save_processed_msa;
54 private boolean _save_original_msa;
55 private File _pwd_outfile;
56 private File _processed_msa_outfile;
57 private File _original_msa_outfile;
59 public synchronized String getMsaPrgParameters() {
60 return _msa_prg_parameters;
63 public synchronized void setMsaPrgParameters( final String msa_prg_parameters ) {
64 _msa_prg_parameters = new String( msa_prg_parameters );
67 public synchronized String getIntermediateFilesBase() {
68 return _intermediate_files_base;
71 public synchronized String getMsaPrg() {
75 public synchronized void setIntermediateFilesBase( final String intermediate_files_base ) {
76 _intermediate_files_base = new String( intermediate_files_base );
79 public PhylogeneticInferenceOptions() {
84 public synchronized PhylogeneticInferenceOptions copy() {
85 final PhylogeneticInferenceOptions o = new PhylogeneticInferenceOptions();
86 o._bootstrap_samples = _bootstrap_samples;
87 o._pwd_distance_method = _pwd_distance_method;
88 o._random_number_generator_seed = _random_number_generator_seed;
89 o._perform_bootstrap_resampling = _perform_bootstrap_resampling;
90 o._intermediate_files_base = new String( _intermediate_files_base );
91 o._msa_prg_parameters = new String( _msa_prg_parameters );
92 o._msa_processing_max_allowed_gap_ratio = _msa_processing_max_allowed_gap_ratio;
93 o._msa_processing_min_allowed_length = _msa_processing_min_allowed_length;
94 o._execute_msa_processing = _execute_msa_processing;
95 o._msa_processing_remove_all_gap_columns = _msa_processing_remove_all_gap_columns;
96 o._save_pwd_file = _save_pwd_file;
97 o._save_processed_msa = _save_processed_msa;
98 o._save_original_msa = _save_original_msa;
99 if ( _pwd_outfile != null ) {
100 o._pwd_outfile = new File( _pwd_outfile.toString() );
102 if ( _processed_msa_outfile != null ) {
103 o._processed_msa_outfile = new File( _processed_msa_outfile.toString() );
105 if ( _original_msa_outfile != null ) {
106 o._original_msa_outfile = new File( _original_msa_outfile.toString() );
111 private synchronized void init() {
112 _bootstrap_samples = BOOTSTRAP_RESAMPLES_DEFAULT;
113 _pwd_distance_method = PWD_DISTANCE_METHOD_DEFAULT;
114 _random_number_generator_seed = RANDOM_NUMBER_SEED_DEFAULT;
115 _perform_bootstrap_resampling = PERFORM_BOOTSTRAP_RESAMPLING_DEFAULT;
116 _intermediate_files_base = "";
117 _msa_prg_parameters = Mafft.getDefaultParameters();
118 _msa_processing_max_allowed_gap_ratio = msa_processing_max_allowed_gap_ratio_default;
119 _msa_processing_min_allowed_length = msa_processing_min_allowed_length_default;
120 _execute_msa_processing = false;
121 _msa_processing_remove_all_gap_columns = false;
122 _save_pwd_file = false;
123 _save_processed_msa = false;
124 _save_original_msa = false;
126 _processed_msa_outfile = null;
127 _original_msa_outfile = null;
130 public synchronized void setBootstrapSamples( final int bootstrap_samples ) {
131 _bootstrap_samples = bootstrap_samples;
134 public synchronized int getBootstrapSamples() {
135 return _bootstrap_samples;
138 public synchronized void setPwdDistanceMethod( final PWD_DISTANCE_METHOD pwd_distance_method ) {
139 _pwd_distance_method = pwd_distance_method;
142 public synchronized PWD_DISTANCE_METHOD getPwdDistanceMethod() {
143 return _pwd_distance_method;
146 public synchronized void setRandomNumberGeneratorSeed( final long random_number_generator_seed ) {
147 _random_number_generator_seed = random_number_generator_seed;
150 public synchronized long getRandomNumberGeneratorSeed() {
151 return _random_number_generator_seed;
154 public synchronized void setPerformBootstrapResampling( final boolean perform_bootstrap_resampling ) {
155 _perform_bootstrap_resampling = perform_bootstrap_resampling;
158 public synchronized boolean isPerformBootstrapResampling() {
159 return _perform_bootstrap_resampling;
162 public static PhylogeneticInferenceOptions createInstance( final Configuration configuration ) {
163 final PhylogeneticInferenceOptions o = new PhylogeneticInferenceOptions();
164 if ( configuration.getDefaultBootstrapSamples() >= 0 ) {
165 o.setBootstrapSamples( configuration.getDefaultBootstrapSamples() );
170 public File getTempDir() {
172 return new File( "/Users/zma/Desktop/tmp/" );
175 public void setMsaProcessingMaxAllowedGapRatio( final double msa_processing_max_allowed_gap_ratio ) {
176 _msa_processing_max_allowed_gap_ratio = msa_processing_max_allowed_gap_ratio;
179 public double getMsaProcessingMaxAllowedGapRatio() {
180 return _msa_processing_max_allowed_gap_ratio;
183 public void setMsaProcessingMinAllowedLength( final int msa_processing_min_allowed_length ) {
184 _msa_processing_min_allowed_length = msa_processing_min_allowed_length;
187 public int getMsaProcessingMinAllowedLength() {
188 return _msa_processing_min_allowed_length;
191 boolean isExecuteMsaProcessing() {
192 return _execute_msa_processing;
195 void setExecuteMsaProcessing( final boolean execute_msa_processing ) {
196 _execute_msa_processing = execute_msa_processing;
199 boolean isMsaProcessingRemoveAllGapColumns() {
200 return _msa_processing_remove_all_gap_columns;
203 void setMsaProcessingRemoveAllGapColumns( final boolean msa_processing_remove_all_gap_columns ) {
204 _msa_processing_remove_all_gap_columns = msa_processing_remove_all_gap_columns;
207 boolean isSavePwdFile() {
208 return _save_pwd_file;
211 void setSavePwdFile( final boolean save_pwd_file ) {
212 _save_pwd_file = save_pwd_file;
215 boolean isSaveProcessedMsa() {
216 return _save_processed_msa;
219 void setSaveProcessedMsa( final boolean save_processed_msa ) {
220 _save_processed_msa = save_processed_msa;
223 boolean isSaveOriginalMsa() {
224 return _save_original_msa;
227 void setSaveOriginalMsa( final boolean save_original_msa ) {
228 _save_original_msa = save_original_msa;
231 File getPwdOutfile() {
235 void setPwdOutfile( final File pwd_outfile ) {
236 _pwd_outfile = pwd_outfile;
239 File getProcesseMsaOutfile() {
240 return _processed_msa_outfile;
243 void setProcesseMsaOutfile( final File processed_msa_outfile ) {
244 _processed_msa_outfile = processed_msa_outfile;
247 File getOriginalMsaOutfile() {
248 return _original_msa_outfile;
251 void setOriginalMsaOutfile( final File original_msa_outfile ) {
252 _original_msa_outfile = original_msa_outfile;