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

cell type assignment #8

Open
elengss opened this issue Oct 21, 2021 · 1 comment
Open

cell type assignment #8

elengss opened this issue Oct 21, 2021 · 1 comment

Comments

@elengss
Copy link

elengss commented Oct 21, 2021

Dear LucasESBS, thank you very much for creating this.
I have been trying to assign cell types but it seems to produce NaN. Do you have any ideas why? Thanks.

celltype_assign = ct.assign_celltypes(cluster_assignment=cluster_assign, ct_pval_df=ct_pval, ct_score_df=ct_score, cutoff=0.1)

Add to anndata object

adata2.obs['scorect'] = celltype_assign
celltype_assign
AAACCTGCAAAGGCGT-1-02_CARTP00G1LI_AMP_ch2_GEX-5pr-v2-0 NaN
AAACCTGCATTTGCCC-1-02_CARTP00G1LI_AMP_ch2_GEX-5pr-v2-0 NaN
AAACCTGGTAGCAAAT-1-02_CARTP00G1LI_AMP_ch2_GEX-5pr-v2-0 NaN
AAACCTGTCATTGCCC-1-02_CARTP00G1LI_AMP_ch2_GEX-5pr-v2-0 NaN
AAACCTGTCTGCAGTA-1-02_CARTP00G1LI_AMP_ch2_GEX-5pr-v2-0 NaN
..
TTTGCGCTCATAACCG-1-09_CARTP00G1LI_BDR_ch2_GEX-5pr-v2-0 NaN
TTTGGTTCAAGCGATG-1-09_CARTP00G1LI_BDR_ch2_GEX-5pr-v2-0 NaN
TTTGGTTCAAGTCATC-1-09_CARTP00G1LI_BDR_ch2_GEX-5pr-v2-0 NaN
TTTGGTTTCGGCGGTT-1-09_CARTP00G1LI_BDR_ch2_GEX-5pr-v2-0 NaN
TTTGTCATCGTCACGG-1-09_CARTP00G1LI_BDR_ch2_GEX-5pr-v2-0 NaN
Name: leiden_res_0.7, Length: 4818, dtype: float64
cluster_assign
AAACCTGCAAAGGCGT-1-02_CARTP00G1LI_AMP_ch2_GEX-5pr-v2-0 11
AAACCTGCATTTGCCC-1-02_CARTP00G1LI_AMP_ch2_GEX-5pr-v2-0 7
AAACCTGGTAGCAAAT-1-02_CARTP00G1LI_AMP_ch2_GEX-5pr-v2-0 11
AAACCTGTCATTGCCC-1-02_CARTP00G1LI_AMP_ch2_GEX-5pr-v2-0 11
AAACCTGTCTGCAGTA-1-02_CARTP00G1LI_AMP_ch2_GEX-5pr-v2-0 3
..
TTTGCGCTCATAACCG-1-09_CARTP00G1LI_BDR_ch2_GEX-5pr-v2-0 0
TTTGGTTCAAGCGATG-1-09_CARTP00G1LI_BDR_ch2_GEX-5pr-v2-0 7
TTTGGTTCAAGTCATC-1-09_CARTP00G1LI_BDR_ch2_GEX-5pr-v2-0 2
TTTGGTTTCGGCGGTT-1-09_CARTP00G1LI_BDR_ch2_GEX-5pr-v2-0 12
TTTGTCATCGTCACGG-1-09_CARTP00G1LI_BDR_ch2_GEX-5pr-v2-0 13
Name: leiden_res_0.7, Length: 4818, dtype: category
Categories (17, int64): [0, 1, 2, 3, ..., 13, 14, 15, 16]
ct_pval
BCells plasma myeloid fibroendo myofibro lamina_propria ... tuft endocrine erythrocytes NK_cells monocytes CustomSet
0 1.204387e-02 4.070538e-10 1.000000e+00 1.000000e+00 1.000000 1.000000e+00 ... 6.347508e-02 1.0 1.0 1.0 1.00000 1.0
1 2.306778e-02 1.000000e+00 1.000000e+00 1.000000e+00 1.000000 1.000000e+00 ... 1.000000e+00 1.0 1.0 1.0 1.00000 1.0
10 2.306778e-02 1.000000e+00 1.515579e-12 1.000000e+00 1.000000 1.000000e+00 ... 1.385330e-02 1.0 1.0 1.0 0.00491 1.0
11 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000 1.000000e+00 ... 1.000000e+00 1.0 1.0 1.0 1.00000 1.0
12 1.000000e+00 1.000000e+00 1.000000e+00 3.435101e-12 1.000000 3.402924e-02 ... 1.000000e+00 1.0 1.0 1.0 1.00000 1.0
13 1.000000e+00 1.000000e+00 1.000000e+00 1.536033e-28 1.000000 8.539887e-06 ... 1.000000e+00 1.0 1.0 1.0 1.00000 1.0
14 3.402924e-02 1.000000e+00 7.647075e-09 1.000000e+00 1.000000 1.000000e+00 ... 2.666548e-04 1.0 1.0 1.0 1.00000 1.0
15 1.000000e+00 1.000000e+00 1.000000e+00 4.871892e-15 0.019492 5.576572e-02 ... 1.000000e+00 1.0 1.0 1.0 1.00000 1.0
16 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000 1.000000e+00 ... 1.031787e-17 1.0 1.0 1.0 1.00000 1.0
2 2.306778e-02 1.000000e+00 1.000000e+00 1.000000e+00 1.000000 1.000000e+00 ... 1.000000e+00 1.0 1.0 1.0 1.00000 1.0
3 2.306778e-02 1.000000e+00 1.000000e+00 1.000000e+00 1.000000 1.000000e+00 ... 1.000000e+00 1.0 1.0 1.0 1.00000 1.0
4 1.000000e+00 1.000000e+00 1.000000e+00 3.901415e-06 1.000000 1.000000e+00 ... 1.000000e+00 1.0 1.0 1.0 1.00000 1.0
5 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000 1.000000e+00 ... 1.000000e+00 1.0 1.0 1.0 1.00000 1.0
6 1.339561e-17 1.000000e+00 1.000000e+00 1.000000e+00 1.000000 1.000000e+00 ... 2.637989e-02 1.0 1.0 1.0 1.00000 1.0
7 1.000000e+00 1.000000e+00 1.000000e+00 1.000000e+00 1.000000 1.000000e+00 ... 1.000000e+00 1.0 1.0 1.0 1.00000 1.0
8 1.000000e+00 1.000000e+00 1.000000e+00 1.692935e-35 1.000000 2.657604e-13 ... 1.000000e+00 1.0 1.0 1.0 1.00000 1.0
9 1.000000e+00 1.000000e+00 1.000000e+00 2.309834e-20 0.024291 1.000000e+00 ... 1.000000e+00 1.0 1.0 1.0 1.00000 1.0

[17 rows x 20 columns]

ct_score
BCells plasma myeloid fibroendo myofibro lamina_propria sox6_fibroblasts ... paneth tuft endocrine erythrocytes NK_cells monocytes CustomSet
0 5.0 19.0 0.0 0.0 0.0 0.0 0.0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

Dear elengss,
Sorry for the late reply ! This problem probably arises because the Leiden clusters are formatted as integers. If you want you can just convert this field of the dataframe to a category and it should fix this issue. I will probably add a fix to that caveat soon. Thank you for contributing !

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

2 participants