This is a test version of Biostars. For the public version, visit https://www.biostars.org.
all variables in design formula must be columns in colData

Hello,

I am having the hardest time determining what in my original file is misaligned and why this error message persists. Any suggestions? I added the columns "status" and "sample" and those are the only columns that align with the data. I am not sure what is missing .

 #Import data
> getwd()

> samples <- read.table("data/samples_updated.txt", header = TRUE)

> samples

    sample status
1    10007 urgent
2    10018  asymp
3    10037 urgent
4    10045 urgent
5    10047  asymp
6    10049 urgent
7  011811A  asymp
8  051111A  asymp
9  051512A urgent
10 111111A  asymp
11 121511A urgent

> dir <- "data"

> files <- file.path(dir, paste0(samples$sample, ".genes.results"))

> names(files) <- paste0("sample", 1:11)

> all(file.exists(files))
[1] TRUE

> txi.rsem <- tximport(files, type = "rsem", txIn = FALSE, txOut = FALSE)
reading in files with read_tsv
1 2 3 4 5 6 7 8 9 10 11 

> head(txi.rsem$counts)
          sample1 sample2 sample3 sample4 sample5 sample6 sample7 sample8 sample9 sample10 sample11
5S_rRNA      0.00    0.00    1.51    0.00    0.00    2.94    1.00    1.00    0.79     1.16     0.00
5_8S_rRNA    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00     0.00     0.00
7SK         60.28   47.00   67.30   33.94   62.29   42.90   78.67   60.04   84.67    56.25   107.75
A1BG        78.08   40.82   75.10   75.24   68.61   53.74   69.94   43.81   61.44    60.16    54.27
A1BG-AS1    90.00   57.00  112.57   93.03   78.98   65.00   72.00   74.00   78.98    32.38    97.00
A1CF         4.10    0.00    2.04    3.11    5.13    1.47    1.41    4.27    3.20     3.68     8.00
> 

> #import into DESeq2

> sampleTable <- data.frame(read.csv("data/samples_updated.txt", header=T))

> rownames(sampleTable) <- colnames(txi.rsem$counts)

> txi.rsem$length <- replace (txi.rsem$length, txi.rsem$length==0,1)

*> dds <- DESeqDataSetFromTximport(txi.rsem, sampleTable, ~Status)
Error in DESeqDataSet(se, design = design, ignoreRank) : 
  all variables in design formula must be columns in colData*
deseq2

1 answer

It seems you have status as column name and Status in the DESeqDataSetFromTximport command, maybe that is the issue?

I will try to address that now! Thank you.

I am not sure what I would change - the column or the command?

status with a lowercase leading s in the design, ~status, not ~Status, it must be the same as in the colData.

The issue was that the two input files I was using, one txt and one csv were not matching - the content and names within their columns were not aligned. In case someone has this issue - try this solution.

Log in to answer this question.