Search code examples
pythonreportlabbiopython

How to add more to Biopython's chromosome drawings?


I am trying to draw a karyotype/ideogram figure using Biopython's BasicChromosome library. I am able to draw my chromosome and make annotations inside the chromosome like in the tutorial; however, my boss prefers the annotations on the outside of the chromosome along with various symbols.

How can I expand on this great simple ideogram drawing tool? I noticed it uses reportlab and I am guessing I would have to customize the source code? For example, would I make a copy of the Module Bio.Graphics.BasicChromosome and edit the portion that pertains to drawing annotations then explicitly import my version? And for adding symbols I would have to learn reportlab's other features?


Solution

  • Yes, you would need to learn a bit more about ReportLab and then try modifying https://github.com/biopython/biopython/blob/master/Bio/Graphics/BasicChromosome.py

    (I'm not quite sure what changes you want to make, an annotated image might help, so I can't give you any more specific hints)