genepattern / single_cell_clustering_notebook

BSD 3-Clause "New" or "Revised" License
8 stars 10 forks source link

reverted to python3.6 (gpnb 19.07.1) #23

Closed alex-wenzel closed 4 years ago

alex-wenzel commented 4 years ago

This pull request makes the notebook (with new visualizations from the F1000 revision) compatible with the python3.6 kernel on the notebook server. Development was with the recommended stable version of the notebook server 19.07.1. The notebook runs all the way through on the example dataset in the 19.07.1 docker container on my laptop.

edjuaro commented 4 years ago

@alex-wenzel I am running it locally and when I run it on the 3.6 kernel I get an error on the PCA step. Using the 3.7 kernel runs just fine. I'm not sure how to proceed.

Here is the error I get on the Python 3.6 kernel

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-9-5abef441b83b> in <module>
----> 1 analysis.preprocess_counts(min_n_cells=3, min_n_genes=200, max_n_genes=1700, min_n_counts=0, max_n_counts=5700, min_percent_mito=0, max_percent_mito=6, normalization_method="LogNormalize", do_regression=True)

/Notebooks/single_cell_clustering_notebook/singlecell.py in preprocess_counts(self, min_n_cells, min_n_genes, max_n_genes, min_n_counts, max_n_counts, min_percent_mito, max_percent_mito, normalization_method, do_regression)
    715         if success_run:
    716             _update_status(stat, "Preparing preprocessing results visualizations...")
--> 717             self._preprocess_counts_ui(orig_n_cells, orig_n_genes)
    718             _update_status(stat, "Done! See the results of preprocessing below")
    719 

/Notebooks/single_cell_clustering_notebook/singlecell.py in _preprocess_counts_ui(self, orig_n_cells, orig_n_genes)
    831         display(output_div)
    832         display(_info_message('Hover over the plot to interact.'))
--> 833         pca_fig, pca_py_fig = self._plot_pca()
    834         pca_plot_box = Output(layout=Layout(
    835             display='flex',

/Notebooks/single_cell_clustering_notebook/singlecell.py in _plot_pca(self)
    845         fig_elbow_plot = plt.figure(figsize=(7, 6))
    846         #pc_var = self.data.uns['pca_variance_ratio']
--> 847         pc_var = self.data.uns['pca']['variance_ratio']
    848         pc_var = pc_var[:min(len(pc_var), 30)]
    849 

KeyError: 'pca'
<Figure size 504x432 with 0 Axes>
alex-wenzel commented 4 years ago

@edjuaro Can you confirm you're looking at the 36kernel branch? That line of code should indeed cause a KeyError in the 3.6, but I have it commented out on the 36kernel branch.

image
edjuaro commented 4 years ago

Nope, I was on the develop branch -- my bad, that's the default branch I checkout for PRs. I'll check out the 36kernel branch.

edjuaro commented 4 years ago

It runs as expected. Note that I removed one line that seemed like a debugging line to me. See commit 53daea0 for "details"

edjuaro commented 4 years ago

@alex-wenzel Should we clean up the many branches in this repo? I like the minimalist approach of "Only a master and a develop branch unless we need other branches"

alex-wenzel commented 4 years ago

@edjuaro Agreed. I'll go ahead and delete this branch. I'm sure the other ones can be deleted as well since they're quite old. Sorry also for the name confusion.