### BEAST2 Command Line Execution Source: https://context7.com/bjoelle/bfd_snapper_tutorial/llms.txt This section provides bash commands for running a BEAST2 analysis. It includes steps for installing necessary packages (SNAPPER, Model_Selection) via BEAUti and executing the analysis using an XML configuration file. It also shows how to monitor the log file and lists the expected output files. ```bash # Install BEAST2 and required packages # Download BEAST2 from http://www.beast2.org/ # Install SNAPPER and Model_Selection packages through BEAUti # File > Manage Packages > Select SNAPPER and Model_Selection > Install/Upgrade # Run analysis with XML configuration beast RunA.xml # Expected output files: # RunA.log - parameter trace file # RunA.trees - sampled trees file # Monitor progress tail -f RunA.log # Analysis parameters for tutorial: # Chain length: 10,000,000 iterations # Sample frequency: every 10 iterations # Expected runtime: several hours depending on system ``` -------------------------------- ### Analyzing BEAST2 Results with Tracer Source: https://context7.com/bjoelle/bfd_snapper_tutorial/llms.txt This section guides users on how to analyze the output of a BEAST2 analysis using the Tracer software. It covers loading trace files, checking convergence diagnostics (ESS, trace plots), and identifying key parameters to examine for model fit and divergence times. ```bash # Download Tracer from http://beast.community/tracer # Load trace file tracer RunA.log # Check convergence diagnostics: # - ESS (Effective Sample Size) > 200 for all parameters # - Trace plots show good mixing (no trends) # - Posterior, likelihood, and prior stabilize after burn-in # Key parameters to examine: # - posterior: overall model fit # - TreeHeight: root height (divergence time) ``` -------------------------------- ### Species Assignment from Taxon Names Convention Source: https://context7.com/bjoelle/bfd_snapper_tutorial/llms.txt This section explains the convention used for assigning species based on taxon names in sequence IDs. The format is 'species_population_individual', where the species identifier is crucial for delimitation. Examples provided illustrate how to parse these names. ```bash # Species names are parsed from sequence IDs using delimiters # Format: species_population_individual # Examples: eng_NG_1 # eng = H. englersi, NG = Nigeria, individual 1 coal_CA1_2 # coal = H. coalescens, CA = Cameroon, individual 2 kya_GH3_7 # kya = H. kyaboboensis, GH = Ghana, individual 7 fas_GH1_12 # fas = H. fasciatus, GH = Ghana, individual 12 ``` -------------------------------- ### BEAUti Workflow for XML Configuration Source: https://context7.com/bjoelle/bfd_snapper_tutorial/llms.txt This snippet details the interactive steps required in BEAUti to configure species delimitation models and generate the necessary XML file for BEAST. It covers setting the template, importing alignments, defining taxon sets, configuring model parameters (like non-polymorphic and log likelihood correction), setting priors (Gamma distribution for birth rate), and configuring MCMC settings (chain length, storage frequency). ```bash # Launch BEAUti beauti # 1. Set template # File > Template > SNAPPER # 2. Import alignment # File > Import Alignment > select hemi129.nex # 3. Define species in Taxon Sets tab # Click "Guess" to parse species from taxon names # Use underscore "_" as delimiter # Or import custom mapping file # 4. Configure Model Parameters tab # Uncheck "Non-polymorphic" (for SNP data with only variable sites) # Set N=33 for Chebyshev approximation (higher = more accurate but slower) # Check "Use Log Likelihood Correction" for Bayes factor calculations # Leave mutation rates U and V at 1.0 (not estimated) # 5. Set Priors tab # Lambda (birth rate): Change from Uniform to Gamma(2.0, 2.0) # Coalescent Rate: Default Gamma(2.0, 2.0) is appropriate # Keep Yule model for species tree # 6. Configure MCMC tab # Chain length: 10,000,000 # Store every: 5,000 # Log every: 10 # Tracelog filename: $(filebase).log # Treelog filename: $(filebase).trees # 7. Save XML # File > Save As > RunA.xml ``` -------------------------------- ### BEAST2 XML Configuration for SNAPPER Source: https://context7.com/bjoelle/bfd_snapper_tutorial/llms.txt This XML snippet configures a BEAST2 analysis using the SNAPPER package. It defines the site model with a SnapSubstitutionModel, a StrictClockModel for branch rates, MCMC operators for exploring the parameter space, and logging settings for trace and tree files. Mutation rates are fixed at 1.0. ```xml 1.0 1.0 1.0 ``` -------------------------------- ### BEAST XML Configuration for Model Parameters and Priors Source: https://context7.com/bjoelle/bfd_snapper_tutorial/llms.txt This snippet provides an XML configuration excerpt for BEAST, focusing on species delimitation parameters. It defines the `snapperCoalescentRate` and `birthRate` (Lambda) with specified ranges and estimation settings. Crucially, it sets Gamma priors for both parameters, favoring smaller population sizes for the coalescent rate and a more realistic distribution for the birth rate. It also includes SNAPPER-specific settings like `non_polymorphic`, `pattern`, and `useLogLikelihoodCorrection` for Bayes Factor calculations. ```xml 1.0 0.01 100.1 1.0 2.0 2.0 pattern="coalescentRate" useLogLikelihoodCorrection="true" mutationOnlyAtRoot="false" useBetaRootPrior="false"> ``` -------------------------------- ### BEAST XML Configuration for SNAPPER Analysis Source: https://context7.com/bjoelle/bfd_snapper_tutorial/llms.txt This XML configuration file sets up a basic SNAPPER analysis in BEAST. It defines the data source (SNP alignment), the MCMC run parameters, the species tree structure with defined taxa sets, and the prior and likelihood distributions for the coalescent and speciation rates. It requires BEAST v2.7.6 and SNAPPER v1.1.4. ```xml 1.0 1.0 2.0 2.0 0.01 100.1 ``` -------------------------------- ### Bayes Factor Delimitation Workflow using BEAST Source: https://context7.com/bjoelle/bfd_snapper_tutorial/llms.txt This snippet outlines the workflow for species delimitation model comparison using Bayes Factor Delimitation (BFD) with BEAST. It includes defining alternative species delimitation models in XML, running path sampling to estimate marginal likelihoods, extracting these likelihoods from log files, and calculating Bayes Factors to compare models. The interpretation of Bayes Factor values is also provided. ```bash # Step 1: Define alternative species delimitation models # RunA.xml - Base model: 4 species (kya, coal, fas, eng) # RunB.xml - Lump coal+eng into single species (3 species) # RunC.xml - Lump fas+kya into single species (3 species) # RunD.xml - Split eng by geography (5 species) # RunE.xml - All samples as single species (1 species) # RunF.xml - Each population as separate species (7+ species) # Step 2: Run path sampling for each model to estimate marginal likelihood # Edit XML to include path sampling configuration beast -beagle_SSE RunA.xml # Step 3: Extract marginal likelihood (MLE) from log files grep "marginal L" RunA.log # Output: marginal L estimate = -2543.21 (95% HPD: -2545.32, -2541.10) # Step 4: Calculate Bayes Factors # BF = 2 * (MLE_model1 - MLE_model2) # Interpretation: # BF < 2: Not worth more than a bare mention # BF 2-6: Positive evidence # BF 6-10: Strong evidence # BF > 10: Very strong evidence # Example comparison: # Model A (4 species): MLE = -2543.21 # Model B (3 species): MLE = -2559.45 # BF = 2 * (-2543.21 - (-2559.45)) = 32.48 # Interpretation: Very strong support for 4-species model over 3-species model ``` -------------------------------- ### Summarizing Posterior Trees with TreeAnnotator Source: https://context7.com/bjoelle/bfd_snapper_tutorial/llms.txt This snippet describes how to use the `treeannotator` tool to summarize the posterior distribution of trees generated by BEAST, producing a Maximum Clade Credibility (MCC) tree. It specifies parameters for burn-in and node height calculation, and suggests visualizing the resulting tree in FigTree to examine key features like posterior probabilities, branch lengths, and node heights. ```bash # Summarize posterior tree distribution treeannotator -burnin 10 -heights mean RunA.trees RunA_summary.tree # Parameters: # -burnin 10: discard first 10% of trees # -heights mean: use mean node heights # Output: maximum clade credibility (MCC) tree with posterior probabilities # Visualize tree in FigTree figtree RunA_summary.tree # Key tree features to examine: # - Node posterior probabilities (support values) # - Branch lengths (in substitutions/site) # - Node heights (divergence times) # - Population size parameters at nodes ``` -------------------------------- ### SNP Data Configuration in NEXUS Format Source: https://context7.com/bjoelle/bfd_snapper_tutorial/llms.txt This snippet shows the configuration of SNP data in NEXUS format for SNAPPER analysis. It defines the dimensions of the dataset, the data type, symbols used for alleles, and the matrix of genetic markers for each individual. Ensure the format aligns with SNAPPER's requirements for biallelic markers. ```nexus #NEXUS [SNP data format for SNAPPER analysis] Begin data; Dimensions ntax=46 nchar=129; Format datatype=integerdata symbols="012" gap=-; Matrix eng_NG_1 2-0202-22120211220222-10212-01222022202202202000220122020220220022-20220202020202121022200021100-022200220202222-0202222200220202 coal_CA1_2 12020212202020222022222012211022-02221210210201022002202021020002122222010202020202202220020220020122012202022212020222020-200201 coal_CA1_3 220202022020102210222220222110222022202202202000220022020220220022221220202020202122002200202210100220122020222220202210200220212 kya_GH3_7 222222220220202220222020220000221022212222202220020222022222022202200220202222000202020022200002222222002020202202220222210220202 fas_GH1_12 222222220220202220222020220000212022202222202220020222022222022202200220202222000022020022201002222222000020202202220222200220202 ; End; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.