Errors with DiffBind, Error in peaks[, pCol]/max(peaks[, pCol]) : non-numeric argument to binary operator
2
0
Entering edit mode
Mark • 0
@1630df1a
Last seen 7 months ago
United States

Hello, I hope you are doing well and are safe. I wanted to reach out since I have been having issues with loading my broadPeaks and/or the .xls outputs from MACS2 into DiffBind. Would appreciate any help you can provide, thank you! My thinking is there might be something wrong with the way I am setting up the SampleSheet. But I changed the PeakCaller to broadPeak and still didn't work. I also tried changing the Peaks to the .xls files and the PeakCaller to macs and that didnt work either.

I set up a SampleSheet.csv which looks like the following header:

SampleID Tissue Factor Condition Treatment Replicate bamReads Peaks PeakCaller ControlID bamControl


sampleSheet <- read.csv("SampleSheet.csv", header=TRUE, stringsAsFactors=FALSE> 

peaks <- dba(sampleSheet =sampleSheet, peakFormat="broadPeak")

Dox-1d-ASCL1-10 Neurons Treated DOX1D DOX1D 1 bed
Error in peaks[, pCol]/max(peaks[, pCol]) : 
  non-numeric argument to binary operator



head(sampleSheet)
         SampleID  Tissue  Factor Condition Treatment Replicate
1 Dox-1d-ASCL1-10 Neurons Treated     DOX1D     DOX1D         1
2 Dox-1d-ASCL1-11 Neurons Treated     DOX1D     DOX1D         2
3 Dox-1d-ASCL1-12 Neurons Treated     DOX1D     DOX1D         3
4  Dox-1d-DLX2-19 Neurons Treated     DOX1D     DOX1D         1
5  Dox-1d-DLX2-20 Neurons Treated     DOX1D     DOX1D         2
6  Dox-1d-DLX2-21 Neurons Treated     DOX1D     DOX1D         3
                   bamReads                            Peaks PeakCaller
1 Dox-1d-ASCL1-10.dedup.bam Dox-1d-ASCL1-10__peaks.broadPeak        bed
2 Dox-1d-ASCL1-11.dedup.bam Dox-1d-ASCL1-11__peaks.broadPeak        bed
3 Dox-1d-ASCL1-12.dedup.bam Dox-1d-ASCL1-12__peaks.broadPeak        bed
4  Dox-1d-DLX2-19.dedup.bam  Dox-1d-DLX2-19__peaks.broadPeak        bed
5  Dox-1d-DLX2-20.dedup.bam  Dox-1d-DLX2-20__peaks.broadPeak        bed
6  Dox-1d-DLX2-21.dedup.bam  Dox-1d-DLX2-21__peaks.broadPeak        bed
  ControlID             bamControl
1     DOX1D Dox-1d-IGG-1.dedup.bam
2     DOX1D Dox-1d-IGG-1.dedup.bam
3     DOX1D Dox-1d-IGG-1.dedup.bam
4     DOX1D Dox-1d-IGG-1.dedup.bam
5     DOX1D Dox-1d-IGG-1.dedup.bam
6     DOX1D Dox-1d-IGG-1.dedup.bamA    


sessionInfo( )

R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

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    stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] DiffBind_3.6.3              SummarizedExperiment_1.26.1
 [3] Biobase_2.56.0              MatrixGenerics_1.8.1       
 [5] matrixStats_0.62.0          GenomicRanges_1.48.0       
 [7] GenomeInfoDb_1.34.9         IRanges_2.30.0             
 [9] S4Vectors_0.34.0            BiocGenerics_0.42.0        

loaded via a namespace (and not attached):
 [1] bitops_1.0-7             RColorBrewer_1.1-3       numDeriv_2016.8-1.1     
 [4] tools_4.2.0              utf8_1.2.3               R6_2.5.1                
 [7] irlba_2.3.5              KernSmooth_2.23-20       DBI_1.1.3               
