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, 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, sort, table,
##     tapply, union, unique, unsplit, which.max, which.min
## Loading required package: AnnotationHub
## Loading required package: BiocFileCache
## Loading required package: dbplyr
eh <- ExperimentHub()
## snapshotDate(): 2021-10-18
query(eh, "spatialDmelxsim")
## ExperimentHub with 1 record
## # snapshotDate(): 2021-10-18
## # 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)
## snapshotDate(): 2021-10-18
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")