Closed MrTomRod closed 4 years ago
Got it. Not sure how easy it will be. A short term solution is to reverse your original Biopython record using record.reverse_complement()
before you translate it to a graphic record. You would obtain the second figure, with the difference that the ruler's indices would be different, they would be relative to the (-) strand.
Have you tried this? I haven't tried it but it could work:
ax, _ = graphic_record.plot(figure_width=12)
x_start, x_end = ax.get_xlim()
ax.set_xlim(x_end, x_start)
It works! The function name is slightly different, get_xlim
instead of get_xlims
:
ax, _ = graphic_record.plot(figure_width=12)
x_start, x_end = ax.get_xlim()
ax.set_xlim(x_end, x_start)
This solves the issue for me. Thanks a lot!
Yay! Matplotlib saved the day. Thanks for the use case suggestion, I'll add this to the documentation.
It would be nice to be able to plot a genomic region in reverse. I'm writing a script that allows me to compare the loci around the same genes in different species. Sometimes, the locus of interest is on the leading and sometimes on the lagging strand. I'd like to correct for this by discerning the orientation of the gene of interest and then to plot the region in reverse order if necessary.
Example: Regular plot:
Reversed plot:
I'd be very happy if you could implement this.