I have the following code which produces the following error:
bamDataRanges <- getReadCountsFromBAM(BAMFiles, sampleNames=NULL, parallel=15)
head(bamDataRanges)
resCNMOPS <- exomecn.mops(bamDataRanges, normType = "median",minReadCount = 10)
resCNMOPS_cICN <- calcIntegerCopyNumbers(resCNMOPS)
The error is:
Normalizing...
Warning message in normalizeChromosomes(X, chr = chr, normType = normType, qu = normQu, : “Normalization for reference sequence chrM not applicable, because of low number of segments” Error in normalizeChromosomes(X, chr = chr, normType = normType, qu = normQu, : Some normalization factors are zero! Remove samples or chromosomes for which the average read count is zero, e.g. chromosome Y. Traceback:
- exomecn.mops(trimming, normType = "median", minReadCount = 10)
- cn.mops(input = input, I = I, classes = classes, priorImpact = priorImpact, . cyc = cyc, parallel = parallel, normType = normType, normQu = normQu, . norm = norm, sizeFactor = sizeFactor, quSizeFactor = quSizeFactor, . lowerThreshold = lowerThreshold, upperThreshold = upperThreshold, . minWidth = minWidth, segAlgorithm = segAlgorithm, minReadCount = minReadCount,
. useMedian = useMedian, returnPosterior = returnPosterior, .
...)- normalizeChromosomes(X, chr = chr, normType = normType, qu = normQu, . sizeFactor = sizeFactor, quSizeFactor = quSizeFactor)
- stop(paste("Some normalization factors are zero!", "Remove samples or chromosomes for which the average read count is zero,", .
"e.g. chromosome Y."))
My session info (if required) is below using the following command
sessionInfo()
The output:
R version 4.2.2 (2022-10-31) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux 10 (buster)
Matrix products: default BLAS: path LAPACK: path
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=Cattached base packages: [1] stats4 parallel stats graphics grDevices utils datasets
[8] methods baseother attached packages: [1] cn.mops_1.44.0 GenomicRanges_1.50.2 GenomeInfoDb_1.34.9
[4] IRanges_2.32.0 S4Vectors_0.36.1 BiocGenerics_0.44.0loaded via a namespace (and not attached):
1] pillar_1.8.1 compiler_4.2.2 XVector_0.38.0
[4] base64enc_0.1-3 bitops_1.0-7 tools_4.2.2
[7] zlibbioc_1.44.0 digest_0.6.31 uuid_1.1-0
[10] jsonlite_1.8.4 evaluate_0.19 lifecycle_1.0.3
[13] rlang_1.0.6 IRdisplay_1.1 cli_3.5.0
[16] IRkernel_1.3.2 fastmap_1.1.0 GenomeInfoDbData_1.2.9 [19] repr_1.1.6 Biostrings_2.66.0 vctrs_0.5.1
[22] glue_1.6.2 Biobase_2.58.0 snow_0.4-4
[25] exomeCopy_1.44.0 fansi_1.0.3 BiocParallel_1.32.5
[28] pbdZMQ_0.3-9 Rsamtools_2.14.0 codetools_0.2-18
[31] htmltools_0.5.4 utf8_1.2.2 RCurl_1.98-1.9
[34] crayon_1.5.2
I tried to trim is using trim(bamDataRanges)
and inputting that into the exomecn.mops()
function however, that did not stop the issue. How can I create a function to remove the zeros if there are zeros.