BiocStyle::markdown()

This vignette outlines quick conversion from the Quake et al. dataset (available to download here) to a scater object for use with embeddr.

library(scater)
library(data.table)
library(dplyr)

Fetch data from URL and convert to data.frame:

data_url <- "http://www.nature.com/nature/journal/v509/n7500/extref/nature13173-s4.txt"

d <- fread(data_url, data.table=FALSE)

## remove bulk samples:
d <- dplyr::filter(d, putative_cell_type != 'bulk')

Basic scater object has phenodata (some metadata for each cell) and a gene-by-cell expression matrix:

d_numeric <- select(d, -cell_name, -time_point, -sample, -putative_cell_type)
d_pheno <- select(d, cell_name, time_point, sample, putative_cell_type)

pd <- new('AnnotatedDataFrame', data=d_pheno)
lsce <- newSCESet(exprsData = t(d_numeric), phenoData = pd) # this is log2 data so use exprs

lsce

Now save to an R object for easy loading:

save_file <- '~/path/to/lsce.Rdata'
save(lsce, file=save_file, compress='gzip')


kieranrcampbell/embeddr documentation built on May 20, 2019, 9:24 a.m.