hemberg-lab / SC3

A tool for the unsupervised clustering of cells from single cell RNA-Seq experiments
http://bioconductor.org/packages/SC3
GNU General Public License v3.0
119 stars 55 forks source link

unable to generate sc3_plot_cluster_stability plot in loop #52

Closed ghost closed 5 years ago

ghost commented 6 years ago

Hi,

I have a script which attempts to generate a pdf file that includes the sc3_plot_cluster_stabilty plot and it appears that if the function is used in a loop, the plot is not able to be generated. However, if the function is used outside of the loop, the plot is able to be generated.

I am currently running the function in a script through the commandline using the sample dataset that was provided.

pdf("fout.pdf")
for(i in num_of_clusters ){
  sc3_plot_cluster_stability(sce, k = i)
  sc3_plot_consensus(sce, k=i )
  sc3_plot_silhouette(sce, k=i)
  sc3_plot_expression(sce, k = i)
}

In the code snippet, the num_of_clusters is a user provided value. This returns a pdf with all of the plots except the cluster stability. Perhaps someone has insight on this?

I would be happy to email/provide the script and my commandline arguments if that would help.

wikiselev commented 6 years ago

Hi, sorry, I missed this completely, hope you have already solved your problem. But I think, what you are doing is not right. Please look at the pdf documentation, but running a for loop after this functions is generally not a good idea.

alfonsosaera commented 6 years ago

Dear wikiselev,

Could you elaborate a little bit more why running a for loop is not a good idea? or could you direct me to the part of the manual that explain it?

Thanks!

wikiselev commented 6 years ago

@alfonsosaera I don't know, it's just my experience. If it works, that's great, if it does not work in a for loop, but works without it, I would just run it without it then.

alfonsosaera commented 6 years ago

Thanks for the quick answer!