/** Pebble Release vCebl stuff. @author Matthew Goode */ UNITS_EXPECTED_SUBSTITUTIONS := 0; UNITS_GENERATIONS := 1; UNITS_DAYS := 2; UNITS_YEARS := 3; TSTV_PENALTY := 2; LC_FACTORY := GeneralLCFactory(); FX_DIGITS := 4; X_DIGITS := 4; ALIGNMENT_TREE_INCOMPATIBLE_MESSAGE := "

Incompatible Alignment and Tree

The taxa of the input tree and the sequences of the alignment do not match. Please choose a tree and alignment with matching taxa names.
"; ALIGNMENT_HAS_STOP_CODONS_MESSAGE := "

Alignment has stop codons

The given alignment has sites with stop codons. Such sites cannot be used for analysis.
Click Next to continue with offending sites removed.
"; SAMPLE_INFORMATION_INCOMPATIBLE_WITH_ALIGNMENT_TREE_MESSAGE := "

Incompatible Sample Information

The sample information provided does not give time information for the given alignment and tree. Please choose a sample information object that reflects the given tree and alignment.
"; SAMPLE_INFORMATION_INCOMPATIBLE_WITH_ALIGNMENT_MESSAGE := "

Incompatible Sample Information

The sample information provided does not give time information for the given alignment. Please choose sample information compatible with the given alignment.
"; SAMPLE_INFORMATION_INCOMPATIBLE_WITH_DISTANCE_MATRIX_MESSAGE := "

Incompatible Sample Information

The sample information provided does not give time information for the given distance matrix. Please choose sample information compatible with the given distance matrix.
"; ROOTED_TREE_WARNING := "

Tree appears unrooted

Warning: The input tree appears unrooted (a trification at the base).

Analysis can continue though.
"; STRIPPED_ALL_SITES_MESSAGE := "

No sites left!

Gap-balancing stripped all sites. You will need to reconsider your alignment.
Click \"Cancel\"
"; QueryDataType := [ type = SimpleOptionReader("What is the data type?",{"Nucleotide", "Amino Acid", "Codon"},0,"data_type"); result = if(type==0) { IUPACNucleotides(); } else if(type ==1 ) { AminoAcids(); } else { Codons(); }; ]result; //===== General CheckAlignment := [ alignment = Alignment(?); model = ?; modelDT = GetDataType(model); if(IsNeedingConverting(alignment, modelDT)) { HTMLLabel("

Converting alignment datatype ("+GetDataType(alignment)+") to match model data type ("+modelDT+")


Click \"Next\" to accept.",true,true); }; ]ConvertAlignment(alignment, modelDT); UnitsReader { UnitsReader := SimpleOptionReader("Units", {"Expected Substitutions", "Generations", "Days", "Years"}, ?, "units"); } // ============ IO Stuff ==================== FastaSequenceReader { displayName = "Fasta Sequences"; description= "Opens sequences stored in Fasta format"; FastaSequenceReader := FastaAlignmentReader(?, QueryDataType()); } PhylipClustalSequenceReader { displayName = "Phylip/Clustal Alignment"; description= "Opens sequences stored in Phylip/Clustal format"; PhylipClustalSequenceReader := PhylipClustalAlignmentReader(?, QueryDataType()); } NewickTreeReader { displayName = "Newick Tree"; description = "Opens Newick Tree format files"; icon = "./images/TreeReaderNewick.gif"; NewickTreeReader := ReadTree(?); } CirclePSWriter { displayName = "Postscript Format (circular)"; discription = "Output a tree (in circular form) as a postscript file"; CirclePSWriter := TreePSWriter(?,?,1); } RectangularPSWriter { displayName = "Postscript Format (Rectangular)"; discription = "Output a tree (in rectangular form) as a postscript file"; RectangularPSWriter := TreePSWriter(?,?,0); } NexusExporterGUI { displayName = "Nexus Format"; discription = "Export a tree as a nexus file"; NexusExporterGUI := NexusTreeExporter( ?,?,true, BooleanReader( "Include Branch Lengths?",true, "Including branch lengths", "If this option is selected the branch lenghts of the tree (meaningless or not) will be attached to the output, otherwise, just the topology is exported.", "include_branch_lengths")); } //===== Alignment XGapBalanceAlignment { displayName = "Gap Balance Alignment"; description = "A tool for gap balancing coding alignments."; textButton = true; XGapBalanceAlignment := (name = "Alignment Gap Balancer", brief = "Gap Balance", verbose = "A tool for stripping sites that do not align with regard to codon number.")[ src = ?(name = "Source Alignment", brief = "The alignment on which to base gap balanced alignment", verbose = "The alignment on which to base gap balanced alignment. To adjust the frame use the alignment editor first." ); balanced = Alignment(GapBalanceAlignment(src,0)); balancedSites = GetNumberOfSites(balanced); if(balancedSites==0) { HTMLLabel(STRIPPED_ALL_SITES_MESSAGE,true,false); } else { HTMLLabel("Stripped "+(GetNumberOfSites(src)-balancedSites)+" sites.
Click \"Next\" to finish
",true,true); }; //Print("Balanced:"+balanced); ]Alignment(balanced); } //====== Tree Util XRootTree { displayName = "Root Tree"; description = "Root a tree by an outgroup"; icon = "./images/RootTree.gif"; XRootTree := ( name = "Root Tree", brief = "Root Tree", verbose ="A simple tool for rooting a tree via an outgroup clade" )[ tree = ?(name = "Unrooted Tree", verbose = "The tree to be rooted. The user will be informed if the tree is already rooted."); tree <- if(IsRooted(tree)) { [HTMLLabel("