[10] colorspace_2.0-3         apeglm_1.18.0            tidyselect_1.1.2        
[13] compiler_4.2.0           cli_3.5.0                DelayedArray_0.22.0     
[16] rtracklayer_1.56.1       caTools_1.18.2           scales_1.2.0            
[19] SQUAREM_2021.1           mvtnorm_1.1-3            mixsqp_0.3-43           
[22] stringr_1.4.0            digest_0.6.29            Rsamtools_2.12.0        
[25] XVector_0.36.0           jpeg_0.1-9               pkgconfig_2.0.3         
[28] htmltools_0.5.2          fastmap_1.1.0            invgamma_1.1            
[31] bbmle_1.0.25             limma_3.52.4             BSgenome_1.64.0         
[34] htmlwidgets_1.5.4        rlang_1.0.6              BiocIO_1.6.0            
[37] generics_0.1.2           hwriter_1.3.2.1          BiocParallel_1.30.3     
[40] gtools_3.9.2.2           dplyr_1.0.9              RCurl_1.98-1.7          
[43] magrittr_2.0.3           GenomeInfoDbData_1.2.8   Matrix_1.5-1            
[46] Rcpp_1.0.10              munsell_0.5.0            fansi_1.0.3             
[49] lifecycle_1.0.3          stringi_1.7.6            yaml_2.3.5              
[52] MASS_7.3-56              zlibbioc_1.42.0          gplots_3.1.3            
[55] plyr_1.8.7               grid_4.2.0               parallel_4.2.0          
[58] ggrepel_0.9.1            bdsmatrix_1.3-6          crayon_1.5.1            
[61] lattice_0.20-45          Biostrings_2.64.0        locfit_1.5-9.5          
[64] pillar_1.7.0             rjson_0.2.21             systemPipeR_2.2.2       
[67] codetools_0.2-18         XML_3.99-0.10            glue_1.6.2              
[70] ShortRead_1.54.0         GreyListChIP_1.28.1      latticeExtra_0.6-29     
[73] png_0.1-7                vctrs_0.5.1              gtable_0.3.0            
[76] purrr_0.3.4              amap_0.8-18              assertthat_0.2.1        
[79] ashr_2.2-54              ggplot2_3.4.1            emdbook_1.3.12          
[82] restfulr_0.0.15          coda_0.19-4              truncnorm_1.0-8         
[85] tibble_3.1.7             GenomicAlignments_1.32.0 ellipsis_0.3.2
DiffBind • 1.8k views
ADD COMMENT
2
Entering edit mode
Rory Stark ★ 5.2k
@rory-stark-5741
Last seen 1 day ago
Cambridge, UK

"broadPeak" is not specifically supported as a peakFormat (see help page for dba.peakset()).

In the broadPeak format, the score is in the fifth column. So you could try:

peaks <- dba(sampleSheet = sampleSheet, scoreCol=5)

As you've already specified the PeakCaller in the sampleSheet as "bed", you don't even have to do this - you can leave out peakFormat and scoreCol completely.

I can see that it might be nice to be able to set the peakFormat to an arbitrary string to track it as metadata, I'll put this on the feature list.

ADD COMMENT
0
Entering edit mode

That worked perfectly, thank you for this!

ADD REPLY
1
Entering edit mode
@james-w-macdonald-5106
Last seen 2 hours ago
United States

If you don't specify the argument name, R will use positional arguments. The first position for dba is intended to be a DBA object, not a sampleSheet, so you have to use argument names for all of your arguments.

ADD COMMENT
0
Entering edit mode

thank you for this explanation, when I did that I received the following error:

peaks <- dba(sampleSheet =sampleSheet, peakFormat="broadPeak") Dox-1d-ASCL1-10 Neurons Treated DOX1D DOX1D 1 bed Error in peaks[, pCol]/max(peaks[, pCol]) : non-numeric argument to binary operator

ADD REPLY

Login before adding your answer.

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