ChIPQCreport yields a cryptic error if "Replicate" data is not specified
1
0
Entering edit mode
Coby Viner ▴ 50
@coby-viner-10939
Last seen 3.6 years ago
University of Toronto, Canada

ChIPQCreport requires that the "Replicate" of each sample be provided during the construction of its experiment object.

If it is not provided, ChIPQCreport fails with a cryptic error, even if invoked for only a single experimental sample:

> samples

     SampleID Tissue Factor                         bamReads   ControlID
1 ENCFF863PSQ  DOHH2   CTCF ENCFF863PSQ.sorted.markeddup.bam ENCFF631ENA
                        bamControl Peaks
1 ENCFF631ENA.sorted.markeddup.bam    NA
                                                                                                                   
> experiment <- ChIPQC(samples, annotation="hg38")

> ChIPQCreport(experiment, F)
Saving 7 x 7 in image
Error in seq.default(h[1], h[2], length.out = n) : 
  'to' cannot be NA, NaN or infinite

> traceback()
25: stop("'to' cannot be NA, NaN or infinite")
24: seq.default(h[1], h[2], length.out = n)
23: seq(h[1], h[2], length.out = n)
22: rotate(seq(h[1], h[2], length.out = n))
21: f(...)
20: self$palette(n)
19: f(..., self = self)
18: self$map(df[[j]])
17: FUN(X[[i]], ...)
16: lapply(aesthetics, function(j) self$map(df[[j]]))
15: f(..., self = self)
14: scale$map_df(df = df)
13: FUN(X[[i]], ...)
12: lapply(scales$scales, function(scale) scale$map_df(df = df))
11: unlist(lapply(scales$scales, function(scale) scale$map_df(df = df)), 
        recursive = FALSE)
10: FUN(X[[i]], ...)
9: lapply(data, scales_map_df, scales = npscales)
8: ggplot_build(x)
7: print.ggplot(x)
6: print(x)
5: grid.draw.ggplot(plot)
4: grid.draw(plot)
3: ggsave(plotCC(object, facet = facet, facetBy = facetBy, colourBy = colourBy, 
       lineBy = lineBy, addMetaData = addMetaData), filename = file.path(reportFolder, 
       "CCPlot.png"))
2: ChIPQCreport(experiment, F)
1: ChIPQCreport(experiment, F)

> sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.5 (Final)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] ChIPQC_1.8.7               DiffBind_2.0.2            
 [3] SummarizedExperiment_1.2.3 Biobase_2.32.0            
 [5] GenomicRanges_1.24.2       GenomeInfoDb_1.8.1        
 [7] IRanges_2.6.1              S4Vectors_0.10.1          
 [9] BiocGenerics_0.18.0        ggplot2_2.1.0             

loaded via a namespace (and not attached):
 [1] edgeR_3.14.0                             
 [2] splines_3.3.0                            
 [3] TxDb.Hsapiens.UCSC.hg18.knownGene_3.2.2  
 [4] TxDb.Mmusculus.UCSC.mm10.knownGene_3.2.2 
 [5] gtools_3.5.0                             
 [6] assertthat_0.1                           
 [7] latticeExtra_0.6-28                      
 [8] amap_0.8-14                              
 [9] RBGL_1.48.1                              
