knitr::opts_chunk$set(echo = TRUE)
options(width = 100)

Download data

The count table was downloaded from https://s3.amazonaws.com/czbiohub-tabula-muris/TM_droplet_mat.rds, following instructions on https://github.com/czbiohub/tabula-muris-vignettes/tree/master/data (accessed August 26, 2018).

The metadata was obtained from https://github.com/czbiohub/tabula-muris-vignettes/tree/master/data (accessed August 26, 2018).

suppressPackageStartupMessages({
    library(Matrix)
    library(SingleCellExperiment)
    library(readr)
    library(dplyr)
})

counts <- readRDS("TM_droplet_mat.rds")
metadata <- readr::read_csv("TM_droplet_metadata.csv")

Generate SingleCellExperiment object

stopifnot(all(colnames(counts) == metadata$cell))

droplet <- SingleCellExperiment(
    assay = list(counts = counts),
    colData = DataFrame(metadata %>% dplyr::rename(mouse_id = mouse.id,
                                                   mouse_sex = mouse.sex)),
    rowData = DataFrame(ID = rownames(counts),
                        Symbol = rownames(counts))
)

Exclude ERCCs

droplet <- droplet[grep("^ERCC-", rownames(droplet), invert = TRUE), ]
dim(droplet)

Save SingleCellExperiment object

droplet
head(colData(droplet))
saveRDS(droplet, file = "TabulaMurisDroplet.rds")

Session info

sessionInfo()


csoneson/TabulaMurisData documentation built on Nov. 2, 2024, 9:52 p.m.