.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery_output/FunctionEnrichment/plot_specific_annotation.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_output_FunctionEnrichment_plot_specific_annotation.py: Assessing enriched PTM functions ======================================================= As described in Running PTM-POSE section, PTM-POSE provides various options for annotating functional information for PTMs, coming from various databases. Often, we will want to dig deeper into the specific functions, processes, interactions, etc. associated with the proteins in our dataset. First, we can look at the annotations currently available for analysis, based on annotations that have been appended using the annotate module: .. GENERATED FROM PYTHON SOURCE LINES 7-20 .. code-block:: Python from ptm_pose import helpers from ptm_pose.analyze import annotations import matplotlib.pyplot as plt import warnings warnings.filterwarnings("ignore") spliced_ptms, altered_flanks = helpers.load_example_data(spliced_ptms = True, altered_flanks = True) annot_categories = annotations.get_available_annotations(spliced_ptms) annot_categories .. raw:: html
Database Annotation Type Appended to PTM data?
0 iKiP Enzyme No
1 PhosphoSitePlus Enzyme No
2 PhosphoSitePlus Disease No
3 PhosphoSitePlus Interactions No
4 PhosphoSitePlus Function No
5 PhosphoSitePlus Process No
6 PhosphoSitePlus Perturbation No
7 PTMsigDB Perturbation-DIA No
8 PTMsigDB Perturbation-DIA2 No
9 PTMsigDB Pathway-NetPath No
10 PTMsigDB Pathway-WikiPathways No
11 PTMsigDB Perturbation-PRM No
12 PTMsigDB Pathway-BI No
13 DEPOD Enzyme No
14 RegPhos Enzyme No


.. GENERATED FROM PYTHON SOURCE LINES 21-22 This will tell us what database information is available and the types of information from that database. Let's take a closer look at the biological process information from PhosphoSitePlus: .. GENERATED FROM PYTHON SOURCE LINES 22-26 .. code-block:: Python ptms_with_annotation, annotation_counts = annotations.get_ptm_annotations(spliced_ptms, database = "PhosphoSitePlus", annotation_type = 'Process') print('Specific PTMs with annotation:') ptms_with_annotation .. rst-class:: sphx-glr-script-out .. code-block:: none 3 PTMs removed due to insignificant splice event (p < 0.05, dpsi >= 0.1): (33.33%) Final number of PTMs to be assessed: 6 Specific PTMs with annotation: .. raw:: html
Gene UniProtKB Accession Residue PTM Position in Isoform Modification Class PhosphoSitePlus:Function dPSI Significance Impact
0 CEACAM1 P13688 S 461.0 Phosphorylation activity, inhibited 0.525 1.73943268451e-09 Included
1 SPHK2 Q9NRA0 S 419.0 Phosphorylation intracellular localization 0.253 0.0129400018182 Included
2 SPHK2 Q9NRA0 S 421.0 Phosphorylation intracellular localization 0.253 0.0129400018182 Included
3 TSC2 P49815 S 981.0 Phosphorylation activity, inhibited;intracellular localization... -0.219 4.18472157275e-05 Excluded
4 YAP1 P46937 K 342.0 Ubiquitination protein degradation -0.188;-0.161 0.000211254197372;4.17884655686e-07 Excluded


.. GENERATED FROM PYTHON SOURCE LINES 27-28 From this, we note a total of 9 impacted PTMs from 7 genes that have biological process information available. While we could manually look through to look for common processes, we can also inspect the annotation counts object to see the most common processes, including a breakdown by the type of impact (included [dPSI > 0], excluded [dPSI < 0], or altered flanking sequence). We can also look at the number of PTMs associated with each annotation: .. GENERATED FROM PYTHON SOURCE LINES 28-31 .. code-block:: Python print('Number of PTMs associated with each annotation:') annotation_counts .. rst-class:: sphx-glr-script-out .. code-block:: none Number of PTMs associated with each annotation: .. raw:: html
All Impacted Included Excluded
PhosphoSitePlus:Function
intracellular localization 3 2.0 1
activity, inhibited 2 1.0 1
molecular association, regulation 1 0.0 1
protein degradation 1 0.0 1


.. GENERATED FROM PYTHON SOURCE LINES 32-33 To better visualize the enriched functions, we can also plot the number of PTMs associated with each function: .. GENERATED FROM PYTHON SOURCE LINES 33-44 .. code-block:: Python #plot annotatinos when not collapsing them fig, ax = plt.subplots(ncols = 2, figsize = (6, 3)) fig.subplots_adjust(wspace = 2) annotations.plot_annotation_counts(spliced_ptms =spliced_ptms, altered_flanks = altered_flanks, ax = ax[0], collapse_on_similar = False, database = 'PhosphoSitePlus', annot_type = 'Process', top_terms = 10) ax[0].set_title('Full Annotation') #plot annotations when collapsing them annotations.plot_annotation_counts(altered_flanks = altered_flanks, ax = ax[1], collapse_on_similar = True, database = 'PhosphoSitePlus', annot_type = 'Process', top_terms = 10) ax[1].set_title('Collapsed Annotation') .. image-sg:: /gallery_output/FunctionEnrichment/images/sphx_glr_plot_specific_annotation_001.png :alt: Full Annotation, Collapsed Annotation :srcset: /gallery_output/FunctionEnrichment/images/sphx_glr_plot_specific_annotation_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Text(0.5, 1.0, 'Collapsed Annotation') .. GENERATED FROM PYTHON SOURCE LINES 45-46 We can also perform enrichment analysis to identify if any of the functions are more likely to be present then expected, using collapsed annotations to increase likelihood of finding enriched terms: .. GENERATED FROM PYTHON SOURCE LINES 46-53 .. code-block:: Python enrichment = annotations.annotation_enrichment(spliced_ptms, database = 'PhosphoSitePlus', annotation_type = 'Function', collapse_on_similar=True) enrichment.head() .. raw:: html
Fraction Impacted p-value Adjusted p-value PTM
PhosphoSitePlus:Function
intracellular localization 3/3006 0.394168 1.0 SPHK2_S419;SPHK2_S421;TSC2_S981
protein degradation 1/1645 0.710863 1.0 YAP1_K342
activity NaN NaN NaN CEACAM1_S461;TSC2_S981
molecular association NaN NaN NaN TSC2_S981


.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.462 seconds) .. _sphx_glr_download_gallery_output_FunctionEnrichment_plot_specific_annotation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_specific_annotation.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_specific_annotation.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_specific_annotation.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_