├── MALDIpy-0.1.5.tar.gz ├── README.md ├── readme_fig ├── AI_paint.jpg ├── featureplot1.png ├── featureplot2.png ├── featureplot3.png ├── featureplot4.png ├── function.png ├── plt1.png ├── plt2.png ├── plt3.png ├── plt4.png └── project_cluster_in_groups.png └── vignette ├── kidney_cortex.ipynb └── kidney_integration.ipynb /MALDIpy-0.1.5.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheHumphreysLab/MALDIpy/7d5a471dedc32756f1ac9a07939642c939110d8c/MALDIpy-0.1.5.tar.gz -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MALDIpy: Analysis of MALDI-MS imaging mass spectrometry data (spatial metabolomics) in Python at the single-cell resolution 2 | `MALDIpy` is a Python package for analyzing and visualizing MALDI-MS imaging mass spectrometry data (especially designed for spatially resolved metabolomics) at the single-cell level (each “cell” refers to a 10-µm pixel metabolome). 3 | 4 | Its function includes: metabolite feature visualization, Scanpy-based single-cell analysis with UMAP clustering, projection of cluster annotations, integrative multi-sample visualization and analysis. 5 | 6 |
7 | 8 | # 1. Installation 9 | 10 | To install `MALDIpy`, run it in a terminal 11 | 12 | ``` 13 | pip install MALDIpy 14 | ``` 15 | 16 | # 2. Tutorials 17 | 18 | (1) Analyze one single dataset with high efficiency -- all analysis can be done in 5-10 minutes on a labtop: 19 | https://github.com/TheHumphreysLab/MALDIpy/blob/main/vignette/kidney_cortex.ipynb 20 | 21 | (2) Integrative analysis of multiple MALDI-MS datasets: 22 | https://github.com/TheHumphreysLab/MALDIpy/blob/main/vignette/kidney_integration.ipynb 23 |
24 | 25 | # 3. Key functions 26 | 27 | (1) Create a MALDIpy object with `msi_data`. 28 | 29 | ``` 30 | maldi_obj = msi_data(raw_file, scale=10) 31 | ``` 32 | 33 | (2) Visualize any metabolite of interest in a MALDIpy object with `plt`. 34 | 35 | ``` 36 | maldi_obj.plt(mz=741.530654593237, figsize = (6,5), smooth=False, pos = 'lower left', remove_hs = True, cmap = "magma_r") 37 | ``` 38 |
39 | 40 | (3) MALDIpy to AnnData conversion with `to_adata`. 41 | 42 | ``` 43 | adata = maldi_obj.to_adata(add_meta=True, csv_file=raw_file) 44 | ``` 45 | 46 | (4) Efficient single-cell quality control, dimension reduction and clustering with `single_cell`, including `single_cell.maldifilter`, `single_cell.maldi_norm` and `single_cell.maldi_clustering`.
47 | `single_cell.maldi_clustering` includes Harmony-based batch effect correction when processing multiple tissue sections.
48 |
49 | 50 | (5) Project single-cell cluster annotation onto the tissue section with `projection`. 51 | ``` 52 | MALDIpy.projection.umap_projection(adata, file_name=raw_file,pltcmap=adata.uns['leiden_colors'], 53 | figtitle='Leiden Cluster Projection',figdpi=150, fig_size=(4,4),add_scalebar=True) 54 | ``` 55 |
56 | 57 | (6) Core plotting functions included in `featureplot`.
58 | (6.1) Plot a feature with customized colormap with `plot1feature` and plot a region of interest with the argument `subset`. 59 | ``` 60 | cmap_1 = mcolors.LinearSegmentedColormap.from_list('name1',["black", "lime"], N=256) 61 | fig=MALDIpy.featureplot.plot1feature(tissue_obj, mz_use, cmap = cmap_1, max_num=41000, min_num=21000, figsize = (4.5,5)) 62 | fig=MALDIpy.featureplot.plot1feature_subset(tissue_obj,mz_use,cmap = cmap_1, max_num=41000, min_num=21000, figsize = (5,2.9),subset=[95,185,35,175]) 63 | ``` 64 |
65 | 66 | (6.2) Plot two features at the same time with customized colormap with `plot2features` and plot a region of interest with the argument `subset`. 67 | ``` 68 | cmap_1 = mcolors.LinearSegmentedColormap.from_list('name1',["black", "lime"], N=256) 69 | cmap_2 = mcolors.LinearSegmentedColormap.from_list('name2',["black", "magenta"], N=256) 70 | fig=MALDIpy.featureplot.plot2features(tissue_obj, feats = [mz_use1,mz_use2], cmap=[cmap_1,cmap_2], 71 | max_num_1=41000, min_num_1=21000, max_num_2=50000, min_num_2=25000) 72 | fig=MALDIpy.featureplot.plot2features_subset(tissue_obj, feats = [mz_use1,mz_use2], cmap=[cmap_1,cmap_2], 73 | max_num_1=41000, min_num_1=21000, max_num_2=50000, min_num_2=25000, subset=[95,185,35,175]) 74 | ``` 75 |
76 | 77 | (7) Project your cell cluster of interest onto a group of tissue sections with `projection.project_cluster_in_groups`.
78 | First, extract X/Y coordinates from the anndata and add them to adata.obs with `projection.add_coords` 79 | ``` 80 | adata = MALDIpy.projection.add_coords(adata) 81 | ``` 82 | Then, visualize the cluster of interest across multiple samples. 83 | ``` 84 | group=['sample1','sample2','sample3','sample4','sample5','sample6'] 85 | fig = MALDIpy.projection.project_cluster_in_groups(adata, cluster_id='1', cluster_obs_name='leiden', 86 | group_list=group, group_obs_name='sample_id', cmap='Reds') 87 | ``` 88 |
89 | 90 | # 4. Related links 91 | 92 | (1) MALDI-MS (Matrix-assisted laser desorption/ionization mass spectrometry)
93 | (2) METASPACE - cloud platform for spatial metabolomics
94 | (3) Scanpy - Single-Cell Analysis in Python
95 | (4) Harmony - integrating multiple high-dimensional datasets
96 | 97 | # 5. Citation 98 | 99 | We recommend cite the following two related manuscripts for the use of MALDIpy:

