R/extract_assay.R

Defines functions extract_assay

Documented in extract_assay

extract_assay <- function(name, Assay, groups,
groupinfo = NULL, addgroupnames = TRUE){

    allassays <- assays(name)
    selectedassay <- allassays[[Assay]]
    x <- groupinfo
    x <- x[x$group %in% groups,,drop = FALSE]
    y <- name[[Assay]]
    y =  y[rownames(y) %in% rownames(x),]

    x <- x[match(rownames(y), rownames(x)),,drop = FALSE]

    if(addgroupnames){
    y <- cbind(y,x)
    }


    return(y)
}

Try the OMICsPCA package in your browser

Any scripts or data that you put into this service are public.

OMICsPCA documentation built on Nov. 8, 2020, 5:01 p.m.