From 09957f78ef831e10c41f8b12329282e8bcef03e3 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 5 Mar 2010 00:29:23 +0000
Subject: texshade 1.21 (2mar10)

git-svn-id: svn://tug.org/texlive/trunk@17314 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/source/latex/texshade/texshade.dtx  | 936 +++++++++++++++++----
 1 file changed, 790 insertions(+), 146 deletions(-)

(limited to 'Master/texmf-dist/source/latex/texshade/texshade.dtx')

diff --git a/Master/texmf-dist/source/latex/texshade/texshade.dtx b/Master/texmf-dist/source/latex/texshade/texshade.dtx
index d1e9b0e83dd..c5098fdb54b 100644
--- a/Master/texmf-dist/source/latex/texshade/texshade.dtx
+++ b/Master/texmf-dist/source/latex/texshade/texshade.dtx
@@ -358,6 +358,20 @@
 %                    `percentidentity{seq1}{seq2}'.
 %                    }
 %
+%    \changes{1.20a}{2009-11-30}{%
+%      Corrections:  identity/similarity tables work now without the need to
+%                    set a conservation plot in the feature line.
+%                    }
+%
+%    \changes{1.21}{2010-03-01}{%
+%      Corrections:  `setdomain' ignored a changed `startnumber', corrected;
+%                    further bug fixes. 
+%      Introduction: in several commands sequence motifs can be given instead
+%                    of numeral sequence stretch definitions;
+%                    new type of sequence emphasis by lowercase characters:
+%                    `lowerregion' and `lowerblock'.
+%                    }
+%
 %
 % \CharacterTable
 %  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -396,7 +410,7 @@
 %            for further information, updates and on-line documentation 
 %            see my homepage at
 %            \texttt{www.pharmazie.uni-kiel.de/chem/Prof\_Beitz/biotex.html} }}
-%    \date{\small v1.20; 2009/10/05\\[2pt] {*** incredible 10 years since first release ***}}
+%    \date{\small v1.21; 2010/03/01\\[2pt]}
 %    \maketitle
 %    \begin{abstract}
 %      Setting alignments of nucleotides and peptides for publication 
@@ -475,6 +489,30 @@
 %    
 %    \subsection{Version History}
 %
+%    \textbf{v1.21 2010/03/01}
+%    \medskip
+%
+%    \emph{Corrections:} |\setdomain| now recognizes a changed |\startnumber|. 
+%
+%    \emph{Introductions:} 
+%    (a) Sequence motifs (\ref{Lshaderegion}) can be given as a selection pattern
+%    in sequence stretch labeling commands, such as |\shaderegion|,
+%    |\emphregion| or |\frameblock|, instead of numeral stretch definitions.
+%    
+%    (b) A new type of sequence emphasis by lowercase letters was implemented: 
+%    |\lowerregion| and |\lowerblock| (\ref{Llowerregion}).
+%    \medskip
+%
+%    \textbf{v1.20a 2009/11/30}
+%    \medskip
+%
+%    \emph{Corrections:}  Identity/similarity tables
+%    work now without having to set a conservation plot in the feature
+%    line. 
+%    \medskip
+%
+%    \newpage
+%
 %    \textbf{v1.20 2009/10/05}
 %    \medskip
 %
@@ -611,7 +649,6 @@
 %    by |\hiderelevance|.
 %    \bigskip
 %
-%    \newpage
 %
 %    \textbf{v1.13 2006/02/23}
 %    \medskip
@@ -839,7 +876,6 @@
 %    works now.
 %    \bigskip
 %    
-%    \newpage
 %
 %    \textbf{v1.2 1999/6/12}
 %    \medskip
@@ -1150,7 +1186,7 @@
 %    
 %    \begin{texshade}{AQPpro.MSF}
 %       \setdomain{1}{75..86,103..103,148..148,151..153,155..156,193..195,218..219,222..222}
-%       \showruler{1}{top} \rulersteps{1}
+%       \showruler{top}{1} \rulersteps{1}
 %       \hidenumbering
 %       \hideconsensus
 %    \end{texshade}
@@ -1161,7 +1197,7 @@
 %    \begin{verbatim}    
 %    \begin{texshade}{AQPpro.MSF}
 %       \setdomain{1}{point[8]:1J4N.pdb,81[CA]}
-%       \showruler{1}{top} \rulersteps{1}
+%       \showruler{top}{1} \rulersteps{1}
 %       \hidenumbering
 %       \hideconsensus
 %    \end{texshade}
@@ -1387,12 +1423,15 @@
 %    \item [\textbf{hydropathy}:] discrimination between acidic and
 %                        basic, polar uncharged and hydrophobic nonpolar residues
 %                        \label{hydro}
+%    \bigskip    
 %    
 %    \begin{texshade}{AQPpro.MSF}
 %       \residuesperline*{34}
 %       \shadingmode[hydropathy]{functional}
 %       \feature{top}{1}{158..163}{brace}{tinted}
 %       \tintblock{1}{158..163}
+%       \feature{top}{1}{QLVLC}{brace}{lowercased}
+%       \lowerblock{1}{QLVLC}
 %       \setends{1}{138..170}
 %       \showlegend
 %    \end{texshade}
@@ -1405,6 +1444,8 @@
 %       \shadingmode[hydropathy]{functional}
 %       \feature{top}{1}{158..163}{brace}{tinted}
 %       \tintblock{1}{158..163}
+%       \feature{top}{1}{QLVLC}{brace}{lowercased}
+%       \lowerblock{1}{QLVLC}
 %       \setends{1}{138..170}
 %       \showlegend
 %    \end{texshade}
@@ -1414,6 +1455,7 @@
 %    \item [\textbf{structure}:] displays the potential
 %                        localization within the tertiary structure of
 %                        the protein \label{struc}
+%    \bigskip    
 %    
 %    \begin{texshade}{AQPpro.MSF}
 %       \residuesperline*{34}
@@ -1423,7 +1465,7 @@
 %           $\alpha$-helix[Yellow]}{transmembrane domain 4}
 %       \feature{top}{1}{158..163}{translate[Blue]}{}
 %       \backtranslabel{oblique}
-%       \feature{bottom}{1}{158..163}{brace[Blue]}{loop D [Blue]}
+%       \feature{bottom}{1}{[DE]RXXR[DE]}{brace[Blue]}{loop D [Blue]}
 %       \feature{top}{1}{164..170}{o->[Red]}{trans. dom. 5}
 %       \showlegend
 %    \end{texshade}
@@ -1439,7 +1481,7 @@
 %           $\alpha$-helix[Yellow]}{transmembrane domain 4}
 %       \feature{top}{1}{158..163}{translate[Blue]}{}
 %       \backtranslabel{oblique}
-%       \feature{bottom}{1}{158..163}{brace[Blue]}{loop D [Blue]}
+%       \feature{bottom}{1}{[DE]RXXR[DE]}{brace[Blue]}{loop D [Blue]}
 %       \feature{top}{1}{164..170}{o->[Red]}{trans. dom. 5}
 %       \showlegend
 %    \end{texshade}
@@ -1449,6 +1491,7 @@
 %    \item [\textbf{chemical}:] residues are shaded due to chemical 
 %                      properties of
 %                      their functional groups \label{chem}
+%    \bigskip    
 %                      
 %    \begin{texshade}{AQPpro.MSF}
 %       \residuesperline*{34}
@@ -1473,6 +1516,7 @@
 %          This is \emph{not} identical to a threshold of 0\%
 %          where only the majority group would be shaded. See the
 %          difference:
+%    \bigskip    
 %          
 %    \begin{texshade}{AQPpro.MSF}
 %       \residuesperline*{34}
@@ -1497,7 +1541,7 @@
 %                      shading following the rasmol
 %                      color scheme \label{ras}
 %    \bigskip
-%                      
+%    \bigskip
 %    \bigskip
 %                      
 %    \begin{texshade}{AQPpro.MSF}
@@ -1534,6 +1578,7 @@
 %                      differences in the surface 
 %                      area \label{starea}
 %                      of the different amino acid's sidechains
+%    \bigskip    
 %                      
 %    \begin{texshade}{AQPpro.MSF}
 %       \residuesperline*{34}
@@ -1563,6 +1608,7 @@
 %                     residues), whereas highly accessible 
 %                     sidechains are hydrophilic (compare to
 %                     \textbf{hydropathy} and \textbf{structure})
+%    \bigskip    
 %                   
 %    \begin{texshade}{AQPpro.MSF}
 %       \residuesperline*{34}
@@ -3434,20 +3480,22 @@
 %    within the alignment. The 
 %    foreground and background colors can be set with the last two 
 %    parameters. 
-%    \meta{selection} can have two different formats
-%    depending on whether (a) the user wants to select the positions manually
-%    or (b) \TeXshade{} is supposed to select the residues based on 3D
+%    \meta{selection} can have three different formats
+%    depending on whether (a) the user wants to select the positions manually,
+%    (b) the selection should be based on a sequence motif to be found by \TeXshade{}, 
+%    or (c) \TeXshade{} is supposed to select the residues based on 3D
 %    coordinates provided by a PDB file.
+%    \medskip
 %    
-%    To select the residues manually, the user provides a position list of
+%    (a) To select the residues manually, the user provides a position list of
 %    the following format:
 %    \medskip
 %    
 %    \quad|{|\meta{start1}..\meta{stop1}|,|\meta{start2}..\meta{stop2}|,|\ldots|,|\meta{start n}..\meta{stop n}|}|
 %    \medskip
 %    
-%    Example: in order to shade residue number 13 and the region
-%    20--30 of sequence number 1 in red letters on green ground 
+%    In order to shade residue number 13 and the region
+%    20--30 of sequence number 1 in red letters on a green background 
 %    type the following command:
 %    \medskip
 %    
@@ -3458,7 +3506,23 @@
 %    \meta{seqref}.
 %    \medskip
 %    
