r3fang / SnapATAC

Analysis Pipeline for Single Cell ATAC-seq
GNU General Public License v3.0
301 stars 125 forks source link

runJDA with Knit Rmarkdown #39

Closed JGASmits closed 5 years ago

JGASmits commented 5 years ago

hi Rongxin Fang,

While working with SnapATAC I'm using a R markdown file (in order to more easily show stuff during work discussions). I noticed however that the runJDA command breaks the Knit process. My code runs fine but kniting the document breaks at the runJDA command giving the following error:

Error in isIncomplete(con) : invalid connection Calls: ... handle_condition -> handle_output -> -> isIncomplete Quitting from lines 19-36 (file.Rmd) Error in isOpen(con) : invalid connection Calls: ... -> evaluate_call -> -> isOpen Execution halted

I tried to also generate a knited document from the demo.sp dataset ant the same problem is occurring there. Rmd code used:

title: "SnapATAC_test" author: "Jsmits" date: "May 22, 2019" output: html_document

library('SnapATAC')
data(demo.sp)
demo.sp = makeBinary(demo.sp)
demo.sp = runJDA(
obj=demo.sp, 
input.mat="bmat", 
 bin.cov.zscore.lower=-2,
 bin.cov.zscore.upper=2,
pc.num=50,
norm.method="normOVE",
tmp.folder=tempdir(),
max.var=2000,
do.par=TRUE,
ncell.chunk=1000,
num.cores=5,
seed.use=10)

Am I doing something wrong or is it a small bug somewhere?

Greetings Jos Smits

PS: here is my session info:

R version 3.5.1 (2018-07-02) Platform: x86_64-conda_cos6-linux-gnu (64-bit) Running under: Gentoo/Linux

Matrix products: default BLAS/LAPACK: /home/jsmits/anaconda3/envs/P3_SnapATAC/lib/R/lib/libRblas.so

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

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

other attached packages: [1] SnapATAC_1.0.0 rhdf5_2.26.2 Matrix_1.2-17

loaded via a namespace (and not attached): [1] Rcpp_1.0.1 plyr_1.8.4 compiler_3.5.1 RColorBrewer_1.1-2 GenomeInfoDb_1.18.2 XVector_0.22.0
[7] bitops_1.0-6 iterators_1.0.10 tools_3.5.1 zlibbioc_1.28.0 digest_0.6.19 evaluate_0.13
[13] Rtsne_0.15 lattice_0.20-38 pkgconfig_2.0.2 doSNOW_1.0.16 foreach_1.4.4 igraph_1.2.4.1
[19] yaml_2.2.0 parallel_3.5.1 xfun_0.7 GenomeInfoDbData_1.2.0 raster_2.9-5 knitr_1.23
[25] S4Vectors_0.20.1 IRanges_2.16.0 stats4_3.5.1 locfit_1.5-9.1 grid_3.5.1 snow_0.4-3
[31] bigmemory_4.5.33 bigmemory.sri_0.1.3 rmarkdown_1.12 RANN_2.6.1 sp_1.3-1 irlba_2.3.3
[37] limma_3.38.3 Rhdf5lib_1.4.3 edgeR_3.24.3 magrittr_1.5 scales_1.0.0 codetools_0.2-16
[43] htmltools_0.3.6 BiocGenerics_0.28.0 GenomicRanges_1.34.0 colorspace_1.4-1 munsell_0.5.0 RCurl_1.95-4.12
[49] doParallel_1.0.14

AlexChitsazan commented 5 years ago

I have the same issue. Any update?

r3fang commented 5 years ago

Hi there,

Can you maybe run each step separately instead of runJDA and let me know at which step it failed https://github.com/r3fang/SnapATAC/blob/65da1ebbd01a086fc47f2308d05d907527c4efa5/examples/10X_P50/README.md https://github.com/r3fang/SnapATAC/blob/65da1ebbd01a086fc47f2308d05d907527c4efa5/examples/10X_P50/README.md

-- Rongxin Fang, Ren Lab Ludwig Cancer Research Bioinformatics Ph.D. Student University of California, San Diego

On Jun 20, 2019, at 4:33 PM, StatsAreForLosers notifications@github.com wrote:

I have the same issue. Any update?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/r3fang/SnapATAC/issues/39?email_source=notifications&email_token=ABT6GGY2K4FHRDMHK72A3K3P3QHUBA5CNFSM4HOSQRB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYHAL3I#issuecomment-504235501, or mute the thread https://github.com/notifications/unsubscribe-auth/ABT6GG2IBWUP6SVTR5RAGZTP3QHUBANCNFSM4HOSQRBQ.

JGASmits commented 5 years ago

Dear Rongxin,

If i use the seperate steps instead of runJDA, it crashes at the runNormJaccard() step. Once agian only if I knit it, if i run it otherwise it works. a bit weird :S

Greetings Jos

r3fang commented 5 years ago

I know, it is wired. Can you try it with runNormJaccard by setting do.par=FALSE?

-- Rongxin Fang, Ren Lab Ludwig Cancer Research Bioinformatics Ph.D. Student University of California, San Diego

On Jun 21, 2019, at 11:25 AM, Jos Smits notifications@github.com wrote:

Dear Rongxin,

If i use the seperate steps instead of runJDA, it crashes at the runNormJaccard() step. Once agian only if I knit it, if i run it otherwise it works. a bit weird :S

Greetings Jos

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/r3fang/SnapATAC/issues/39?email_source=notifications&email_token=ABT6GG7XFXQIJFVVO3VP4VTP3UMIPA5CNFSM4HOSQRB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYJHEEA#issuecomment-504525328, or mute the thread https://github.com/notifications/unsubscribe-auth/ABT6GGZFS2NRSB266SXKYNLP3UMIPANCNFSM4HOSQRBQ.

JGASmits commented 5 years ago

Thanks for your responses! Running runNormJaccard with the option do.par=FALSE seems to knit agian. So it is something in the paralellization that breaks something in knitr.

r3fang commented 5 years ago

I think so... if you don’t have a very large number, so.par=FALSE is fine

Sent from my iPhone

On Jun 21, 2019, at 12:19 PM, Jos Smits notifications@github.com wrote:

Thanks for your responses! Running runNormJaccard with the option do.par=FALSE seems to knit agian. So it is something in the paralellization that breaks something in knitr.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

JGASmits commented 5 years ago

Once my samplesize is starting to get to large ill just have to stop using knitr i guess. Not ideal but workable. Thanks for your help troubleshooting.