Hello Biostars,
Ryan Dale posted 4 years ago a wonderful answer to the question of how to start your own chromosome plots using Python's Matplotlib Visualize Chromosome With Python ?
I am migrating from Perl to Python and have been bashing my head for 3 days trying to add extra lines and gene annotations to Ryan's code, so that the extra gene "tracks" appear below each corresponding chromosome. I'd also like to zoom in to specific regions, and feed that as ranges in the code (i.e. from positions 1-100,000 in each chromosome). So far I have been unsuccessful :(
Anyone with matplotlib experience in here who could give me a hand?
While there are many chromosome plotters out there I would like to learn how to use Matplotlib and Python. I have seen many programmers do rather amazing publication quality figures with it.
Best,
Sakti
Fantastic work. I noticed a little mistake in the chromosome_collection function. line 61, facecolors should be group['colors'] and not df['colors']. thanks a lot anyway @Ryan_Dale
Ah, you're right. It wasn't raising an exception because it looks like
matplotlib.Collection
allows the colors to cycle, which means they don't have to be the same length as xrange, yrange. So the stain colors were wrong for all but the first chromosome. I updated the gist (code and plot) to fix this. Thank you, nice catch.Beautiful reply, and great code to continue with my Python and matlib trainings. I really appreciate your reply, and hope it's useful for more Biostarters!!!
@ Ryan Dale: How can I add multiple peak sets? I guess the one here is for one peak set. Could you please highlight that part or adjust the script that it works for more than one peakset.
I tried to run it and it did not work the same as on the picture I would recommend a karyoploteR library in R to make these vizualizations.