Skip to main content
syntax highlighting
Source Link
Konrad Rudolph
  • 4.9k
  • 16
  • 45

I have RNA seq data which I've quantified using Kallisto. I'd like to use tximport to transform the read count data into input for EdgeR, following the R code supplied in the tximport documentation:

cts <- txi$counts
normMat <- txi$length
normMat <- normMat/exp(rowMeans(log(normMat)))
library(edgeR)
o <- log(calcNormFactors(cts/normMat)) + log(colSums(cts/normMat))
y <- DGEList(cts)
y$offset <- t(t(log(normMat)) + o)
# y is now ready for estimate dispersion functions see edgeR User's Guide
cts <- txi$counts
normMat <- txi$length
normMat <- normMat/exp(rowMeans(log(normMat)))
library(edgeR)
o <- log(calcNormFactors(cts/normMat)) + log(colSums(cts/normMat))
y <- DGEList(cts)
y$offset <- t(t(log(normMat)) + o)
# y is now ready for estimate dispersion functions see edgeR User's Guide

I would ideally follow this up with EdgeR's exactTest. However, I'd also like to remove genes with low read counts using code such as this:

filterCounts <- function(counts) {
  cpms <- cpm(counts)
  keep <- rowSums(cpms > 1) >= 1
  counts[keep,]
}
filterCounts <- function(counts) {
  cpms <- cpm(counts)
  keep <- rowSums(cpms > 1) >= 1
  counts[keep,]
}

The only issue is that I can't tell whether I should remove the genes with low read counts before or after I normality the counts while importing with tximport in the first code. I'm thinking that it would be best to do this before, editing out the abundance, counts, and length rows of the txi data frame which correspond to lowly expressed genes, but I woul dlik ethiswould like this to be confirmed before I proceed.

I have RNA seq data which I've quantified using Kallisto. I'd like to use tximport to transform the read count data into input for EdgeR, following the R code supplied in the tximport documentation:

cts <- txi$counts
normMat <- txi$length
normMat <- normMat/exp(rowMeans(log(normMat)))
library(edgeR)
o <- log(calcNormFactors(cts/normMat)) + log(colSums(cts/normMat))
y <- DGEList(cts)
y$offset <- t(t(log(normMat)) + o)
# y is now ready for estimate dispersion functions see edgeR User's Guide

I would ideally follow this up with EdgeR's exactTest. However, I'd also like to remove genes with low read counts using code such as this:

filterCounts <- function(counts) {
  cpms <- cpm(counts)
  keep <- rowSums(cpms > 1) >= 1
  counts[keep,]
}

The only issue is that I can't tell whether I should remove the genes with low read counts before or after I normality the counts while importing with tximport in the first code. I'm thinking that it would be best to do this before, editing out the abundance, counts, and length rows of the txi data frame which correspond to lowly expressed genes, but I woul dlik ethis to be confirmed before I proceed.

I have RNA seq data which I've quantified using Kallisto. I'd like to use tximport to transform the read count data into input for EdgeR, following the R code supplied in the tximport documentation:

cts <- txi$counts
normMat <- txi$length
normMat <- normMat/exp(rowMeans(log(normMat)))
library(edgeR)
o <- log(calcNormFactors(cts/normMat)) + log(colSums(cts/normMat))
y <- DGEList(cts)
y$offset <- t(t(log(normMat)) + o)
# y is now ready for estimate dispersion functions see edgeR User's Guide

I would ideally follow this up with EdgeR's exactTest. However, I'd also like to remove genes with low read counts using code such as this:

filterCounts <- function(counts) {
  cpms <- cpm(counts)
  keep <- rowSums(cpms > 1) >= 1
  counts[keep,]
}

The only issue is that I can't tell whether I should remove the genes with low read counts before or after I normality the counts while importing with tximport in the first code. I'm thinking that it would be best to do this before, editing out the abundance, counts, and length rows of the txi data frame which correspond to lowly expressed genes, but I would like this to be confirmed before I proceed.

Source Link
J0HN_TIT0R
  • 541
  • 1
  • 4
  • 7

When performing differential expression analysis, should genes with low read counts be removed before or after normalization?

I have RNA seq data which I've quantified using Kallisto. I'd like to use tximport to transform the read count data into input for EdgeR, following the R code supplied in the tximport documentation:

cts <- txi$counts
normMat <- txi$length
normMat <- normMat/exp(rowMeans(log(normMat)))
library(edgeR)
o <- log(calcNormFactors(cts/normMat)) + log(colSums(cts/normMat))
y <- DGEList(cts)
y$offset <- t(t(log(normMat)) + o)
# y is now ready for estimate dispersion functions see edgeR User's Guide

I would ideally follow this up with EdgeR's exactTest. However, I'd also like to remove genes with low read counts using code such as this:

filterCounts <- function(counts) {
  cpms <- cpm(counts)
  keep <- rowSums(cpms > 1) >= 1
  counts[keep,]
}

The only issue is that I can't tell whether I should remove the genes with low read counts before or after I normality the counts while importing with tximport in the first code. I'm thinking that it would be best to do this before, editing out the abundance, counts, and length rows of the txi data frame which correspond to lowly expressed genes, but I woul dlik ethis to be confirmed before I proceed.