make_SampleQC_report() reports a "object 'qc_dt' not found".
Closed this issue · 5 comments
It seems make_SampleQC_report()
expects the QC datatable to be named qc_dt
. Mine isnt named as such. I thus renamed my dt qc_dt
. This resulted in the error:
"Quitting from lines 67-79 (SampleQC_report_template.Rmd)
Something went wrong with rendering your report :/
Here's the original error message:
comparison (1) is possible only for atomic and list types"
Hey
Thanks for this. There were two issues:
- Your code for making
qc_dt
and calling other functions wasn't quite right to work within the currentSampleQC
framework. I definitely need to both think this through, and do some clearer examples! I've written some code below that should make it work. - There was a bug in one of the plotting functions that was previously hidden by qc_names usually being present in the global scope. Think I need to look at using
.local
...
If you reinstall SampleQC
, then the following code should work:
library('data.table')
library('SampleQC')
cell.mets <- readRDS("/home/imran/code/roche_p2/output/cell.mets.rds")
cell.mets <- cell.mets[,c("log_counts", "log_feats", "mito_prop"):=
list(log10(lib_size), log10(num_detected_genes), subsets_Mt_percent/100)]
# qc.names <- c("log_counts", "log_feats", "mito_prop")
qc.names <- c("log_counts", "log_feats", "logit_mito")
annot_disc <- c("Diagnosis")
qc_dt <- make_qc_dt(cell.mets, qc_names=qc.names)
mmd_list <- calculate_sample_to_sample_MMDs(qc_dt, qc.names, subsample=200, n_times=20)
mmd_list <- embed_sample_to_sample_MMDs(mmd_list, qc_dt, annot_discrete=annot_disc, n_nhbrs=5)
print(table(mmd_list$mmd_clusts))
em_list <- fit_sampleQC(mmd_list, qc_dt, qc.names, K_list=rep(1, length(unique(mmd_list$mmd_clusts))))
proj.name <- 'CSF Columbia study'
save.dir <- 'output/imran_reprex'
dir.create(save.dir)
make_SampleQC_report(mmd_list, em_list, save.dir, proj.name)
It might also be interesting to look at the outputs of this way of calling it:
em_list_2 <- fit_sampleQC(mmd_list, qc_dt, qc.names, K_all=1)
proj.name <- 'CSF Columbia study - v2'
save.dir <- 'output/imran_reprex'
dir.create(save.dir)
make_SampleQC_report(mmd_list, em_list, save.dir, proj.name)
So that's one half - getting it to do what you wanted it to do. I still need to look at the other half - why it behaved weirdly when you called it, and how to catch that.
Quick update, regarding the "otehr half" (i.e. fit_sampleQC() hanging indefinitely).
The call doesnt hang when I do K_all=1
(instead of K_list=rep(1, length(unique(mmd_list$mmd_clusts)))
). Strangely.
Though, I definitely prefer the latter explicit version of the call.
Closing because I haven't been able to replicate the issue... If it's still a problem with the newest version, I can reopen.