.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/gallery/sequence/annotation/plasmid_map.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_examples_gallery_sequence_annotation_plasmid_map.py: Plasmid map of a vector ======================= This script downloads the GenBank file for a *pET15* plasmid from *AddGene* and draws a plasmid map using a custom feature formatter. - **Promoters** - green arrow - **Terminators** - red arrow - **Protein binding sites** - light green rectangle - **RBS** - light orange rectangle - **CDS** - orange arrow - **Ori** - gray arrow - **Primer** - blue arrow .. GENERATED FROM PYTHON SOURCE LINES 16-80 .. image-sg:: /examples/gallery/sequence/annotation/images/sphx_glr_plasmid_map_001.png :alt: plasmid map :srcset: /examples/gallery/sequence/annotation/images/sphx_glr_plasmid_map_001.png :class: sphx-glr-single-img .. code-block:: Python # Code source: Patrick Kunzmann # License: BSD 3 clause import io import matplotlib.pyplot as plt import requests import biotite import biotite.sequence.graphics as graphics import biotite.sequence.io.genbank as gb PLASMID_URL = ( "https://media.addgene.org/snapgene-media/v2.0.0/sequences/12250/" "9998fdbe-051f-4dc6-ba0f-24e65127a0c5/addgene-plasmid-26092-sequence-12250.gbk" ) response = requests.get(PLASMID_URL) gb_file = gb.GenBankFile.read(io.StringIO(response.text)) annotation = gb.get_annotation( gb_file, include_only=[ "promoter", "terminator", "protein_bind", "RBS", "CDS", "rep_origin", "primer_bind", ], ) _, seq_length, _, _, _, _ = gb.get_locus(gb_file) def custom_feature_formatter(feature): # AddGene stores the feature label in the '\label' qualifier label = feature.qual.get("label") if feature.key == "promoter": return True, biotite.colors["dimgreen"], "black", label elif feature.key == "terminator": return True, "firebrick", "black", label elif feature.key == "protein_bind": return False, biotite.colors["lightgreen"], "black", label elif feature.key == "RBS": return False, biotite.colors["brightorange"], "black", label elif feature.key == "CDS": return True, biotite.colors["orange"], "black", label elif feature.key == "rep_origin": return True, "lightgray", "black", label elif feature.key == "primer_bind": return True, "blue", "black", label fig = plt.figure(figsize=(8.0, 8.0)) ax = fig.add_subplot(111, projection="polar") graphics.plot_plasmid_map( ax, annotation, plasmid_size=seq_length, label="pET15-MHL", feature_formatter=custom_feature_formatter, ) fig.tight_layout() plt.show() .. _sphx_glr_download_examples_gallery_sequence_annotation_plasmid_map.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plasmid_map.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plasmid_map.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plasmid_map.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_