dpeerlab / SEACells

SEACells algorithm for Inference of transcriptional and epigenomic cellular states from single-cell genomics data
GNU General Public License v2.0
145 stars 27 forks source link

Type checking needed in initialize_archetypes #17

Closed smorabit closed 2 years ago

smorabit commented 2 years ago

Hi, I was following along with this tutorial, and I kept coming across this error message triggered on line 194 of core.py:

‘numpy.float64’ object cannot be interpreted as an integer

Based on the tutorial, it was recommended to select one metacell for every 75 single cells, so I thought I was being clever by doing this to automatically select the number of metacells:

n_SEACells = np.floor(adata.obs.shape[0] / 75)

However, this code returns a numpy.float64, which screws up a bunch of the downstream steps such as initialize_archetypes. Basically, this parameter n_SEACells throws an error if it is not an int, so I am suggesting to add in a type check for this parameter so you can throw a more informative error in the future.

ManuSetty commented 2 years ago

n_SEACells needs to be an integer. A simple trick: n_SEACells = int(np.floor(adata.obs.shape[0] / 75))