Description Details Author(s) References Examples
SAM for Cell-specific Differential Expression SAM.
Package: | csSAM |
Type: | Package |
Version: | 1.2 |
Date: | 2011-10-08 |
License: | LGPL |
LazyLoad: | yes |
Tissues are often made up of multiple cell-types. Each with its own functional attributes and molecular signature. Yet, the proportions of any given cell-type in a sample can vary markedly. This results in a significant loss of sensitivity in gene expression studies and great difficulty in identifying the cellular source of any perturbations. Here we present a statistical methodology (cell-type specific Significance Analysis of Microarrays or csSAM) which, given microarray data from two groups of biological samples and the relative cell-type frequencies of each sample, estimates in a virtual manner the gene expression data for each cell-type at a group level, and uses these to identify differentially expressed genes at a cell-type specific level between groups. The lower limit for the number of samples needed for deconvolving the cell-specific expression of N cell-types is N+1. For a singe color array - the result could be interperted as the avg. expression level of a given gene in a cell-type of that group. Multiplied by the frequecy of a given cell-type in an individual in the group, it is the amount contributed by that cell type to the overall measured expression on the array. | |
Key functions for this package: | |
csSamWrapper - Single wrapper function performs all functionality. csfit: For deconvolving the average cell-type specific expression for each cell-type in a given group. | |
csSAM: For calculating the constrast between every pair of cells being compared between the two groups. | |
fdrCsSAM: Estimate the false discovery rate for each cell-type specific comparison. | |
findSigGenes:Identifies the list of differentially expressed genes in a given cell-type at a given FDR cutoff. | |
plotCsSAM:Plots a fdr plot of ther results. | |
Additional functions exists (runSAM and fdrSAM to contrast csSAM with the tissue heterogeneity ignorant SAM).
Shai Shen-Orr, Rob Tibshirani, Narasimhan Balasubramanian, David Wang
Maintainer: Shai Shen-Orr <shenorr@stanford.edu>
Shen-Orr SS, Tibshirani R, Khatri P, Bodian DL, Staedtler F, Perry NM, Hastie T, Sarwal MM, Davis MM and Butte AJ (2010). "Cell type-specific gene expression differences in complex tissues." _Nature methods_, *7*(4), pp. 287-9. ISSN 1548-7105, <URL: http://dx.doi.org/10.1038/nmeth.1439>, <URL: http://www.ncbi.nlm.nih.gov/pubmed/20208531>.
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | library("csSAM")
##
## Generate random dataset
##
set.seed(143)
k <- 5 # number of cell types
ng <- 500 # number of genes
p <- 20 # number of samples
ndiff <- 100 # number of genes differentially expressed
# true cell-specific signatures
H1 <- matrix(rnorm(5*ng), ncol=ng)
H2 <- H1
# create differential expression for 3rd cell type
H2[3,1:ndiff] <- H2[3,1:ndiff] + 5
# cell frequency matrix per sample
cc <- matrix(runif(p*k), ncol=k)
cc <- t(scale(t(cc), center=FALSE, scale=rowSums(cc)))
colnames(cc) <- paste('cellType', 1:ncol(cc), sep="")
# global expression matrix
G <- rbind(cc[1:10, ] %*% H1, cc[11:p, ] %*%H2 ) + matrix(rnorm(p*ng), ncol=ng)
# sample classes (2 groups)
y <- gl(2, p/2)
fileName = "Example File.pdf";
# Now run, either using the wrapper
# NB: more permutations would be needed for real data
deconvResults = csSamWrapper(G, cc, y, nperms = 50, alternative = "two.sided"
, standardize = TRUE
, medianCenter = TRUE
, fileName = fileName)
# Or by calling each function independently:
# this is useful if you want to perform only cell-specific expression
# without differential expression.
## Not run:
numset = nlevels(y)
n <- summary(y, maxsum=Inf) # number of samples in each class
numgene = ncol(G)
numcell = ncol(cc)
geneID = colnames(G)
cellID = colnames(cc)
deconv <- list()
# run analysis
for (curset in levels(y))
deconv[[curset]]= csfit(cc[y==curset,], G[y==curset,])
rhat <- array(dim = c(numcell,numgene))
rhat[, ] <- csSAM(deconv[[1]]$ghat, deconv[[1]]$se,
n[1], deconv[[2]]$ghat, deconv[[2]]$se, n[2],
standardize=TRUE, medianCenter=TRUE, nonNeg=TRUE)
tt.sam <- runSAM(G, y)
falseDiscovR <- fdrCsSAM(G,cc,y,n,numcell,numgene, rhat,
nperms = 200,standardize=TRUE,alternative='two.sided',
medianCenter=TRUE, nonNeg=TRUE)
falseDiscovRSAM <- fdrSAM(G, y, nperms=200, alternative = 'two.sided',tt.sam)
sigGene <- findSigGene(G, cc, y, rhat, falseDiscovR)
plotCsSAM(falseDiscovR, falseDiscovRSAM,alternative='two.sided',cellID,numcell, fileName)
print (falseDiscovR$fdr.g[ , ] )
## End(Not run)
|
Loading required package: compiler
Warning messages:
1: In xy.coords(x, y, xlabel, ylabel, log) :
1 x value <= 0 omitted from logarithmic plot
2: In xy.coords(x, y, xlabel, ylabel, log) :
1 x value <= 0 omitted from logarithmic plot
3: In xy.coords(x, y, xlabel, ylabel, log) :
1 x value <= 0 omitted from logarithmic plot
4: In xy.coords(x, y, xlabel, ylabel, log) :
1 x value <= 0 omitted from logarithmic plot
5: In xy.coords(x, y, xlabel, ylabel, log) :
1 x value <= 0 omitted from logarithmic plot
6: In xy.coords(x, y, xlabel, ylabel, log) :
1 x value <= 0 omitted from logarithmic plot
png
2
Warning messages:
1: In xy.coords(x, y, xlabel, ylabel, log) :
1 x value <= 0 omitted from logarithmic plot
2: In xy.coords(x, y, xlabel, ylabel, log) :
1 x value <= 0 omitted from logarithmic plot
3: In xy.coords(x, y, xlabel, ylabel, log) :
1 x value <= 0 omitted from logarithmic plot
4: In xy.coords(x, y, xlabel, ylabel, log) :
1 x value <= 0 omitted from logarithmic plot
5: In xy.coords(x, y, xlabel, ylabel, log) :
1 x value <= 0 omitted from logarithmic plot
6: In xy.coords(x, y, xlabel, ylabel, log) :
1 x value <= 0 omitted from logarithmic plot
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[2,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[3,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.9944281
[4,] 0.9914516 0.9914516 0.9904532 0.9744428 0.9744428 0.9744428 0.9744428
[5,] 0.9243360 0.9092127 0.9016619 0.9016619 0.9016619 0.9014127 0.9014127
[,8] [,9] [,10] [,11] [,12] [,13] [,14]
[1,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[2,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[3,] 0.9672000 0.9672000 0.9672000 0.9386090 0.9386090 0.9386090 0.9386090
[4,] 0.9744428 0.9743939 0.9637598 0.9500408 0.9324895 0.9324895 0.9324895
[5,] 0.9014127 0.9014127 0.9014127 0.9014127 0.9014127 0.8995532 0.8995532
[,15] [,16] [,17] [,18] [,19] [,20] [,21]
[1,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[2,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 0.9882927 0.9778662
[3,] 0.9350233 0.9226214 0.9174490 0.9118011 0.8931844 0.8931844 0.8909434
[4,] 0.9324895 0.9324895 0.9324895 0.9184770 0.9184770 0.9184770 0.9184770
[5,] 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532
[,22] [,23] [,24] [,25] [,26] [,27] [,28]
[1,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[2,] 0.9778662 0.9778662 0.9778662 0.9778662 0.9494672 0.9230085 0.9199107
[3,] 0.8740461 0.8503401 0.8421071 0.8421071 0.8421071 0.8409565 0.8225909
[4,] 0.9184770 0.9176154 0.8690698 0.8690698 0.8690698 0.8690698 0.8690698
[5,] 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532
[,29] [,30] [,31] [,32] [,33] [,34] [,35]
[1,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[2,] 0.9141981 0.9094500 0.9008421 0.9008421 0.9008421 0.9008421 0.9008421
[3,] 0.8196602 0.7992929 0.7692187 0.7692187 0.7515698 0.7256627 0.7256627
[4,] 0.8690698 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857
[5,] 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532
[,36] [,37] [,38] [,39] [,40] [,41] [,42]
[1,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[2,] 0.9008421 0.9008421 0.8865323 0.8865323 0.8700000 0.8700000 0.8700000
[3,] 0.7256627 0.7256627 0.7169048 0.7169048 0.7169048 0.7076471 0.7076471
[4,] 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857
[5,] 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532
[,43] [,44] [,45] [,46] [,47] [,48] [,49]
[1,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[2,] 0.8471739 0.8471739 0.8471739 0.8471739 0.8471739 0.8471739 0.8463333
[3,] 0.7076471 0.7076471 0.7076471 0.7076471 0.7076471 0.7076471 0.7076471
[4,] 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857
[5,] 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532
[,50] [,51] [,52] [,53] [,54] [,55] [,56]
[1,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[2,] 0.8463333 0.8463333 0.8450000 0.7891667 0.7573913 0.7315909 0.7085714
[3,] 0.7076471 0.7076471 0.7076471 0.7076471 0.7076471 0.7076471 0.7076471
[4,] 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857
[5,] 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532
[,57] [,58] [,59] [,60] [,61] [,62] [,63]
[1,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[2,] 0.6514286 0.6514286 0.6514286 0.6514286 0.6514286 0.6417857 0.5946429
[3,] 0.7076471 0.7076471 0.7076471 0.6583333 0.6045833 0.5570833 0.5070833
[4,] 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857
[5,] 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532 0.8995532
[,64] [,65] [,66] [,67] [,68] [,69] [,70]
[1,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[2,] 0.5946429 0.5461538 0.5026923 0.4630769 0.4562500 0.4129167 0.4129167
[3,] 0.5054545 0.5054545 0.5054545 0.4733333 0.4733333 0.4625000 0.4237500
[4,] 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857
[5,] 0.8970000 0.8255000 0.8255000 0.7783333 0.7783333 0.7783333 0.7783333
[,71] [,72] [,73] [,74] [,75] [,76] [,77]
[1,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[2,] 0.3777273 0.3777273 0.3777273 0.3777273 0.3777273 0.3777273 0.3777273
[3,] 0.4237500 0.4237500 0.4237500 0.4237500 0.4237500 0.4237500 0.4237500
[4,] 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857
[5,] 0.7357143 0.7357143 0.7357143 0.7357143 0.7357143 0.7357143 0.7357143
[,78] [,79] [,80] [,81] [,82] [,83] [,84]
[1,] 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
[2,] 0.3777273 0.3777273 0.3777273 0.3777273 0.3777273 0.3777273 0.3777273
[3,] 0.4087500 0.3837500 0.3437500 0.3062500 0.2787500 0.2787500 0.2787500
[4,] 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857 0.8392857
[5,] 0.7357143 0.6812500 0.6300000 0.6300000 0.6300000 0.6300000 0.5966667
[,85] [,86] [,87] [,88] [,89] [,90] [,91]
[1,] 1.0000000 1.0000000 0.9900000 0.9387500 0.9387500 0.9387500 0.9387500
[2,] 0.3683333 0.3316667 0.3316667 0.3316667 0.3316667 0.3316667 0.3175000
[3,] 0.2683333 0.2416667 0.2150000 0.2050000 0.1866667 0.1816667 0.1550000
[4,] 0.8392857 0.8392857 0.8392857 0.7850000 0.7350000 0.6800000 0.6250000
[5,] 0.5966667 0.5966667 0.5966667 0.5966667 0.5966667 0.5966667 0.5966667
[,92] [,93] [,94] [,95] [,96] [,97] [,98]
[1,] 0.9387500 0.9387500 0.9387500 0.9387500 0.9387500 0.9387500 0.9387500
[2,] 0.2900000 0.2600000 0.2425000 0.2225000 0.1900000 0.1900000 0.1900000
[3,] 0.1400000 0.1266667 0.1133333 0.1133333 0.1133333 0.1133333 0.1133333
[4,] 0.5950000 0.5300000 0.4750000 0.4300000 0.3900000 0.3500000 0.3250000
[5,] 0.5966667 0.5966667 0.5966667 0.5966667 0.5966667 0.5950000 0.5400000
[,99] [,100]
[1,] 0.9387500 0.9387500
[2,] 0.1900000 0.1900000
[3,] 0.1133333 0.1133333
[4,] 0.3000000 0.3000000
[5,] 0.4750000 0.4750000
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.