This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to subset the output of tximport in DE analysis using DEseq2

I have a dataset of 32 samples quantified using salmon. I used tximport to import the data:

txi=tximport(c(a vector of file names),type="salmon",tx2gene=tx2gene)

I have created the colData and used DESeqDataSetFromTximport to construct the Deseq2 data set:

dds <- DESeqDataSetFromTximport(txi = txi,colData = col_data,design = ~ Form)

In this case, all 32 samples are used, now I only want to use a subset of txi by choosing specific samples. Is there a way to subset my current txi rather than constructing a new txi using only the samples that I want?

deseq2 tximport rna-seq r

Does this means after the subset, you should reset the design to the situation of the subset? Thanks!

If the filter changed the design (like removing an entire group), then probably yes.

1 answer

The DESeq2 object is basically a SummarizedExperiment so you can subset this prior to running DESeq using standard operations such as dds_use <- dds[,c(columns_to_keep] where columns_to_keep is a numeric vector with the columns (samples) you want to use.

That is clear! Thank you for your explanation.

Log in to answer this question.