HTqPCR: dealing with technical replicates (filterCategory) and inability to analyze datasets with filtered genes (limmaCtData).
0
0
Entering edit mode
edu.guasch • 0
@eduguasch-18905
Last seen 5.9 years ago

Hi all,

I am new to R, I have found HTqPCR very useful, but I am having a couple of issues that maybe you will be able to clarify for me.

-          When using “filterCatergory” to filter high Ct values (and change them to NA), technical replicates are all given the same value (and, specifically, the value of the first Feature). This happens even in those genes that have not been filtered.

For example:

> data(qPCRraw)
> qPCRraw.filtered <- setCategory(qPCRraw, groups=NULL)
Categories after Ct.max and Ct.min filtering:
      sample1 sample2 sample3 sample4 sample5 sample6
OK        313     264     327     295     296     286
Undetermined 68 119 56 86 86 96
Unreliable 3 1 1 3 2 2
> qPCRraw.filtered <- filterCategory(qPCRraw.filtered)

When we check one of the technical replicates (‘Gene1’) before filtering, each of the 4 replicates has different Ct values:

> exprs(qPCRraw) [featureNames(x)=='Gene1',]
       sample1  sample2  sample3  sample4  sample5  sample6
Gene1 11.46317 11.56698 10.61630 11.48673 10.46428 10.45688
Gene1 11.97096 11.97583 10.95670 11.97655 10.95597 10.95501
Gene1 11.50615 11.71752 10.55143 11.56976 10.32268 10.66761
Gene1 11.87627 11.89721 10.92549 11.77865 10.83317 10.95978

But this changes after “filterCategory” (not after “setCategory):

> exprs(qPCRraw.filtered) [featureNames(x)=='Gene1',]
       sample1  sample2 sample3  sample4  sample5  sample6
Gene1 11.46317 11.56698 10.6163 11.48673 10.46428 10.45688
Gene1 11.46317 11.56698 10.6163 11.48673 10.46428 10.45688
Gene1 11.46317 11.56698 10.6163 11.48673 10.46428 10.45688
Gene1 11.46317 11.56698 10.6163 11.48673 10.46428 10.45688

Is there any rationale behind this behaviour?

Second, when I filter out any gene with filterCtdata (for example, one gene I am not interested in or are of a low quality, as suggested in the HTqPCR reference manual), the dataset is not valid anymore to be analyzed with limmaCtData, likely because a change in the number of rows of the data.frame. For example, the example of the reference manual works great:

> # Load example preprocessed data
> data(qPCRpros)
> samples <- read.delim(file.path(system.file("exData", package="HTqPCR"), "files.txt"))
> # Define design and contrasts
> design <- model.matrix(~0+samples$Treatment)
> colnames(design) <- c("Control", "LongStarve", "Starve")
> contrasts <- makeContrasts(LongStarve-Control, LongStarve-Starve, Starve-Control, levels=design)
> diff.exp <- limmaCtData(qPCRpros, design=design, contrasts=contrasts)
> diff.exp[["LongStarve - Control"]][1:5,]
genes feature.pos     t.test      p.value adj.p.value     ddCt
72     72         C24  -8.330294 0.0004927066  0.06306645 -8.320716
251   251         K11 -10.426733 0.0001758778  0.06306645 -6.569095
334   334         N22  -8.348398 0.0004878740  0.06306645 -6.621950
336   336         N24   7.383109 0.0008489351  0.08149777  7.379072
39     39         B15  -5.903588 0.0022683881  0.10675037 -4.725538
(...)

However, if we remove any of the genes thought to be of low quality, it does not work anymore:

> # Load example preprocessed data
> data(qPCRpros)
> samples <- read.delim(file.path(system.file("exData", package="HTqPCR"), "files.txt"))
> # Define design and contrasts
> design <- model.matrix(~0+samples$Treatment)
> colnames(design) <- c("Control", "LongStarve", "Starve")
> contrasts <- makeContrasts(LongStarve-Control, LongStarve-Starve, Starve-Control, levels=design)
> #Filtering 'Gene1'
> qPCRpros.filtered<-filterCtData(qPCRpros,remove.name = 'Gene1')
Removed 4 'Gene1' features based on featureNames(q).
> #The actual test
> diff.exp <- limmaCtData(qPCRpros.filtered,
+                         design=design,
+                         contrasts=contrasts)
Error in data.frame(..., check.names = FALSE) :
  arguments imply differing number of rows: 380, 0

How could I analyze these data with limmaCtData after filtering out on of the genes? Where am I failing?

Thank you very much for you help!

NB2: Sorry for frequent edits... just learning how to make this readable.

NB: sessionInfo()

R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=Catalan_Spain.1252  LC_CTYPE=Catalan_Spain.1252   
[3] LC_MONETARY=Catalan_Spain.1252 LC_NUMERIC=C                  
[5] LC_TIME=Catalan_Spain.1252    

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets 
[7] methods   base     

other attached packages:
[1] HTqPCR_1.36.0       limma_3.38.3        RColorBrewer_1.1-2 
[4] Biobase_2.42.0      BiocGenerics_0.28.0

loaded via a namespace (and not attached):
 [1] gtools_3.8.1          bitops_1.0-6          affy_1.60.0          
 [4] stats4_3.5.1          KernSmooth_2.23-15    gplots_3.0.1         
 [7] zlibbioc_1.28.0       gdata_2.18.0          affyio_1.52.0        
[10] preprocessCore_1.44.0 tools_3.5.1           yaml_2.2.0           
[13] compiler_3.5.1        BiocManager_1.30.4    caTools_1.17.1.1
limma htqpcr • 978 views
ADD COMMENT
0
Entering edit mode

I ran into the same issue. It appears that filtering does not carry over featureData with the exception of featureNames, e.g. call featureData on original and filtered set. The featurePos is used in the limma Ct wrapper function when outputting the final results. The hack is to add featurePos to the filtered set for the wrapper to work.

ADD REPLY

Login before adding your answer.

Traffic: 709 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6