\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{k+kn}{from} \PYG{n+nn}{Bio} \PYG{k+kn}{import} \PYG{n}{Align}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{aligner} \PYG{o}{=} \PYG{n}{Align}\PYG{o}{.}\PYG{n}{PairwiseAligner}\PYG{p}{()}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{aligner}\PYG{o}{.}\PYG{n}{mismatch\PYGZus{}score} \PYG{o}{=} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{aligner}\PYG{o}{.}\PYG{n}{internal\PYGZus{}gap\PYGZus{}score} \PYG{o}{=} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{5}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{aligner}\PYG{o}{.}\PYG{n}{wildcard} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}N\PYGZdq{}}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{target} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}AAAAAAAggggGGNGAAAAA\PYGZdq{}}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{query} \PYG{o}{=} \PYG{l+s+s2}{\PYGZdq{}GGTGGGGG\PYGZdq{}}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{alignments} \PYG{o}{=} \PYG{n}{aligner}\PYG{o}{.}\PYG{n}{align}\PYG{p}{(}\PYG{n}{target}\PYG{o}{.}\PYG{n}{upper}\PYG{p}{(),} \PYG{n}{query}\PYG{p}{)}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n+nb}{print}\PYG{p}{(}\PYG{n+nb}{len}\PYG{p}{(}\PYG{n}{alignments}\PYG{p}{))}
\PYG{g+go}{1}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{alignment} \PYG{o}{=} \PYG{n}{alignments}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{]}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{alignment}\PYG{p}{)}
\PYG{g+go}{AAAAAAAGGGGGGNGAAAAA}
\PYG{g+go}{\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}||.|||.|\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}}
\PYG{g+go}{\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}GGTGGGGG\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}}
\PYG{g+go}{\PYGZlt{}BLANKLINE\PYGZgt{}}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{alignment}\PYG{o}{.}\PYG{n}{score}
\PYG{g+go}{5.0}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{alignment}\PYG{o}{.}\PYG{n}{target}
\PYG{g+go}{\PYGZsq{}AAAAAAAGGGGGGNGAAAAA\PYGZsq{}}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{alignment}\PYG{o}{.}\PYG{n}{target} \PYG{o}{=} \PYG{n}{target}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{alignment}\PYG{o}{.}\PYG{n}{target}
\PYG{g+go}{\PYGZsq{}AAAAAAAggggGGNGAAAAA\PYGZsq{}}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{alignment}\PYG{p}{)}
\PYG{g+go}{AAAAAAAggggGGNGAAAAA}
\PYG{g+go}{\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}....||.|\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}}
\PYG{g+go}{\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}GGTGGGGG\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}\PYGZhy{}}
\PYG{g+go}{\PYGZlt{}BLANKLINE\PYGZgt{}}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{alignment}\PYG{o}{.}\PYG{n}{format}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}psl\PYGZdq{}}\PYG{p}{))}  \PYG{c+c1}{\PYGZsh{}doctest: +NORMALIZE\PYGZus{}WHITESPACE}
\PYG{g+go}{6   1   0   1   0   0   0   0   +   query   8   0   8   target   20   7   15   1   8,   0,   7,}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{alignment}\PYG{o}{.}\PYG{n}{format}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}psl\PYGZdq{}}\PYG{p}{,} \PYG{n}{mask}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}lower\PYGZdq{}}\PYG{p}{))}  \PYG{c+c1}{\PYGZsh{}doctest: +NORMALIZE\PYGZus{}WHITESPACE}
\PYG{g+go}{3   1   3   1   0   0   0   0   +   query   8   0   8   target   20   7   15   1   8,   0,   7,}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n+nb}{print}\PYG{p}{(}\PYG{n}{alignment}\PYG{o}{.}\PYG{n}{format}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}psl\PYGZdq{}}\PYG{p}{,} \PYG{n}{mask}\PYG{o}{=}\PYG{l+s+s2}{\PYGZdq{}lower\PYGZdq{}}\PYG{p}{,} \PYG{n}{wildcard}\PYG{o}{=}\PYG{k+kc}{None}\PYG{p}{))}  \PYG{c+c1}{\PYGZsh{}doctest: +NORMALIZE\PYGZus{}WHITESPACE}
\PYG{g+go}{3   2   3   0   0   0   0   0   +   query   8   0   8   target   20   7   15   1   8,   0,   7,}
\end{Verbatim}
