I saw this post from a while ago regarding a similar issue: edgeR: Problem with subsetting a DGEList in latest package version
>d$samples[1:6,]
sample lib.size norm.factor type time
preExercise_TAGGCTGACTTGAG.1 856 1.1020236 B pre
preExercise_TCCATCCTCGTTAG.1 1033 1.2198739 B pre
pbmc001_TTGAGGACTTTCAC.1 703 1.2050717 B pre
pbmc001_AGTCGCCTGCTTAG.1 1230 1.0304974 B post
pbmc001_TACTACACAGCACT.1 1053 0.9790636 C post
pbmc001_TAAACAACCCTTAT.1 895 1.1032946 D pre
...
I am trying to do differential expression of things only of type 'B', with the time frame as the group 'post vs pre'. I though the easiest way would be to just subset d via:
d.B = d[,grep('B',d$samples$type)]
But I get the error:
Error in `$<-.data.frame`(`*tmp*`, "group", value = integer(0)) :
replacement has 0 rows, data has 226
Is there a proper way of doing differential expression on just a subset of the DGEList?
I got around this by employing the method from the post Iinked:
B=grep('B',d$samples$type)
test=DGEList(d$counts)
test=test[,B]
Then replacing test$samples with its proper subset from d:
test$samples=d$samples[Bcells,]
This just seems sort of hacky...
Something seems strange.
Can you start a new R session, call
library(edgeR)
and then come back here to update your question with the contents provided by copy/pasting the output ofsessionInfo()
> library(edgeR)
Loading required package: limma
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.5 (El Capitan)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] edgeR_3.14.0 limma_3.28.14
Can you post a minimal working example of this behaviour?