Methods to obtain scores for CMAPCollection gene sets from a matrix or eSet

Share:

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

 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
## S4 method for signature 'CMAPCollection,eSet'
featureScores(query, dat, element="z",simplify=TRUE)

## S4 method for signature 'CMAPCollection,matrix'
featureScores(query,dat, simplify=TRUE)

## S4 method for signature 'CMAPCollection,BigMatrix'
featureScores(query, dat, simplify=TRUE)

## S4 method for signature 'eSet,CMAPCollection'
featureScores(query, dat, element="z")

## S4 method for signature 'matrix,CMAPCollection'
featureScores(query, dat)

## S4 method for signature 'BigMatrix,CMAPCollection'
featureScores(query, dat)

## S4 method for signature 'CMAPCollection,numeric'
featureScores(query, dat)

## S4 method for signature 'CMAPCollection,CMAPCollection'
featureScores(query, dat)

## S4 method for signature 'numeric,CMAPCollection'
featureScores(query, dat)

## S4 method for signature 'CMAPCollection,matrix_or_big.matrix'
featureScores(query, dat, simplify = TRUE)

## S4 method for signature 'matrix_or_big.matrix,CMAPCollection'
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")

}

Author(s)

Thomas Sandmann

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
  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"
    )

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.