[BioC] edgeR glmFit

Mark Robinson mark.robinson at imls.uzh.ch
Wed Dec 18 16:12:17 CET 2013


Hi Jahn,

Chapter 3 demonstrates the setup of design matrices; 3.1 says "In this chapter, we outline the principles for setting up the design matrix and forming contrasts for some typical experimental designs".  You would then combine that with what is shown in "1.4 Quick start" to do all the steps, something like:

> design <- model.matrix(~<add yours here>)
> y <- estimateGLMCommonDisp(y,design)
> y <- estimateGLMTrendedDisp(y,design)
> y <- estimateGLMTagwiseDisp(y,design)
> fit <- glmFit(y,design)
> lrt <- glmLRT(fit,coef=<add yours here>)
> topTags(lrt)

In particular, you might have a look at some of the case studies in Chapter 4, for example 4.4 (but using your design matrix).

Hope that helps.

Best, Mark


----------
Prof. Dr. Mark Robinson
Bioinformatics, Institute of Molecular Life Sciences
University of Zurich
http://ow.ly/riRea






On 18.12.2013, at 11:21, Jahn Davik [guest] <guest at bioconductor.org> wrote:

> 
> I am working my way through the edgeR User's Guide and following section 3.3, I encounter a problem. I run the following commands - using my own counts data:
> ## Chapt 3.3 i Users Guide
> 
> cots<-read.table("H:/bip1/RNAseq/Data/transcriptsRed.counts.matrix",header=T)
> head(cots)
> data = as.matrix(cots);
> y = round(data);
> head(y)
> 
> dim(data)
> 
> targets<-read.table("H:/bip1/RNAseq/Data/targets.txt",header=T)
> targets
> 
> # setting up a combined factor
> 
> Group<-factor(paste(targets$Treat,targets$Time,sep="."))
> cbind(targets,Group=Group)
> 
> design<-model.matrix(~0+Group)
> colnames(design)<-levels(Group)
> design
> 
> fit<-glmFit(y,design)
> 
> sessionInfo()
> 
> Resulting in 'Error in glmFit.default(y, design) : No dispersion values provided.'
> 
> I do not quite see where my mistake is and would appreciate help.
> Thank you.
> 
> jahn
> 
> 
> 
> 
> 
> 
> 
> 
> -- output of sessionInfo(): 
> 
> cots<-read.table("H:/bip1/RNAseq/Data/transcriptsRed.counts.matrix",header=T)
>> head(cots)
>                    E00R1  E00R2  E00R3 E01R1  E01R2  E01R3  E05R1 E05R2 E05R3  E48R2 E48R3 E96R1 E96R2 E96R3  J00R1 J00R2  J00R3 J01R1
> comp168996_c1_seq1    0.00   0.00   0.00  0.00   0.00   0.00   0.00  0.00  0.00   0.00  0.00  0.00  0.00  0.00   0.00  0.00   0.00  0.00
> comp442719_c0_seq1    0.00   0.00   0.00  0.00   0.00   0.00   0.00  0.00  0.00   0.00  0.00  0.00  0.00  0.00   0.00  0.00   0.00  0.00
> comp436057_c0_seq13   0.00   7.38  21.04  0.00   0.00   0.21  21.65  0.00  0.00   0.00  0.86  0.57  9.69 18.73   0.00  0.00   0.00  7.14
> comp415319_c0_seq20  28.17   0.00   0.00  0.00   0.00   0.00   0.00  0.00  0.00   0.00  0.00  0.00  0.00  0.00   0.00  0.00   0.00  0.00
> comp428135_c0_seq8  249.73 228.53 172.18 57.52 104.48 113.96 187.05 94.64 84.65 134.65 99.82  0.00 65.46 82.83 219.37 59.18 134.04 81.56
> comp73458_c0_seq1     0.00   0.00   0.00  0.00   0.00   0.00   0.00  0.00  2.00   0.00  0.00  0.00  0.00  0.00   0.00  0.00   0.00  0.00
>                   J01R2  J01R3  J05R1  J05R2 J05R3 J48R2 J48R3 J96R1  J96R2  J96R3
> comp168996_c1_seq1   1.00   0.00   1.00   0.00  0.00  0.00     0  0.00   0.00   0.00
> comp442719_c0_seq1   0.00   0.00  35.09   0.00  0.00  0.00     0  0.00   0.00   0.00
> comp436057_c0_seq13  3.07   0.00   0.05   0.00  0.00 19.09     0  0.60   0.00   0.00
> comp415319_c0_seq20  0.00   0.00   0.00   0.00  0.00  0.00     0  0.00   0.00   0.00
> comp428135_c0_seq8  87.00 188.03 177.74 115.65 75.66 26.50     0 41.02 131.62 101.48
> comp73458_c0_seq1    0.00   1.00   0.00   0.00  0.00  0.00     0  0.00   0.00   0.00
>> data = as.matrix(cots);
>> y = round(data);
>> head(y)
>                   E00R1 E00R2 E00R3 E01R1 E01R2 E01R3 E05R1 E05R2 E05R3 E48R2 E48R3 E96R1 E96R2 E96R3 J00R1 J00R2 J00R3 J01R1 J01R2
> comp168996_c1_seq1      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     1
> comp442719_c0_seq1      0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
> comp436057_c0_seq13     0     7    21     0     0     0    22     0     0     0     1     1    10    19     0     0     0     7     3
> comp415319_c0_seq20    28     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
> comp428135_c0_seq8    250   229   172    58   104   114   187    95    85   135   100     0    65    83   219    59   134    82    87
> comp73458_c0_seq1       0     0     0     0     0     0     0     0     2     0     0     0     0     0     0     0     0     0     0
>                   J01R3 J05R1 J05R2 J05R3 J48R2 J48R3 J96R1 J96R2 J96R3
> comp168996_c1_seq1      0     1     0     0     0     0     0     0     0
> comp442719_c0_seq1      0    35     0     0     0     0     0     0     0
> comp436057_c0_seq13     0     0     0     0    19     0     1     0     0
> comp415319_c0_seq20     0     0     0     0     0     0     0     0     0
> comp428135_c0_seq8    188   178   116    76    26     0    41   132   101
> comp73458_c0_seq1       1     0     0     0     0     0     0     0     0
>> 
>> dim(data)
> [1] 621694     28
>> 
>> targets<-read.table("H:/bip1/RNAseq/Data/targets.txt",header=T)
>> targets
>  Sample Treat Time
> 1   E00R1   Els  00h
> 2   E00R2   Els  00h
> 3   E00R3   Els  00h
> 4   E01R1   Els  01h
> 5   E01R2   Els  01h
> 6   E01R3   Els  01h
> 7   E05R1   Els  05h
> 8   E05R2   Els  05h
> 9   E05R3   Els  05h
> 10  E48R2   Els  48h
> 11  E48R3   Els  48h
> 12  E96R1   Els  96h
> 13  E96R2   Els  96h
> 14  E96R3   Els  96h
> 15  J00R1   Jon  00h
> 16  J00R2   Jon  00h
> 17  J00R3   Jon  00h
> 18  J01R1   Jon  01h
> 19  J01R2   Jon  01h
> 20  J01R3   Jon  01h
> 21  J05R1   Jon  05h
> 22  J05R2   Jon  05h
> 23  J05R3   Jon  05h
> 24  J48R2   Jon  48h
> 25  J48R3   Jon  48h
> 26  J96R1   Jon  96h
> 27  J96R2   Jon  96h
> 28  J96R3   Jon  96h
>> 
>> # setting up a combined factor
>> 
>> Group<-factor(paste(targets$Treat,targets$Time,sep="."))
>> cbind(targets,Group=Group)
>  Sample Treat Time   Group
> 1   E00R1   Els  00h Els.00h
> 2   E00R2   Els  00h Els.00h
> 3   E00R3   Els  00h Els.00h
> 4   E01R1   Els  01h Els.01h
> 5   E01R2   Els  01h Els.01h
> 6   E01R3   Els  01h Els.01h
> 7   E05R1   Els  05h Els.05h
> 8   E05R2   Els  05h Els.05h
> 9   E05R3   Els  05h Els.05h
> 10  E48R2   Els  48h Els.48h
> 11  E48R3   Els  48h Els.48h
> 12  E96R1   Els  96h Els.96h
> 13  E96R2   Els  96h Els.96h
> 14  E96R3   Els  96h Els.96h
> 15  J00R1   Jon  00h Jon.00h
> 16  J00R2   Jon  00h Jon.00h
> 17  J00R3   Jon  00h Jon.00h
> 18  J01R1   Jon  01h Jon.01h
> 19  J01R2   Jon  01h Jon.01h
> 20  J01R3   Jon  01h Jon.01h
> 21  J05R1   Jon  05h Jon.05h
> 22  J05R2   Jon  05h Jon.05h
> 23  J05R3   Jon  05h Jon.05h
> 24  J48R2   Jon  48h Jon.48h
> 25  J48R3   Jon  48h Jon.48h
> 26  J96R1   Jon  96h Jon.96h
> 27  J96R2   Jon  96h Jon.96h
> 28  J96R3   Jon  96h Jon.96h
>> 
>> design<-model.matrix(~0+Group)
>> colnames(design)<-levels(Group)
>> design
>  Els.00h Els.01h Els.05h Els.48h Els.96h Jon.00h Jon.01h Jon.05h Jon.48h Jon.96h
> 1        1       0       0       0       0       0       0       0       0       0
> 2        1       0       0       0       0       0       0       0       0       0
> 3        1       0       0       0       0       0       0       0       0       0
> 4        0       1       0       0       0       0       0       0       0       0
> 5        0       1       0       0       0       0       0       0       0       0
> 6        0       1       0       0       0       0       0       0       0       0
> 7        0       0       1       0       0       0       0       0       0       0
> 8        0       0       1       0       0       0       0       0       0       0
> 9        0       0       1       0       0       0       0       0       0       0
> 10       0       0       0       1       0       0       0       0       0       0
> 11       0       0       0       1       0       0       0       0       0       0
> 12       0       0       0       0       1       0       0       0       0       0
> 13       0       0       0       0       1       0       0       0       0       0
> 14       0       0       0       0       1       0       0       0       0       0
> 15       0       0       0       0       0       1       0       0       0       0
> 16       0       0       0       0       0       1       0       0       0       0
> 17       0       0       0       0       0       1       0       0       0       0
> 18       0       0       0       0       0       0       1       0       0       0
> 19       0       0       0       0       0       0       1       0       0       0
> 20       0       0       0       0       0       0       1       0       0       0
> 21       0       0       0       0       0       0       0       1       0       0
> 22       0       0       0       0       0       0       0       1       0       0
> 23       0       0       0       0       0       0       0       1       0       0
> 24       0       0       0       0       0       0       0       0       1       0
> 25       0       0       0       0       0       0       0       0       1       0
> 26       0       0       0       0       0       0       0       0       0       1
> 27       0       0       0       0       0       0       0       0       0       1
> 28       0       0       0       0       0       0       0       0       0       1
> attr(,"assign")
> [1] 1 1 1 1 1 1 1 1 1 1
> attr(,"contrasts")
> attr(,"contrasts")$Group
> [1] "contr.treatment"
> 
>> 
>> fit<-glmFit(y,design)
> Error in glmFit.default(y, design) : No dispersion values provided.
>> 
>> sessionInfo()
> R version 3.0.2 (2013-09-25)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> 
> locale:
> [1] LC_COLLATE=Norwegian (Bokmål)_Norway.1252  LC_CTYPE=Norwegian (Bokmål)_Norway.1252    LC_MONETARY=Norwegian (Bokmål)_Norway.1252
> [4] LC_NUMERIC=C                               LC_TIME=Norwegian (Bokmål)_Norway.1252    
> 
> attached base packages:
> [1] parallel  stats     graphics  grDevices utils     datasets  methods   base     
> 
> other attached packages:
> [1] edgeR_3.4.2        limma_3.18.6       DESeq_1.14.0       lattice_0.20-24    locfit_1.5-9.1     Biobase_2.22.0     BiocGenerics_0.8.0
> 
> loaded via a namespace (and not attached):
> [1] annotate_1.40.0      AnnotationDbi_1.24.0 DBI_0.2-7            genefilter_1.44.0    geneplotter_1.40.0   grid_3.0.2          
> [7] IRanges_1.20.6       RColorBrewer_1.0-5   RSQLite_0.11.4       splines_3.0.2        stats4_3.0.2         survival_2.37-4     
> [13] tools_3.0.2          XML_3.98-1.1         xtable_1.7-1 
> 
> --
> Sent via the guest posting facility at bioconductor.org.
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor



More information about the Bioconductor mailing list