Session 24 – Biopython: Chromosome Modeling
24.1 Gene Feature Modeling
Dataset is in this link
from reportlab.lib.units import cm
from Bio import SeqIO
from Bio.Graphics import BasicChromosome
= [
entries "Chr I", "L1.gb"),
("Chr II", "L2.gb"),
("Chr III", "L3.gb"),
("Chr IV", "L4.gb"),
("Chr V", "L5.gb"),
(
]
= 219802468 # Could compute this from the entries dict
max_len = 100000 # For illustration
telomere_length
= BasicChromosome.Organism()
chr_diagram = (45 * cm, 500 * cm) # A4 landscape
chr_diagram.page_size
for index, (name, filename) in enumerate(entries):
= SeqIO.read(filename, "genbank")
record = len(record)
length = [f for f in record.features if f.type == "gene"]
features for f in features:
"color"] = [index + 2]
f.qualifiers[= BasicChromosome.Chromosome(name)
cur_chromosome = max_len + 2 * telomere_length
cur_chromosome.scale_num = BasicChromosome.TelomereSegment()
start = telomere_length
start.scale cur_chromosome.add(start)
= BasicChromosome.AnnotatedChromosomeSegment(length, features)
body = length
body.scale cur_chromosome.add(body)
= BasicChromosome.TelomereSegment(inverted=True)
end = telomere_length
end.scale cur_chromosome.add(end)
chr_diagram.add(cur_chromosome)
chr_diagram.draw("Chromosome.pdf", "Xenopus laevis")