This is a test version of Biostars. For the public version, visit https://www.biostars.org.
DeSeq2 filter transcripts

Hello, I am running Differential gene analysis. I am filter the counts before running differential gene analysis, because so many of my genes have low mapped reads and that is affecting it. My issue is that I take out my transcript column to run DeSeq2 but the issue is that then since I filter the sample I am unsure what gene goes with what count, so then when I make a volcano plot I can see genes are upregulated and down regulated but I do not know what genes are. Please see attached code

  cts <- read_excel("~/DS.xlsx", sheet="fibro_IFN100_DS_CT")

metadata <- (read_excel("~/DS.xlsx", sheet="fibro_IFN100_DS_CT_coldata"))

rownames(cts) <- cts$transcript

temp_cts_with_transcriptNames <- cts

#Adding NULL info to roName
cts$transcript <- NULL
cts_no_transcript<- cts[,-1]

dds <- DESeqDataSetFromMatrix(countData = cts_no_transcript,
                              colData = metadata,
                              design= ~ factor(condition))

smallestGroupSize <- 2

keep <- rowSums(counts(dds) >= 50) >= smallestGroupSize
dds <- dds[keep,]


dds2 <- DESeq(dds)
resultsNames(dds2)
res <- results(dds2, name="factor.condition.DS")
res
res
deseq2 rna-seq rna

1 answer

You can hand DESeq2 a matrix with rownames as gene names, or if the first column of your matrix is gene names use the tidy=TRUE argument (see ?DESeqDataSetFromMatrix)

Guessing from your code above, you should be able to do something like:

rownames(cts) <- cts$transcript
cts <- cts[,-1]

dds <- DESeqDataSetFromMatrix(countData = cts,
                              colData = metadata,
                              design= ~ factor(condition))

(just removing the transcript column from your matrix after you use it to assign rownames)

Log in to answer this question.