-%    In order to select positions based on the 3D structure a PDB
+%    (b) A sequence motif can be given, which will be found and labeled. A simple 
+%    example selecting all sequence motifs `NNAD' in sequence `1' would be:
+%    \medskip
+%
+%    \quad|\shaderegion{1}{NNAD}{Red}{Green}|
+%    \medskip
+%
+%    The definition can further include `X' for any residue and groups of residues in brackets
+%    at uncertain positions. The example below will find all motifs in sequence `1'
+%    that start with an asparagine, followed by any two residues, an acidic, a
+%    basic residue, again any two residues and finally a glutamine.
+%    \medskip
+%    
+%    \quad|\shaderegion{1}{NXX[DE][KR]XXQ}{Red}{Green}|
+%    \medskip
+%    
+%    (c) In order to select positions based on the 3D structure a PDB
 %    structure file is required. \TeXshade{} can select residues within
 %    a given distance in \AA{} around a point, along a line, or above and
 %    below a plane, which are defined by one to three residues. The points 
@@ -3513,7 +3577,7 @@
 %    
 %    Both selection formats, i.\,e. a manually given list and the 3D selection,
 %    can be used with |\shadeblock| (see below), 
-%    |\tintregion|, |\tintblock|, |\emphregion|, |\emphblock|, 
+%    |\tintregion|, |\tintblock|, |\emphregion|, |\emphblock|, |\lowerregion|, |\lowerblock|,
 %    |\frameblock| (all in \ref{Lframeblock}), and |\feature| (\ref{Lfeature}).
 %
 %
@@ -3529,10 +3593,10 @@
 %    \medskip
 %    
 %    
-%    \subsubsection{Emphasizing, tinting, and framing}
+%    \subsubsection{Emphasizing, tinting, lowercasing, and framing}
 %    
 %    \label{Lemphregion}\label{Lemphblock}
-%    If it is prefered to keep the calculated shading colors 
+%    If it is preferred to keep the calculated shading colors 
 %    but distinct regions or blocks are yet to be emphasized one
 %    can use the following commands to change the font style of 
 %    such regions:
@@ -3560,6 +3624,7 @@
 %    
 %    \label{Ltintregion}\label{Ltintblock}
 %    Further, it is possible to tint the region or block in question
+%    or to switch the characters to lowercase
 %    by using the commands (for example see hydropathy-figure on page 
 %    \pageref{hydro}):
 %    \medskip
@@ -3577,6 +3642,18 @@
 %    The level of tinting in the region in question can be set by 
 %    |\tintdefault{|\meta{level}|}| with |weak|, |normal|, and
 %    |strong| as possible \meta{level}s.
