BiomedicalMachineLearning / stLearn

A novel machine learning pipeline to analyse spatial transcriptomics data
Other
176 stars 23 forks source link

st.pl.lr_chord_plot: TypeError: __init__() takes 4 positional arguments but 7 were given #281

Closed Ajaingithub closed 3 months ago

Ajaingithub commented 4 months ago

Hi, Thanks a lot for the great tool.

I am facing an issue while making a CCI chord plot for Ligand Receptor Interactions. While I have easily made other plots.

The error is based on the positional argument in Arc function. It takes 4 argument but 7 arguments are provided.

>>> st.pl.lr_chord_plot(slide_018_A1_R, 'celltypes', label_size=11)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/research/labs/immunology/goronzy_weyand/GoronzyLab_Mayo/Abhinav/miniconda3/envs/stlearn/lib/python3.9/site-packages/stlearn/plotting/cci_plot.py", line 1485, in lr_chord_plot
    nodePos = chordDiagram(flux, ax, lim=1.25, colors=colors)
  File "/research/labs/immunology/goronzy_weyand/GoronzyLab_Mayo/Abhinav/miniconda3/envs/stlearn/lib/python3.9/site-packages/stlearn/plotting/cci_plot_helpers.py", line 757, in chordDiagram
    a = Arc((0, 0), diam, diam, 0, start, end, color=colors[i], lw=10)
TypeError: __init__() takes 4 positional arguments but 7 were given

The adata is:

>>> slide_018_A1_R
AnnData object with n_obs × n_vars = 1161 × 17877
    obs: 'in_tissue', 'array_row', 'array_col', 'n_genes_by_counts', 'log1p_n_genes_by_counts', 'total_counts', 'log1p_total_counts', 'pct_counts_in_top_50_genes', 'pct_counts_in_top_100_genes', 'pct_counts_in_top_200_genes', 'pct_counts_in_top_500_genes', 'total_counts_mt', 'log1p_total_counts_mt', 'pct_counts_mt', 'n_counts', 'clusters', 'celltypes', 'seurat_clusters', 'barcode', 'imagecol', 'imagerow', 'FN1_TNFRSF11B_binary_labels'
    var: 'gene_ids', 'feature_types', 'genome', 'mt', 'n_cells_by_counts', 'mean_counts', 'log1p_mean_counts', 'pct_dropout_by_counts', 'total_counts', 'log1p_total_counts', 'n_cells', 'highly_variable', 'means', 'dispersions', 'dispersions_norm'
    uns: 'celltypes_colors', 'celltypes_nhood_enrichment', 'clusters_colors', 'dendrogram_clusters', 'hvg', 'leiden', 'log1p', 'neighbors', 'pca', 'rank_genes_groups', 'spatial', 'spatial_neighbors', 'umap', 'lrfeatures', 'lr_summary', 'FN1_TNFRSF11B_binary_labels_colors', 'lr_cci_celltypes', 'lr_cci_raw_celltypes', 'per_lr_cci_celltypes', 'per_lr_cci_pvals_celltypes', 'per_lr_cci_raw_celltypes'
    obsm: 'X_pca', 'X_umap', 'spatial', 'spot_neighbours', 'spot_neigh_bcs', 'lr_scores', 'p_vals', 'p_adjs', '-log10(p_adjs)', 'lr_sig_scores'
    varm: 'PCs'
    obsp: 'connectivities', 'distances', 'spatial_connectivities', 'spatial_distances'

Thanks a lot.

duypham2108 commented 3 months ago

Sorry I just back from a long holiday. Have you solved this issue yet? It might be a library version problem. I will check it and back to you soon

jinhaohaohao commented 3 months ago

Thanks this powerful tool, I ve met the same question. Have you figured it out? Thanks alot!

duypham2108 commented 3 months ago

I fixed this. The issue of the new matplotlib version. Please install the GitHub version to fix it

pip uninstall stlearn --yes
git clone https://github.com/BiomedicalMachineLearning/stLearn.git
cd stLearn
python setup.py install
jinhaohaohao commented 3 months ago

Brilliant!I‘ve followed your method, and it really won't report any errors!Thx! 

金濠 @.***

 

------------------ 原始邮件 ------------------ 发件人: "Duy @.>; 发送时间: 2024年3月19日(星期二) 上午9:18 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [BiomedicalMachineLearning/stLearn] st.pl.lr_chord_plot: TypeError: init() takes 4 positional arguments but 7 were given (Issue #281)

I fixed this. The issue of the new matplotlib version. Please install the GitHub version to fix it pip uninstall stlearn --yes git clone https://github.com/BiomedicalMachineLearning/stLearn.git cd stLearn python setup.py install
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>