[10] Rsamtools_1.24.0                         
[11] Category_2.38.0                          
[12] RSQLite_1.0.0                            
[13] backports_1.0.2                          
[14] lattice_0.20-33                          
[15] limma_3.28.10                            
[16] digest_0.6.10                            
[17] RColorBrewer_1.1-2                       
[18] XVector_0.12.0                           
[19] checkmate_1.8.0                          
[20] colorspace_1.2-6                         
[21] Matrix_1.2-6                             
[22] plyr_1.8.4                               
[23] GSEABase_1.34.0                          
[24] chipseq_1.22.0                           
[25] TxDb.Hsapiens.UCSC.hg38.knownGene_3.1.3  
[26] XML_3.98-1.4                             
[27] pheatmap_1.0.8                           
[28] ShortRead_1.30.0                         
[29] biomaRt_2.28.0                           
[30] genefilter_1.54.2                        
[31] zlibbioc_1.18.0                          
[32] xtable_1.8-2                             
[33] GO.db_3.3.0                              
[34] scales_0.4.0                             
[35] brew_1.0-6                               
[36] gdata_2.17.0                             
[37] TxDb.Rnorvegicus.UCSC.rn4.ensGene_3.2.2  
[38] BiocParallel_1.6.2                       
[39] annotate_1.50.0                          
[40] GenomicFeatures_1.24.2                   
[41] survival_2.39-4                          
[42] magrittr_1.5                             
[43] systemPipeR_1.6.2                        
[44] fail_1.3                                 
[45] gplots_3.0.1                             
[46] hwriter_1.3.2                            
[47] GOstats_2.38.0                           
[48] graph_1.50.0                             
[49] tools_3.3.0                              
[50] BBmisc_1.9                               
[51] stringr_1.1.0                            
[52] sendmailR_1.2-1                          
[53] munsell_0.4.3                            
[54] locfit_1.5-9.1                           
[55] AnnotationDbi_1.34.3                     
[56] Biostrings_2.40.2                        
[57] caTools_1.17.1                           
[58] grid_3.3.0                               
[59] RCurl_1.95-4.8                           
[60] TxDb.Celegans.UCSC.ce6.ensGene_3.2.2     
[61] rjson_0.2.15                             
[62] AnnotationForge_1.14.2                   
[63] bitops_1.0-6                             
[64] base64enc_0.1-3                          
[65] gtable_0.2.0                             
[66] DBI_0.4-1                                
[67] reshape2_1.4.1                           
[68] R6_2.1.3                                 
[69] GenomicAlignments_1.8.3                  
[70] Nozzle.R1_1.1-1                          
[71] dplyr_0.4.3                              
[72] rtracklayer_1.32.1                       
[73] KernSmooth_2.23-15                       
[74] stringi_1.1.1                            
[75] TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2  
[76] BatchJobs_1.6                            
[77] Rcpp_0.12.7                              
[78] TxDb.Dmelanogaster.UCSC.dm3.ensGene_3.2.2
[79] TxDb.Mmusculus.UCSC.mm9.knownGene_3.2.2

This error does not occur for an identical invocation of ChIPQCreport for an experiment object whose sample was assigned "Replicate" = 1.

 

 

ChIPQC chipqc • 1.6k views
ADD COMMENT
2
Entering edit mode
Rory Stark ★ 5.2k
@rory-stark-5741
Last seen 5 weeks ago
Cambridge, UK

I'll add a fix for this to DiffBind.

I'm not sure how well reports on a ChIPQCexperiment object with only one sample will work in general -- you're better off running the report on the ChIPQCsample object if there is only one.

-Rory

ADD COMMENT
0
Entering edit mode

Great, thanks Rory.

ADD REPLY
0
Entering edit mode

Thanks, Rory!

Might it be possible to add a check for that within ChIPQCreport itself (and for it to automatically use the ChIPQCsample object, from the ChIPQCexperiment), to prevent users from needing to use a workaround with only a single sample (i.e. to maintain a consistent API)?

ADD REPLY
1
Entering edit mode

The ChIPQCreport() function should generate reports from ChIPQCexperiment and ChIPQCsample in a very similar manner.

In your case the below examples would give equivalent results. This would work with Replicates are NA as in your case.

> ChIPQCreport(QCsample(experiment)[[1]])
> ChIPQCreport(experiment,facetBy="Sample",colourBy=NULL,lineBy=NULL)
 

Both ChIPQCsample and ChIPQCexperiment reports should contain the same information but when creating from an ChIPQCexperiment, various aesthetics are filled in from the samplesheet or user defined metadata. By default we use Replicate to colour lines and so in your case this failed. One immediate solution, as Rory recommends, is to simply work with one sample and no metadata - first example, the other immediate solution is to set parameters such as "facetBy","Sample","lineBy","colourBy" to columns with metadata.

I agree a check for valid columns is required and will look to implement in the future.

best,

tom

 

ADD REPLY
0
Entering edit mode

I appreciate this useful information!

I will keep that workaround in mind and am glad to hear that.

Thanks,

Coby

ADD REPLY
0
Entering edit mode

Just wanted to follow-up on this. This workaround is still needed in the latest version (1.12.0) and the same cryptic error message is emitted without it.

ADD REPLY

Login before adding your answer.

Traffic: 547 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