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PYGZhy{}2.  0.  0.  1.  0.]}
\PYG{g+go}{ [\PYGZhy{}2.  0.  0.  0.  1.]]}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{aligner}\PYG{o}{.}\PYG{n}{substitution\PYGZus{}matrix} \PYG{o}{=} \PYG{n}{m}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{aligner}\PYG{o}{.}\PYG{n}{gap\PYGZus{}score} \PYG{o}{=} \PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{s1} \PYG{o}{=} \PYG{n}{numpy}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{4}\PYG{p}{],} \PYG{n}{numpy}\PYG{o}{.}\PYG{n}{int32}\PYG{p}{)}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{s2} \PYG{o}{=} \PYG{n}{numpy}\PYG{o}{.}\PYG{n}{array}\PYG{p}{([}\PYG{l+m+mi}{0}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{,} \PYG{l+m+mi}{1}\PYG{p}{],} \PYG{n}{numpy}\PYG{o}{.}\PYG{n}{int32}\PYG{p}{)}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{alignments} \PYG{o}{=} \PYG{n}{aligner}\PYG{o}{.}\PYG{n}{align}\PYG{p}{(}\PYG{n}{s1}\PYG{p}{,} \PYG{n}{s2}\PYG{p}{)}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{k}{print}\PYG{p}{(}\PYG{n+nb}{len}\PYG{p}{(}\PYG{n}{alignments}\PYG{p}{))}
\PYG{g+go}{2}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{k}{print}\PYG{p}{(}\PYG{n}{alignments}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{])}
\PYG{g+go}{0 \PYGZhy{} 2 3 4}
\PYG{g+go}{| \PYGZhy{} | . \PYGZhy{}}
\PYG{g+go}{0 3 2 1 \PYGZhy{}}
\PYG{g+go}{\PYGZlt{}BLANKLINE\PYGZgt{}}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{k}{print}\PYG{p}{(}\PYG{n}{alignments}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{])}
\PYG{g+go}{0 \PYGZhy{} 2 3 4}
\PYG{g+go}{| \PYGZhy{} | \PYGZhy{} .}
\PYG{g+go}{0 3 2 \PYGZhy{} 1}
\PYG{g+go}{\PYGZlt{}BLANKLINE\PYGZgt{}}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{k}{print}\PYG{p}{(}\PYG{n}{alignments}\PYG{o}{.}\PYG{n}{score}\PYG{p}{)}
\PYG{g+go}{2.0}
\end{Verbatim}
