Contents

1 Allelic counts of D melanogaster x D simulans cross

This package contains data of allelic expression counts of spatial slices of a fly embryo, which is a D melanogaster x D simulans cross. The experiment is a reciprocal cross (see strain), with three replicates of one parental arrangement and two of another, which was sufficient to ensure at least one embryo of each sex for each parental arrangement.

Data was downloaded from GSE102233 as described in the publication:

Combs PA, Fraser HB (2018) Spatially varying cis-regulatory divergence in Drosophila embryos elucidates cis-regulatory logic. PLOS Genetics 14(11): e1007631. https://doi.org/10.1371/journal.pgen.1007631

The scripts for creating the SummarizedExperiment object can be found in inst/scripts/make-data.R.

We can find the resource via ExperimentHub:

library(ExperimentHub)
## Loading required package: BiocGenerics
## 
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
##     as.data.frame, basename, cbind, colnames, dirname, do.call,
##     duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
##     lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
##     pmin.int, rank, rbind, rownames, sapply, setdiff, table, tapply,
##     union, unique, unsplit, which.max, which.min
## Loading required package: AnnotationHub
## Loading required package: BiocFileCache
## Loading required package: dbplyr
eh <- ExperimentHub()
query(eh, "spatialDmelxsim")
## ExperimentHub with 1 record
## # snapshotDate(): 2023-10-24
## # names(): EH6129
## # package(): spatialDmelxsim
## # $dataprovider: Fraser Lab, Stanford
## # $species: Drosophila melanogaster
## # $rdataclass: RangedSummarizedExperiment
## # $rdatadateadded: 2021-06-16
## # $title: spatialDmelxsim
## # $description: Allelic expression counts of spatial slices of a fly embryo ...
## # $taxonomyid: 7227
## # $genome: dm6
## # $sourcetype: TXT
## # $sourceurl: https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE102233
## # $sourcesize: NA
## # $tags: c("allelic", "ASE", "Drosophila_melanogaster_Data", "embryo",
## #   "ExpressionData", "GEO", "patterning", "RNASeqData",
## #   "SequencingData", "spatial") 
## # retrieve record with 'object[["EH6129"]]'

Or load directly with a function defined within this package:

suppressPackageStartupMessages(library(SummarizedExperiment))
library(spatialDmelxsim)
se <- spatialDmelxsim()
## see ?spatialDmelxsim and browseVignettes('spatialDmelxsim') for documentation
## loading from cache

The rownames of the SummarizedExperiment are Ensembl IDs. For simplicity of code for plotting individual genes, we will change the rownames to gene symbols (those used in the paper). We check first that all genes have a symbol, because rownames cannot contain an NA.

table(is.na(mcols(se)$paper_symbol))
## 
## FALSE 
## 13498
rownames(se) <- mcols(se)$paper_symbol

Note we use the following annotation of alleles:

Then we calculate the allelic ratio for D simulans allele:

assay(se, "total") <- assay(se, "a1") + assay(se, "a2") 
assay(se, "ratio") <- assay(se, "a1") / assay(se, "total")

We plot the ratio over the slice, using the normSlice column of metadata. This is the original slice number, scaled up to 27 (rep2 had 26 slices and rep4 had 25 slices).

plotGene <- function(gene) {
    x <- se$normSlice
    y <- assay(se, "ratio")[gene,]
    col <- as.integer(se$rep)
    plot(x, y, xlab="normSlice", ylab="sim / total ratio",
        ylim=c(0,1), main=gene, col=col)
    lw <- loess(y ~ x, data=data.frame(x,y=unname(y)))
    lines(sort(lw$x), lw$fitted[order(lw$x)], col="red", lwd=2)
    abline(h=0.5, col="grey")
}

An example of a gene with global bias toward the simulans allele.

plotGene("DOR")

Example of some genes with spatial patterning of allelic expression:

plotGene("uif")

plotGene("bmm")

plotGene("hb")

