martinjzhang / scDRS

Single-cell disease relevance score (scDRS)
https://martinjzhang.github.io/scDRS/
MIT License
109 stars 14 forks source link

TypeError: '<' not supported between instances of 'str' and 'float' #78

Closed zehualilab closed 9 months ago

zehualilab commented 9 months ago

scdrs perform-downstream \

    --h5ad-file pbmc3k.h5ad \
    --score-file HT.full_score.gz \
    --out-folder out/step3 \
    --group-analysis seurat_annotations \
    --flag-filter-data True \
    --flag-raw-count True

  • Single-cell disease relevance score (scDRS)
  • Version 1.0.2
  • Martin Jinye Zhang and Kangcheng Hou
  • HSPH / Broad Institute / UCLA
  • MIT License

    Call: scdrs perform-downstream \ --h5ad-file pbmc3k.h5ad \ --score-file HT.full_score.gz \ --out-folder out/step3 \ --group-analysis seurat_annotations\ --flag-filter-data True \ --flag-raw-count True \ --knn-n-neighbors 15 \ --knn-n-pcs 20

--h5ad-file loaded: n_cell=2700, n_gene=7111 (sys_time=0.2s) First 3 cells: ['AAACATACAACCAC', 'AAACATTGAGCTAC', 'AAACATTGATCAGC'] First 5 genes: ['NOC2L', 'HES4', 'ISG15', 'TNFRSF18', 'TNFRSF4'] Score file folder: /home/lsl/pbmc2700 Find 1 score files: HT.full_score.gz --score-file loaded: n_trait=1 (sys_time=0.8s) Print info for the first trait, first 3 cells, and first 8 columns: Trait HT Cells ['AAACATACAACCAC', 'AAACATTGAGCTAC', 'AAACATTGATCAGC'] raw_score [0.14360526 0.17214036 0.20114502] norm_score [ 0.3978422 -0.21874318 1.0402024 ] mc_pval [0.34065935 0.5934066 0.13686314] pval [0.3322468 0.57024527 0.14963955] nlog10_pval [0.47853917 0.24393833 0.8249536 ] zscore [ 0.43371746 -0.17699857 1.0379806 ] ctrl_norm_score_0 [ 0.23545742 1.6407315 -0.39324072] ctrl_norm_score_1 [ 1.0009282 -1.2050868 0.76875365]

Performing scDRS group-analysis Traceback (most recent call last): File "/home/lsl/miniconda3/envs/scdrs/bin/scdrs", line 740, in fire.Fire() File "/home/lsl/miniconda3/envs/scdrs/lib/python3.8/site-packages/fire/core.py", line 141, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "/home/lsl/miniconda3/envs/scdrs/lib/python3.8/site-packages/fire/core.py", line 475, in _Fire component, remaining_args = _CallAndUpdateTrace( File "/home/lsl/miniconda3/envs/scdrs/lib/python3.8/site-packages/fire/core.py", line 691, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) File "/home/lsl/miniconda3/envs/scdrs/bin/scdrs", line 683, in perform_downstream dict_df_res = scdrs.method.downstream_group_analysis( File "/home/lsl/miniconda3/envs/scdrs/lib/python3.8/site-packages/scdrs/method.py", line 759, in downstream_group_analysis group_list = sorted(set(adata.obs[group_col])) TypeError: '<' not supported between instances of 'str' and 'float'

zehualilab commented 9 months ago

Thank you for any help!

martinjzhang commented 9 months ago

Hi,

it seems your annotations may contain both numbers and strings. Can you check it? Converting annotations to all strings may solve the issue.

Best, Martin

zehualilab commented 9 months ago

Thank you very much! It worked after converting to all strings.