Warning: The input tree is already rooted.

Will unroot
Click \"Next\" to continue
",true,true);] UnrootedTree(tree) } else { tree; }; ] RootTree(tree,StringSetReader("Please identify outgroup members?","Sequence IDs", "Outgroup IDs",GetTreeNodeNames(tree),true)); } XRestrictTree { displayName = "Restrict Tree"; description = "Remove leaves from a tree"; XRestrictTree := ( name = "Restrict Tree", brief = "Restrict Tree", verbose ="A simple tool for removing parts of a tree while preserving the remaining structure" )[ tree = ?(name = "Base Tree", verbose = "The base tree to be restricted."); ] RestrictTree(tree,StringSetReader("Please identify members to remove?","To Keep", "To Remove",GetTreeNodeNames(tree),true), false); XRestrictTree := ( name = "Restrict Tree Via External", brief = "Restrict Tree Via External", verbose ="Restirct the taxa in a tree based on the members of another object such as an alignment, or another tree." )[ tree = ?(name = "Base Tree", verbose = "The base tree to be restricted."); ids = ?(name = "Restriction Base", verbose = "An object with identifiers on which to base the restriction on. Includes Sample Information, Trees, Distance Matrices, and Alignments."); ] RestrictTree(tree,GetIDNames(ids), true); } XUnrootTree { displayName = "Unroot Tree"; XUnrootTree := ( name = "Unroot Tree", brief = "Unroot Tree", verbose ="Unroots a tree by creating a trification at a bificating base." )[ tree = ?(name = "Rooted Tree", verbose = "The tree to be unrooted. The user will be informed if the tree is already unrooted."); // if(!IsRooted(tree)) { // HTMLLabel("

The input tree is already unrooted!

",true,false); // }; ]UnrootedTree(tree); } XGetMidPointRooted { displayName = "Mid Point Root Tree"; XGetMidPointRooted := ( name = "Mid Point Root Tree", brief = "Mid Point Root Tree", verbose ="Roots a tree at the mid point between the two most distance taxa." ) [ tree = ?(name = "Base Tree", verbose = "The tree to be rooted via the Mid-point rooting method. If the tree is already rooted, it will be unrooted first."); ]GetMidPointRooted(tree); } XExtractAlternativeTree { displayName = "Extract Alternative Tree"; XExtractAlternativeTree := (name = "Extract Alternative Tree", verbose = "Extracts an alternative representation from a tree if it is supported. This function is mainly used for extracting time based trees from Expected Substitution based trees, for the purposes of exporting from Pebble." )[ t = ?(name = "Source Tree", verbose = "The tree from which to extract an alternative representation. This will typically be a representation using time based units (such as months, years, or generations), as opposed to Expected Substitution." ); if(!HasAlternativeTree(t)) { HTMLLabel("

The input tree has not alternative version to extract

",true,false); }; ]ExtractAlternativeTree(t); } MyNewickTreeWriter { displayName = "Newick Format"; description = "Outputs a tree in Newick Format"; MyNewickTreeWriter := StringWriter(?, NewickFormat(?, includeLengths = BooleanReader("Include Lengths?",true,"include_lengths"), includeLengths)); } MyObjectReader { displayName = "Object Reader"; description = "Open files saved using Java Serialization"; icon = "./images/objectreader.gif"; MyObjectReader := ObjectReader(?); } //Mep Util //============================================================================= // ============ Distance Based Stuff ========== //============================================================================= XMultipleAlignment { displayName = "Progressive Multiple Alignment"; description = "A simple multiple alignment algorithm"; XMultipleAlignment := ( name = "Progressive Multiple Alignment", brief = "Progressive Multiple Alignment", verbose = "Performs a simple form of Multiple Alignment on a given alignment or set of seuqences. Uses previously prepared cost function." )[ alignment = CombineAlignmentSequences(?(name = "Sequences", verbose = "The sequences on which to perform alignment. Any form of alignment or sequence group is acceptable (any previous gap information is ignored), and more than one source can be selected.")); cost = ?(name = "Cost Function", verbose = "A cost function as derived from the NewCostFunction ceblet."); alignment <- CheckAlignment(alignment, CostFunction(cost)); localAlignment = BooleanReader("Local Alignment?",false,"local"); HTMLLabel("

Calculating Multiple Alignment

