Eventually, this will become a script. Until then…
First, find all strings of bases (except the last)
/\v([0-9]*1) .{-} ([0-9]*0)/e
Then go to start
gg
and record the macro
na<CR><esc>
before running it to the end of the file.
Delete everything after the last number, then strip everything before the numbers with
:%s/\v^.{-}([0-9]*1 .{-} [0-9]+)/\1/g
and the last line, if necerssary
Gdd
At the start of the file
gg
delete until after \colortbl;
d/colortbl;/e
Find all references to the colour table,
/\v\\chshdng.{-}\\chcbpat([0-9]+)\\cb\1
Return to the start
gg^
and run the macro
df;nsWr gg^
before deleting the rest of that first line
dd
Get rid of all line numbers, sticking a |
at the end of each line
:%s/\v^[0-9]+ *(.{-}) *[0-9]+$/\1|/
Join all lines (without spaces)
ggVGgJ
and then split lines by colour groups
:%s/\v\}\{/\r/g
which should also delete all braces.
Manually, highlight the first colour code in visual mode, and search with *
.
Then delete all but the first and last in each section
:%s/<C-R>///gc
Change the first item in each list (now the odd items) to a latex colour code, e.g.
ggncW'{pink}
Repeat for each colour code
Then, replace the remaining colour codes with white (no highlight)
:%s/\v^\\red[0-9]+\\green[0-9]+\\blue[0-9]+ (.{-})$/\1 '{white}/g
Strip all whitespace at the starts of lines
:%s/\v^ +//g
then rejoin all lines
ggVGgJ
ensure spacing around colour codes
:%s/\v *(\'\{.{-}\}) */ \1 /g
before wrapping the whole thing in \DNA!
and !
I|<esc>yss!<esc>I\DNA
Finally, split at |
:%s/\v\|/\r/g
Paste
\documentclass[a4paper,11pt,oneside,fleqn,final]{article}
\usepackage[usenames,svgnames]{xcolor}
\usepackage{geometry}
\usepackage{dnaseq}
\renewcommand{\DNAblock}{10}% 10 bases per block
\renewcommand{\DNAreserve}{0000}% Four digit numbering
\begin{document}
and
\end{document
afterwards.
Delete all superfluous codes
:%s/\v\{\\red[0-9]+\\green[0-9]+\\blue[0-9]+\|\}//g
And braces, too
:%s/\v[{}]//g