Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plot_gene_loadings error #16

Open
kanghelen opened this issue May 7, 2024 · 9 comments
Open

plot_gene_loadings error #16

kanghelen opened this issue May 7, 2024 · 9 comments
Assignees

Comments

@kanghelen
Copy link

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?

@theAeon theAeon self-assigned this May 7, 2024
@theAeon
Copy link
Member

theAeon commented May 8, 2024

seems this is a dup of #5 but i'm going to close that one as its old

@theAeon
Copy link
Member

theAeon commented May 8, 2024

give it a shot off the master branch and let me know!

@kanghelen
Copy link
Author

Hi @theAeon! Thanks! It seems like I don't have the permission to push a branch.

@kanghelen kanghelen reopened this May 8, 2024
@theAeon
Copy link
Member

theAeon commented May 8, 2024

I think you may want to pull the branch, not push 😅

@kanghelen
Copy link
Author

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!

@theAeon
Copy link
Member

theAeon commented May 8, 2024

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?

@Lulu0015 Lulu0015 self-assigned this May 8, 2024
@kanghelen
Copy link
Author

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:

np.repeat(dataset1, np.sum(labels[dataset2] == factor))),

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

@theAeon
Copy link
Member

theAeon commented May 8, 2024

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.

@theAeon theAeon removed their assignment May 8, 2024
@theAeon
Copy link
Member

theAeon commented Jun 18, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants