Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Plot to represent coverage of a sequence

Does anyone have an idea of generating a plot that would look something like this: plot

Basically, I would have sequences, say T1 and T2, which need to be aligned to the "main" sequence. Also, please note that there is no need for actual alignment here, the sequence range is already known (For eg. T1 is 7-12, 32-36). These regions simply needs to be place accordingly and represented.

I thought of representing it in a bar plot, but as there would be breaks in the region it wouldnt be helpful.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Here is a very minimalistic example that should get you going:

import matplotlib.pyplot as plt


Main = "123684651984656497243684986425465798"
T1 = "651984"
T2 = "864"


f, ax = plt.subplots()
ax.set_axis_off()
ax.text(.1,.5, 
        "\n".join(
            [Main, 
             " "*Main.index(T1) + T1, 
             " "*Main.index(T2) + T2]),
        ha="left", 
        va="center",
        family="monospace")

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading