Learn R Programming

gCMAP (version 1.16.0)

featureScores-methods: Methods to obtain scores for CMAPCollection gene sets from a matrix or eSet

Description

These methods extract the scores for CMAPCollection gene set members from eSet or matrix objects and return them as a list (argument 'query') of lists (argument 'dat') with score vectors. Argument order determines the organization of the list, e.g. if 'query' is a CMAPCollection, one list element is returned for each gene set, containing all score vectors for the respective set. If 'simplify' is set to TRUE, score vectors are combined and a list of matrices is returned instead. Score vectors and matrices carries an additional 'sign' attribute corresponding to the sign annotated in the CMAPCollection.

Usage

"featureScores"(query, dat, element="z",simplify=TRUE)
"featureScores"(query,dat, simplify=TRUE)
"featureScores"(query, dat, simplify=TRUE)
"featureScores"(query, dat, element="z")
"featureScores"(query, dat)
"featureScores"(query, dat)
"featureScores"(query, dat)
"featureScores"(query, dat)
"featureScores"(query, dat)
"featureScores"(query, dat, simplify = TRUE)
"featureScores"(query, dat)

Arguments

query
A CMAPCollection, eSet or matrix.
dat
A CMAPCollection, eSet or matrix.
element
Character string specifying which assayDataElement to extract from eSet objects.
simplify
Logical: when possible, should score columns for each gene set collected in a matrix ?

Value

A nested list: one list element for each 'query', containing a list with score vectors for each 'dat'.

Methods

signature(query = "CMAPCollection", dat = "eSet")
}
signature(query = "CMAPCollection", dat = "matrix")
}
signature(query = "CMAPCollection", dat = "BigMatrix")
}
signature(query = "eSet", dat = "CMAPCollection")
}
signature(query = "matrix", dat = "CMAPCollection")
}
signature(query = "BigMatrix", dat = "CMAPCollection")
}
signature(query = "CMAPCollection", dat = "numeric")
}
signature(query = "CMAPCollection", dat = "CMAPCollection")
}
signature(query = "numeric", dat = "CMAPCollection")
}
signature(query = "matrix_or_big.matrix", dat = "CMAPCollection")
}
signature(query = "CMAPCollection", dat = "matrix_or_big.matrix")
}

Examples

Run this code
  data(gCMAPData)
  ## generate CMAPCollection with two sets (drug1, drug2)
  sets <- induceCMAPCollection(gCMAPData, "z", higher=-2, lower=2)[,1:2]
  sampleNames(sets) <- c("set1", "set2")
  
  ## extract per-gene scores as matrices
  res <- featureScores(sets, gCMAPData)
  class(res) ## list
  names(res) ## one element per set
  class(res[["set1"]]) ## matrix
  dim(res[["set1"]])

  ## or as lists of score vectors
  res2 <- featureScores(sets, gCMAPData, simplify=FALSE)
  class(res2[["set1"]]) ## list
  length(res2[["set1"]])

  ## stripplot for set2, colored by annotated sign
  m <- res[["set2"]][,"drug2"]
  colors <- ifelse( attr(res[["set2"]], "sign") == "up", "red", "blue")
  gene.sign <- factor( attr(res[["set2"]], "sign"))
  boxplot( 
    m ~ gene.sign,
    col=c("blue", "red"),
    ylab="z-score", 
    xlab="Query gene sign",
    main="Set 2"
    )

Run the code above in your browser using DataLab