Question: How to obtain a normalised expression matrix from read counts and scaling factors
gravatar for user31888
4 months ago by
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


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)
ADD COMMENTlink modified 4 months ago by Ryan C. Thompson6.9k • written 4 months ago by user3188830
gravatar for Ryan C. Thompson
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.

ADD COMMENTlink written 4 months ago by Ryan C. Thompson6.9k

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?

ADD REPLYlink modified 4 months ago • written 4 months ago by user3188830

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")
ADD REPLYlink written 4 months ago by Ryan C. Thompson6.9k

Ok, I see. Thanks Ryan !

ADD REPLYlink written 4 months ago by user3188830

Also note that the cpm() function does not have an argument called 'weights', so using that argument will not do anything.

ADD REPLYlink written 4 months ago by Gordon Smyth35k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 395 users visited in the last hour