qsbase / qs

Quick serialization of R objects
400 stars 19 forks source link

qsavem error unexpected end of input 1 #39

Closed vtosevski closed 4 years ago

vtosevski commented 4 years ago

Hi there,

I used to use qsavem previously without issues but now somehow it doesn't work, and I don't understand why. The example code that comes with the package works fine, but when using it in an actual pipeline I am getting:

Error in parse(text = paste0("qsave(savelist, ", paste0(objnames[-unnamed], : <text>:2:0: unexpected end of input 1: qsave(savelist, qsavem(file = "/pstore/data/RICZ_SCA/09_CD20-TCB/abundance_expression_ExpA_SCT.qs") ^

The traceback shows:

3. parse(text = paste0("qsave(savelist, ", paste0(objnames[-unnamed], collapse = ", "), ")"))
2. eval(parse(text = paste0("qsave(savelist, ", paste0(objnames[-unnamed], collapse = ", "), ")")))
1. qsavem(file = "/pstore/data/RICZ_SCA/09_CD20-TCB/abundance_expression_ExpA_SCT.qs", seurat, lineages, T.markers, tumor.markers, cluster_DEG_A, cluster_DEG_B, GO_A, GO_B)

What am I doing wrong here?

Thanks, Vinko

traversc commented 4 years ago

Should be fixable, will let you know.

@bryce-chamberlain do you want to have a look? (Also, do you want to fill out your information in the DESCRIPTION file?)

Looks like it fails because the command gets broken into several lines.

Simple reproducible example:

seurat <-lineages <-T.markers <-tumor.markers <-cluster_DEG_A <-cluster_DEG_B <-GO_A <- GO_B <- 1

qsavem(file = "abundance_expression_ExpA_SCT.qs", seurat, lineages, T.markers, tumor.markers, cluster_DEG_A, cluster_DEG_B, GO_A, GO_B)
traversc commented 4 years ago

In the mean time, you can do this which is equivalent:

qsave(file = "abundance_expression_ExpA_SCT.qs", list(seurat=seurat, lineages=lineages, 
                                                      T.markers=T.markers, tumor.markers=tumor.markers, 
                                                      cluster_DEG_A=cluster_DEG_A, cluster_DEG_B=cluster_DEG_B, GO_A=GO_A, GO_B=GO_B))
brycechamberlain-ow commented 4 years ago

Sure, I'll take a look.

brycechamberlain-ow commented 4 years ago

Looks like there is an issue where the file argument must be last. So

qsavem(seurat, lineages, T.markers, tumor.markers, cluster_DEG_A, cluster_DEG_B, GO_A, GO_B, file = "abundance_expression_ExpA_SCT.qs")

might work. I'll submit a PR to remove this requirement.

vtosevski commented 4 years ago

Hi both,

Thanks a lot for the swift reply. I have initially tried both suggestions you made (making a named list of objects as an argument) and also putting file argument last (and also with and without nthreads argument). None of those worked albeit I was getting a different error message, if memory serves me well. Let me do that again and report the exact outcome.

traversc commented 4 years ago

@vtosevski Try remotes::install_github("traversc/qs")