DOI: 10.5061/dryad.2fqz612n2
title: Data from: Comparative genomics reveals high rates of horizontal transfer and strong purifying selection on rhizobial symbiosis genes

description: Horizontal transfer (HT) alters the repertoire of symbiosis genes in
 rhizobial genomes and may play an important role in the on-going evolution
 of the rhizobia-legume symbiosis. To gain insight into the extent of HT of
 symbiosis genes with different functional roles (nodulation, N-fixation,
 host benefit, and symbiont fitness), we conducted comparative genomic and
 selection analyses of the full genome sequences from 27 rhizobial genomes.
 We find that symbiosis genes experience high rates of HT among rhizobial
 lineages but also bear signatures of purifying selection (low Ka:Ks). HT
 and purifying selection appear to be particularly strong in genes involved
 in initiating the symbiosis (e.g. nodulation) and in genome-wide
 association candidates for mediating variation in benefits provided to the
 host. These patterns are consistent with rhizobia adapting to the host
 environment through the loss and gain of symbiosis genes, but not with
 host-imposed positive selection driving divergence of symbiosis genes
 through recurring bouts of positive selection.
description: Data is from 27 complete bacterial genome assemblies--all
 symbiotic rhizobia--downloaded from the NCBI repository. Orthologous genes
 were identified and a variety of comparative, phylogenetic, and
 evolutionary analyses were conducted.
description: (All of this information is repeated in the README
 file.) Gene data<br> ==========
 If you are looking for the statistics for each gene or pair of
 sequences<br> they can be found in these two files:<br> -
 6-comparison/pairwise_divergence.tsv<br> - Table S5 in the ms has
 key gene summary statistics. This is also repeated<br>   in
 6-comparison/gene_divergence_summary.tsv.<br> - Both of these files
 are also included in the top level of the data submission<br>   for
 your convenience--no need to unzip any directories.
 <br> Workflow, code, and various output files:<br>
 =========================================== 1. Genome
 assemblies downloaded from public databases<br>    Lists of strains
 and accession numbers are provided in the 1-genomes<br>   
 directory.<br>    - Accession numbers for the 72 strains from NCBI
 are found in<br>      ncbi_genomes.tsv.<br>    - USDA4894 and
 USDA1106 were also downloaded from the MaGe Microscope<br>     
 platform:
 https://mage.genoscope.cns.fr/microscope/search/exportForm.php?mode=ORG<br>    - The 27 alpha-Proteobacteria with complete genome assemblies that<br>      were chosen for evolutionary analyses (after running OrthoFinder)<br>      are listed in 27_chosen_strains.txt.<br>    - The full list of strains downloaded is in all_strains.txt. 2. Ortholog identification by using OrthoFinder<br>    The code and output for the OrthoFinder run is provided in the<br>    2-orthologs directory.<br>    - script is orthofinder_pipeline.sh. Note that it was set up to run<br>      on the Univ. of MN Supercomputing Institute servers, so it will<br>      have to be modified if run in a different environment. Also, file<br>      paths will have to be adjusted. This is true of all the pipeline<br>      scripts in this repository.<br>    - all auxiliary python scripts have also been included.<br>    - I (Brendan) modified one of the scripts included with OrthoFinder<br>      so that it would print out the rooted gene trees.<br>    - Output files:<br>      - reconciled orthologs: reconciled_genes.tsv, this file is where<br>        the genes for the rest of the analysis are defined. It was<br>        created by extract_orthosets_from_orthofinder_trees.py, which<br>        used the rooted gene trees to identify phylogenetic groupings of<br>        gene sequences. "subset" column is the gene name.<br>      - annotation: annotation.tsv. The "description" column was an<br>        attempt at combining the gene products from all strains into a<br>        summary; sometimes this was successful. The "gene" and<br>        "descriptions" columns have comma-separated lists of all the<br>        unique gene names and descriptions for the gene (from all<br>        strains).<br>      - pseudogenes: pseudogenes.txt<br>      - rooted gene trees from OrthoFinder:<br>        rooted_gene_tress_from_orthofinder.tsv, one newick formatted tree<br>        per line, first column is the "orthogroup". This output file is<br>        from the modfied OrthoFinder script.<br>      - IMPORTANT NOTE: The output files from this step still include<br>        pseudogenes. These have to be removed during subsequent analysis<br>        steps.<br>    - Symbiosis genes are in symbiosis_genes<br>      - Note: The rhizobial fitness phenotype is the same one presented in<br>        Burghardt et al. (2017, PNAS). However, the candidate gene list<br>        used here is slightly different--for consistency, the analysis was<br>        re-run using the same methods as in Epstein et al. (2018, mSphere).<br>        The difference is testing one variant per LD group, instead of all<br>        variants. 3. Alignment of sequences by using muscle<br>    Code for this step is found in 3-alignment.<br>    - alignment-pipeline.sh is the shell script that ran the protein<br>      alignment and produced nucleotide alignments from the protein<br>      alignments.<br>    - helper python scripts also included<br>    - alignments were produced for entire orthogroups (the MCL output<br>      from OrthoFinder) and for "orthosets" (the reconciled gene<br>      groupings)<br>    - Note: codon alignments of just sequences from one "orthoset" were<br>      based on the protein alignment of all sequences in the orthogroup,<br>      not on the orthoset-only protein alignment--more for convenience<br>      than a different analysis. 4. Construction of a single-copy-core phylogenetic tree by using IQ-tree<br>    Code and output for this step is found in 4-species_tree.<br>    - species_tree_pipeline.sh: code to construct the tree<br>    - output tree from IQtree: sc.treefile<br>    - ML estimates of pairwise distances: sc.mldist<br>    - output tree rooted by using figtree: rooted.nw<br>    - IQ-tree log file: sc.iqtree<br>    - NOTE: For some reason, the list of single copy core genes here does<br>      not include 9 genes that are single copy core according to the data<br>      I used for the symbiosis gene comparison. This is because the<br>      IQ-tree list of single-copy core genes was obtained by looking for<br>      scc genes, then removing any with pseudogenes. By contrast, the<br>      gene comparison data have the pseudogenes removed first, then<br>      searched for scc--nine of the scc genes have extra pseudogene<br>      copies. I don't think this is an important issue. 5. Calculation of statistics for genes 5a. Calculation of Ka/Ks for all pairs of sequences by using gestimator<br>     Code for this step is found in 5-divergence/5a-kaks.<br>     - kaks_pipeline.sh: Shell script to run the analysis<br>     - output, cleaned of pseudogenes, is found in the directory for step<br>       6-comparison 5b. Calculation of pairwise protein distances by using FastME<br>     Code for this step is found in 5-divergence/5b-protein_dist<br>     - protein_dist_pipeline.sh: Shell script to run the analysis.<br>     - output is found in 6-comparison 5c. Calculation of phylogenetic signal statistics by using R packages<br>     Code for this step is found in 5-divergence/5c-phylogenetic_signal<br>     - phylo-signal-pipeline.sh: Shell script to run the analysis.<br>     - A helper Python script and the R scripts that contain the<br>       phylogenetic analysis are also included.<br>     - output is summarized in 6-comparison 5d. Estimates of rates of dup., loss, & transfer by using GeneRax<br>     5-divergence/5d-generax<br>     - generax-pipeline.sh: Shell script to run the analysis<br>     - helper scripts included<br>     - output is summarized in 6-comparison 6. Comparison of symbiosis genes to rest of the genome<br>    Code and output for this step is in 6-comparison.<br>    Files with the statistics for each gene or pair of sequences:<br>    - pairwise_divergence.tsv: Pairwise sequence statistics, with<br>      pseudogenes removed.<br>    - gene_divergence_summary.tsv: Averages, etc. of pairwise statistics<br>      and other statistics for each gene.  Code:<br>    - pairwise-table-script.sh: This script compiles the pairwise<br>      divergence and Ka/Ks data into a single table, while removing<br>      pseudogenes. It also contains code for calculating medians and<br>      means, but this was eventually moved to a different script (see<br>      below)<br>    - make_orthoset_divergence_table.r: The R code that actually does the<br>      work of tabulating pairwise divergence data. Is not fast.<br>    - gene_comparison-pipeline.sh: code to calculate summary statistics<br>      for each gene, create lists of randomly chosen background genes,<br>      and compare the background to the symbiosis genes<br>    - helper scripts included Output files:<br>    - randomly_chosen_gene_sets: genes chosen as random background. Each<br>      line is one set. "all": randomly chosen from all genes;<br>      "matched_strain_count": randomly chosen from genes with the same<br>      number of genomes as the symbiosis genes; "matched_count_and_copy":<br>      randomly chosen from genes that were similar in the number of<br>      genomes and copies to the symbiosis genes;<br>      "phenotype_permutations": GWAS hits from analyses run on permuted<br>      phenotype values (see Epstein et al. 2018).<br>    - comparison_results: all the output from comparing symbiosis genes<br>      to background genes. The file naming convention is<br>      table.&lt;background set&gt;.&lt;statistic&gt;.tsv. The file format is one row<br>      per gene set, with the values separated by tabs. The first row is<br>      the values for the symbiosis genes, while each remaining row is one<br>      random sample. 7. Tables, figures, and summaries<br>    Code for making the figures and tables and for doing the major<br>    statistical tests is in 7-figures_and_tables.