#! /usr/bin/env python from PIPRes.util.ui_tools import * group = UI_Group("RID3") formatter = UI_StringTemplate.nameValueTemplate('Set%s=%s;') serviceFormatter = UI_StringTemplate.nameValueTemplate('Set%s=%s') LimitRecursionBy = UI_List("Limit Recursion by", [ UI_Choice("none", "No taxa-based recursion limit"), UI_Choice("MaxTaxaSubsetSize", "Taxa Subset Size"), UI_Choice("MaxTaxaSubsetPercent", "Percent Taxa Subset Size"), ]) LimitRecursionBy.help = "Specifies which method to use for limiting recursion" LimitRecursionBy.default = 1 LimitRecursionBy.formatter = UI_StringTemplate.VALUE group.LimitRecursionBy = LimitRecursionBy MaxTaxaSubsetSize = UI_Int("Max Taxa Subset Size") MaxTaxaSubsetSize.name = 'MaxTaxaSubsetSize' MaxTaxaSubsetSize.default = 20 MaxTaxaSubsetSize.help = "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." MaxTaxaSubsetSize.availablity = LimitRecursionBy == 'MaxTaxaSubsetSize' MaxTaxaSubsetSize.constraint = MaxTaxaSubsetSize > 3 MaxTaxaSubsetSize.formatter = formatter LimitRecursionBy.addSubParam(MaxTaxaSubsetSize) MaxTaxaSubsetPercent = UI_Float("Percent Taxa Subset Size", formatter=formatter) MaxTaxaSubsetPercent.name = 'MaxTaxaSubsetPercent' MaxTaxaSubsetPercent.default = 75 MaxTaxaSubsetPercent.help = "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." MaxTaxaSubsetPercent.availablity = LimitRecursionBy == 'MaxTaxaSubsetPercent' t = (MaxTaxaSubsetPercent > 0) & (MaxTaxaSubsetPercent <= 100) t.message = "'Max Taxa Percent' must be a decimal number greater than 0 (e.g. 25.5 means 25.5 %)" MaxTaxaSubsetPercent.constraint = t LimitRecursionBy.addSubParam(MaxTaxaSubsetPercent) MaxRecursionLevels = UI_Int("Max Recursion Levels", formatter=formatter) MaxRecursionLevels.help = "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" MaxRecursionLevels.constraint = MaxRecursionLevels >= 0 group.MaxRecursionLevels = MaxRecursionLevels MaxIterations = UI_Int("Max # Iterations", formatter=formatter) MaxIterations.default = 2 MaxIterations.help = "Specifies the maximum number of iterations. The algorithm will continue until either the Max # Iterations or Max Analysis Time is acheived" MaxIterations.constraint = MaxIterations > 0 group.MaxIterations = MaxIterations MaxAnalysisTime = UI_Int("Max Analysis Time (hr)", formatter=formatter) MaxAnalysisTime.default = 1000000 MaxAnalysisTime.help = "Specifies the maximum analysis time. The algorithm will continue until either the Max # Iterations or Max Analysis Time is acheived" MaxAnalysisTime.constraint = MaxAnalysisTime > 0 group.MaxAnalysisTime = MaxAnalysisTime TreeDecompModule = UI_Service("Tree Decomposer Module", "IDL:CipresIDL_api1/TreeDecompose:1.0", formatter=serviceFormatter) TreeDecompModule.help = "Specifies the module to employ for Tree Decomposition" TreeDecompModule.demand = UI_Param.IS_VALID group.TreeDecompModule = TreeDecompModule LargeTreeInferenceModule = UI_Service("Large Tree Inference Module", "IDL:CipresIDL_api1/TreeImprove:1.0", formatter=serviceFormatter) LargeTreeInferenceModule.help = "Specifies the module to employ for large (full) tree inference" LargeTreeInferenceModule.demand = UI_Param.IS_VALID LargeTreeInferenceModule.choices = [UI_Choice("none", "No large tree inference")] group.LargeTreeInferenceModule = LargeTreeInferenceModule SmallTreeInferenceModule = UI_Service("Small Tree Inference Module", "IDL:CipresIDL_api1/TreeImprove:1.0", formatter=serviceFormatter) SmallTreeInferenceModule.help = "Specifies the module to employ for tree inference for subsets of the taxa" SmallTreeInferenceModule.demand = UI_Param.IS_VALID group.SmallTreeInferenceModule = SmallTreeInferenceModule TreeMergeModule = UI_Service("Tree Merge Module", "IDL:CipresIDL_api1/TreeMerge:1.0", formatter=serviceFormatter) TreeMergeModule.help = "Specifies the module to employ for tree merger (the supertree step)" TreeMergeModule.demand = UI_Param.IS_VALID group.TreeMergeModule = TreeMergeModule TreeRefineModule = UI_Service("Tree Refine Module", "IDL:CipresIDL_api1/TreeRefine:1.0", formatter=serviceFormatter) TreeRefineModule.help = "Specifies the module to employ for tree refining (merged trees often have polytomies)" TreeRefineModule.demand = UI_Param.IS_VALID group.TreeRefineModule = TreeRefineModule print toUI_XML(group)