\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{k}{def} \PYG{n+nf}{map\PYGZus{}func}\PYG{p}{(}\PYG{n}{hit}\PYG{p}{):}
\PYG{g+gp}{... }    \PYG{n}{hit}\PYG{o}{.}\PYG{n}{id} \PYG{o}{=} \PYG{n}{hit}\PYG{o}{.}\PYG{n}{id}\PYG{o}{.}\PYG{n}{split}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}|\PYGZdq{}}\PYG{p}{)[}\PYG{l+m+mi}{3}\PYG{p}{]}   \PYG{c+c1}{\PYGZsh{} renames \PYGZdq{}gi|301171322|ref|NR\PYGZus{}035857.1|\PYGZdq{} to \PYGZdq{}NR\PYGZus{}035857.1\PYGZdq{}}
\PYG{g+gp}{... }    \PYG{k}{return} \PYG{n}{hit}
\PYG{g+gp}{...}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{mapped\PYGZus{}qresult} \PYG{o}{=} \PYG{n}{blast\PYGZus{}qresult}\PYG{o}{.}\PYG{n}{hit\PYGZus{}map}\PYG{p}{(}\PYG{n}{map\PYGZus{}func}\PYG{p}{)}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{k}{for} \PYG{n}{hit} \PYG{o+ow}{in} \PYG{n}{mapped\PYGZus{}qresult}\PYG{p}{[:}\PYG{l+m+mi}{5}\PYG{p}{]:}
\PYG{g+gp}{... }    \PYG{k}{print}\PYG{p}{(}\PYG{n}{hit}\PYG{o}{.}\PYG{n}{id}\PYG{p}{)}
\PYG{g+go}{NR\PYGZus{}030195.1}
\PYG{g+go}{NR\PYGZus{}035856.1}
\PYG{g+go}{NR\PYGZus{}032573.1}
\PYG{g+go}{NR\PYGZus{}035857.1}
\PYG{g+go}{NR\PYGZus{}035851.1}
\end{Verbatim}