Please be patient ...
",false,true); ]MultipleAlignmentImpl(alignment,cost,localAlignment); XMultipleAlignment := ( name = "Progressive Multiple Alignment", brief = "Progressive Multiple Alignment", verbose = "Performs a simple form of Multiple Alignment on a given alignment or set of sequences. Prompts user for cost function." )[ alignment = CombineAlignmentSequences(?(name = "Sequences", verbose = "The sequences on which to perform alignment. Any form of alignment or sequence group is acceptable (any previous gap information is ignored), and more than one source can be selected.")); cost = NewCostFunction(); alignment <- CheckAlignment(alignment, CostFunction(cost)); localAlignment = BooleanReader("Local Alignment?",false,"local"); HTMLLabel("

Calculating Multiple Alignment

Please be patient ...
",false,true); ]MultipleAlignmentImpl(alignment,cost, localAlignment); } CalculateDistances { displayName = "Calculate Evolutionary Distances"; icon = "./images/distance.gif"; description = "Calculates Evolutionary Distances given an alignment and a substitution model"; CalculateDistances := ( name = "Calculate Distances", brief = "Evolutionary distance matrix calculator.", verbose = "Calculates a distance matrix of evolutionary distances based an alignment and a substitution model." )[ alignment = ?(name = "Base Alignment", verbose = "The data type of the alignment does not have to match that of the substitution model (as conversion will automatically be done), but in general they should match for best results."); model = ?(name = "Base Model", verbose = "The data type of the alignment does not have to match that of the substitution model (as conversion will automatically be done), but in general they should match for best results."); //alignment <- CheckAlignment(alignment, SubstitutionModel(model)); ]Distance(alignment,model); } XDistanceMatrix { displayName = "Distance Matrix"; icon = "./images/distance.gif"; description = "Distance matrix constructions"; XDistanceMatrix := ( name = "Evolutionary Distances", brief = "Evolutionary distance based matrix.", verbose = "Calculates a distance matrix of evolutionary distances based an alignment and a substitution model." )[ alignment = ?(name = "Base Alignment", verbose = "The data type of the alignment does not have to match that of the substitution model (as conversion will automatically be done), but in general they should match for best results."); model = ?(name = "Base Model", verbose = "The data type of the alignment does not have to match that of the substitution model (as conversion will automatically be done), but in general they should match for best results."); //alignment <- CheckAlignment(alignment, SubstitutionModel(model)); ]Distance(alignment,model); XDistanceMatrix := ( name = "Tree Length Distances", brief = "Distance matrix based on tree.", verbose = "Calculates a distance matrix based on the distances between taxanomic units in a given tree." )[ tree= ?(name = "Input Tree", verbose = "The tree which describes the distances between taxanomic units."); ]GetTreeDistanceMatrix(tree); } //============================================================================= // ============ Likelihood Based Stuff ========== //============================================================================= //Max Likelihood stuff //0 - ConstantMutationRate(0.01,units); //1 - SteppedMutationRate(GetTOCDTimes(tocd),units) ; //2 - SteppedMutationRate(DoubleArrayReader("Rate change times?",1,numberOfSamples-1,0,MAXIMUM_VALUE,{1.0},"time_rate_change"),units) ; BasicOptimiseML { displayName = "General ML Estimate"; description = "Peforms maximum likelihood optimisation on a fixed topology to gain estimates of branch lengths, and or substitution model parameters."; icon = "./images/optclock.gif"; BasicOptimiseML :=( name = "Predefined Model", brief = "Predefined Model", verbose = "Estimate tree and/or model parameters using maximum likelihood based on sequences without reference to time or sample information. Uses a predefined substitution model as a template." )[ tree = ?( name = "Base Tree", verbose "The input tree"); alignment = ? ( name = "Base Alignment", verbose = "The Alignment that corresponds to the input tree. The data type of the base alignment may differ from that of the substitution model (conversion is automatic), but they should be the same for best results."); model = ?(name = "Substitution Model", verbose = "The Substitution Model is used in the likelihood calculation process. If the data type of the given Substitution Model varies from that of the base alignment than the alignment will be converted to match (after prompting the user to confirm)."), if(!IsIDsMatch(Tree(tree),Alignment(alignment))) { HTMLLabel(ALIGNMENT_TREE_INCOMPATIBLE_MESSAGE,true,false); }; alignment <- CheckAlignment(alignment, SubstitutionModel(model)); ml = MaxLikelihoodGUI(tree,alignment,model,LC_FACTORY); result = MLOptimiser(ml); HTMLDisplay("

Result Information:

"+GetSummary(result),true,true); ]result; BasicOptimiseML :=( name = "Normal", brief = "Normal", verbose = "Estimate tree and/or model parameters using maximum likelihood based on sequences without reference to time or sample information." )[ tree = ?( name = "Base Tree", verbose "The input tree"); alignment = ? ( name = "Base Alignment", verbose = "The Alignment that corresponds to the input tree. The data type of the base alignment may differ from that of the substitution model (conversion is automatic), but they should be the same for best results."); if(!IsIDsMatch(Tree(tree),Alignment(alignment))) { HTMLLabel(ALIGNMENT_TREE_INCOMPATIBLE_MESSAGE,true,false); }; ml = MaxLikelihoodGUI(tree,alignment,LC_FACTORY); result = MLOptimiser(ml); HTMLDisplay("

