\begin{Verbatim}[commandchars=\\\{\}]
\PYG{k+kn}{from} \PYG{n+nn}{reportlab.lib.units} \PYG{k+kn}{import} \PYG{n}{cm}
\PYG{k+kn}{from} \PYG{n+nn}{Bio} \PYG{k+kn}{import} \PYG{n}{SeqIO}
\PYG{k+kn}{from} \PYG{n+nn}{Bio.Graphics} \PYG{k+kn}{import} \PYG{n}{BasicChromosome}

\PYG{n}{entries} \PYG{o}{=} \PYG{p}{[}
    \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Chr I\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}CHR\PYGZus{}I/NC\PYGZus{}003070.gbk\PYGZdq{}}\PYG{p}{),}
    \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Chr II\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}CHR\PYGZus{}II/NC\PYGZus{}003071.gbk\PYGZdq{}}\PYG{p}{),}
    \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Chr III\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}CHR\PYGZus{}III/NC\PYGZus{}003074.gbk\PYGZdq{}}\PYG{p}{),}
    \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Chr IV\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}CHR\PYGZus{}IV/NC\PYGZus{}003075.gbk\PYGZdq{}}\PYG{p}{),}
    \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Chr V\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}CHR\PYGZus{}V/NC\PYGZus{}003076.gbk\PYGZdq{}}\PYG{p}{),}
\PYG{p}{]}

\PYG{n}{max\PYGZus{}len} \PYG{o}{=} \PYG{l+m+mi}{30432563}  \PYG{c+c1}{\PYGZsh{} Could compute this from the entries dict}
\PYG{n}{telomere\PYGZus{}length} \PYG{o}{=} \PYG{l+m+mi}{1000000}  \PYG{c+c1}{\PYGZsh{} For illustration}

\PYG{n}{chr\PYGZus{}diagram} \PYG{o}{=} \PYG{n}{BasicChromosome}\PYG{o}{.}\PYG{n}{Organism}\PYG{p}{()}
\PYG{n}{chr\PYGZus{}diagram}\PYG{o}{.}\PYG{n}{page\PYGZus{}size} \PYG{o}{=} \PYG{p}{(}\PYG{l+m+mf}{29.7} \PYG{o}{*} \PYG{n}{cm}\PYG{p}{,} \PYG{l+m+mi}{21} \PYG{o}{*} \PYG{n}{cm}\PYG{p}{)}  \PYG{c+c1}{\PYGZsh{} A4 landscape}

