.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery_output/flanking_sequences/plot_location_altered_flanks.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_flanking_sequences_plot_location_altered_flanks.py: Probing where and how PTM flanking sequences are altered =============================================================== In order to understand how PTMs may be altered due to splicing events, it is useful to identify the flanking sequences of the PTMs and how they may be altered due to nearby splice events (as identified by flanking sequence module). Once we have, this information we can analyze and visualize where the alterations in the flanking sequences occur. First, we need to compare the flanking sequences of PTMs based on whether an exonic region is included or excluded using the `compare_flanking_sequences` function in PTM-POSE. .. GENERATED FROM PYTHON SOURCE LINES 7-19 .. code-block:: Python from ptm_pose import helpers from ptm_pose.analyze import flank_analysis as afs #load example altered flanking sequence data altered_flanks = helpers.load_example_data(altered_flanks = True) altered_flanks = afs.compare_flanking_sequences(altered_flanks) print('Comparison of flanking sequences:') altered_flanks[['UniProtKB Accession', 'Residue', 'PTM Position in Isoform', 'Modification Class', 'Inclusion Flanking Sequence', 'Exclusion Flanking Sequence', 'Sequence Identity', 'Altered Positions', 'Residue Change', 'Altered Flank Side']].head() .. rst-class:: sphx-glr-script-out .. code-block:: none Comparison of flanking sequences: .. raw:: html
UniProtKB Accession Residue PTM Position in Isoform Modification Class Inclusion Flanking Sequence Exclusion Flanking Sequence Sequence Identity Altered Positions Residue Change Altered Flank Side
0 Q68EM7 S 497 Phosphorylation LVKKEsFGVKL LVKKEsPPKPK 0.636364 [1.0, 2.0, 3.0, 4.0, 5.0] [F->P, G->P, V->K, K->P, L->K] C-term only
1 Q68EM7 S 497 Phosphorylation LVKKEsFGVKL LVKKEsPPKPK 0.636364 [1.0, 2.0, 3.0, 4.0, 5.0] [F->P, G->P, V->K, K->P, L->K] C-term only
2 P01116 K 147 Acetylation IETSAkTRQRV IETSAkTRQGV 0.909091 [4.0] [R->G] C-term only
3 P01116 K 147 Ubiquitination IETSAkTRQRV IETSAkTRQGV 0.909091 [4.0] [R->G] C-term only
4 P01116 T 148 Phosphorylation ETSAKtRQRVE ETSAKtRQGVD 0.818182 [3.0, 5.0] [R->G, E->D] C-term only


.. GENERATED FROM PYTHON SOURCE LINES 20-21 Note, we only calculate these metrics for cases where altered flanking sequences do not cause a stop codon to be introduced, as this is harder to interpret (such as for the first PTM in the list). The above table will indicate the positions in the flanking sequence that are altered, how similar the altered flanking sequence is to the original flanking sequence, and the specific residue change that takes place. We can also plot some of this information to get a better sense of the distribution of altered flanking sequences: .. GENERATED FROM PYTHON SOURCE LINES 21-24 .. code-block:: Python afs.plot_location_of_altered_flanking_residues(altered_flanks) .. image-sg:: /gallery_output/flanking_sequences/images/sphx_glr_plot_location_altered_flanks_001.png :alt: plot location altered flanks :srcset: /gallery_output/flanking_sequences/images/sphx_glr_plot_location_altered_flanks_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/srcrowl/miniconda3/envs/pose_doc/lib/python3.12/site-packages/ptm_pose/analyze/flank_analysis.py:360: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator. ax[0].set_xticklabels(['N-term\nonly', 'C-term\nonly']) .. GENERATED FROM PYTHON SOURCE LINES 25-26 We can even create the same plot for specific modification types or residues, as well as label the specific residue changes that occur: .. GENERATED FROM PYTHON SOURCE LINES 26-27 .. code-block:: Python afs.plot_location_of_altered_flanking_residues(altered_flanks, modification_class='Acetylation') .. image-sg:: /gallery_output/flanking_sequences/images/sphx_glr_plot_location_altered_flanks_002.png :alt: plot location altered flanks :srcset: /gallery_output/flanking_sequences/images/sphx_glr_plot_location_altered_flanks_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/srcrowl/miniconda3/envs/pose_doc/lib/python3.12/site-packages/ptm_pose/analyze/flank_analysis.py:360: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator. ax[0].set_xticklabels(['N-term\nonly', 'C-term\nonly']) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.287 seconds) .. _sphx_glr_download_gallery_output_flanking_sequences_plot_location_altered_flanks.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_location_altered_flanks.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_location_altered_flanks.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_location_altered_flanks.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_