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

Assistance Needed with Code Execution #2

Open
chujun225 opened this issue Oct 9, 2024 · 0 comments
Open

Assistance Needed with Code Execution #2

chujun225 opened this issue Oct 9, 2024 · 0 comments

Comments

@chujun225
Copy link

Hi!

I'm making a concerted effort to replicate your impressive workflow, but I've encountered some difficulties that I can't resolve on my own.

I ran the following code:

python
Anchor = 'CD4+ T cells'
ntrain_per_class = 12
K = 50
k = 10
labels = ['1', '2', 'rand1', 'rand2']
classes = [0, 1, 2, 2]
path = '/'.join(os.path.abspath(os.getcwd()).split('/')[:-1]) + '/CRCs'
nrun = 50
nset_thr = 0.9
background = True
ms.run_scima(Anchor, ntrain_per_class, K, k, nset_thr, labels, classes, path, nrun, background)

However, I keep encountering the following error:


ValueError Traceback (most recent call last)
Cell In[102], line 16
14 nset_thr = 0.9
15 background = True
---> 16 ms.run_scima(Anchor, ntrain_per_class, K, k, nset_thr, labels, classes, path, nrun, background)

File ~/S3-CIMA/S3-CIMA-main/S3CIMA/modules_scima.py:246, in run_scima(Anchor, ntrain_per_class, K, k, nset_thr, labels, classes, path, nrun, background)
244 for i in range(0, int(len(labels)/2)):
245 lab = str(labels[i])
--> 246 train_idx[lab] = list(np.random.choice(group[lab], size=ntrain_per_class, replace=False))
247 test_idx[lab] = [j for j in group[lab] if j not in train_idx[lab]]
248 rlab = str(labels[i + int(len(labels)/2)])

File mtrand.pyx:934, in numpy.random.mtrand.RandomState.choice()

ValueError: 'a' cannot be empty unless no samples are taken

The code in S3CIMA_example.ipynb runs successfully up until the line ms.run_scima(Anchor, ntrain_per_class, K, k, nset_thr, labels, classes, path, nrun, background).

I've tried various approaches to fix this issue, but unfortunately, I haven't been able to resolve it. I would greatly appreciate any assistance or guidance you could provide.

Thank you very much!

Feel free to adjust any specific details as needed!

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

1 participant