#!/usr/bin/python # Copyright (c) 2005 by Mark T. Holder, Florida State University. (see end of file) from PIPRes.util.ui_xml import * from PIPRes.util.io import cipresGetLogger from cStringIO import StringIO import unittest _LOG = cipresGetLogger('pipres.util.test_ui_xml') class CipresUI_XML_Test(unittest.TestCase): def testRoundtrip(self): a = StringIO(ridcm3XML) readUICmdParamGroupFromXMLObj(a) ridcm3XML = """ Excl false Specifies which method to use for limiting recursion none No taxa-based recursion limit MaxTaxaSubsetSize Taxa Subset Size MaxTaxaSubsetPercent Percent Taxa Subset Size $LimitRecursionBy Integer false 20 Specifies the maximum size of taxa subsets for small tree inference. The algorithm will decompose taxa subsets until either Max Taxa Subset Size or Max Recursion Levels are acheived. SetMaxTaxaSubsetSize=$MaxTaxaSubsetSize; $MaxTaxaSubsetSize greater_than 3 $LimitRecursionBy equals MaxTaxaSubsetSize unnamed-0 the "Max Taxa Subset Size" setting must be greater than 3 unnamed-1 the "Limit Recursion by" setting must equal MaxTaxaSubsetSize Float false 75 Specifies the maximum size of taxa subsets for small tree inference as a percentage of the total number of characters. The algorithm will decompose taxa into subsets until the subset is no bigger than 'Max Taxa Percent' or Max Recursion Levels are acheived. SetMaxTaxaSubsetPercent=$MaxTaxaSubsetPercent; $MaxTaxaSubsetPercent greater_than 0 $MaxTaxaSubsetPercent less_or_equal 100 $LimitRecursionBy equals MaxTaxaSubsetPercent (unnamed-2 and unnamed-3) 'Max Taxa Percent' must be a decimal number greater than 0 (e.g. 25.5 means 25.5 %) unnamed-4 the "Limit Recursion by" setting must equal MaxTaxaSubsetPercent Integer false Specifies the recursion levels for decomposing taxa subsets prior to small tree inference. The algorithm will decompose taxa subsets until either Max Taxa Subset Size or Max Recursion Levels are acheived SetMaxRecursionLevels=$MaxRecursionLevels; $MaxRecursionLevels greater_or_equal 0 unnamed-5 the "Max Recursion Levels" setting must be greater than or equal to 0 Integer false 2 Specifies the maximum number of iterations. The algorithm will continue until either the Max # Iterations or Max Analysis Time is acheived SetMaxIterations=$MaxIterations; $MaxIterations greater_than 0 unnamed-6 the "Max # Iterations" setting must be greater than 0 Integer false 1000000 Specifies the maximum analysis time. The algorithm will continue until either the Max # Iterations or Max Analysis Time is acheived SetMaxAnalysisTime=$MaxAnalysisTime; $MaxAnalysisTime greater_than 0 unnamed-7 the "Max Analysis Time (hr)" setting must be greater than 0 Excl IDL:CipresIDL_api1/TreeDecompose:1.0 true Specifies the module to employ for Tree Decomposition SetTreeDecompModule=$TreeDecompModule Excl IDL:CipresIDL_api1/TreeImprove:1.0 true Specifies the module to employ for large (full) tree inference none No large tree inference SetLargeTreeInferenceModule=$LargeTreeInferenceModule Excl IDL:CipresIDL_api1/TreeImprove:1.0 true Specifies the module to employ for tree inference for subsets of the taxa SetSmallTreeInferenceModule=$SmallTreeInferenceModule Excl IDL:CipresIDL_api1/TreeMerge:1.0 true Specifies the module to employ for tree merger (the supertree step) SetTreeMergeModule=$TreeMergeModule Excl IDL:CipresIDL_api1/TreeRefine:1.0 true Specifies the module to employ for tree refining (merged trees often have polytomies) SetTreeRefineModule=$TreeRefineModule """ if __name__ == '__main__': import os if 'CIPRES_TEST_UI' in os.environ: unittest.main() # This file is part of the PIPRes library # The PIPRes library is free software; you can redistribute it # and/or modify it under the terms of the GNU Lesser General # Public License as published by the Free Software Foundation; # either version 2.1 of the License, or (at your option) any later # version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # MA 02111-1307, USA