\PYG{k}{for} \PYG{n}{index}\PYG{p}{,} \PYG{p}{(}\PYG{n}{name}\PYG{p}{,} \PYG{n}{filename}\PYG{p}{)} \PYG{o+ow}{in} \PYG{n+nb}{enumerate}\PYG{p}{(}\PYG{n}{entries}\PYG{p}{):}
    \PYG{n}{record} \PYG{o}{=} \PYG{n}{SeqIO}\PYG{o}{.}\PYG{n}{read}\PYG{p}{(}\PYG{n}{filename}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}genbank\PYGZdq{}}\PYG{p}{)}
    \PYG{n}{length} \PYG{o}{=} \PYG{n+nb}{len}\PYG{p}{(}\PYG{n}{record}\PYG{p}{)}
    \PYG{n}{features} \PYG{o}{=} \PYG{p}{[}\PYG{n}{f} \PYG{k}{for} \PYG{n}{f} \PYG{o+ow}{in} \PYG{n}{record}\PYG{o}{.}\PYG{n}{features} \PYG{k}{if} \PYG{n}{f}\PYG{o}{.}\PYG{n}{type} \PYG{o}{==} \PYG{l+s+s2}{\PYGZdq{}tRNA\PYGZdq{}}\PYG{p}{]}
    \PYG{c+c1}{\PYGZsh{} Record an Artemis style integer color in the feature\PYGZsq{}s qualifiers,}
    \PYG{c+c1}{\PYGZsh{} 1 = Black, 2 = Red, 3 = Green, 4 = blue, 5 =cyan, 6 = purple}
    \PYG{k}{for} \PYG{n}{f} \PYG{o+ow}{in} \PYG{n}{features}\PYG{p}{:}
        \PYG{n}{f}\PYG{o}{.}\PYG{n}{qualifiers}\PYG{p}{[}\PYG{l+s+s2}{\PYGZdq{}color\PYGZdq{}}\PYG{p}{]} \PYG{o}{=} \PYG{p}{[}\PYG{n}{index} \PYG{o}{+} \PYG{l+m+mi}{2}\PYG{p}{]}

    \PYG{n}{cur\PYGZus{}chromosome} \PYG{o}{=} \PYG{n}{BasicChromosome}\PYG{o}{.}\PYG{n}{Chromosome}\PYG{p}{(}\PYG{n}{name}\PYG{p}{)}
    \PYG{c+c1}{\PYGZsh{} Set the scale to the MAXIMUM length plus the two telomeres in bp,}
    \PYG{c+c1}{\PYGZsh{} want the same scale used on all five chromosomes so they can be}
    \PYG{c+c1}{\PYGZsh{} compared to each other}
    \PYG{n}{cur\PYGZus{}chromosome}\PYG{o}{.}\PYG{n}{scale\PYGZus{}num} \PYG{o}{=} \PYG{n}{max\PYGZus{}len} \PYG{o}{+} \PYG{l+m+mi}{2} \PYG{o}{*} \PYG{n}{telomere\PYGZus{}length}

    \PYG{c+c1}{\PYGZsh{} Add an opening telomere}
    \PYG{n}{start} \PYG{o}{=} \PYG{n}{BasicChromosome}\PYG{o}{.}\PYG{n}{TelomereSegment}\PYG{p}{()}
    \PYG{n}{start}\PYG{o}{.}\PYG{n}{scale} \PYG{o}{=} \PYG{n}{telomere\PYGZus{}length}
    \PYG{n}{cur\PYGZus{}chromosome}\PYG{o}{.}\PYG{n}{add}\PYG{p}{(}\PYG{n}{start}\PYG{p}{)}

    \PYG{c+c1}{\PYGZsh{} Add a body \PYGZhy{} again using bp as the scale length here.}
    \PYG{n}{body} \PYG{o}{=} \PYG{n}{BasicChromosome}\PYG{o}{.}\PYG{n}{AnnotatedChromosomeSegment}\PYG{p}{(}\PYG{n}{length}\PYG{p}{,} \PYG{n}{features}\PYG{p}{)}
    \PYG{n}{body}\PYG{o}{.}\PYG{n}{scale} \PYG{o}{=} \PYG{n}{length}
    \PYG{n}{cur\PYGZus{}chromosome}\PYG{o}{.}\PYG{n}{add}\PYG{p}{(}\PYG{n}{body}\PYG{p}{)}

    \PYG{c+c1}{\PYGZsh{} Add a closing telomere}
    \PYG{n}{end} \PYG{o}{=} \PYG{n}{BasicChromosome}\PYG{o}{.}\PYG{n}{TelomereSegment}\PYG{p}{(}\PYG{n}{inverted}\PYG{o}{=}\PYG{k+kc}{True}\PYG{p}{)}
    \PYG{n}{end}\PYG{o}{.}\PYG{n}{scale} \PYG{o}{=} \PYG{n}{telomere\PYGZus{}length}
    \PYG{n}{cur\PYGZus{}chromosome}\PYG{o}{.}\PYG{n}{add}\PYG{p}{(}\PYG{n}{end}\PYG{p}{)}

    \PYG{c+c1}{\PYGZsh{} This chromosome is done}
    \PYG{n}{chr\PYGZus{}diagram}\PYG{o}{.}\PYG{n}{add}\PYG{p}{(}\PYG{n}{cur\PYGZus{}chromosome}\PYG{p}{)}

\PYG{n}{chr\PYGZus{}diagram}\PYG{o}{.}\PYG{n}{draw}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}tRNA\PYGZus{}chrom.pdf\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Arabidopsis thaliana\PYGZdq{}}\PYG{p}{)}
\end{Verbatim}
