tanaylab / metacells

Metacells - Single-cell RNA Sequencing Analysis
MIT License
86 stars 8 forks source link

AssertionError on outgoing rank from KNN #30

Closed Benfeitas closed 1 year ago

Benfeitas commented 1 year ago

Hi,

I'm computing metacells per cluster, and finding an AssertionError thrown in _rank_outgoing line 278 of metacells/tools/knn_graph.py: assert np.sum(np.diagonal(outgoing_ranks) == size) == size. I've exported the outgoing_ranks and can see that only 9 elements of the diagonal vector are equal to size. How would you approach this issue?

Thanks in advance

orenbenkiki commented 1 year ago

What is the value of the remaining elements, and how many are there in total? Are there NaN values in there (that will cause all sort of trouble).

If the matrices are small enough, I'd go into the code and examine the intermediate results (that means directly patching the source code, though).

orenbenkiki commented 1 year ago

Closing assuming it was a NaN issue?

Benfeitas commented 1 year ago

hi, yes, I could not examine exactly what was going on. I went back to change the input data and all worked in the end, so I couldn't really understand what happened but the NaN is not unlikely