\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.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+m+mi}{30432563}\PYG{p}{),}
    \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Chr II\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{19705359}\PYG{p}{),}
    \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Chr III\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{23470805}\PYG{p}{),}
    \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Chr IV\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{18585042}\PYG{p}{),}
    \PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}Chr V\PYGZdq{}}\PYG{p}{,} \PYG{l+m+mi}{26992728}\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}{name}\PYG{p}{,} \PYG{n}{length} \PYG{o+ow}{in} \PYG{n}{entries}\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{} using bp as the scale length here.}
    \PYG{n}{body} \PYG{o}{=} \PYG{n}{BasicChromosome}\PYG{o}{.}\PYG{n}{ChromosomeSegment}\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{n+nb+bp}{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{}simple\PYGZus{}chrom.pdf\PYGZdq{}}\PYG{p}{,} \PYG{l+s+s2}{\PYGZdq{}Arabidopsis thaliana\PYGZdq{}}\PYG{p}{)}
\end{Verbatim}
