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

Hashsolo failing when only two HTOs are present? #77

Closed
apredeus opened this issue Oct 25, 2022 · 5 comments
Closed

Hashsolo failing when only two HTOs are present? #77

apredeus opened this issue Oct 25, 2022 · 5 comments

Comments

@apredeus
Copy link

Hi,

Thank you for the tool - it's very useful for reprocessing cell hashing experiments! However, I've come across a strange issue which I think comes down to how hashsolo estimates noise. When the multiplexed sample has only 2 HTOs, the hashsolo invariably fails - generating lots of NaNs, and assigning all cells to either "negative" or a "doublet", while the HTO distribution clearly suggests otherwise.

Is this expected? I saw this comment in the code and thought that's probably what's causing the issue:

Noise distributions for a hashing barcode are estimated from samples where that hashing barcode is one the k-2 lowest barcodes, where k is the number of barcodes.

Perhaps it's something more basic though. The manual/README doesn't seem to mention this - is the user expected to provide a matrix of raw HTO counts, or do they need to be normalized/filtered in any way?

Would be thankful for any comment/feedback.

@njbernstein
Copy link
Contributor

Hi there,

The documentation should be more clear about this but its not. Very sorry about that.

Set the number of noise barcodes = 1 either via the command line argument -n 1 or when using the python function hasholo(..., number_of_noise_barcodes=1)

Let me know if that doesnt fix the issue.

Best,
Nick

@apredeus
Copy link
Author

Hi Nick,
thank you for the quick reply! Yes the default of "null" for this variable has tripped me up - perhaps it would be good to update the README. I've used the latter option for "inline" hashsolo and it didn't fix the issues.

Could you comment if the data is expected to be normalized/log-transformed/cleaned from low count droplets for hashsolo?

Thank you

@njbernstein
Copy link
Contributor

Hi there,

Sorry I have responded for over a year. The data expected is a an h5ad with count data (completely untransformed)

I will try to get a PR in shortly to fix it when only two hashes are present.

Best,
Nick

@njbernstein
Copy link
Contributor

Actually now that I've caught back up on this I believe it must be input counts you were giving it that were causing the issue. @davek44 I think we can close this out as well.

@davek44 davek44 closed this as completed Oct 4, 2023
@ccasar
Copy link

ccasar commented Oct 5, 2023

I also want to run Hashsolo on a data set where only 2 HTOs are present.

However, when I use the CLI version and set -n 1, Hashsolo crashes with this error:

  File "<path>/miniconda3/envs/scRNA_solo/bin/hashsolo", line 8, in <module>
    sys.exit(main())
  File "<path>/miniconda3/envs/scRNA_solo/lib/python3.7/site-packages/solo/hashsolo.py", line 602, in main
    **params
  File "<path>/miniconda3/envs/scRNA_solo/lib/python3.7/site-packages/solo/hashsolo.py", line 392, in hashsolo
    posterior_dict = _calculate_bayes_rule(data, priors, number_of_noise_barcodes)
  File "<path>/miniconda3/envs/scRNA_solo/lib/python3.7/site-packages/solo/hashsolo.py", line 239, in _calculate_bayes_rule
    data, number_of_noise_barcodes
  File "<path>/miniconda3/envs/scRNA_solo/lib/python3.7/site-packages/solo/hashsolo.py", line 86, in _calculate_log_likelihoods
    if number_of_noise_barcodes is not None
TypeError: unsupported operand type(s) for -: 'int' and 'str'

I assume this happens because the value for -n is never converted to an integer?

Edit: Adding type=int to the argument parser for -n seems to fix the issue. But clarifying the help message and including that n-1 is the correct number for this option would still be helpful.

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

4 participants