DOI: 10.5061/dryad.6t1g1jxbg
title: Scripts and detailed command lines supporting: Ecological selection as drivers during early speciation: Insights from two allopatric cypress species in the Himalaya

description: Understanding the factors driving speciation is fundamental to
 evolutionary biology. While geographic isolation has long been considered
 a primary factor, the role of ecological selection during early speciation
 stages is poorly understood. The Himalaya, a biodiversity hotspot, offers
 a unique opportunity to study these processes. We investigated two closely
 related conifer species, Cupressus torulosa and C. cashmeriana, which are
 geographically separated yet exhibit distinct ecological adaptations.
 Using target-capture sequencing of 52 C. cashmeriana samples from Bhutan
 and 46 C. torulosa samples from Nepal, we surveyed their genetic
 diversity, demographic history, and adaptive evolution. Genomic analyses
 revealed moderate genetic differentiation between them, yet confirmed they
 are genetically distinct sister species. Demographic modeling indicated
 their divergence began around 6.57 million years ago, with strong gene
 flow persisting until approximately 2.08 million years ago, shortly after
 the initiation of Quaternary climate oscillations. Ecological niche
 modeling showed low niche overlap, reflecting adaptations to different
 climatic conditions—C. cashmeriana to warmer, wetter habitats and C.
 torulosa to colder, drier habitats. We identified positively selected
 genes related to environmental stress responses, highlighting the crucial
 role of ecological selection. Genotype–environment association and partial
 redundancy analysis emphasized that ecological factors significantly drive
 genetic variation. Under future climate scenarios, both species show
 increased genomic vulnerability, particularly C. torulosa. Our findings
 underscore the importance of ecological selection in initiating speciation
 despite strong gene flow and have significant implications for managing
 mountain biodiversity in the face of climate change.
description: # Scripts and detailed command lines supporting: Ecological selection as
 drivers during early speciation: Insights from two allopatric cypress
 species in the Himalaya Dataset DOI:
 [10.5061/dryad.6t1g1jxbg](10.5061/dryad.6t1g1jxbg) ## Description of the
 data and file structure ### Files and variables #### File:
 Ecological-selection-of-two-cypress-species.zip **Description:** This
 archive contains all necessary scripts and auxiliary files used in the
 analysis pipeline for this study. This workflow provides a comprehensive
 pipeline for analyzing genomic data, including reference alignment, SNP
 calling, population structure inference, demographic modeling, and gene
 functional annotation. --- #### **Step 1: Reference Assembly and SNP
 Calling** **Script:** `Step1.Reference_assembly_and_SNPs_calling.sh`
 **Description:** Performs genome alignment, variant calling, and SNP
 extraction. --- #### **Step 2: Population Structure and Admixture
 Analysis** **Script:** `Step2.Population_structure_and_admixture.sh`
 **Description:** Executes PCA, population structure inference (e.g.,
 ADMIXTURE), and result visualization. --- #### **VCF Filtering**
 **Script:** `filter.vcf.gz.py` **Description:** Python script for
 filtering VCF files using user-defined criteria such as minor allele
 frequency (MAF), missing rate, etc. --- #### **Fastsimcoal2-Based
 Demographic Inference** #### **Source Scripts** Perl scripts adapted from:
 * GitHub:
 [https://github.com/wk8910/bio_tools/](https://github.com/wk8910/bio_tools/) * Ru et al. (2018), *Molecular Ecology*, 27:4875–4887. [DOI: 10.1111/mec.14909](https://doi.org/10.1111/mec.14909) #### **Script Descriptions** * `get_0fold-4fold_sites.pl`: Extracts 0-fold and 4-fold degenerate sites from VCF for assessing selection and neutrality. * `vcf2maf.pl`: Converts VCF data to a 2D Site Frequency Spectrum (SFS) format for demographic modeling. * `26.fastsimcoal.pl`: Runs fastsimcoal2 (v26) for 50 replicates to infer demographic parameters. * `01.best.pl`: Identifies the best-fitting model based on the lowest AIC (Akaike Information Criterion). * `run_fsc26.sh`: Executes the fastsimcoal2 simulation, specifying detailed command-line parameters. --- #### **Gene Annotation and GO Enrichment** #### **Environment Setup** `source activate eggnog export EGGNOG_DATA_DIR=/data/blastdb/eggnog.db` #### **Create DIAMOND Database for Viridiplantae** `create_dbs.py -m diamond --dbname Viridiplantae --taxa Viridiplantae` #### **Run EggNOG-mapper for Functional Annotation** `emapper.py --cpu 20 -m diamond \ --dmnd_db /data/blastdb/eggnog.db/Viridiplantae.dmnd \ -i LJL17009_target.pep -o LJL17009_target --override` #### **Extract GO Terms** `python anno2go.py LJL17009_target.emapper.annotations LJL17009_target.emapper.go.txt` Generates a two-column file: `gene_name GO_term` --- #### **GO Enrichment and Visualization** * #### `Rscript topGo.R`: Performs GO enrichment analysis using **topGO**. * `Rscript plot_GO.R`: Visualizes the enrichment results using **ggplot2**. --- #### **Script Package** All scripts are included in the archive: **`Ecological-selection-of-two-cypress-species.zip`**