# [BioC] about HTqPCR

Heidi Dvinge heidi at ebi.ac.uk
Sun Jun 12 11:27:10 CEST 2011

```Hi Josep

> Dear Heidi,
>
> Thank you for your explanations. I think that your suggestions will be
> very
> helpful, and I am sure that you solved all my uncertainties. I would be
> grateful if you could send me this sniped code for normalizing with the
> mean
> of all miRNAs.
>
You can give this a go. It's a linear scaling, and assumes that your total
amount of miRNA expression is constant. It doesn't required you to define
any house-keeping genes though, which can be notoriously tricky for
miRNAs.

# Load test data
data(qPCRraw)

# Define plotting function (or just use the individual commands directly)
my.norm.method	<- function(q, Ct.max=35, ref=1)
{
# Get the data
data <- exprs(q)
# For each column, calculate the geometric mean of Ct values<Ct.max
geo.mean	<- apply(data, 2, function(x) {
xx <- log2(subset(x, x<Ct.max))
2^mean(xx)})
# Calculate the scaling factor
geo.scale	<- geo.mean/geo.mean[ref]
# Adjust the data accordingly
data.norm <- t(t(data) * geo.scale)
# Return the normalised object
exprs(q) <- data.norm
q
}

# Normalise
q.norm	<- my.norm.method(qPCRraw)

# Plot raw versus normalised data
plot(exprs(qPCRraw), exprs(q.norm), col=rep(1:n.samples(q.norm),
each=n.wells(q.norm)))

> Besides that, I have yet another question. I am planning to validate some
> of
> the miRNAs for which I found interesing results, but not using
> microfluidic
> plates. Is your program also available to work with data of few miRNAs
> (let's say 10 or 20), using only the deltaCt method, of course? Is there a
> function to easily load a dataframe of qPCR experiments and convert them
> to
> a qPCR object?
>
Sure. You can read in you data using any of the "standard" functions, and
then use new() to generate a qPCRset object. For example:

> # Generate some test data
> temp<- matrix(1, nrow=10, ncol=4)
> # In your case, this would probably be read in using read.table()
>
> # Add some row/column names
> rownames(temp)	<- paste("gene", 1:10, sep="")
> colnames(temp)	<- paste("sample", 1:4, sep="")
> # Usually, row/column names will be present in you data, so these two
lines can be ignored
>
> # Create qPCRset
> q	<- new("qPCRset", exprs=temp, sampleNames=colnames(temp),
featureNames=rownames(temp), featureCategory=as.data.frame(array("OK",
dim=dim(temp))))
> q
An object of class "qPCRset"
Size:  10 features, 4 samples
Feature types:
Feature names:		 gene1 gene2 gene3 ...
Feature classes:
Feature categories:	 OK
Sample names:		 sample1 sample2 sample3 ...

HTH
\Heidi

> Thank you for all your help and your time again.
>
> Best regards,
>
> Josep
>
> On Sat, Jun 11, 2011 at 8:19 AM, Heidi Dvinge <heidi at ebi.ac.uk> wrote:
>
>> Hi Josep,
>>
>> > Dear Heidi,
>> >
>> > I am using your package HTqPCR, in order to analyze miRNA taqman
>> plates,
>> > for
>> > which this package is extremely useful.
>> >
>> > For normalization, I used "rank invariant" which selects two miRNAs as
>> the
>> > most "rank invariant". However, as a "sanity check", I wanted to check
>> if
>> > the results normalizing by the "deltaCt" method using the same miRNAs
>> as
>> > contorls.
>> >
>> > To my surprise, the normalized values when normalizing by these two
>> miRNAs
>> > using the deltaCt method and the "rank invariant" showed very weak
>> > correlation. I was expecting that the correlations should be similar.
>> > Should
>> > I worry about that? What is the method I should trust most, then?
>> >
>> Although using the same genes for normalisation, these two methods don't
>> necessarily give the same results at all.
>>
>> For deltaCt, the average Ct value of the genes is calculated, and this
>> is
>> simply subtracted from all other Ct values. So this is a strictly linear
>> normalisation method. If you plot the raw versus the normalised value,
>> you'll notice that these are simply shifted compared to the diagonal.
>>
>> The rank invariant method on the other hand is a non-linear
>> normalisation
>> method. The rank invariant genes are identified, a smoothed line is
>> fitted
>> though the corresponding Ct values, and this smoothing is subsequently
>> applied to all the Ct values on the plate.
>>
>> Which method to go for depends on your data. deltaCt is the "classical"
>> method that is commonly used for mRNA genes using e.g. actin and GAPDH.
>> However, I personally don't always like it 100%. These reference genes
>> tend to be expressed at very high levels, i.e. have low Ct values.
>> Therefore, they might not be representative of any biases that might be
>> present for genes expressed at lower levels, i.e. at the high end of the
>> Ct range.
>>
>> A smoothing approach can often be more robust, at least if the rank
>> invariant genes cover a broad range of the Ct values observed in your
>> data. In your case I notice that there are only 2 rank invariant genes
>> though. This might still be okay, but if you have more than a couple of
>> samples, you might try decreasing hte scale.rank.samples parameter in
>> normalizeCtData(). This indicates how many samples each gene has to be
>> rank invariant across in order to be used for the normalisation. Which a
>> high number of samples, this can be relaxed a bit.
>>
>> Please also note that for miRNAs that have a been a couple of
>> publications
>> suggesting simply normalising by subtracting the mean Ct of all miRNAs
>> present on the plate. This option isn't included in the release version
>> of
>> HTqPCR, however I have the snippet of code for it, and can send it to
>> you
>> if you're interested. Alternatively, selecting norm="deltaCt" and
>> setting
>> deltaCt.genes equal to all your featureNames should in principle give
>> you
>> the same result.
>>
>> HTH
>> \Heidi
>>
>> > Find attached the data and the code used as an example.
>> >
>> > I would be grateful if you could give me a reply regarding this issue.
>> >
>> > Thank you for your time and consideration.
>> >
>> > Best regards,
>> >
>> > Josep
>> > --
>> > Josep Maria Mercader, PhD
>> > Barcelona Supercomputing Center
>> > Life Science Department, Computational Genomics Group.
>> > josep.mercader at bsc.es
>> > josepmaria.mercader at gmail.com
>> > www.bsc.es
>> >
>>
>>
>>
>
>
> --
> Josep Maria Mercader, PhD
> Barcelona Supercomputing Center
> Life Science Department, Computational Genomics Group.
> josep.mercader at bsc.es
> josepmaria.mercader at gmail.com
> www.bsc.es
>

```