This is a test version of Biostars. For the public version, visit https://www.biostars.org.
collapseReplicates changes the order of the original dataframe in DESeq2

Hi all,

I noticed a strange behaviour of collapseReplicates function of DESeq2 v 1.22.2. After collapsing replicates, DESeq2 for some reorders the columns in the dataframe. Below is an example:

m <- matrixsample.int(100, size = 28*100, replace = T), ncol = 28, nrow = 100)

rownames(m)<-paste0("gene",1:100)

colnames(m)<-c("a1","a2","A0C1","A0C1reseq","A0C2","A0C2reseq","a3",
           "3reseq","a4","5a","6a","a7","a8","a9","a10","a11","a12",
           "a13","a14","a15","a16","a59","a17","a18","A24C1","A24C1reseq",
           "A24C2","A24C2reseq")
grouping<-c("sample1","sample2", "sampleA0C1","sampleA0C1",
        "sampleA0C2","sampleA0C2","sample3", "sample3","sample4","sample5a",
        "sample6","sample7","sample8","sample9","sample10","sample11","sample12",
        "sample13","sample14","sample15","sample16","sample59","sample17","sample18",
        "sampleA24C1","sampleA24C1","sampleA24C2","sampleA24C2")

colData_test<-data.frame(time=c(rep("0",6), rep("1.5",4), rep("3",3), 
                              rep("3c",2), rep("12", 3), rep("24",4), rep("24c",6)),
                         grouping,
                         ids=colnames(m))

pre_dds <- DESeqDataSetFromMatrix(m, colData=colData_test, ~time)

pre_dds_collaps<-collapseReplicates(pre_dds,pre_dds$grouping,pre_dds$ids, renameCols = F)

Then if you do assay(pre_dds_collaps), the order of columns is changed from the original.

Do I do anything wrong?

deseq2 collapsereplicates

In this case (as an exception) you may want to post on Bioconductor support so Michael Love will take note/respond.

1 answer

Answered by Michael Love https://support.bioconductor.org/p/123060/

Log in to answer this question.