hansenlab / bsseq

Devel repository for bsseq
36 stars 26 forks source link

BSmooth.tstat error, Error in compute.correction #108

Open yang-mj opened 2 years ago

yang-mj commented 2 years ago

I am trying to run the BSmooth.tstat command for 45 treatment cases and 35 control samples. When I used qSD=0.75 and local.correct=TRUE paramters on the smoothed data , I got the following error: error in evaluating the argument 'args' in selecting a method for function 'do.call': NA/NaN/Inf in foreign function call (arg 2)

while BSmooth.tstat completed successfully when I used a qSD value <= 0.65 or >=0.85 and local.correct=TRUE

Is there any suggestion for choosing qSD and why it failed when I used the default qSD value?

Thank you!

sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: $HOME/anaconda2/envs/r_412/lib/libopenblasp-r0.3.18.so

locale:
[1] C

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

other attached packages:
 [1] locfit_1.5-9.5              bsseq_1.30.0
 [3] SummarizedExperiment_1.24.0 Biobase_2.54.0
 [5] MatrixGenerics_1.6.0        matrixStats_0.61.0
 [7] GenomicRanges_1.46.1        GenomeInfoDb_1.30.1
 [9] IRanges_2.28.0              S4Vectors_0.32.3
[11] BiocGenerics_0.40.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8                restfulr_0.0.13
 [3] compiler_4.1.2            XVector_0.34.0
 [5] R.methodsS3_1.8.1         R.utils_2.11.0
 [7] rhdf5filters_1.6.0        bitops_1.0-7
 [9] tools_4.1.2               DelayedMatrixStats_1.16.0
[11] zlibbioc_1.40.0           BSgenome_1.62.0
[13] lifecycle_1.0.1           rhdf5_2.38.0
[15] lattice_0.20-45           rlang_1.0.2
[17] Matrix_1.4-0              DelayedArray_0.20.0
[19] cli_3.2.0                 yaml_2.3.5
[21] GenomeInfoDbData_1.2.7    rtracklayer_1.54.0
[23] Biostrings_2.62.0         gtools_3.9.2
[25] grid_4.1.2                data.table_1.14.2
[27] R6_2.5.1                  HDF5Array_1.22.1
[29] XML_3.99-0.8              BiocParallel_1.28.3
[31] limma_3.50.1              Rhdf5lib_1.16.0
[33] GenomicAlignments_1.30.0  Rsamtools_2.10.0
[35] scales_1.1.1              sparseMatrixStats_1.6.0
[37] permute_0.9-7             colorspace_2.0-3
[39] RCurl_1.98-1.6            munsell_0.5.0
[41] rjson_0.2.21              crayon_1.5.0
[43] R.oo_1.24.0               BiocIO_1.4.0
PeteHaitch commented 2 years ago

Hi @yang-mj,

I'm not sure why that it wouldn't be working for the default value of qSd but is for others values both less-than or more-than the default. It's not a parameter I have much experience with, but perhaps @kasperdanielhansen may be able to provide some ideas.

Cheers, Pete

kasperdanielhansen commented 2 years ago

I have no idea to be honest. It computes a quantile of the CpG-specific standard deviations. It looks like you have missing values, and that would result in the quantiles having missing values and stuff failing. But that should be the case no matter what the argument is for qSD, I have no idea how it would work with some values and not with others.

Do you have any super weird contigs, like contigs with very few CpGs in them? If so, I would remove them and try again.

Best, Kasper

On Fri, Apr 1, 2022 at 8:20 PM Peter Hickey @.***> wrote:

Hi @yang-mj https://github.com/yang-mj,

I'm not sure why that it wouldn't be working for the default value of qSd but is for others values both less-than or more-than the default. It's not a parameter I have much experience with, but perhaps @kasperdanielhansen https://github.com/kasperdanielhansen may be able to provide some ideas.

Cheers, Pete

— Reply to this email directly, view it on GitHub https://github.com/hansenlab/bsseq/issues/108#issuecomment-1086426946, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABF2DHZ6M2JOR6X7KRAGNNTVC6HEPANCNFSM5ROON6TA . You are receiving this because you were mentioned.Message ID: @.***>

-- Best, Kasper

priyatamapandey commented 1 year ago

Hi All, I am having the same issue while running the tstats. It fails while computing across the sample. I have also tired with estimate.var = "same" but retuned the same error.

@yang-mj, any suggestion whether you were able to fix it?

Screenshot 2023-04-27 at 10 54 23 AM

Thank you, Priya

yang-mj commented 1 year ago

@priyatamapandey I fixed it by swapping these two groups. What I did was only used symmetric CpG sites with minimum 10x coverage (http://smithlabresearch.org/software/methpipe/) and then followed the bsseq pipeline on bsseq's website. So try to set D1 D2 as either group1 or group2 and it'll probably be fixed

priyatamapandey commented 1 year ago

Thank you for your quick reply. I swapped the group as group2 = c("D1","D2") and kept estimate.var = "group2". It did not fail but Is it statistically correct? As in the base documentation it says that two groups being compared (it is always group1 - group2 ) and estimate.var is considers based on the low variability samples.

I am attaching the plot while looking the plot what cutoff to choose and put in dmrFinder function further, any suggestion is appreciated?

Screenshot 2023-04-27 at 2 31 46 PM

Thank you, Priya