plotGene("CG4500")

Other interesting spatial genes can be found by consulting the Combs and Fraser (2018) paper, in Supplementary Figure 6 “Complete heatmap of ASE for genes with svASE.” Other species-specific genes are found in Supplementary Figure 7 “Genes with species-specific expression, regardless of parent of origin.” Note that the SF6 spatially varying ASE genes are labelled in mcols(se)$scASE.

2 Additional details

As said above, the file inst/scripts/make-data.R provides the script that was used to construct the SummarizedExperiment object from the data available on GEO. Here are some additional details:

sessionInfo()
## R Under development (unstable) (2023-10-22 r85388)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 22.04.3 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.19-bioc/R/lib/libRblas.so 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## time zone: America/New_York
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] spatialDmelxsim_1.9.0       SummarizedExperiment_1.33.0
##  [3] Biobase_2.63.0              GenomicRanges_1.55.1       
##  [5] GenomeInfoDb_1.39.0         IRanges_2.37.0             
##  [7] S4Vectors_0.41.1            MatrixGenerics_1.15.0      
##  [9] matrixStats_1.0.0           ExperimentHub_2.11.0       
## [11] AnnotationHub_3.11.0        BiocFileCache_2.11.1       
## [13] dbplyr_2.4.0                BiocGenerics_0.49.0        
## [15] BiocStyle_2.31.0           
## 
## loaded via a namespace (and not attached):
##  [1] tidyselect_1.2.0              dplyr_1.1.3                  
##  [3] blob_1.2.4                    filelock_1.0.2               
##  [5] Biostrings_2.71.1             bitops_1.0-7                 
##  [7] fastmap_1.1.1                 RCurl_1.98-1.12              
##  [9] promises_1.2.1                digest_0.6.33                
## [11] mime_0.12                     lifecycle_1.0.3              
## [13] ellipsis_0.3.2                KEGGREST_1.43.0              
## [15] interactiveDisplayBase_1.41.0 RSQLite_2.3.2                
## [17] magrittr_2.0.3                compiler_4.4.0               
## [19] rlang_1.1.1                   sass_0.4.7                   
## [21] tools_4.4.0                   utf8_1.2.4                   
## [23] yaml_2.3.7                    knitr_1.45                   
## [25] S4Arrays_1.3.0                bit_4.0.5                    
## [27] curl_5.1.0                    DelayedArray_0.29.0          
## [29] abind_1.4-5                   withr_2.5.2                  
## [31] purrr_1.0.2                   grid_4.4.0                   
## [33] fansi_1.0.5                   xtable_1.8-4                 
## [35] cli_3.6.1                     rmarkdown_2.25               
## [37] crayon_1.5.2                  generics_0.1.3               
## [39] httr_1.4.7                    DBI_1.1.3                    
## [41] cachem_1.0.8                  zlibbioc_1.49.0              
## [43] AnnotationDbi_1.65.0          BiocManager_1.30.22          
## [45] XVector_0.43.0                vctrs_0.6.4                  
## [47] Matrix_1.6-1.1                jsonlite_1.8.7               
## [49] bookdown_0.36                 bit64_4.0.5                  
## [51] magick_2.8.1                  jquerylib_0.1.4              
## [53] glue_1.6.2                    BiocVersion_3.19.1           
## [55] later_1.3.1                   tibble_3.2.1                 
## [57] pillar_1.9.0                  rappdirs_0.3.3               
## [59] htmltools_0.5.6.1             GenomeInfoDbData_1.2.11      
## [61] R6_2.5.1                      evaluate_0.22                
## [63] shiny_1.7.5.1                 lattice_0.22-5               
## [65] highr_0.10                    png_0.1-8                    
## [67] memoise_2.0.1                 httpuv_1.6.12                
## [69] bslib_0.5.1                   Rcpp_1.0.11                  
## [71] SparseArray_1.3.0             xfun_0.40                    
## [73] pkgconfig_2.0.3