Code Monkey home page Code Monkey logo

delayedplier's Introduction

DelayedPLIER

Example

We first create a toy example using an available large-scale scRNA-seq

library(TENxPBMCData)
sce <- TENxPBMCData("pbmc4k")
mat <- counts(sce)
rownames(mat) <- rowData(sce)$ENSEMBL_ID 
colnames(mat) <- colData(sce)$Sequence
writeHDF5Array(mat, filepath = "counts.hdf5", name = "count")
saveRDS(list(row.names = rowData(sce)$ENSEMBL_ID , col.names = colData(sce)$Sequence), file = "dimnames.RDS")

In the latest version of HDF5Array, dimension names can be written in to the hdf5 file directly writeHDF5Array(mat, filepath = "counts.hdf5", name = "count", with.dimnames=T)

Load all functions in funcs.R

source("funcs.R") #glmnet and HDF5Array will be loaded 
setAutoRealizationBackend("HDF5Array") #supportedRealizationBackends(), getRealizationBackend()

Read in the file we just created. The name can be verified via h5ls("counts.hdf5")

sce <- DelayedArray(seed = HDF5ArraySeed(filepath = "counts.hdf5", name = "count"))

Read the dimension names

dimnamaes <- readRDS("dimnames.RDS")
rownames(sce) <- dimnamaes$row.names
colnames(sce) <- dimnamaes$col.names

Remove all NA values and genes that are not differentially expressed

sce[is.na(sce)] <- 0
data <- sce[which(DelayedMatrixStats::rowSds(sce) >0),]

Read in prior information matrix

priorMat <- readRDS("canonicalPathways_ENSG.RDS")

Run the DelayedPLIER PLIER.res$residual, PLIER.res$Z and PLIER.res$B are stored as three on-disk files instead of variables in the memory. PLIER() function will realize and write these three to hard disk based on the output_path. Other values are still in the memory can be directly accessed via PLIER.res$'name of the values'

ptm <- proc.time()
PLIER.res <- PLIER(data, priorMat, output_path = "output/")
print(proc.time()-ptm)

Tutorial

Basic Functions & Tutorial

  1. https://www.bioconductor.org/packages/release/bioc/vignettes/MultiAssayExperiment/inst/doc/UsingHDF5Array.html
  2. https://bioconductor.github.io/BiocWorkshops/effectively-using-the-delayedarray-framework-to-support-the-analysis-of-large-datasets.html#
  3. http://biocworkshops2019.bioconductor.org.s3-website-us-east-1.amazonaws.com/page/DelayedArrayWorkshop__Effectively_using_the_DelayedArray_framework_for_users/

Available Delayed Operators

  1. DelayedArray-utils https://www.rdocumentation.org/packages/HDF5Array/versions/1.0.2/topics/DelayedArray-utils
  2. DelayedMatrixStats https://www.bioconductor.org/packages/release/bioc/vignettes/DelayedMatrixStats/inst/doc/DelayedMatrixStatsOverview.html
  3. BiocSingular https://master.bioconductor.org/packages/devel/bioc/manuals/BiocSingular/man/BiocSingular.pdf

delayedplier's People

Contributors

wgmao avatar msubirana avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.