Search
Question: How to obtain a normalised expression matrix from read counts and scaling factors
0
4 months ago by
user3188830
United States
user3188830 wrote:

I am trying to get normalised RNASeq expression matrices using different methods.

I have a read count matrix:

> matrix
sample1   sample2   sample3
gene1    13456     16172     13303
gene2      988       830       857
gene3    11780     13831     10550

And I calculated scaling factors with the 3 methods available from the EdgeR calcNormFactors function:

> upQuartileFactors <- calcNormFactors(matrix, method="upperquartile", p=0.75)
> upQuartileFactors
sample1   sample2   sample3
0.9952710 1.0063954 0.9983665

> tmmFactors <- calcNormFactors(in_matrix, method="TMM")
> tmmfactors
[1] 0.9962241 1.0020331 1.0017536

> rleFactors <- calcNormFactors(in_matrix, method="RLE")
> rleFactors
sample1   sample2   sample3
1.0038347 0.9851548 1.0111914

QUESTIONS:

I do I get a normalised expression matrix for each of the normalisation method employed?

Can I do one of the following and for which method?

matrix / scaled_factors

matrix * scaled_factors

matrix / (library_size * scaled_factors)
modified 4 months ago by Ryan C. Thompson6.9k • written 4 months ago by user3188830
4
4 months ago by
The Scripps Research Institute, La Jolla, CA
Ryan C. Thompson6.9k wrote:

There's no need to work out the correct formula for yourself. This is already implemented in the cpm function. You simply need to pass the count matrix and normalization factors as the correct arguments. Please read the help text for this function.

Thanks Ryan. The only way I see I could use the cpm function would be as follows:

> cpm(matrix, normalized.lib.sizes=F, weights=upQuartileFactors)
sample1   sample2   sample3
gene1 513117.75 524502.97 538365.03
gene2  37675.41  26919.21  34682.31
gene3 449206.83 448577.82 426952.65

Is it correct?

Does it not add another normalisation layer with the count per million though?

2

It would be easiest if you used the DGEList class to contain both the counts and normalization factors. For example:

dge <- DGEList(matrix)
dge_tmm <- calcNormFactors(dge, method="TMM")
cpm(dge_tmm)


Ok, I see. Thanks Ryan !