+%    \medskip
+%    
+%    \label{Llowerregion}\label{Llowerblock}
+%    \quad|\lowerregion{|\meta{seqref}|}{|\meta{selection}|}|
+%    \medskip   
+%    
+%    and
+%    \medskip
+%    
+%    \quad|\lowerblock{|\meta{seqref}|}{|\meta{selection}|}|
+%    \medskip   
+%    
 %    
 %    Another option is to draw a bounding box around the sequence block
 %    in question (for an example see diversity mode-figure on page 
@@ -3630,9 +3707,9 @@
 %    |\bottomspace{-0.1in}|.
 %    
 %    The argument \meta{seqref} and the third 
-%    parameter containing the selection of the specified residues
+%    parameter containing the \meta{selection} of the specified residues
 %    are identical to the ones described before in several commands, e.\,g.
-%    |\ruler| (\ref{ruler}) or |\shaderegion| (\ref{shaderegion}). 
+%    |\shaderegion| (\ref{shaderegion}). 
 %    
 %    New is the fourth parameter for the definition of the label style.
 %    There are many possibilities like braces, helices, boxes, arrows, bars, any
@@ -5919,6 +5996,12 @@
 %    \quad|\tintdefault{|\meta{effect}|}| \qquad\qquad|weak, normal, strong|
 %       \hfill[\pageref{Ltintdefault}]
 %    
+%    \quad|\lowerregion{|\meta{seqref}|}{|\meta{selection}|}|
+%       \hfill[\pageref{Llowerregion}]
+%    
+%    \quad|\lowerblock{|\meta{seqref}|}{|\meta{selection}|}|
+%       \hfill[\pageref{Llowerblock}]
+%    
 %    \quad|\frameblock{|\meta{seqref}|}{|\meta{selection}|}{|\meta{color}|[|\meta{length}|]}|
 %       \hfill[\pageref{Lframeblock}]
 %    
@@ -6019,6 +6102,7 @@
 %
 %    \vspace{1.5\baselineskip}
 %    
+%    \newpage
 %
 %    \textbf{Including secondary structure information}
 %    \medskip
@@ -6130,6 +6214,8 @@
 %    
 %    \vspace{1.5\baselineskip}
 %    
+%    \newpage    
+%    
 %    \textbf{Font handling}
 %    \medskip
 %    
@@ -6292,8 +6378,8 @@
 %    \begin{macrocode}
 %<*texshade>
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{texshade}[2009/10/05 LaTeX TeXshade (v1.20)]
-\message{Package `texshade', Version 1.20 of 2009/10/05.}
+\ProvidesPackage{texshade}[2010/03/01 LaTeX TeXshade (v1.21)]
+\message{Package `texshade', Version 1.21 of 2010/03/01.}
 
 \PassOptionsToPackage{dvips}{color}
 \PassOptionsToPackage{dvips}{graphicx}
@@ -6390,13 +6476,15 @@
 \newif\ifttopfeature  \newif\ifbbottomfeature
 \newif\iftttopfeature \newif\ifbbbottomfeature
 \newif\ifttttopfeature\newif\ifbbbbottomfeature
-\newif\ifall@fshade   \newif\ifregionalemph    
+\newif\ifall@fshade   \newif\ifregionalemph 
+\newif\ifregionallower    
 \newif\ifframe@       \newif\ifregionaltint
 \newif\ifshow@logo    \newif\ifshow@sublogo
 \newif\ifhidechar     \newif\ifsh@wg@ps
 \newif\ifsimmode
 \newif\ifregionaltintnow
 \newif\ifregionalemphnow
+\newif\ifregionallowernow
 \newif\ifregionalshadenow
 \newif\iftopfeaturenow
 \newif\ifttopfeaturenow
@@ -6417,7 +6505,8 @@
 \def\comm@{,} \def\@loc{LOC} \def\@asg{ASG} \def\@t{@} \def\@HP{>HP:}
 \def\gre@ter{>} \def\sm@ller{<} \def\N@{N} \def\equ@l{=} \def\H@{H}
 \def\gap@char{.} \def\dom@char{{\dom@rule}} \def\yes{yes} \def\y@{y} \def\n@{n} 
-\def\o@{o} \def\d@t{.} \def\questi@n{?} \def\st@p@char{*}
+\def\o@{o} \def\d@t{.} \def\questi@n{?} \def\st@p@char{*} \def\semic@n{;}
+\def\br@cket{[}
 \def\@TOM{ATOM} \def\C@lpha{CA} \def\@point@{point} \def\@line@{line} \def\@plane@{plane}
 \def\gap@rule{\rule[0.3\box@height]{\box@width}{\gap@rulethick}}
 \def\dom@rule{\vrule depth\box@depth height\box@height width\domgap@rulethick}
@@ -8576,10 +8665,10 @@
                     \csname stack@@reg#1\endcsname}
       \expandafter\xdef\csname stack@tintreg\the\loopcount\endcsname{%
                     \csname stack@@tintreg#1\endcsname}
-      \expandafter\xdef\csname stack@hidereg\the\loopcount\endcsname{%
-                    \csname stack@@hidereg#1\endcsname}
       \expandafter\xdef\csname stack@emphreg\the\loopcount\endcsname{%
                     \csname stack@@emphreg#1\endcsname}
+      \expandafter\xdef\csname stack@lowerreg\the\loopcount\endcsname{%
+                    \csname stack@@lowerreg#1\endcsname}
       \expandafter\xdef\csname stack@framereg\the\loopcount\endcsname{%
                     \csname stack@@framereg#1\endcsname}
       \expandafter\xdef\csname stack@top\the\loopcount\endcsname{%
@@ -8629,10 +8718,10 @@
             \csname stack@reg\the\loopcount\endcsname}
          \expandafter\xdef\csname stack@@tintreg\the\loopcount\endcsname{%
             \csname stack@tintreg\the\loopcount\endcsname}
-         \expandafter\xdef\csname stack@@hidereg\the\loopcount\endcsname{%
-            \csname stack@hidereg\the\loopcount\endcsname}
          \expandafter\xdef\csname stack@@emphreg\the\loopcount\endcsname{%
             \csname stack@emphreg\the\loopcount\endcsname}
+         \expandafter\xdef\csname stack@@lowerreg\the\loopcount\endcsname{%
+            \csname stack@lowerreg\the\loopcount\endcsname}
          \expandafter\xdef\csname stack@@framereg\the\loopcount\endcsname{%
             \csname stack@framereg\the\loopcount\endcsname}
          \expandafter\xdef\csname stack@@top\the\loopcount\endcsname{%
@@ -8918,10 +9007,10 @@
             \csname stack@reg\the\innerloopcount\endcsname}
       \expandafter\xdef\csname stack@tintreg\the\loopcount\endcsname{%
             \csname stack@tintreg\the\innerloopcount\endcsname}
-      \expandafter\xdef\csname stack@hidereg\the\loopcount\endcsname{%
-            \csname stack@hidereg\the\innerloopcount\endcsname}
       \expandafter\xdef\csname stack@emphreg\the\loopcount\endcsname{%
             \csname stack@emphreg\the\innerloopcount\endcsname}
+      \expandafter\xdef\csname stack@lowerreg\the\loopcount\endcsname{%
+            \csname stack@lowerreg\the\innerloopcount\endcsname}
       \expandafter\xdef\csname stack@framereg\the\loopcount\endcsname{%
             \csname stack@framereg\the\innerloopcount\endcsname}
       \expandafter\xdef\csname stack@top\the\loopcount\endcsname{%
@@ -9189,15 +9278,16 @@
    \expandafter\xdef\csname stack@reg\temp@\endcsname{\last@}
 }
 \def\sort@stack{%
-   \expandafter\get@fromstack\last@
-   \ifx\first@\ampers@nd
+   \expandafter\get@fromstack\last@ 
+   \ifx\first@\ampers@nd  
       \xdef\tmpstack{\tmpstack\the\loopcount;\st@rt;\st@p;\@ll;&;&;&;&;@}
-   \else
+   \else 
    \ifnum\st@rt<\second@
       \xdef\tmpstack{\tmpstack\the\loopcount;\st@rt;\st@p;\@ll;%
-                     \first@;\second@;\third@;\fourth@;\last@}
+                     \first@;\second@;\third@;\fourth@;\last@} 
    \else
-      \xdef\tmpstack{\tmpstack\first@;\second@;\third@;\fourth@;} \sort@stack
+      \xdef\tmpstack{\tmpstack\first@;\second@;\third@;\fourth@;} 
+      \sort@stack
    \fi\fi
 }
 \def\get@regions#1..#2,#3@{%
@@ -9207,28 +9297,6 @@
    \sort@stack
    \expandafter\xdef\csname stack@reg\seq@\endcsname{\tmpstack}
 }
-\def\getregion@fromhidestack#1{%
-   \xdef\temp@{#1}
-   \xdef\first@{\csname stack@hidereg\temp@\endcsname}
-   \expandafter\get@fromstack\first@
-   \expandafter\xdef\csname hidestart\temp@\endcsname{\first@}
-   \expandafter\xdef\csname hidestop\temp@\endcsname{\second@}
-   \expandafter\xdef\csname hidestyle\temp@\endcsname{\third@}
-   \expandafter\xdef\csname hidetext\temp@\endcsname{\fourth@}
-   \expandafter\xdef\csname stack@hidereg\temp@\endcsname{\last@}
-}
-\def\sort@hidestack{%
-   \expandafter\get@fromstack\last@
-   \ifx\first@\ampers@nd
-      \xdef\tmpstack{\tmpstack\st@rt;\st@p;\@ll;\text@;&;&;&;&;&;@}
-   \else
-   \ifnum\st@rt<\second@
-      \xdef\tmpstack{\tmpstack\st@rt;\st@p;\@ll;\text@;%
-                     \first@;\second@;\third@;\fourth@;\last@}
-   \else
-      \xdef\tmpstack{\tmpstack\first@;\second@;\third@;\fourth@;} \sort@hidestack
-   \fi\fi
-}
 \def\get@fromemphstack#1;#2;#3;#4@{%
    \xdef\first@{#1} \xdef\second@{#2}
    \xdef\third@{#3} \xdef\last@{#4@}
@@ -9261,6 +9329,34 @@
    \sort@emphstack
    \expandafter\xdef\csname stack@emphreg\seq@\endcsname{\tmpstack}
 }
+\def\getregion@fromlowerstack#1{%
+   \xdef\temp@{#1}
+   \xdef\first@{\csname stack@lowerreg\temp@\endcsname}
+   \expandafter\get@fromemphstack\first@
+   \expandafter\xdef\csname lowerstart\temp@\endcsname{\first@}
+   \expandafter\xdef\csname lowerstop\temp@\endcsname{\second@}
+   \expandafter\xdef\csname lowerall\temp@\endcsname{\third@}
+   \expandafter\xdef\csname stack@lowerreg\temp@\endcsname{\last@}
+}
+\def\sort@lowerstack{%
+   \expandafter\get@fromemphstack\last@
+   \ifx\first@\ampers@nd
+      \xdef\tmpstack{\tmpstack\st@rt;\st@p;\@ll;&;&;&;@}
+   \else
+   \ifnum\st@rt<\second@
+      \xdef\tmpstack{\tmpstack\st@rt;\st@p;\@ll;\first@;\second@;\third@;\last@}
+   \else
+      \xdef\tmpstack{\tmpstack\first@;\second@;\third@;} \sort@lowerstack
+   \fi\fi
+}
+\def\get@lowerregions#1..#2,#3@{%
+   \regionallowertrue
+   \xdef\st@rt{#1} \xdef\st@p{#2} \xdef\list@{#3}
+   \xdef\last@{\csname stack@lowerreg\seq@\endcsname}
+   \xdef\tmpstack{}
+   \sort@lowerstack
+   \expandafter\xdef\csname stack@lowerreg\seq@\endcsname{\tmpstack}
+}
 \def\get@fromdomstack#1;#2;#3@{%
    \xdef\first@{#1} \xdef\second@{#2}
    \xdef\last@{#3@}
@@ -9304,23 +9400,12 @@
    \expandafter\xdef\csname tintall\temp@\endcsname{\third@}
    \expandafter\xdef\csname stack@tintreg\temp@\endcsname{\last@}
 }
-\def\sort@tintstack{%
-   \expandafter\get@fromemphstack\last@
-   \ifx\first@\ampers@nd
-      \xdef\tmpstack{\tmpstack\st@rt;\st@p;\@ll;&;&;&;@}
-   \else
-   \ifnum\st@rt<\second@
-      \xdef\tmpstack{\tmpstack\st@rt;\st@p;\@ll;\first@;\second@;\third@;\last@}
-   \else
-      \xdef\tmpstack{\tmpstack\first@;\second@;\third@;} \sort@tintstack
-   \fi\fi
-}
 \def\get@tintregions#1..#2,#3@{%
    \regionaltinttrue
    \xdef\st@rt{#1} \xdef\st@p{#2} \xdef\list@{#3}
    \xdef\last@{\csname stack@tintreg\seq@\endcsname}
    \xdef\tmpstack{}
-   \sort@tintstack
+   \sort@emphstack
    \expandafter\xdef\csname stack@tintreg\seq@\endcsname{\tmpstack}
 }
 \def\getregion@fromframestack#1{%
@@ -9466,23 +9551,312 @@
       \fi%
    \fi%
 }
+\def\test@get#1#2@{%
+   \xdef\temp@{#1} \xdef\third@@{#2@}
+   \ifx\temp@\ampers@nd
+   \else
+      \if \temp@ X
+         \xdef\temp@{\second@@}
+      \fi
+      \ifx\temp@\second@@
+         \xdef\third@@{\second@@}
+      \else
+         \expandafter\test@get\third@@
+      \fi
+   \fi
+}
+\def\get@@second@#1#2@{\xdef\second@@{#1}\xdef\first@@{#2@}}
+\def\get@@third@#1]#2@{\xdef\third@@{#1&@}\xdef\fifth@@{#2@}}
+\def\get@third@#1#2@{\xdef\third@@{#1}\xdef\fifth@@{#2@}}
+\def\find@motif{%
+   \expandafter\get@@second@\first@@
+   \ifx\second@@\ampers@nd
+   \else
+      \ifx\second@@\d@t
+      \else
+         \advance\temp@count by 1
+         \if \third@@ X
+            \xdef\third@@{\second@@}
+         \fi
+         \ifx\third@@\br@cket
+            \expandafter\get@@third@\fifth@@
+            \expandafter\test@get\third@@
+         \fi
+         \ifx\second@@\third@@
+            \ifx\nineth@@\n@
+               \xdef\st@rt{\the\temp@count}
+               \xdef\st@p{n}
+            \fi
+            \xdef\nineth@@{y}
+            \expandafter\get@third@\fifth@@
+            \ifx\third@@\ampers@nd
+               \xdef\st@p{\the\temp@count}
+               \xdef\list@{}
+               \xdef\tmpstack{}
+               \xdef\temp@{shade}
+               \ifx\temp@\temp@@
+                  \xdef\last@{\csname stack@reg\seq@\endcsname} 
+                  \loopcount=\style@
+                  \sort@stack
+                  \expandafter\xdef\csname stack@reg\seq@\endcsname{\tmpstack}
+               \else
+               \xdef\temp@{emph}
+               \ifx\temp@\temp@@
+                  \regionalemphtrue
+                  \xdef\last@{\csname stack@emphreg\seq@\endcsname} 
+                  \sort@emphstack
+                  \expandafter\xdef\csname stack@emphreg\seq@\endcsname{\tmpstack}
+               \else
+               \xdef\temp@{lower}
+               \ifx\temp@\temp@@
+                  \regionallowertrue
+                  \xdef\last@{\csname stack@lowerreg\seq@\endcsname} 
+                  \sort@lowerstack
+                  \expandafter\xdef\csname stack@lowerreg\seq@\endcsname{\tmpstack}
+               \else
+               \xdef\temp@{tint}
+               \ifx\temp@\temp@@
+                  \regionaltinttrue
+                  \xdef\last@{\csname stack@tintreg\seq@\endcsname}     \message{((last:\last@))}
+                  \sort@emphstack
+                  \expandafter\xdef\csname stack@tintreg\seq@\endcsname{\tmpstack} \message{((tmp:\tmpstack))}
+               \else
+               \xdef\temp@{frame}
+               \ifx\temp@\temp@@
+                  \frame@true
+                  \xdef\last@{\csname stack@framereg\seq@\endcsname} 
+                  \sort@emphstack
+                  \expandafter\xdef\csname stack@framereg\seq@\endcsname{\tmpstack}
+               \else
+               \xdef\temp@{ttttop}
+               \ifx\temp@\temp@@
+                  \xdef\last@{\csname stack@ttttop\seq@\endcsname} 
+                  \sort@fstack
+                  \expandafter\xdef\csname stack@ttttop\seq@\endcsname{\tmpstack}
+               \else
+               \xdef\temp@{tttop}
+               \ifx\temp@\temp@@
+                  \xdef\last@{\csname stack@tttop\seq@\endcsname} 
+                  \sort@fstack
+                  \expandafter\xdef\csname stack@tttop\seq@\endcsname{\tmpstack}
+               \else
+               \xdef\temp@{ttop}
+               \ifx\temp@\temp@@
+                  \xdef\last@{\csname stack@ttop\seq@\endcsname} 
+                  \sort@fstack
+                  \expandafter\xdef\csname stack@ttop\seq@\endcsname{\tmpstack}
+               \else
+               \xdef\temp@{top}
+               \ifx\temp@\temp@@
+                  \xdef\last@{\csname stack@top\seq@\endcsname}
+                  \sort@fstack
+                  \expandafter\xdef\csname stack@top\seq@\endcsname{\tmpstack}
+               \else
+               \xdef\temp@{bottom}
+               \ifx\temp@\temp@@
+                  \xdef\last@{\csname stack@bottom\seq@\endcsname} 
+                  \sort@fstack
+                  \expandafter\xdef\csname stack@bottom\seq@\endcsname{\tmpstack}
+               \else
+               \xdef\temp@{bbottom}
+               \ifx\temp@\temp@@
+                  \xdef\last@{\csname stack@bbottom\seq@\endcsname} 
+                  \sort@fstack
+                  \expandafter\xdef\csname stack@bbottom\seq@\endcsname{\tmpstack}
+               \else
+               \xdef\temp@{bbbottom}
+               \ifx\temp@\temp@@
+                  \xdef\last@{\csname stack@bbbottom\seq@\endcsname} 
+                  \sort@fstack
+                  \expandafter\xdef\csname stack@bbbottom\seq@\endcsname{\tmpstack}
+               \else
+               \xdef\temp@{bbbbottom}
+               \ifx\temp@\temp@@
+                  \xdef\last@{\csname stack@bbbbottom\seq@\endcsname} 
+                  \sort@fstack
+                  \expandafter\xdef\csname stack@bbbbottom\seq@\endcsname{\tmpstack}
+               \fi
+               \fi
+               \fi
+               \fi
+               \fi
+               \fi
+               \fi
+               \fi
+               \fi
+               \fi
+               \fi
+               \fi
+               \fi
+               \xdef\fifth@@{\m@tif} \expandafter\get@third@\fifth@@
+               \xdef\nineth@@{n}
+            \fi
+         \else
+            \xdef\nineth@@{n} \xdef\st@p{n}
+            \xdef\fifth@@{\m@tif} \expandafter\get@third@\fifth@@
+         \fi
+      \fi
+   \find@motif
+   \fi
+}
+\def\prep@motif{%
+
+   \def\get@motif@specs##1,##2,##3,##4,##5,&{%
+      \xdef\seq@{##1} \xdef\temp@@{##2} \xdef\@ll{##3} \def\fourth@@{##4} \xdef\fifth@@{##5&@}
+   }
+
+   \loopcount=0
+   \loop
+      \advance\loopcount by 1
+      \expandafter\xdef\csname stack@reg\the\loopcount\endcsname{\csname style\the\loopcount\endcsname;%
+                                                                 \csname start\the\loopcount\endcsname;%
+                                                                 \csname stop\the\loopcount\endcsname;%
+                                                                 \csname all\the\loopcount\endcsname;%
+                                                                 \csname stack@reg\the\loopcount\endcsname}
+      \expandafter\xdef\csname stack@emphreg\the\loopcount\endcsname{\csname emphstart\the\loopcount\endcsname;%
+                                                                 \csname emphstop\the\loopcount\endcsname;%
+                                                                 \csname emphall\the\loopcount\endcsname;%
+                                                                 \csname stack@emphreg\the\loopcount\endcsname}
+      \expandafter\xdef\csname stack@lowerreg\the\loopcount\endcsname{\csname lowerstart\the\loopcount\endcsname;%
+                                                                 \csname lowerstop\the\loopcount\endcsname;%
+                                                                 \csname lowerall\the\loopcount\endcsname;%
+                                                                 \csname stack@lowerreg\the\loopcount\endcsname}
+      \expandafter\xdef\csname stack@tintreg\the\loopcount\endcsname{\csname tintstart\the\loopcount\endcsname;%
+                                                                 \csname tintstop\the\loopcount\endcsname;%
+                                                                 \csname tintall\the\loopcount\endcsname;%
+                                                                 \csname stack@tintreg\the\loopcount\endcsname}
+      \expandafter\xdef\csname stack@framereg\the\loopcount\endcsname{\csname framestart\the\loopcount\endcsname;%
+                                                                 \csname framestop\the\loopcount\endcsname;%
+                                                                 \csname framestyle\the\loopcount\endcsname;%
+                                                                 \csname stack@framereg\the\loopcount\endcsname}
+      \expandafter\xdef\csname stack@ttttop\the\loopcount\endcsname{\csname textttttop\the\loopcount\endcsname;%
+                                                                 \csname startttttop\the\loopcount\endcsname;%
+                                                                 \csname stopttttop\the\loopcount\endcsname;%
+                                                                 \csname stylettttop\the\loopcount\endcsname;%
+                                                                 \csname stack@ttttop\the\loopcount\endcsname}
+      \expandafter\xdef\csname stack@tttop\the\loopcount\endcsname{\csname texttttop\the\loopcount\endcsname;%
+                                                                 \csname starttttop\the\loopcount\endcsname;%
+                                                                 \csname stoptttop\the\loopcount\endcsname;%
+                                                                 \csname styletttop\the\loopcount\endcsname;%
+                                                                 \csname stack@tttop\the\loopcount\endcsname}
+      \expandafter\xdef\csname stack@ttop\the\loopcount\endcsname{\csname textttop\the\loopcount\endcsname;%
+                                                                 \csname startttop\the\loopcount\endcsname;%
+                                                                 \csname stopttop\the\loopcount\endcsname;%
+                                                                 \csname stylettop\the\loopcount\endcsname;%
+                                                                 \csname stack@ttop\the\loopcount\endcsname}
+      \expandafter\xdef\csname stack@top\the\loopcount\endcsname{\csname texttop\the\loopcount\endcsname;%
+                                                                 \csname starttop\the\loopcount\endcsname;%
+                                                                 \csname stoptop\the\loopcount\endcsname;%
+                                                                 \csname styletop\the\loopcount\endcsname;%
+                                                                 \csname stack@top\the\loopcount\endcsname}
+      \expandafter\xdef\csname stack@bottom\the\loopcount\endcsname{\csname textbottom\the\loopcount\endcsname;%
+                                                                 \csname startbottom\the\loopcount\endcsname;%
+                                                                 \csname stopbottom\the\loopcount\endcsname;%
+                                                                 \csname stylebottom\the\loopcount\endcsname;%
+                                                                 \csname stack@bottom\the\loopcount\endcsname}
+      \expandafter\xdef\csname stack@bbottom\the\loopcount\endcsname{\csname textbbottom\the\loopcount\endcsname;%
+                                                                 \csname startbbottom\the\loopcount\endcsname;%
+                                                                 \csname stopbbottom\the\loopcount\endcsname;%
+                                                                 \csname stylebbottom\the\loopcount\endcsname;%
+                                                                 \csname stack@bbottom\the\loopcount\endcsname}
+      \expandafter\xdef\csname stack@bbbottom\the\loopcount\endcsname{\csname textbbbottom\the\loopcount\endcsname;%
+                                                                 \csname startbbbottom\the\loopcount\endcsname;%
+                                                                 \csname stopbbbottom\the\loopcount\endcsname;%
+                                                                 \csname stylebbbottom\the\loopcount\endcsname;%
+                                                                 \csname stack@bbbottom\the\loopcount\endcsname}
+      \expandafter\xdef\csname stack@bbbbottom\the\loopcount\endcsname{\csname textbbbbottom\the\loopcount\endcsname;%
+                                                                 \csname startbbbbottom\the\loopcount\endcsname;%
+                                                                 \csname stopbbbbottom\the\loopcount\endcsname;%
+                                                                 \csname stylebbbbottom\the\loopcount\endcsname;%
+                                                                 \csname stack@bbbbottom\the\loopcount\endcsname}
+   \ifnum\loopcount<\seq@num\repeat
+   \temp@@count=0
+   \loop
+      \advance\temp@@count by 1
+      \xdef\first@@{\csname motif\the\temp@@count\endcsname}
+      \expandafter\get@motif@specs\first@@
+      \xdef\first@@{\csname sequence\seq@\endcsname &@}
+      \temp@count=\csname res@count\seq@\endcsname
+      \xdef\f@text@{\@ll}
+      \xdef\style@{\fourth@@}
+      \xdef\m@tif{\fifth@@} \expandafter\get@third@\fifth@@
+      \xdef\nineth@@{n} \xdef\st@p{n}
+      \find@motif
+   \ifnum\temp@@count<\motif@num\repeat
+   \loopcount=0
+   \loop
+      \advance\loopcount by 1
+      \expandafter\getregion@fromstack{\the\loopcount}
+      \expandafter\getregion@fromtintstack{\the\loopcount}
+      \expandafter\getregion@fromemphstack{\the\loopcount}
+      \expandafter\getregion@fromlowerstack{\the\loopcount}
+      \expandafter\getregion@fromframestack{\the\loopcount}
+      \xdef\bottop@{top}       \expandafter\getregion@fromfstack{\the\loopcount}
+      \xdef\bottop@{ttop}      \expandafter\getregion@fromfstack{\the\loopcount}
+      \xdef\bottop@{tttop}     \expandafter\getregion@fromfstack{\the\loopcount}
+      \xdef\bottop@{ttttop}    \expandafter\getregion@fromfstack{\the\loopcount}
+      \xdef\bottop@{bottom}    \expandafter\getregion@fromfstack{\the\loopcount}
+      \xdef\bottop@{bbottom}   \expandafter\getregion@fromfstack{\the\loopcount}
+      \xdef\bottop@{bbbottom}  \expandafter\getregion@fromfstack{\the\loopcount}
+      \xdef\bottop@{bbbbottom} \expandafter\getregion@fromfstack{\the\loopcount}
+   \ifnum\loopcount<\seq@num\repeat
+}
+
+\def\test@motif#1#2@{%
+   \xdef\temp@{shade}
+   \ifx\temp@\temp@@ \xdef\style@{\the\loopcount} \fi
+   \xdef\temp@{emph}
+   \ifx\temp@\temp@@ \xdef\style@{0} \fi
+   \xdef\temp@{lower}
+   \ifx\temp@\temp@@ \xdef\style@{0} \fi
+   \xdef\temp@{tint}
+   \ifx\temp@\temp@@ \xdef\style@{0} \fi
+   \xdef\temp@{frame}
+   \ifx\temp@\temp@@ \xdef\style@{0} \fi
+   \xdef\temp@{#1#2}
+   \xdef\first@{#1}
+   \ifx\first@\br@cket
+      \xdef\label@motif{y}
+      \temp@count=\motif@num
+      \advance\temp@count by 1
+      \xdef\motif@num{\the\temp@count} 
+      \expandafter\xdef\csname motif\the\temp@count\endcsname{\seq@,\temp@@,\@ll,\style@,\temp@}
+      \xdef\list@{&}
+   \else
+      \expandafter\check@char\first@
+      \ifletter
+         \xdef\label@motif{y}
+         \temp@count=\motif@num
+         \advance\temp@count by 1
+         \xdef\motif@num{\the\temp@count} 
+         \expandafter\xdef\csname motif\the\temp@count\endcsname{\seq@,\temp@@,\@ll,\style@,\temp@}
+         \xdef\list@{&}
+      \fi
+   \fi   
+}
 
 \def\test@PDB#1:#2,#3,#4,#5,#6@{%
    \xdef\last@{#1[,]&}\expandafter\opt@color\last@
+   \xdef\PDB@distance{no}
    \ifx\f@color\comm@
-      \xdef\PDB@distance{no}
    \else
       \xdef\f@color{\f@color .&&@}
       \expandafter\coord@get\f@color
-      \temp@count=\c@@rd
-      \multiply\temp@count by \temp@count
-      \xdef\PDB@distance{\the\temp@count}
+      \xdef\temp@{\c@@rd @}
+      \expandafter\check@letter\temp@
+      \ifletter
+      \else
+         \temp@count=\c@@rd
+         \multiply\temp@count by \temp@count
+         \xdef\PDB@distance{\the\temp@count}
+      \fi
    \fi
    \xdef\PDB@hitpos{0}
    \xdef\PDB@stack{}
    \xdef\PDB@name{#2}
    \xdef\PDB@type{point}
    \ifx\fourth@\PDB@type
+      \xdef\PDB@{y}
       \xdef\last@{#3[,]&}\expandafter\opt@color\last@
       \xdef\PDB@refnum@a{\fourth@}
       \ifx\f@color\C@lpha
@@ -9498,6 +9872,7 @@
    \else
       \xdef\PDB@type{line}
       \ifx\fourth@\PDB@type
+         \xdef\PDB@{y}
          \xdef\last@{#3[,]&}\expandafter\opt@color\last@
          \xdef\PDB@refnum{\fourth@}
          \ifx\f@color\C@lpha
@@ -9532,6 +9907,7 @@
       \else
          \xdef\PDB@type{plane}
          \ifx\fourth@\PDB@type
+            \xdef\PDB@{y}
             \xdef\last@{#3[,]&}\expandafter\opt@color\last@
             \xdef\PDB@refnum{\fourth@}
             \ifx\f@color\C@lpha
@@ -9587,6 +9963,9 @@
             \ifx\PDB@distance\n@ \xdef\PDB@distance{100}\fi
             \load@PDB 
             \expandafter\get@item\PDB@stack \xdef\list@{\first@@}
+         \else
+            \xdef\temp@{\list@ @}
+            \expandafter\test@motif\temp@
          \fi
       \fi
    \fi
@@ -11245,11 +11624,15 @@
      \expandafter\xdef\csname fgseqregion\the\loopcount\endcsname{#3}
      \expandafter\xdef\csname bgseqregion\the\loopcount\endcsname{#4}
      \xdef\list@{#2,&}
-     \xdef\temp@{#2,,,:,,,,@} \expandafter\test@PDB\temp@ 
-     \loop
-        \xdef\list@{\list@ @}
-        \expandafter\get@regions\list@
-     \ifx\list@\ampers@nd\else\repeat
+     \xdef\temp@@{shade}
+     \xdef\temp@{#2,,,:,,,,@} \expandafter\test@PDB\temp@
+     \ifx\list@\ampers@nd
+     \else
+        \loop
+           \xdef\list@{\list@ @}
+           \expandafter\get@regions\list@
+        \ifx\list@\ampers@nd\else\repeat
+     \fi
    \fi
 }
 \def\shadeblock#1#2#3#4{%
@@ -11269,11 +11652,15 @@
    \else
      \ifx\@ll\yes \xdef\@ll{y}\else \xdef\@ll{n}\fi
      \xdef\list@{#2,&}
+     \xdef\temp@@{tint} \loopcount=0
      \xdef\temp@{#2,,,:,,,,@} \expandafter\test@PDB\temp@
-     \loop
-        \xdef\list@{\list@ @}
-        \expandafter\get@tintregions\list@
-     \ifx\list@\ampers@nd\else\repeat
+     \ifx\list@\ampers@nd
+     \else
+        \loop
+           \xdef\list@{\list@ @}
+           \expandafter\get@tintregions\list@
+        \ifx\list@\ampers@nd\else\repeat
+     \fi
    \fi
 }
 \def\tintblock#1#2{%
@@ -11299,6 +11686,34 @@
       \xdef\light@{LightLight}
    \fi\fi\fi
 }
+\def\lowerregion#1#2{%
+   \xdef\seq@{#1}
+   \xdef\temp@{consensus} \ifx\seq@\temp@ \xdef\seq@{0} \fi
+   \xdef\first@{\seq@ @} \expandafter\check@letter\first@
+   \xdef\first@{\seq@}
+   \ifletter \get@name@number \xdef\seq@{\first@} \fi
+   \ifnum\seq@>\seq@count
+     \message{<Ignored seq `\seq@' in \noexpand\lowerregion or \noexpand\lowerblock>}
+   \else
+     \ifx\@ll\yes \xdef\@ll{y}\else \xdef\@ll{n}\fi
+     \xdef\list@{#2,&}
+     \xdef\temp@@{lower} \loopcount=0
+     \xdef\temp@{#2,,,:,,,,@} \expandafter\test@PDB\temp@
+     \ifx\list@\ampers@nd
+     \else
+        \loop
+           \xdef\list@{\list@ @}
+           \expandafter\get@lowerregions\list@
+        \ifx\list@\ampers@nd\else\repeat
+     \fi
+   \fi
+}
+\def\lowerblock#1#2{%
+   \xdef\seq@{#1}
+      \xdef\@ll{yes}
+      \lowerregion{#1}{#2}
+      \xdef\@ll{}
+}
 \def\emphregion#1#2{%
    \xdef\seq@{#1}
    \xdef\temp@{consensus} \ifx\seq@\temp@ \xdef\seq@{0} \fi
@@ -11310,11 +11725,15 @@
    \else
      \ifx\@ll\yes \xdef\@ll{y}\else \xdef\@ll{n}\fi
      \xdef\list@{#2,&}
+     \xdef\temp@@{emph} \loopcount=0
      \xdef\temp@{#2,,,:,,,,@} \expandafter\test@PDB\temp@
-     \loop
-        \xdef\list@{\list@ @}
-        \expandafter\get@emphregions\list@
-     \ifx\list@\ampers@nd\else\repeat
+     \ifx\list@\ampers@nd
+     \else
+        \loop
+           \xdef\list@{\list@ @}
+           \expandafter\get@emphregions\list@
+        \ifx\list@\ampers@nd\else\repeat
+     \fi
    \fi
 }
 \def\emphblock#1#2{%
@@ -11335,11 +11754,15 @@
    \else
      \xdef\@ll{#3}
      \xdef\list@{#2,&}
+     \xdef\temp@@{frame} \loopcount=0
      \xdef\temp@{#2,,,:,,,,@} \expandafter\test@PDB\temp@
-     \loop
-        \xdef\list@{\list@ @}
-        \expandafter\get@frameregions\list@
-     \ifx\list@\ampers@nd\else\repeat
+     \ifx\list@\ampers@nd
+     \else
+        \loop
+           \xdef\list@{\list@ @}
+           \expandafter\get@frameregions\list@
+        \ifx\list@\ampers@nd\else\repeat
+     \fi
    \fi
 }
 \def\bargraphstretch#1{\def\b@r@stretch{#1}}
@@ -11722,8 +12145,6 @@
       \do@colorgraph
    \else
    \xdef\f@@color{\f@color}
-   \xdef\list@{#3,&}
-   \xdef\temp@{#3,,,:,,,,@} \expandafter\test@PDB\temp@
    \def\f@text@{#5}
    \xdef\f@color{\f@@color}
    \xdef\temp@{#4&}
@@ -11802,13 +12223,20 @@
       \fi
       \fi
       \fi
+   \xdef\list@{#3,&}
+   \xdef\@ll{\f@text@}
+   \xdef\temp@@{\bottop@}
+   \xdef\temp@{#3,,,:,,,,@} \expandafter\test@PDB\temp@
+   \fi
+   \loopcount=0 
+   \ifx\list@\ampers@nd
+   \else
+      \loop
+         \advance\loopcount by 1\relax
+         \xdef\list@{\list@ @}
+         \expandafter\get@fregions\list@
+      \ifx\list@\ampers@nd\else\repeat
    \fi
-   \loopcount=0
-   \loop
-      \advance\loopcount by 1\relax
-      \xdef\list@{\list@ @}
-      \expandafter\get@fregions\list@
-   \ifx\list@\ampers@nd\else\repeat
    \fi\fi\fi
    \fi
 }
@@ -13764,6 +14192,9 @@
            \xdef\first@{\csname res\the\loopcount\endcsname}
            \ifx\first@\equ@l
              \def\first@{\dom@char} \def\third@{9}
+             \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                   \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+             \xdef\first@{;\first@}\fi
              \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                    \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
              \xdef\first@{=\first@}\fi
@@ -13793,6 +14224,9 @@
                     \fi
                     \fi
                  \fi
+                \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                   \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                \xdef\first@{;\first@}\fi
                 \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                    \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -13814,6 +14248,9 @@
                        \def\first@{{}} \def\third@{8}
                     \fi
                  \fi
+                \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                   \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                \xdef\first@{;\first@}\fi
                 \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                    \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -13827,6 +14264,9 @@
                \xdef\low@up{lower} \ifx\resn@m@tch\low@up \make@lower \else
                \xdef\low@up{upper} \ifx\resn@m@tch\low@up
                \else \xdef\first@{\resn@m@tch} \fi\fi\fi
+               \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                  \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                  \xdef\first@{;\first@}\fi
                \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                   \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                   \xdef\first@{=\first@}\fi
@@ -13843,6 +14283,9 @@
        \xdef\low@up{lower} \ifx\n@m@tch\low@up \xdef\first@{{ }} \else
        \xdef\low@up{upper} \ifx\n@m@tch\low@up \xdef\first@{{ }}
        \else \xdef\first@{\n@m@tch} \fi\fi
+       \expandafter\ifx\csname lower@seq0\endcsname\y@
+          \expandafter\xdef\csname lower@seq0\endcsname{n}
+          \xdef\first@{;\first@}\fi
        \expandafter\ifx\csname tint@seq0\endcsname\y@
           \expandafter\xdef\csname tint@seq0\endcsname{n}
           \xdef\first@{=\first@}\fi
@@ -13873,6 +14316,9 @@
              \ifx\first@\d@t\def\first@{\gap@char}\fi
              \ifx\first@\questi@n\def\first@{\st@p@char}\fi
              \ifx\first@\equ@l\def\first@{\dom@char} \xdef\g@p{y} \fi
+             \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                \xdef\first@{;\first@}\fi
              \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                 \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -13937,6 +14383,9 @@
               \fi
             \fi
           \fi
+          \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                \xdef\first@{;\first@}\fi
           \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                 \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -13951,6 +14400,9 @@
      \xdef\low@up{lower} \ifx\m@tch\low@up \make@lower \else
      \xdef\low@up{upper} \ifx\m@tch\low@up
      \else \xdef\first@{\m@tch} \fi\fi
+     \expandafter\ifx\csname lower@seq0\endcsname\y@
+                \expandafter\xdef\csname lower@seq0\endcsname{n}
+                \xdef\first@{;\first@}\fi
      \expandafter\ifx\csname tint@seq0\endcsname\y@
                 \expandafter\xdef\csname tint@seq0\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -13972,6 +14424,9 @@
        \xdef\first@{\csname res\the\loopcount\endcsname}
        \ifx\first@\equ@l
           \def\first@{\dom@char} \def\third@{!}  \xdef\g@p{y}
+          \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                   \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                   \xdef\first@{;\first@}\fi
           \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                    \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                    \xdef\first@{=\first@}\fi
@@ -14001,6 +14456,9 @@
                     \fi
                \fi
              \fi
+          \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                   \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                   \xdef\first@{;\first@}\fi
           \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                    \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                    \xdef\first@{=\first@}\fi
@@ -14022,6 +14480,9 @@
                   \def\first@{{}} \def\third@{/}
                \fi
              \fi
+          \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                   \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                   \xdef\first@{;\st@p@char}\fi
           \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                    \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                    \xdef\first@{=\st@p@char}\fi
@@ -14034,6 +14495,9 @@
           \xdef\low@up{lower} \ifx\resn@m@tch\low@up \make@lower \else
           \xdef\low@up{upper} \ifx\resn@m@tch\low@up
           \else \xdef\first@{\resn@m@tch} \fi\fi
+          \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                   \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                   \xdef\first@{;\first@}\fi
           \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                    \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                    \xdef\first@{=\first@}\fi
@@ -14056,6 +14520,9 @@
              \ifx\first@\d@t\def\first@{\gap@char}\fi
              \ifx\first@\questi@n\def\first@{\st@p@char}\fi
              \ifx\first@\equ@l\def\first@{\dom@char}  \xdef\g@p{y} \fi
+             \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                \xdef\first@{;\first@}\fi
              \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                 \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -14069,6 +14536,9 @@
          \xdef\first@{\csname res\the\loopcount\endcsname}
          \ifx\first@\equ@l
             \def\first@{\dom@char} \def\third@{9}  \xdef\g@p{y}
+           \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                   \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                   \xdef\first@{;\first@}\fi
            \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                    \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                    \xdef\first@{=\first@}\fi
@@ -14098,6 +14568,9 @@
                     \fi
                \fi
             \fi
+           \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                   \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                   \xdef\first@{;\first@}\fi
            \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                    \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                    \xdef\first@{=\first@}\fi
@@ -14119,6 +14592,9 @@
                        \def\first@{{}} \def\third@{8}
                \fi
             \fi
+           \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                   \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                   \xdef\first@{;\first@}\fi
            \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                    \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                    \xdef\first@{=\first@}\fi
@@ -14132,6 +14608,9 @@
            \xdef\low@up{lower} \ifx\resn@m@tch\low@up \make@lower \else
            \xdef\low@up{upper} \ifx\resn@m@tch\low@up
            \else \xdef\first@{\resn@m@tch} \fi\fi\fi
+           \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                   \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                   \xdef\first@{;\first@}\fi
            \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                    \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                    \xdef\first@{=\first@}\fi
@@ -14148,6 +14627,9 @@
     \xdef\low@up{lower} \ifx\n@m@tch\low@up \xdef\first@{{ }} \else
     \xdef\low@up{upper} \ifx\n@m@tch\low@up \xdef\first@{{ }}
     \else \xdef\first@{\n@m@tch} \fi\fi
+    \expandafter\ifx\csname lower@seq0\endcsname\y@
+                \expandafter\xdef\csname lower@seq0\endcsname{n}
+                \xdef\first@{;\first@}\fi
     \expandafter\ifx\csname tint@seq0\endcsname\y@
                 \expandafter\xdef\csname tint@seq0\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -14173,6 +14655,9 @@
              \ifx\first@\d@t\def\first@{\gap@char}\fi
              \ifx\first@\questi@n\def\first@{\st@p@char}\fi
              \ifx\first@\equ@l\def\first@{\dom@char} \xdef\g@p{y} \fi
+             \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                \xdef\first@{;\first@}\fi
              \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                 \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -14246,6 +14731,9 @@
                \fi
             \fi
     \fi
+    \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                \xdef\first@{;\first@}\fi
     \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                 \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -14260,6 +14748,9 @@
  \xdef\second@{lower} \ifx\m@tch\second@ \make@lower \else
  \xdef\second@{upper} \ifx\m@tch\second@
  \else \xdef\first@{\m@tch} \fi\fi
+ \expandafter\ifx\csname lower@seq0\endcsname\y@
+                \expandafter\xdef\csname lower@seq0\endcsname{n}
+                \xdef\first@{;\first@}\fi
  \expandafter\ifx\csname tint@seq0\endcsname\y@
                 \expandafter\xdef\csname tint@seq0\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -14284,6 +14775,9 @@
              \ifx\first@\d@t\def\first@{\gap@char}\fi
              \ifx\first@\questi@n\def\first@{\st@p@char}\fi
              \ifx\first@\equ@l\def\first@{\dom@char} \xdef\g@p{y} \fi
+             \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                \xdef\first@{;\first@}\fi
              \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                 \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -14362,6 +14856,9 @@
                \fi
             \fi
     \fi
+    \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                \xdef\first@{;\first@}\fi
     \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                 \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -14376,6 +14873,9 @@
  \xdef\second@{lower} \ifx\@llm@tch\second@ \make@lower \else
  \xdef\second@{upper} \ifx\@llm@tch\second@
  \else \xdef\first@{\@llm@tch} \fi\fi
+ \expandafter\ifx\csname lower@seq0\endcsname\y@
+                \expandafter\xdef\csname lower@seq0\endcsname{n}
+                \xdef\first@{;\first@}\fi
  \expandafter\ifx\csname tint@seq0\endcsname\y@
                 \expandafter\xdef\csname tint@seq0\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -14402,6 +14902,9 @@
         \xdef\third@{noshade}
         \expandafter\ifx\csname hide@seq\the\loopcount\endcsname\third@
              \xdef\first@{\csname res\the\loopcount\endcsname}
+             \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                \xdef\first@{;\first@}\fi
              \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                 \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -14463,6 +14966,9 @@
          \fi
          \fi
         \fi
+        \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                \xdef\first@{;\first@}\fi
         \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                 \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -14521,6 +15027,9 @@
                  \make@lower \fi
      \xdef\third@{noshade}
      \expandafter\ifx\csname hide@seq\the\loopcount\endcsname\third@
+             \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                \xdef\first@{;\first@}\fi
              \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                 \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -14531,6 +15040,9 @@
                 \csname seq\the\loopcount\endcsname%
                 0\first@}
      \else
+             \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                \xdef\first@{;\first@}\fi
              \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                 \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -14586,6 +15098,9 @@
      \fi
      \xdef\third@{noshade}
      \expandafter\ifx\csname hide@seq\the\loopcount\endcsname\third@
+             \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                \xdef\first@{;\first@}\fi
              \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                 \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -14596,6 +15111,9 @@
                 \csname seq\the\loopcount\endcsname%
                 *\first@}
      \else
+             \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+                \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
+                \xdef\first@{;\first@}\fi
              \expandafter\ifx\csname tint@seq\the\loopcount\endcsname\y@
                 \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -14608,6 +15126,9 @@
      \fi
    \ifnum\loopcount<\seq@count \repeat
    \xdef\first@{\csname res0\endcsname}
+   \expandafter\ifx\csname lower@seq0\endcsname\y@
+                \expandafter\xdef\csname lower@seq0\endcsname{n}
+                \xdef\first@{;\first@}\fi
    \expandafter\ifx\csname tint@seq0\endcsname\y@
                 \expandafter\xdef\csname tint@seq0\endcsname{n}
                 \xdef\first@{=\first@}\fi
@@ -14735,6 +15256,56 @@
       \fi
 }
 
+\def\getregion@fromlowerstack@first{%
+      \expandafter\getregion@fromlowerstack{\the\loopcount}
+      \expandafter\ifx\csname lowerstart\the\loopcount\endcsname\ampers@nd
+      \else
+      \expandafter\ifnum\csname lowerstop\the\loopcount\endcsname<\first@@
+         \getregion@fromlowerstack@first
+      \else
+         \expandafter\ifx\csname lowerall\the\loopcount\endcsname\y@
+            \innerloopcount=1
+         \fi
+         \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{y}
+      \fi
+      \fi
+}
+
+\def\calc@reglower{%
+      \loopcount=-1 \innerloopcount=0
+      \loop
+         \advance\loopcount by 1
+         \ifnum\loopcount=0 \xdef\first@@{\the\cons@count}
+         \else \xdef\first@@{\csname res@count\the\loopcount\endcsname} \fi
+         \expandafter\ifx\csname lowerstart\the\loopcount\endcsname\ampers@nd
+         \else
+         \expandafter\ifnum\csname lowerstart\the\loopcount\endcsname>\first@@
+         \else
+            \expandafter\ifnum\csname lowerstop\the\loopcount\endcsname<\first@@
+              \getregion@fromlowerstack@first
+            \else
+               \expandafter\ifx\csname lowerall\the\loopcount\endcsname\y@
+                  \innerloopcount=1
+               \fi
+               \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{y}
+               \expandafter\ifnum\csname lowerstop\the\loopcount\endcsname=\first@@
+                  \expandafter\getregion@fromlowerstack{\the\loopcount}
+               \fi
+            \fi
+         \fi\fi
+      \ifnum\loopcount<\seq@count \repeat
+      \loopcount=0
+      \expandafter\ifx\csname lower@seq\the\loopcount\endcsname\y@
+         \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{y}
+      \fi
+      \ifnum\innerloopcount>0
+         \loop
+            \advance\loopcount by 1
+            \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{y}
+         \ifnum\loopcount<\seq@count \repeat
+      \fi
+}
+
 \def\getregion@fromtintstack@first{%
       \expandafter\getregion@fromtintstack{\the\loopcount}
       \expandafter\ifx\csname tintstart\the\loopcount\endcsname\ampers@nd
@@ -15024,7 +15595,60 @@
    \advance\innerloopcount by 1
    \xdef\second@@@{\csname res\the\innerloopcount\endcsname}
    \xdef\third@@@{\csname cons\first@@@\second@@@\endcsname}   
-   \advance\temp@count by \third@@@
+   \advance\temp@count by \third@@@   
+   \ifnum\innerloopcount<\seq@count\sum@up\fi
+}
+
+\def\sum@up@cons{%
+   \innerloopcount=\outerloopcount
+   \xdef\first@@@{\csname res\the\outerloopcount\endcsname}
+   \sum@up
+   \advance\outerloopcount by 1\relax
+   \ifnum\outerloopcount<\seq@count
+      \sum@up@cons
+   \else
+      \innerloopcount=\seq@count
+      \advance\innerloopcount by -1
+      \multiply\innerloopcount by \seq@count
+      \multiply\temp@count by 2
+      \multiply\temp@count by \m@trixf@ctor
+      \divide\temp@count by \innerloopcount
+      
+      \ifnum\temp@count>100 \temp@count=100 \fi
+      \ifnum\temp@count<0   \temp@count=0 \fi
+      \xdef\cons@val{\the\temp@count}
+      \ifx\first@\equ@l \xdef\cons@val{N} \fi
+      
+      \ifx\T@coffee@bcons\y@
+         \xdef\cons@val{\csname TC@num0\endcsname}
+         \if\cons@val * 
+            \xdef\cons@val{99}
+         \fi
+      \fi
+      \ifx\T@coffee@ccons\y@
+         \xdef\cons@val{\csname TC@num0\endcsname}
+         \if\cons@val * 
+            \xdef\cons@val{99}
+         \fi
+      \fi
+   \fi
+}
+
+\def\collect@cons@res{%
+   \xdef\temp@{\temp@\csname res\the\innerloopcount\endcsname}
+   \advance\innerloopcount by 1
+   \ifnum\innerloopcount>\seq@count\relax
+      \outerloopcount=1\relax
+      \temp@count=0\relax
+      \sum@up@cons
+   \else
+      \collect@cons@res
+   \fi
+}
+
+\def\sum@@up{%
+   \advance\innerloopcount by 1
+   \xdef\second@@@{\csname res\the\innerloopcount\endcsname}
    
    \ifx\first@@@\d@t
    \else
@@ -15062,55 +15686,32 @@
     \fi
    \fi
    
-   \ifnum\innerloopcount<\seq@count\sum@up\fi
+   \ifnum\innerloopcount<\seq@count\sum@@up\fi
 }
 
-\def\sum@up@cons{%
+\def\sum@up@sim{%
    \innerloopcount=\outerloopcount
    \xdef\first@@@{\csname res\the\outerloopcount\endcsname}
-   \sum@up
+   \sum@@up
    \advance\outerloopcount by 1\relax
    \ifnum\outerloopcount<\seq@count
-      \sum@up@cons
-   \else
-      \innerloopcount=\seq@count
-      \advance\innerloopcount by -1
-      \multiply\innerloopcount by \seq@count
-      \multiply\temp@count by 2
-      \multiply\temp@count by \m@trixf@ctor
-      \divide\temp@count by \innerloopcount
-      
-      \ifnum\temp@count>100 \temp@count=100 \fi
-      \ifnum\temp@count<0   \temp@count=0 \fi
-      \xdef\cons@val{\the\temp@count}
-      \ifx\first@\equ@l \xdef\cons@val{N} \fi
-      
-      \ifx\T@coffee@bcons\y@
-         \xdef\cons@val{\csname TC@num0\endcsname}
-         \if\cons@val * 
-            \xdef\cons@val{99}
-         \fi
-      \fi
-      \ifx\T@coffee@ccons\y@
-         \xdef\cons@val{\csname TC@num0\endcsname}
-         \if\cons@val * 
-            \xdef\cons@val{99}
-         \fi
-      \fi
+      \sum@up@sim
    \fi
 }
 
-\def\collect@cons@res{%
+\def\collect@similarity{%
    \xdef\temp@{\temp@\csname res\the\innerloopcount\endcsname}
    \advance\innerloopcount by 1
    \ifnum\innerloopcount>\seq@count\relax
       \outerloopcount=1\relax
       \temp@count=0\relax
-      \sum@up@cons
+      \sum@up@sim
    \else
-      \collect@cons@res
+      \collect@similarity
    \fi
 }
+
+
 \def\sum@up@bits{%
    \ifx\first@@@\second@@@
       \ifx\first@@@\d@t
@@ -16337,6 +16938,7 @@
     \ifregionalshadenow \calc@regshade \fi
     \ifregionaltintnow  \calc@regtint  \fi
     \ifregionalemphnow  \calc@regemph  \fi
+    \ifregionallowernow \calc@reglower \fi
     \ifframenow         \calc@frame    \fi
     \iftopfeaturenow       \xdef\bottop@{top}       \calc@feature \fi
     \ifttopfeaturenow      \xdef\bottop@{ttop}      \calc@feature \fi
@@ -16346,6 +16948,7 @@
     \ifbbottomfeaturenow   \xdef\bottop@{bbottom}   \calc@feature \fi
     \ifbbbottomfeaturenow  \xdef\bottop@{bbbottom}  \calc@feature \fi
     \ifbbbbottomfeaturenow \xdef\bottop@{bbbbottom} \calc@feature \fi
+    \ifnum\seq@count>1 \innerloopcount=1 \collect@similarity \fi
     \advance\pos@count by 1 
      \ifshow@logo         \calc@logo     \fi
      \ifall@fshade \all@funcshade
@@ -16494,12 +17097,21 @@
          \else
             \expandafter\ifnum\csname emphstart\the\loopcount\endcsname>%
             \innerloopcount
-            \else
             \else
                   \regionalemphnowtrue
             \fi
          \fi
     \fi
+    \ifregionallower
+         \expandafter\ifx\csname lowerstart\the\loopcount\endcsname\ampers@nd
+         \else
+            \expandafter\ifnum\csname lowerstart\the\loopcount\endcsname>%
+            \innerloopcount
+            \else
+                  \regionallowernowtrue
+            \fi
+         \fi
+    \fi
     \ifframe@
          \expandafter\ifx\csname framestart\the\loopcount\endcsname\ampers@nd
          \else
@@ -16655,7 +17267,7 @@
     \else        
          \innerloopcount=\csname res@count\the\loopcount\endcsname
          \advance\innerloopcount by \res@perline
-    \fi              %%%%%%%%%%%%%*****
+    \fi
     \advance\innerloopcount by 1
     \ifregionalshade
          \expandafter\ifx\csname start\the\loopcount\endcsname\ampers@nd
@@ -16687,6 +17299,16 @@
             \fi
          \fi
     \fi
+    \ifregionallower
+         \expandafter\ifx\csname lowerstart\the\loopcount\endcsname\ampers@nd
+         \else
+            \expandafter\ifnum\csname lowerstart\the\loopcount\endcsname>%
+            \innerloopcount
+            \else
+               \regionallowernowtrue
+            \fi
+         \fi
+    \fi
     \ifframe@
          \expandafter\ifx\csname framestart\the\loopcount\endcsname\ampers@nd
          \else
@@ -17101,6 +17723,14 @@
          \xdef\temp@@{\light@}%
          \expandafter\get@second@\first@%
    \fi%
+   \ifx\second@\semic@n%
+         \expandafter\get@second@\first@%
+         \xdef\first@@{\first@}%
+         \xdef\first@{\second@}%
+         \make@lower%
+         \xdef\second@{\first@}%
+         \xdef\first@{\first@@}%
+   \fi%
    \textcolor{\temp@@\boxc@l@r}{\box@rule}%
    \ifhidechar%
       \ifx\second@\o@%
@@ -17205,6 +17835,14 @@
    \else%
          \def\temp@{\csname relax\endcsname}%
    \fi%
+   \ifx\second@\semic@n%
+         \expandafter\get@second@\first@%
+         \xdef\first@@{\first@}%
+         \xdef\first@{\second@}%
+         \make@lower%
+         \xdef\second@{\first@}%
+         \xdef\first@{\first@@}%
+   \fi%
    \textcolor{\boxc@l@r}{\box@rule}%
    \ifhidechar%
       \ifx\second@\o@%
@@ -19265,7 +19903,7 @@
           \expandafter\xdef\csname sequence\the\loopcount\endcsname{}
           \expandafter\xdef\csname dom@num\the\loopcount\endcsname{}
           \expandafter\xdef\csname dom@num@break\the\loopcount\endcsname{}
-          \expandafter\xdef\csname dom@count\the\loopcount\endcsname{0}
+          \expandafter\xdef\csname dom@count\the\loopcount\endcsname{\csname res@count\the\loopcount\endcsname}
        \ifnum\loopcount<\seq@count\repeat
        \xdef\domain@num@list{}
        \xdef\last@{\stack@dom}
@@ -19314,6 +19952,7 @@
      \fi       
      \ifshow@sublogo \prep@sublogo \fi
      \ifshow@logo  \prep@logo  \fi
+     \ifx\label@motif\y@  \prep@motif \fi
      \ifnum\seq@pointer>\res@perline \block@output \fi 
     \else \read@loop
     \fi}
@@ -19365,7 +20004,7 @@
           \expandafter\xdef\csname sequence\the\loopcount\endcsname{}
           \expandafter\xdef\csname dom@num\the\loopcount\endcsname{}
           \expandafter\xdef\csname dom@num@break\the\loopcount\endcsname{}
-          \expandafter\xdef\csname dom@count\the\loopcount\endcsname{0}
+          \expandafter\xdef\csname dom@count\the\loopcount\endcsname{\csname res@count\the\loopcount\endcsname}
        \ifnum\loopcount<\seq@count\repeat
        \xdef\domain@num@list{}
        \xdef\last@{\stack@dom}
@@ -19414,6 +20053,7 @@
      \fi
      \ifshow@sublogo \prep@sublogo \fi
      \ifshow@logo  \prep@logo  \fi
+     \ifx\label@motif\y@  \prep@motif \fi
      \ifnum\seq@pointer>\res@perline \block@output \fi
     \else 
        \read@fasta 
@@ -19548,8 +20188,8 @@
     \expandafter\xdef\csname stack@dom\endcsname{&;&;&;&;@}
     \expandafter\xdef\csname stack@reg\the\loopcount\endcsname{&;&;&;&;@}
     \expandafter\xdef\csname stack@tintreg\the\loopcount\endcsname{&;&;&;@}
-    \expandafter\xdef\csname stack@hidereg\the\loopcount\endcsname{&;&;&;&;@}
     \expandafter\xdef\csname stack@emphreg\the\loopcount\endcsname{&;&;&;@}
+    \expandafter\xdef\csname stack@lowerreg\the\loopcount\endcsname{&;&;&;@}
     \expandafter\xdef\csname stack@framereg\the\loopcount\endcsname{&;&;&;@}
     \expandafter\xdef\csname stack@top\the\loopcount\endcsname{&;&;&;&;@}
     \expandafter\xdef\csname stack@ttop\the\loopcount\endcsname{&;&;&;&;@}
@@ -19569,6 +20209,7 @@
        \cleanup@name
        \expandafter\xdef\csname tint@seq\the\loopcount\endcsname{n}
        \expandafter\xdef\csname emph@seq\the\loopcount\endcsname{n}
+       \expandafter\xdef\csname lower@seq\the\loopcount\endcsname{n}
        \expandafter\xdef\csname hide@seq\the\loopcount\endcsname{false}
        \expandafter\xdef\csname hide@@@seq\the\loopcount\endcsname{false}
        \expandafter\xdef\csname hide@name\the\loopcount\endcsname{no}
@@ -19577,8 +20218,8 @@
        \expandafter\xdef\csname number@col\the\loopcount\endcsname{yes}
        \expandafter\xdef\csname stack@reg\the\loopcount\endcsname{&;&;&;&;@}
        \expandafter\xdef\csname stack@tintreg\the\loopcount\endcsname{&;&;&;@}
-       \expandafter\xdef\csname stack@hidereg\the\loopcount\endcsname{&;&;&;&;@}
        \expandafter\xdef\csname stack@emphreg\the\loopcount\endcsname{&;&;&;@}
+       \expandafter\xdef\csname stack@lowerreg\the\loopcount\endcsname{&;&;&;@}
        \expandafter\xdef\csname stack@framereg\the\loopcount\endcsname{&;&;&;@}
        \expandafter\xdef\csname stack@top\the\loopcount\endcsname{&;&;&;&;@}
        \expandafter\xdef\csname stack@ttop\the\loopcount\endcsname{&;&;&;&;@}
@@ -19625,9 +20266,9 @@
    \ifshow@cons\setbox1=\hbox{\cons@name}\name@width=\wd1\else\name@width=0pt\fi
    \loopcount=0
    \expandafter\getregion@fromstack{\the\loopcount}
-   \expandafter\getregion@fromhidestack{\the\loopcount}
    \expandafter\getregion@fromtintstack{\the\loopcount}
    \expandafter\getregion@fromemphstack{\the\loopcount}
+   \expandafter\getregion@fromlowerstack{\the\loopcount}
    \expandafter\getregion@fromframestack{\the\loopcount}
    \xdef\bottop@{top}       \expandafter\getregion@fromfstack{\the\loopcount}
    \xdef\bottop@{ttop}      \expandafter\getregion@fromfstack{\the\loopcount}
@@ -19676,9 +20317,9 @@
           \baselineskip=\box@height \advance\baselineskip by \box@depth
        \fi
        \expandafter\getregion@fromstack{\the\loopcount}
-       \expandafter\getregion@fromhidestack{\the\loopcount}
        \expandafter\getregion@fromtintstack{\the\loopcount}
        \expandafter\getregion@fromemphstack{\the\loopcount}
+       \expandafter\getregion@fromlowerstack{\the\loopcount}
        \expandafter\getregion@fromframestack{\the\loopcount}
        \xdef\bottop@{top}       \expandafter\getregion@fromfstack{\the\loopcount}
        \xdef\bottop@{ttop}      \expandafter\getregion@fromfstack{\the\loopcount}
@@ -19910,7 +20551,7 @@
 \cons@count=0
 \expandafter\xdef\csname res@count0\endcsname{0}
 \xdef\allow@zero{n} \xdef\c@ns@shift{0}
-\regionalshadefalse\regionalemphfalse\regionaltintfalse
+\regionalshadefalse\regionalemphfalse\regionallowerfalse\regionaltintfalse
 \frame@false
 \xdef\ruler@rot{0}
 \topfeaturefalse    \bottomfeaturefalse
@@ -20019,7 +20660,8 @@
 \xdef\all@thresh@ld{100}  \all@shadefalse
 \hidefeaturenames         \hidefeaturestylenames
 \xdef\T@coffee@ccons{n}   \xdef\T@coffee@bcons{n}
-\xdef\dom@in{no}
+\xdef\dom@in{no}          \xdef\label@motif{no}
+\xdef\motif@num{0}
 \hfuzz9999pt
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -20282,7 +20924,7 @@
 \medsepline                         %  Medium height if separation line is on
 \medblockskip                       %  Medium skip between sequence blocks
 \flexblockspace                     %  Use optimized space between blocks
-\featurerule{0.5ex}                 %  Set feature rule thickness to 1/5 ex
+\featurerule{0.5ex}                 %  Set feature rule thickness to 1/2 ex
 \bargraphstretch{1}                 %  Do not stretch bars in feature graphs
 \colorscalestretch{1}               %  Do not stretch color scales in features
 \backtranstext{horizontal}          %  Horizontal triplets in feature texts
@@ -20311,6 +20953,10 @@
 \setseries{features}{md}            %  Use normal series for feature texts
 \setshape {features}{it}            %  Use italics shape for feature texts
 \setsize  {features}{normalsize}    %  Use normal size for feature texts
+\setfamily{featurestyles}{tt}       %  Use typewriter family for feature styles
+\setseries{featurestyles}{md}       %  Use normal series for feature styles
+\setshape {featurestyles}{up}       %  Use upright shape for feature styles
+\setsize {featurestyles}{normalsize}%  Use normal size for feature styles
 \setfamily{legend}{tt}              %  Use typewriter family for legend texts
 \setseries{legend}{md}              %  Use normal series for legend texts
 \setshape {legend}{up}              %  Use upright shape for legend texts
@@ -20333,10 +20979,10 @@
 \appearance{PHDtopo}{TM}{top}       %   |
      {box[LightGray]:TM\numcount}{} %   |
 \appearance{HMMTOP}{internal}       %   |
-           {bottom}{---}            %   |
+           {bottom}{'-'}            %   |
            {int.\ \Alphacount}      %   |
 \appearance{HMMTOP}{external}       %   |
-           {top}{---}               %   |
+           {top}{,-,}               %   |
            {ext.\ \Alphacount}      %   |
 \appearance{HMMTOP}{TM}{top}        %   |
            {helix}{TM\numcount}     %   |
@@ -20370,7 +21016,6 @@
            {top}{,-,}{turn}         %   |
 \appearance{DSSP}{bend}{top}        %  /
            {fill:$\diamond$}{}      % /
-           
 
 \pepgroups{FYW,ILVM,RK,DE,GA,ST,NQ} %  Amino acid grouping due to similarity
 
@@ -20397,7 +21042,6 @@
 \pepsims{N}{QD}                     %  Q and D (but not E) are similar to N
 \pepsims{Q}{NE}                     %  N and E (but not D) are similar to Q
 
-
 \DNAgroups{GAR,CTY}                 %  Nucleotide grouping due to similarity
 
 \DNAsims{A}{GR}                     %  G and R are similar to A
-- 
cgit v1.2.3