100 | Cell Metabolism 2024 (PMID: 38513647): 101 | ``` 102 | Li, Haikuo, et al. "Transcriptomic, epigenomic, and spatial metabolomic cell profiling redefines regional human kidney anatomy." Cell metabolism 36.5 (2024): 1105-1125. 103 | ``` 104 | Data in Brief 2024 (PMID: 38708307): 105 | ``` 106 | Li, Haikuo, and Benjamin D. Humphreys. "Spatially resolved metabolomic dataset of distinct human kidney anatomic regions." Data in Brief 54 (2024): 110431. 107 | ``` 108 | 109 | 110 |

111 |
112 | Adobe Firefly AI painting with command `a robot analyzing tissue section metabolites with imaging mass spectrometry`. 113 | ************** 114 | 115 | 116 | Find us on Twitter: 117 |
118 | @HumphreysLab 119 |

120 | -------------------------------------------------------------------------------- /readme_fig/AI_paint.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheHumphreysLab/MALDIpy/7d5a471dedc32756f1ac9a07939642c939110d8c/readme_fig/AI_paint.jpg -------------------------------------------------------------------------------- /readme_fig/featureplot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheHumphreysLab/MALDIpy/7d5a471dedc32756f1ac9a07939642c939110d8c/readme_fig/featureplot1.png -------------------------------------------------------------------------------- /readme_fig/featureplot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheHumphreysLab/MALDIpy/7d5a471dedc32756f1ac9a07939642c939110d8c/readme_fig/featureplot2.png -------------------------------------------------------------------------------- /readme_fig/featureplot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheHumphreysLab/MALDIpy/7d5a471dedc32756f1ac9a07939642c939110d8c/readme_fig/featureplot3.png -------------------------------------------------------------------------------- /readme_fig/featureplot4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheHumphreysLab/MALDIpy/7d5a471dedc32756f1ac9a07939642c939110d8c/readme_fig/featureplot4.png -------------------------------------------------------------------------------- /readme_fig/function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheHumphreysLab/MALDIpy/7d5a471dedc32756f1ac9a07939642c939110d8c/readme_fig/function.png -------------------------------------------------------------------------------- /readme_fig/plt1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheHumphreysLab/MALDIpy/7d5a471dedc32756f1ac9a07939642c939110d8c/readme_fig/plt1.png -------------------------------------------------------------------------------- /readme_fig/plt2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheHumphreysLab/MALDIpy/7d5a471dedc32756f1ac9a07939642c939110d8c/readme_fig/plt2.png -------------------------------------------------------------------------------- /readme_fig/plt3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheHumphreysLab/MALDIpy/7d5a471dedc32756f1ac9a07939642c939110d8c/readme_fig/plt3.png -------------------------------------------------------------------------------- /readme_fig/plt4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheHumphreysLab/MALDIpy/7d5a471dedc32756f1ac9a07939642c939110d8c/readme_fig/plt4.png -------------------------------------------------------------------------------- /readme_fig/project_cluster_in_groups.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheHumphreysLab/MALDIpy/7d5a471dedc32756f1ac9a07939642c939110d8c/readme_fig/project_cluster_in_groups.png --------------------------------------------------------------------------------