knitr::opts_chunk$set( collapse = TRUE, comment = "#>", crop = NULL ## Related to https://stat.ethz.ch/pipermail/bioc-devel/2020-April/016656.html )
library(cytomapper) library(vroom) library(HDF5Array)
Start with downloading from and unzipping the dataset from: https://datadryad.org/stash/dataset/doi:10.5061%2Fdryad.jm63xsjb2
data.dir <- "data_release_baysor_merfish_gut" raw.dir <- file.path(data.dir, "raw_data") proc.dir <- file.path(data.dir, "data_analysis") baysor.dir <- file.path(proc.dir, "baysor") cellpose.dir <- file.path(proc.dir, "cellpose") baysor.cellpose.dir <- file.path(proc.dir, "baysor_membrane_prior")
Def. ileum: the final and longest segment of the small intestine.
What's there:
list.files(raw.dir)
mRNA molecule data: 820k observations for 241 genes
mol.file <- file.path(raw.dir, "molecules.csv") mol.dat <- vroom::vroom(mol.file) mol.dat <- data.frame(mol.dat) dim(mol.dat) head(mol.dat) length(unique(mol.dat$gene))
Image data:
dapi.file <- file.path(raw.dir, "dapi_stack.tif") dapi.img <- EBImage::readImage(dapi.file) dapi.img
mem.file <- file.path(raw.dir, "membrane_stack.tif") mem.img <- EBImage::readImage(mem.file) mem.img
Store in a CytoImageList
object:
cil <- cytomapper::CytoImageList(dapi = dapi.img, membrane = mem.img) cil channelNames
Plot pixels with images load in memory, takes relatively long:
system.time( cytomapper::plotPixels(cil) )
This plots the first z-layer/channel, but we can select a specific z-layer/channel of the 9 different channels in the z-stack tiffs:
cytomapper::channelNames(cil) cytomapper::plotPixels(cil, colour_by = "2") cytomapper::plotPixels(cil, colour_by = "3")
cur_dir <- HDF5Array::getHDF5DumpDir()
Write to HDF5, takes very long:
system.time( cli.hdf5 <- cytomapper::loadImages(raw.dir, pattern = ".tif$", on_disk = TRUE, h5FilesPath = cur_dir) ) cli.hdf5
Plot pixels using hdf5 backend:
system.time( cytomapper::plotPixels(cli.hdf5) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.