.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_bed.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_auto_examples_plot_bed.py: ========= Bed Track ========= Create a :class:`~pygv.tracks.bed_track.BedTrack`. .. GENERATED FROM PYTHON SOURCE LINES 8-14 .. code-block:: Python import matplotlib.pyplot as plt from pygv.viewer import GenomeViewer from pygv.tracks.bed_track import BedTrack from pygv.tracks.bigwig_track import PairedStrandSpecificTracks gv = GenomeViewer() .. GENERATED FROM PYTHON SOURCE LINES 15-19 The input file here is encoded in standard BED12 format with exons and CDS information stored in the 7th~12th fields. First, we create a :class:`~pygv.tracks.bed_track.BedTrack` and we allow up to two annotation lanes. In this case, PyGV will plot each exon and apply thickness to the CDS. .. GENERATED FROM PYTHON SOURCE LINES 19-23 .. code-block:: Python default_track = BedTrack( "../examples/data/gencodeV24.sub.bed.gz", name="Default", height=1/2, allowed_feature_lanes=2, y_label_ha="right") gv.add_track(default_track) .. GENERATED FROM PYTHON SOURCE LINES 24-26 Second, we create a :class:`~pygv.tracks.bed_track.BedTrack` and we override the default behavior by telling PyGV to not apply thickness to the CDS even though the information presents in the annotation file. .. GENERATED FROM PYTHON SOURCE LINES 26-31 .. code-block:: Python no_thickness_track = BedTrack( "../examples/data/gencodeV24.sub.bed.gz", name="Disable\nthickness", height=1/2, allowed_feature_lanes=2, plot_thickness=False, y_label_rotation=0, y_label_ha="right",) gv.add_track(no_thickness_track) .. GENERATED FROM PYTHON SOURCE LINES 32-34 Third, we create a :class:`~pygv.tracks.bed_track.BedTrack` and we override the default behavior by telling PyGV to not draw feature names, in this case, to hide genes' names. .. GENERATED FROM PYTHON SOURCE LINES 34-39 .. code-block:: Python track = BedTrack( "../examples/data/gencodeV24.sub.bed.gz", name="Disable\nname", height=1/2, allowed_feature_lanes=2, show_name=False, y_label_rotation=0, y_label_ha="right",) gv.add_track(track) .. GENERATED FROM PYTHON SOURCE LINES 40-41 Last, we add a :class:`~pygv.tracks.bigwig_track.PairedStrandSpecificTracks` to show transcription initiation around these annotations. .. GENERATED FROM PYTHON SOURCE LINES 41-47 .. code-block:: Python tss_track = PairedStrandSpecificTracks( "../examples/data/K562_GROcap_hg38_pl.chr1.bw", "../examples/data/K562_GROcap_hg38_mn.chr1.bw", draw_y_independently=True, name="TSS", y_label_rotation=0, y_label_ha="right") gv.add_track(tss_track) .. GENERATED FROM PYTHON SOURCE LINES 48-49 And here is the result: .. GENERATED FROM PYTHON SOURCE LINES 49-51 .. code-block:: Python gv.plot("chr1", 155136034, 155140992, height_scale_factor=0.8) plt.tight_layout() .. image-sg:: /auto_examples/images/sphx_glr_plot_bed_001.png :alt: chr1 :srcset: /auto_examples/images/sphx_glr_plot_bed_001.png, /auto_examples/images/sphx_glr_plot_bed_001_2_00x.png 2.00x :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.224 seconds) .. _sphx_glr_download_auto_examples_plot_bed.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_bed.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_bed.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_bed.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_