checkNames: x

Usage Arguments Examples

Usage

1
checkNames(eset)

Arguments

eset

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (eset) 
{
    require(Biobase)
    check.feature <- intersect(rownames(Biobase::exprs(eset)), 
        rownames(Biobase::fData(eset)))
    if (length(check.feature) == 0) {
        warning("Names of features do not match between expressions and annotations")
        return(NULL)
    }
    else {
        if (length(check.feature) != nrow(Biobase::exprs(eset)) || 
            length(check.feature) != nrow(Biobase::fData(eset))) {
            warning("Some features are missing between expressions and annotations")
        }
    }
    check.sample <- intersect(colnames(Biobase::exprs(eset)), 
        rownames(Biobase::pData(eset)))
    if (length(check.sample) == 0) {
        warning("Names of samples do not match between expressions and phenotypes")
        return(NULL)
    }
    else {
        if (length(check.sample) != ncol(Biobase::exprs(eset)) || 
            length(check.sample) != nrow(Biobase::pData(eset))) {
            warning("Some samples are missing between expressions and phenotypes")
        }
    }
    Biobase::exprs(eset) <- Biobase::exprs(eset)[check.feature, 
        check.sample, drop = FALSE]
    Biobase::fData(eset) <- Biobase::fData(eset)[check.feature, 
        , drop = FALSE]
    Biobase::pData(eset) <- Biobase::pData(eset)[check.sample, 
        , drop = FALSE]
    Biobase::pData(eset)[, "samplename"] <- rownames(Biobase::pData(eset))
    return(eset)
  }

bhklab/MetaGx documentation built on May 12, 2019, 8:25 p.m.