plot_gene_loadings error
Hello!
After running iNMF, I am trying to plot the gene loadings on UMAP/tSNE using plot_gene_loadings function. However, there is an error
markers = get_factor_markers(
^^^^^^^^^^^^^^^^^^^
File "/.conda/envs/inmf_env/lib/python3.12/site-packages/pyliger/tools/_marker.py", line 112, in get_factor_mark\
ers
cell_label = np.concatenate(
^^^^^^^^^^^^^^^
TypeError: only integer scalar arrays can be converted to a scalar index
The code on that line shows
cell_label = np.concatenate(
np.repeat(dataset1, np.sum(labels[dataset1] == factor)),
np.repeat(dataset1, np.sum(labels[dataset2] == factor)),
)
But when I tried to change it to the code below, there is no error. (Also note the change to "dataset2" on the third line.)
cell_label = np.concatenate(
[np.repeat(dataset1, np.sum(labels[dataset1] == factor)),
np.repeat(dataset2, np.sum(labels[dataset2] == factor))]
)
Could I ask if this is a reasonable fix?
seems this is a dup of #5 but i'm going to close that one as its old
give it a shot off the master branch and let me know!
Hi @theAeon! Thanks! It seems like I don't have the permission to push a branch.
I think you may want to pull the branch, not push 😅
I don't think I can submit any changes to the repo (e.g. trying to push changes in a branch and create a pull request).
Sorry for any confusion. First time contributing to a public repo!
oh! I see-you have to fork it for that. I was confused because I (think) I already fixed it on the master branch. Can you give it a test?
Got it! I'll try forking next time. Thanks!
I think you fixed the TypeError: only integer scalar arrays can be converted to a scalar index
There might be a logical error: https://github.com/welch-lab/pyliger/blob/b869a3b7459c0cb104b23e5c2d4dfe74bc6fee97/src/pyliger/tools/_marker.py#L114
The second part should be dataset2 so that wilcoxon test can compare between two datasets.
This will cause a subsequent error:
u, z = _mannwhitneyu(ranks[idx], ranks[~idx], T)
ZeroDivisionError: division by zero
I'm getting a divide by zero error on my end even if I change that to dataset2. Currently waiting on the person who wrote it to take a look to figure out what that was supposed to be.
I looked at the R source code and found that you're right about it being dataset2, not dataset1.
https://github.com/welch-lab/liger/blob/58e59572385688b5975f4d70c0537776a33edd74/R/factorMarker.R#L136-L137
Still not sure what the deal with the divide-by-zero error is.