Result Information:

"+GetSummary(result),true,true); ]result; } MEPOptimiseML { displayName = "Serial ML Estimate"; icon = "./images/optclock.gif"; MEPOptimiseML :=( name = "Predefined Model", brief = "Predefined Model", verbose = "Estimate tree and/or model parameters using maximum likelihood based on sequences using time or sample information." ) [ tree = ?( name = "Base Tree", verbose "The input tree"); alignment = ? ( name = "Base Alignment", verbose = "The Alignment that corresponds to the input tree. The data type of the base alignment may differ from that of the substitution model (conversion is automatic), but they should be the same for best results."); model = ?(name = "Substitution Model", verbose = "The Substitution Model is used in the likelihood calculation process. If the data type of the given Substitution Model varies from that of the base alignment than the alignment will be converted to match (after prompting the user to confirm)."), tocd = ?(name = "Sample Information", verbose = "The Sample Information provides a mapping between sequences and related time/sample information."); if(!IsRooted(Tree(tree))) { HTMLLabel(ROOTED_TREE_WARNING,true,true); }; if(!IsIDsMatch(Tree(tree),Alignment(alignment))) { HTMLLabel(ALIGNMENT_TREE_INCOMPATIBLE_MESSAGE,true,false); }; if(!IsIDsMatch(Alignment(alignment), TOCD(tocd))) { HTMLLabel(SAMPLE_INFORMATION_INCOMPATIBLE_WITH_ALIGNMENT_TREE_MESSAGE,true,false); }; alignment <- CheckAlignment(alignment, SubstitutionModel(model)); ml = MaxLikelihoodGUI(tree,alignment,model,tocd,LC_FACTORY); result = MLOptimiser(ml); HTMLDisplay("

Result Information:

"+GetSummary(result),true,true); ]result; MEPOptimiseML :=( name = "Normal", brief = "Normal", verbose = "Estimate tree and/or model parameters using maximum likelihood based on sequences using time or sample information. Uses a predefined substitution model as a template." ) [ tree = ?( name = "Base Tree", verbose "The input tree"); alignment = ? ( name = "Base Alignment", verbose = "The Alignment that corresponds to the input tree. The data type of the base alignment may differ from that of the substitution model (conversion is automatic), but they should be the same for best results."); tocd = ?(name = "Sample Information", verbose = "The Sample Information provides a mapping between sequences and related time/sample information."); if(!IsIDsMatch(Tree(tree),Alignment(alignment))) { HTMLLabel(ALIGNMENT_TREE_INCOMPATIBLE_MESSAGE,true,false); }; if(!IsIDsMatch(Alignment(alignment), TOCD(tocd))) { HTMLLabel(SAMPLE_INFORMATION_INCOMPATIBLE_WITH_ALIGNMENT_TREE_MESSAGE,true,false); }; ml = MaxLikelihoodGUI(tree,alignment,tocd,LC_FACTORY); result = MLOptimiser(ml); HTMLDisplay("

Result Information:

"+GetSummary(result),true,true); ]result; } XSplitAnalysis { displayName = "TACS Analysis"; icon = "./images/optclock.gif"; XSplitAnalysis := [ tree = ?( name = "Base Tree", verbose "The input tree"); alignment = ? ( name = "Base Alignment", verbose = "The Alignment that corresponds to the input tree. The data type of the base alignment may differ from that of the substitution model (conversion is automatic), but they should be the same for best results."); tocd = ?(name = "Sample Information", verbose = "The Sample Information provides a mapping between sequences and related time/sample information."); if(!IsIDsMatch(Tree(tree),Alignment(alignment))) { HTMLLabel(ALIGNMENT_TREE_INCOMPATIBLE_MESSAGE,true,false); }; if(!IsIDsMatch(Alignment(alignment), TOCD(tocd))) { HTMLLabel(SAMPLE_INFORMATION_INCOMPATIBLE_WITH_ALIGNMENT_TREE_MESSAGE,true,false); }; if(IsHasCodons(Alignment(alignment))) { [ Print("MOOO"); alignment <- RemoveStopCodons(alignment); ]HTMLLabel(ALIGNMENT_HAS_STOP_CODONS_MESSAGE,true,true); }; ml = SplitAnalysisGUI(tree,alignment,tocd); result = MLOptimiser(ml); HTMLDisplay("

Result Information:

