chromVAR icon indicating copy to clipboard operation
chromVAR copied to clipboard

getCounts error

Open jf292 opened this issue 3 years ago • 2 comments

Hi,

I am running into an error when using the getCounts function: fragment_counts <- getCounts(singlecellbams, final_peaks, paired=TRUE, by_rg=FALSE, format = "bam", colData= data.frame(celltype = cellnames))

It seems to be an issue with the bam files rather than the peaks as I can get fragment_counts using the same peaks with a different set of bam files. Would you be able to shed some light on the issue?

Many thanks, Julia

Error in validObject(.Object): invalid class “GRanges” object: 'x@strand' is not parallel to 'x'

Traceback:

  1. getCounts(singlecellbams2, final_peaks, paired = TRUE, by_rg = FALSE, . format = "bam", colData = data.frame(celltype = cellnames))
  2. get_counts_from_bams(alignment_files, peaks, paired, by_rg, colData)
  3. bamToFragments(bams[i], paired = paired)
  4. GRanges(seqnames = scanned$rname, IRanges(start = scanned$pos, . width = 1), strand = "+")
  5. new_GRanges("GRanges", seqnames = seqnames, ranges = ranges, . strand = strand, mcols = mcols, seqlengths = seqlengths, . seqinfo = seqinfo)
  6. new(Class, seqnames = seqnames, ranges = ranges, strand = strand, . elementMetadata = mcols, seqinfo = seqinfo)
  7. initialize(value, ...)
  8. initialize(value, ...)
  9. validObject(.Object)
  10. stop(msg, ": ", errors, domain = NA)

jf292 avatar Feb 23 '21 20:02 jf292

I have a similar issue with getCounts with my own data and testing example(https://rdrr.io/bioc/chromVAR/man/getCounts.html). error message is the same(: I have no clue how to fix it and would appreciate very much if anyone help me fix it. Many thanks in advance!

code used:

`

First we'll read in some peaks

peaks_file <- system.file("extdata", "test_bed.txt", package = "chromVAR") test_peaks <- getPeaks(peaks_file, sort = TRUE)

With single bam with RG tags (can also give multiple bams with RG)

test_rg <- system.file("extdata", "test_RG.bam", package = "chromVAR") test_counts <- getCounts(test_rg, peaks = test_peaks, by_rg = TRUE, paired = TRUE, colData = S4Vectors::DataFrame(condition ="A")) `

error message

Error in getCounts(test_rg, peaks = test_peaks, by_rg = TRUE, paired = TRUE, : unused arguments (peaks = test_peaks, by_rg = TRUE, paired = TRUE, colData = S4Vectors::DataFrame(condition = "A"))

session info

R version 4.1.0 (2021-05-18) Platform: x86_64-pc-linux-gnu (64-bit) Running under: CentOS Linux 7 (Core)

Matrix products: default BLAS/LAPACK: /usr/local/intel/compilers_and_libraries_2020.2.254/linux/mkl/lib/intel64_lin/libmkl_rt.so

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

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

other attached packages: [1] xlsx_0.6.5 edgeR_3.36.0 limma_3.50.0 [4] corrplot_0.92 ggpubr_0.4.0 DESeq2_1.34.0 [7] SummarizedExperiment_1.24.0 Biobase_2.54.0 MatrixGenerics_1.6.0 [10] matrixStats_0.61.0 chromVAR_1.16.0 GenomicRanges_1.46.1 [13] GenomeInfoDb_1.30.0 IRanges_2.28.0 S4Vectors_0.32.3 [16] BiocGenerics_0.40.0 viridis_0.6.2 viridisLite_0.4.0 [19] ggplot2_3.3.5 stringr_1.4.0 dplyr_1.0.7

loaded via a namespace (and not attached): [1] colorspace_2.0-2 ggsignif_0.6.3 rjson_0.2.21 [4] ellipsis_0.3.2 XVector_0.34.0 rstudioapi_0.13 [7] DT_0.20 bit64_4.0.5 AnnotationDbi_1.56.2 [10] fansi_1.0.2 splines_4.1.0 R.methodsS3_1.8.1 [13] cachem_1.0.6 geneplotter_1.72.0 jsonlite_1.7.3 [16] Rsamtools_2.10.0 seqLogo_1.60.0 rJava_1.0-5 [19] broom_0.7.12 annotate_1.72.0 GO.db_3.14.0 [22] png_0.1-7 R.oo_1.24.0 shiny_1.7.1 [25] readr_2.1.2 compiler_4.1.0 httr_1.4.2 [28] backports_1.4.1 assertthat_0.2.1 Matrix_1.3-4 [31] fastmap_1.1.0 lazyeval_0.2.2 cli_3.1.1 [34] later_1.3.0 htmltools_0.5.2 tools_4.1.0 [37] gtable_0.3.0 glue_1.6.1 TFMPvalue_0.0.8 [40] GenomeInfoDbData_1.2.7 reshape2_1.4.4 Rcpp_1.0.8 [43] carData_3.0-5 vctrs_0.3.8 Biostrings_2.62.0 [46] rtracklayer_1.54.0 CNEr_1.30.0 xlsxjars_0.6.1 [49] mime_0.12 miniUI_0.1.1.1 lifecycle_1.0.1 [52] restfulr_0.0.13 poweRlaw_0.70.6 gtools_3.9.2 [55] rstatix_0.7.0 XML_3.99-0.8 zlibbioc_1.40.0 [58] scales_1.1.1 BSgenome_1.62.0 hms_1.1.1 [61] promises_1.2.0.1 parallel_4.1.0 RColorBrewer_1.1-2 [64] yaml_2.2.2 memoise_2.0.1 gridExtra_2.3 [67] stringi_1.7.6 RSQLite_2.2.9 genefilter_1.76.0 [70] BiocIO_1.4.0 caTools_1.18.2 BiocParallel_1.28.3 [73] rlang_1.0.1 pkgconfig_2.0.3 bitops_1.0-7 [76] pracma_2.3.6 lattice_0.20-45 purrr_0.3.4 [79] GenomicAlignments_1.30.0 htmlwidgets_1.5.4 bit_4.0.4 [82] tidyselect_1.1.1 plyr_1.8.6 magrittr_2.0.2 [85] R6_2.5.1 generics_0.1.2 DelayedArray_0.20.0 [88] DBI_1.1.2 pillar_1.7.0 withr_2.4.3 [91] survival_3.2-13 KEGGREST_1.34.0 abind_1.4-5 [94] RCurl_1.98-1.5 tibble_3.1.6 crayon_1.4.2 [97] car_3.0-12 utf8_1.2.2 plotly_4.10.0 [100] tzdb_0.2.0 TFBSTools_1.32.0 locfit_1.5-9.4 [103] grid_4.1.0 data.table_1.14.2 blob_1.2.2 [106] digest_0.6.29 xtable_1.8-4 tidyr_1.2.0 [109] httpuv_1.6.5 R.utils_2.11.0 munsell_0.5.0 [112] DirichletMultinomial_1.36.0

janemd2012 avatar Feb 17 '22 05:02 janemd2012

Never mind! I figure it out. Since there are more than one functions called the getCounts.

adding package info can make it work(:

test_counts <- chromVAR::getCounts(test_rg, peaks = test_peaks, by_rg = TRUE)

janemd2012 avatar Feb 17 '22 05:02 janemd2012