Using the SPEC function

Chris Bolen

2018-05-24

The spec package is extremely simple, and was specifically designed to be easy and quick to use. Here, we present

Installation

The SPEC pacakge tarball can be dowloaded from the Kleinstein lab webpage at: http://clip.med.yale.edu/SPEC/

Once downloaded, install the package using the following:

install.packages("spec_0.5.0.tar.gz")

The package can then be loaded using the following:

library(spec)

Running SPEC

The first step is to read in a matrix of expression values. Here, I’m using a “test matrix” that’s included with the SPEC package.

##read in your expression matrix here. 
fn = system.file("extdata", "Test_matrix.csv", package = "spec")
exprsVals = read.csv(fn, row.names=1)

Note that the expression matrix should have rows of genes and columns of samples, and that the rownames should be Hgnc gene symbols. If not using standard Hgnc symbols, then you will have to provide your own set of subset signatures (see below).

The first step in the SPEC process is to cacluate the cell subset enrichment, using the cellSubsetEnrich function. By default, this uses the irisSignatures data, which is included with the SPEC installation.

##calculate the enrichment of the cell subsets. 
##The default uses the cell signatures from Abbas et al.
subsetEnrichment = cellSubsetEnrich(exprsVals)
## No cell subsets provided; Using the IRIS gene signatures.

We can also provide our own list of cell subset signatures:

subsetEnrichment = cellSubsetEnrich(exprsVals, subsets=palmerSignatures)

Now, we need to generate our “query” signature. Here, we’ll just use the “B cell” signature from the Palmer collection.

querySig = palmerSignatures[["PalmerB"]]

Note that, for best performance, the signature should contain more than 15 genes.

Finally, we’ll run the SPEC function to both calculate the enrichment of the query signature, and correlate the query enrichment scores with the subset enrichment.

##calculate the correlation matrix for the query signatures of interest
SPEC(exprsVals, querySig, subsetEnrichment)
##                  query
## IrisB       0.07470089
## IrisT       0.40625484
## IrisNK     -0.35254474
## IrisDC     -0.22217125
## IrisNeutro -0.28330932
## IrisMye     0.38207924
## IrisMono    0.16200506
## IrisLymph  -0.30520150