"+GetSummary(result),true,true); ]result; } XLikelihoodSummarise { displayName = "Likelihood Summarise"; XLikelihoodSummarise := [ tree = ? ; alignment = ? ; model = ?; alignment <- CheckAlignment(alignment,SubstitutionModel(model)); ]LikelihoodSummarise(tree,alignment,model); } XAlignmentSimulator { displayName = "Alignment Simulator"; XAlignmentSimulator := ( name = "Alignment Simulator", brief = "Alignment Simulator", verbose = "A tool for simulating an alignment across a given tree (with set branch lengths), using a model of substitution," )[ tree = ?(name = "Tree", verbose = "The tree over which to simulate alignments. If the units of the input tree are not Expected Substitutions the user will be required to enter a mutation rate. The branch lengths of the input tree should be meaningful!"); as = AlignmentSimulatorGUI(tree,?); ]SimulateAlignments(as); } DistributionTest { displayName = "Distribution Test"; textButton = true; DistributionTest := iterate(a through 1..10) { [loop(b through 1..100 on b*b*b*b)] (a+10)}; } XSerialCoalescentSimulator { displayName = "Serial Coalescent Simulator"; _base := [ options = ? ; HTMLLabel("

Building trees

Please wait...
",false,true); ]DoSerialCoalescentSimulation(options); XSerialCoalescentSimulator := ( name = "Generated Sample Information", brief = "Generated Sample Information", verbose = "Select this signature if the resulting trees are not to be based on predefined Sample Information." )[ options = SerialCoalescentSimulatorGUI() ; HTMLLabel("

Building trees

Please wait...
",false,true); ]DoSerialCoalescentSimulation(options); XSerialCoalescentSimulator := ( name = "With Given Sample Information", brief = "With Given Sample Information", verbose = "Select this signature if using a previously defined Sample Information template." )[ givenTOCD = ?(name = "Template Sample Information", verbose = "All generated trees will follow the given sample inforation, using the same names, and time information. The Sample Information include time information (not just order information), and the units must either be Expected substitutions, or Generations."); if(!HasTOCDTimes(givenTOCD)) { HTMLLabel("

No time information!

Cannot use Sample Information without time information.
Click \"Cancel\"
",true,false); }; ] _base( SerialCoalescentSimulatorGUI( givenTOCD ) ); } ExampleCeblet { displayName = "Example Ceblet"; ExampleCeblet := (name = "Example Ceblet", brief = "Simple example ceblet.", verbose = "A simple example of a very basic ceblet")[ t = Tree(?(name = "Some type of Tree", verbose = "The base alignment on which to perform sUPGMA analysis. Bootstrap analysis is based on this alignment.")); a = Alignment(?(name = "Some type of Alignment", verbose = "The base alignment on which to perform sUPGMA analysis. Bootstrap analysis is based on this alignment.")); SimpleOptionReader("Please select operation.",{"Reverse", "Jumble", "Realign by tree"},0); ]a; } EstimateTest { displayName := "Estimate Test"; EstimateTest := Estimate(?,?,?,EstimateOptionsInput()); } ClusterTreeImpl { displayName= "General Cluster Analysis"; _main := [ HTMLLabel("

Processing

Please be patient...
",false,true); ]GenerateTrees(?); ClusterTreeImpl :=( name = "Distance Matrix based", brief = "Using general distances.", verbose = "Performs cluster analysis (using either UPGMA style methods, or Neighbour-Joining), based on a general distance matrix." )[ dm = ?(name = "Distance Matrix", verbose = "The distance matrix holds information on similarity between sequences. Lower values should indicate greater similarity."); ]_main(ClusterOptionsInput(dm)); ClusterTreeImpl :=( name = "Alignment based", brief = "Using evolutionary distances.", verbose = "Performs cluster analysis (using either UPGMA style methods, or Neighbour-Joining). Distance matrix derived from evolutionary distances from an alignment and a model of substitution." )[ alignment = ?(name = "Base Alignment", verbose = "The data type of the alignment does not have to match that of the substitution model (as conversion will automatically be done), but in general they should match for best results."); model = ?(name = "Base Model", verbose = "The data type of the alignment does not have to match that of the substitution model (as conversion will automatically be done), but in general they should match for best results."); alignment <- CheckAlignment(alignment, SubstitutionModel(model)); ]_main(ClusterOptionsInput(alignment,model)); } /** * SUPGMA! */ SUPGMAImpl { displayName = "sUPGMA"; _main := [ HTMLLabel("

Processing

Please be patient...
",false,true); result = GenerateTrees(?); HTMLDisplay("

Result Information:

"+GetSummary(result),true,true); ]result; /* SUPGMAImpl := [ dm = ?; tocd = ?; if(!IsIDsMatch(TimeOrderCharacterData(tocd),DistanceMatrix(dm))) { HTMLLabel(SAMPLE_INFORMATION_INCOMPATIBLE_WITH_DISTANCE_MATRIX_MESSAGE,true,false); }; ]_main(SUPGMAGUI(dm,tocd)); */ SUPGMAImpl :=( name = "Alignment based", brief = "SUPGMA using an alignment", verbose = "Perform SUPGMA Analysis given an alignment and a model of substitution. A Sample Information object is required to supply time/order information for each sequence." ) [ alignment = ?(name = "Base Alignment", verbose = "The data type of the alignment does not have to match that of the substitution model (as conversion will automatically be done), but in general they should match for best results."); model = ?(name = "Base Model", verbose = "The data type of the alignment does not have to match that of the substitution model (as conversion will automatically be done), but in general they should match for best results."); tocd = ?(name = "Sample Information", verbose = "The sequences in the sample information must match those in the given alignment."); if(!IsIDsMatch(Alignment(alignment), TOCD(tocd))) { HTMLLabel(SAMPLE_INFORMATION_INCOMPATIBLE_WITH_ALIGNMENT_TREE_MESSAGE,true,false); }; alignment <- CheckAlignment(alignment, SubstitutionModel(model)); ]_main(SUPGMAGUI(alignment,model,tocd)); } /** * The editor wrapper for "Sample Information" objects */ TOCDEditor { displayName = "Sample Information"; TOCDEditor := TOCDInput(TimeOrderCharacterData(?)); } LikelihoodTreeParameterTest { displayName = "Likelihood Tree Parameter Test"; LikelihoodTreeParameterTest:= [ function = GetLikelihoodTreeTree(?, ?, ?); ]ParameterToy(function,{GeneralTreeViewFactory(true), GeneralTreeViewFactory(false)},"moo"); } XSimulateSingle { displayName = "Simulate Single"; XSimulateSingle := [ tree = ?; alignment = ?; tocd = ?; omegaValue = DoubleReader("Omega?",2,0,MAXIMUM_VALUE,"omega"); kappaValue = DoubleReader("Kappa?",2,0,MAXIMUM_VALUE,"kappa"); mutationRate = DoubleReader("Mutation Rate (codons)?",0.1,0,MAXIMUM_VALUE,"rate"); numberToCreate = IntegerReader("Number to create?",10,1,1000,"num_create"); sequenceLength = IntegerReader("Sequence Length?",10,1,1000,"sequence_length"); ]SimulateSingle(tree,alignment,tocd,omegaValue, kappaValue, mutationRate, numberToCreate, sequenceLength); } XSimulateDual { displayName = "Simulate Dual"; XSimulateDual := [ tree = ?; alignment = ?; tocd = ?; recentOmegaValue = DoubleReader("Recent Omega?",2,0,MAXIMUM_VALUE,"recent_omega"); recentKappaValue = DoubleReader("Recent Kappa?",2,0,MAXIMUM_VALUE,"recent_kappa"); pastOmegaValue = DoubleReader("Past Omega?",2,0,MAXIMUM_VALUE,"past_omega"); pastKappaValue = DoubleReader("Past Kappa?",2,0,MAXIMUM_VALUE,"past_kappa"); mutationRate = DoubleReader("Mutation Rate (codons)?",0.1,0,MAXIMUM_VALUE,"rate"); numberToCreate = IntegerReader("Number to create?",10,1,1000,"num_create"); sequenceLength = IntegerReader("Sequence Length?",10,1,1000,"sequence_length"); ]SimulateDual(tree,alignment,tocd, recentOmegaValue, recentKappaValue, pastOmegaValue, pastKappaValue, mutationRate, numberToCreate, sequenceLength); } XScaleTree { displayName = "ScaleTree"; XScaleTree := ScaleTree(?, DoubleReader("Scale?",1,0.0001,100,"scale")); } XAnalysisDual { displayName = "Analysis Dual"; XAnalysisDual:= [ tree = ?; alignments = Alignments(?); tocd = ?; sharedKappa = BooleanReader("Shared Kappa?",false,"share_kappa"); splitTime = DoubleReader("Split Time?", 2,0.1, MAXIMUM_VALUE,"split_time"); info = StringReader("Info?", ""); result = iterate(a through alignments) { AnalysisDual(tree,a,tocd,sharedKappa,info,splitTime); }; ]result; } XMakeLFTree { XMakeLFTree := MakeLFTree(?,?,DoubleReader("Rate?",0.1,0, 100,"rate")); } XAnalysisSingle { displayName = "Analysis Single"; XAnalysisSingle:= [ tree = ?; alignments = Alignments(?); tocd = ?; info = StringReader("Info?", ""); result = iterate(a through alignments) { AnalysisSingle(tree,a,tocd,info); }; ]result; } XPatternSummariseSimulator { displayName = "Pattern Summarise Simulator"; XPatternSummariseSimulator := [ tree = ?(name = "Tree", verbose = "The tree over which to simulate alignments. If the units of the input tree are not Expected Substitutions the user will be required to enter a mutation rate. The branch lengths of the input tree should be meaningful!"); sim = AlignmentSimulatorGUI(tree,?); numRuns = IntegerReader("Number of runs?",1000,1,MAXIMUM_VALUE,"num_runs"); ]PatternSummariseSimulator(sim,numRuns); } XClassicPositiveTaskMaker { displayName = "XClassicPositiveTaskMaker"; XClassicPositiveTaskMaker := [ tree = ?; alignments = Alignments(?); sampleInfo = ?; result = iterate(a through alignments {local}) { MakeClassicPostiveSelection(tree,a,sampleInfo); }; ]result; } XClassicPositiveTaskMakerFixedModel { displayName = "XClassicPositiveTaskMaker Fixed Model"; XClassicPositiveTaskMakerFixedModel := [ tree = ?; alignments = Alignments(?); sampleInfo = ?; kappa = DoubleReader("Kappa?",2,0,MAXIMUM_VALUE, "kappa"); omega = DoubleReader("Omega?",2,0,MAXIMUM_VALUE, "omega"); p0 = DoubleReader("P0?",0.42882574009362434,0,MAXIMUM_VALUE,"p0"); p1 = DoubleReader("P1?",0.46317663348058286,0,MAXIMUM_VALUE,"p1"); p2 = DoubleReader("P2?",0.10799762642579284,0,MAXIMUM_VALUE,"p2"); result = iterate(a through alignments {local}) { MakeClassicPostiveSelection(tree,a,sampleInfo,kappa,omega,p0,p1,p2); }; ]result; } XClassicNeutralTaskMaker { displayName = "XClassicNeutralTaskMaker"; XClassicNeutralTaskMaker := [ tree = ?; alignments = Alignments(?); sampleInfo = ?; result = iterate(a through alignments {local}) { MakeClassicNeutralSelection(tree,a,sampleInfo); }; ]result; } XSplitPositiveTaskMaker { displayName = "XSplitPositiveTaskMaker"; XSplitPositiveTaskMaker := [ tree = ?; alignments = Alignments(?); sampleInfo = ?; loop(name through StringArray(GetTreeNodeNames(tree))) { Print(name); }; splitName = StringReader("Split sample example taxon?","","split_name"); saturated = BooleanReader("Saturated?", true, "saturated"); result = iterate(a through alignments {local}) { MakeSplitPostiveSelection(tree,a,sampleInfo,splitName,saturated); }; ]result; } XSplitPositiveTaskMakerFixedModel { displayName = "XSplitPositiveTaskMakerFixedModel"; XSplitPositiveTaskMakerFixedModel := [ tree = ?; alignments = Alignments(?); sampleInfo = ?; loop(name through StringArray(GetTreeNodeNames(tree))) { Print(name); }; splitTime = DoubleReader("Split time?",10,0,MAXIMUM_VALUE,"split_time"); beforeOmega = DoubleReader("Before Omega?",2,0,MAXIMUM_VALUE,"before_omega"); afterOmega = DoubleReader("After Omega?",2,0,MAXIMUM_VALUE,"after_omega"); beforeKappa = DoubleReader("Before Kappa?",2,0,MAXIMUM_VALUE,"before_kappa"); afterKappa = DoubleReader("After Kappa?",2,0,MAXIMUM_VALUE,"after_kappa"); distributionValues = DoubleArrayReader("Distribution Values?",9,9,0,1,{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},"p_values"); result = iterate(a through alignments {local}) { MakeSplitPostiveSelection(tree,a,sampleInfo,splitTime, beforeOmega, beforeKappa, afterOmega, afterKappa, distributionValues ); }; ]result; } XSplitPositiveTaskMakerFixedModelAlt { displayName = "XSplitPositiveTaskMakerFixedModelAlt"; XSplitPositiveTaskMakerFixedModelAlt := [ tree = ?; alignments = Alignments(?); sampleInfo = ?; loop(name through StringArray(GetTreeNodeNames(tree))) { Print(name); }; splitTime = DoubleReader("Split time?",10,0,MAXIMUM_VALUE,"split_time"); beforeOmega = DoubleReader("Before Omega?",2,0,MAXIMUM_VALUE,"before_omega"); afterOmega = DoubleReader("After Omega?",2,0,MAXIMUM_VALUE,"after_omega"); beforeKappa = DoubleReader("Before Kappa?",2,0,MAXIMUM_VALUE,"before_kappa"); afterKappa = DoubleReader("After Kappa?",2,0,MAXIMUM_VALUE,"after_kappa"); distributionValues = DoubleArrayReader("Distribution Values?",9,9,0,1,{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},"p_values"); result = iterate(a through alignments {local}) { MakeSplitPostiveSelectionAlt(tree,a,sampleInfo,splitTime, beforeOmega, beforeKappa, afterOmega, afterKappa, distributionValues ); }; ]result; } XSplitPositiveTaskMakerTime { displayName = "XSplitPositiveTaskMakerTime"; XSplitPositiveTaskMakerTime := [ tree = ?; alignments = Alignments(?); sampleInfo = ?; splitTime = DoubleReader("Split time?",10,0,MAXIMUM_VALUE,"split_time"); saturated = BooleanReader("Saturated?", true, "saturated"); result = iterate(a through alignments {local}) { MakeSplitPostiveSelection(tree,a,sampleInfo,splitTime,saturated); }; ]result; } XSplitNeutralTaskMaker { displayName = "XSplitNeutralTaskMaker"; XSplitNeutralTaskMaker := [ tree = ?; alignments = Alignments(?); sampleInfo = ?; loop(name through StringArray(GetTreeNodeNames(tree))) { Print(name); }; splitName = StringReader("Split sample example taxon?","","split_name"); saturated = BooleanReader("Saturated?", true, "saturated"); result = iterate(a through alignments {local}) { MakeSplitNeutralSelection(tree,a,sampleInfo,splitName,saturated); }; ]result; XSplitNeutralTaskMaker := [ tree = ?; alignments = Alignments(?); sampleInfo = ?; splitTime = DoubleReader("Split time?",10,0,MAXIMUM_VALUE,"split_time"); saturated = BooleanReader("Saturated?", true, "saturated"); result = iterate(a through alignments {local}) { MakeSplitNeutralSelection(tree,a,sampleInfo,splitTime, saturated); }; ]result; } XLHTaskOptimise { displayName = "XLHTaskOptimise"; XLHTaskOptimise := [ tasks = LikelihoodTasks(?); result = iterate(task through tasks ) { ConstrainedOptimisation(task); }; ]result; } XSplitPositiveConstrainedSimulate { displayName = "Split Positive Constrained Simulate"; XSplitPositiveConstrainedSimulate := [ tree = ?; alignment = ?; sampleInfo = ?; pValues = DoubleArrayReader("PValues?",9,9,0,1,{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},"p_values"); upperKappa = DoubleReader("Upper Kappa?",2,0,100,"uppper_kappa"); upperOmega = DoubleReader("Upper Omega?",2,0,100,"uppper_omega"); lowerKappa = DoubleReader("Lower Kappa?",2,0,100,"lower_kappa"); lowerOmega = DoubleReader("Lower Omega?",2,0,100,"lower_omega"); sequenceLength = IntegerReader("Sequence length?",300,1,MAXIMUM_VALUE,"sequence_length"); stochasticDistribution = BooleanReader("Stochastic Distribution?",false,"stochastic"); loop(name through StringArray(GetTreeNodeNames(tree))) { Print(name); }; sampleTaxon = StringReader("Sample taxon name?","","taxon"); numberToCreate = IntegerReader("Number to create?",30,1,MAXIMUM_VALUE,"num_create"); result = iterate(a through 1..(numberToCreate-1) {local}) { SplitPositiveConstrainedSimulate(tree,alignment,sampleInfo,pValues,upperKappa, upperOmega, lowerKappa,lowerOmega,sequenceLength,stochasticDistribution, sampleTaxon); }; ]result; } XSplitPositiveConstrainedSimulateTime { displayName = "Split Positive Constrained Simulate Time"; XSplitPositiveConstrainedSimulateTime := [ tree = ?; alignment = ?; sampleInfo = ?; pValues = DoubleArrayReader("PValues?",9,9,0,1,{0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5},"p_values"); upperKappa = DoubleReader("Upper Kappa?",2,0,100,"uppper_kappa"); upperOmega = DoubleReader("Upper Omega?",2,0,100,"uppper_omega"); lowerKappa = DoubleReader("Lower Kappa?",2,0,100,"lower_kappa"); lowerOmega = DoubleReader("Lower Omega?",2,0,100,"lower_omega"); sequenceLength = IntegerReader("Sequence length?",300,1,MAXIMUM_VALUE,"sequence_length"); stochasticDistribution = BooleanReader("Stochastic Distribution?",false,"stochastic"); splitTime = DoubleReader("Split time?",10,0,MAXIMUM_VALUE,"split_time"); numberToCreate = IntegerReader("Number to create?",30,1,MAXIMUM_VALUE,"num_create"); result = iterate(a through 1..(numberToCreate-1) {local}) { SplitPositiveConstrainedSimulate(tree,alignment,sampleInfo,pValues,upperKappa, upperOmega, lowerKappa,lowerOmega,sequenceLength,stochasticDistribution, splitTime); }; ]result; } XOptimiseCodonDist { displayName = "Optimise Codon Dist"; XOptimiseCodonDist := [ t = ?; a = ?; number = IntegerReader("Number of trials?",50,1,10000,"number_trials"); result = iterate(x through 1..number) { UnconstrainedCodon(t,a); } ]result; } XMultiTaskConstrainedOptimisation { displayName = "Multi Task Constrained Optimisation"; XMultiTaskConstrainedOptimisation := [ task = ?; number = IntegerReader("Number of attempts?", 10,1,MAXIMUM_VALUE, "number_attempts"); result = iterate(a through 1..number) { TaskConstrainedOptimisation(task); }; ]result; } XWhaleMLTest { displayName = "Whale ML Test"; XWhaleMLTest := [ baseTree = ?; alignment = ?; model = ?; sequenceName = StringReader("Sequence Name", "", "sequence_name"); tree= RestrictTree(baseTree,String(sequenceName), false); ]WhaleMLTest(tree,alignment,model,sequenceName); }