DOI: 10.6084/m9.figshare.30500915.v1
title: DrosophilaSociabilityGenomeScan

description: # Data and scripts repository for Rosenbaum, Torabi-Marashi et al. 2025.This repository contains all data (except raw sequencing files) and scripts associated with the study:<br>Rosenbaum, Torabi-Marashi et al. 2025. Evolution of sociability: Genome scans and gene validation. *Evolution* Accepted.<br>Raw Sequence data for this study is available on [NCBI SRA bioproject PRJNA1311514](https://www.ncbi.nlm.nih.gov/sra/PRJNA1311514).<br>**Please note**: If you wish to use this pipeline for the genomic analysis, and you are new to such pipelines, before using the scripts before, you will likely find the README for the data and scripts associated with [Audet et al. 2024](https://github.com/DworkinLab/Audet_etal_Evolution_2024) a simple overview of the pipeline. Then the scripts below will likely be more useful for replicating the specific analyses from this study.<br><br>### Data<br>#### Phenotypic Data<br>`JR_SociabilityScores_AllCrosses_formatted.csv` Behavioural data (sociability) for the RNAi experiments to test candidate genes. These are analyzed in the script `JR_SA_SociabilityRNAiCrosses_March2025_ID.Rmd`<br>Day: Day of experiment within an experimental block Time: Time (in 15 minute intervals) of phenotyping. So 1 corresponds to the first measure at 15 minutes into the behavioural assessment, 2 is 30 minutes etc...<br>Arena: The arena (unit of sampling) unique to a trial within a day.<br>Treatment: RNAi or control treatment<br>Soc_index: Measure of social aggregation<br>ExperimentalBlock: Blocking variable for the entire experiment (across all RNAi strains)<br>StrainID: Bloomington Drosophila Stock Center identifer<br><br>Additional meta-data for the experiment is in file `Construct_meta_data_JR_correct_EXPblocks.csv`.<br>stock_number: Bloomington Drosophila Stock Center identifer<br>TestDates: Beginning date for experiment (corresponding to Day 1)<br>TRiP: Whether the RNAi strain was from the TRiP or VDRC collection (for this study all were TRiP).<br>vector: Which vector was used to make this particular strain<br>genes: gene name<br>FBgn: Flybase gene identifier<br>Insertion location: Location of transgene insertion<br>Insertion Chromosom: Chromosomal location of transgene insertion<br>full_strain_genotype: Formal genotypic information<br>Notes: Any other notes about the strains either from Bloomington or our own work.<br>#### Allele counts data<br>`.sync` files of allele counts and coverage by samples. Because of file size limitations only the .sync files for the X chromosomes are part of this repo. On the figshare copy all of the sync files are available. On github only the sync files for the X chromosome. See below for more information on how they are generated (mostly via the shell scripts) and the Rscripts for analysis.<br>#### qRT-PCR<br>All `.xlsx` files beginning with "JR_" as well as `rg_JRR_5122025_data.xls` are the output from the qPCR runs. These are analyzed in the script `SociabilityPopGen_qPCR_results_JRR.R`<br>### Intermediate Data<br>#### snp_eff_cmh_fst_overlaps<br>SnpEff outputs and bed files from CMH and FST outputs (to be used for SnpEff) in all contrasts.<br>#### AlleleF_plotting.txt<br>Plotting text file to pull relevant gene names. Note that anywhere in the R scripts where alleleF_plotting.txt is being used, that is just snp_eff.txt for a given contrast, just with the snpeff header removed.<br><br><br>### Output<br>#### ACER and FST outputs for low versus high contrast<br>#### gene_lists<br>gene lists from all analyses as well as overlapping with gene lists found in Torabi-Marashi et al. 2025<br>### Scripts<br>#### R_Analyses<br>`JR_SA_SociabilityRNAiCrosses_March2025_ID.Rmd` - Analysis of behavioural data for RNAi experiments<br>`alleleFrequencyPlottingLoop__Sept8_2025.Rmd` - Allele Frequency plotting loop to plot identified SNPs into single PDF<br>`cmh_updated.R` - CMH test using the ACER package in R (split between autosomes and X chromosome)<br>`dokb_snps_AF_plotting.Rmd` - alternate Allele Frequency plotting for SNPs in *dokb* gene<br>`Figure1_allele_frequency_plotting.R` - alternate Code used to help generate allele frequency plot in figure 1<br>`fst_functions.R` - helper functions to plot FST<br>`gene_curations.R` - overlaps with Torabi-Marashi et al 2025 and between FST and CMH<br>`geneCurations_popGen_PostSubmit.R` - overlapping genes with other studies<br>`overlapSimulation.R` - simulation to test how likely the number of observed genes would overlap by chance<br>`read_sync_SpaceDelimited.R` - helper function to read sync files with space delimitation<br>`revisions_paper_FST_Plot.R` - Plotting FST<br>`updated_all_points_dokb_snps_AF_plotting.Rmd` - Allele Frequency plotting for SNPs in *dokb* gene<br>`updated_All_points_Figure1_allele_frequency_plotting.R` - Code used to help generate allele frequency plot in figure 1<br>#### Unix<br>Unix files to generate from BAM to sync files. All scripts are light and their titles are self explanatory to their function<br><br><br>### Intermediate Data<br>#### snp_eff_cmh_fst_overlaps - SnpEff outputs and bed files from CMH and FST outputs (to be used for SnpEff) in all contrasts<br>#### AlleleF_plotting.txt - plotting text file to pull relevant gene namesNote that anywhere in the R scripts where alleleF_plotting.txt is being used, that is just snp_eff.txt for a given contrast, just with the snpeff header removed<br><br><br>### Unix<br>Unix files for genomics analysis going from raw `.fastq` files to generate BAM to sync files. Titles are self explanatory to their function.<br>The relative order of the scripts (from `.fastq` to `.bam` to `.sync`) is:<br>#### QC & trimming adaptor and low quality sequence from sequence data<br>`fastqc_dna.sh` <br>`trim_rename.sh` <br>`trim_fastqc.sh` <br>#### Index and map reads`index_bwa.sh` <br>`bwa_map.sh` <br>#### Samtools processing<br>`sam_to_bam.sh`<br>`filter.sh`<br>`bam_fastqc.sh`<br>`bam_quality_check.sh`<br>`extractCoreGenomes.sh`<br>`sort_byName.sh`<br>`sort_byCoord.sh`<br>`fixmated.sh`<br>`markdup.sh`<br>#### Picard and GATK`picard_RG.sh`<br>`gatk_mark_indels.sh`<br>`gatk_realign.sh`<br><br>#### Merge replicates and create mpileup`ANC_merge.sh`<br>`U_merge.sh`<br>`C_merge.sh`<br>`D_merge.sh`<br>`make_mpileup.sh`<br>#### SNP Calling<br>`run_PoolSNP.sh`<br>`repeat_masker.sh`<br>`detectIndels_Kapun.sh`<br><br>#### Mpileup to Sync`mp2sync.sh`<br>`subset_syncByVCF.sh`<br>#### FST`run_fst.sh`<br>#### Annotation`local_snp_eff.sh`<br>`snpEff.sh`<br>#### Misc helper function`subset_vcf_byBed.sh`<br><br>### R_Analyses<br>`cmh_updated.R` - CMH test using the ACER package in R (split between autosomes and X chromosome)<br>`revisions_paper_FST_Plot.R` - Plotting FST<br>`fst_functions.R` - helper functions to plot FST<br>`alleleFrequencyPlottingLoop__Sept8_2025.Rmd` - Allele Frequency plotting loop to plot identified SNPs into single PDF<br>`gene_curations.R` - overlaps with Torabi-Marashi et al 2025 and between FST and CMH<br>`geneCurations_popGen_PostSubmit.R` - overlapping genes with other studies<br>`overlapSimulation.R` - simulation to test how likely the number of observed genes would overlap by chance<br>`read_sync_SpaceDelimited.R` - helper function to read sync files with space delimitation<br>`updated_all_points_dokb_snps_AF_plotting.Rmd` - Allele Frequency plotting for SNPs in dokb gene<br>`updated_All_points_Figure1_allele_frequency_plotting.R` - Code used to help generate allele frequency plot in figure 1<br>`dokb_snps_AF_plotting.Rmd` - alternate Allele Frequency plotting for SNPs in dokb gene<br>`Figure1_allele_frequency_plotting.R` - alternate Code used to help generate allele frequency plot in figure 1<br>