ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Prettyprinting DNA sequences
@ 2001-05-24 17:23 Johannes Huesing
  2001-05-25  0:24 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Huesing @ 2001-05-24 17:23 UTC (permalink / raw)


Hi all, 

as it has become hip to fill publications with long strings of capital
letters from the set {A, C, G, T}, I would like to know how difficult
it is to have them prettyprinted, i.e. make A, C, G, T active
characters that are printed out in red (A), blue (G), yellow (C) and
green (T), respectively, and that are broken like regular words i.e. a
line can be broken after each letter.

Do you think this would be feasible?

Greetings

Johannes
-- 
Johannes Hüsing | Domain: Adresse im Internet. Besteht aus einem 
hannes@ruhrau.de| technischen Teil (http://www.), einem Namen 
                | (erwin_meier) und einer Endung  (zum Beispiel 
                | .de für Deutschland) [J. Albrecht, "Zeit" 12/2001]


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Prettyprinting DNA sequences
  2001-05-24 17:23 Prettyprinting DNA sequences Johannes Huesing
@ 2001-05-25  0:24 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2001-05-25  0:24 UTC (permalink / raw)
  Cc: ntg-context

At 07:23 PM 5/24/01 +0200, Johannes Huesing wrote:
>Hi all, 
>
>as it has become hip to fill publications with long strings of capital
>letters from the set {A, C, G, T}, I would like to know how difficult
>it is to have them prettyprinted, i.e. make A, C, G, T active
>characters that are printed out in red (A), blue (G), yellow (C) and
>green (T), respectively, and that are broken like regular words i.e. a
>line can be broken after each letter.
>
>Do you think this would be feasible?

well, fortunately this is quite simple to do, 

\def\dnasymbol#1#2%
  {\unskip 
   {\localcolortrue\tttf#1#2}% local colors are much faster with many
colors per page  
   \hskip0pt plus 1pt minus 1pt % that way we can break and get no
over/underfull lines
   \ignorespaces}

\def\dnasequence #1#2#3#4 % space or line delimited 
  {\dnasymbol\red   #1%
   \dnasymbol\green #2%
   \dnasymbol\blue  #3%
   \dnasymbol\yellow#4}

\def\startdnasequence% watch out,\stopDNAsequence would fail now 
  {\bgroup
   \defineactivecharacter A {\dnasymbol\red    A}%
   \defineactivecharacter C {\dnasymbol\green  C}%
   \defineactivecharacter G {\dnasymbol\blue   G}%
   \defineactivecharacter T {\dnasymbol\yellow T}}

\def\stopdnasequence% so we use lowercase names 
  {\egroup}

\setupcolors[state=start]

\starttext

\dnasequence ACGT
\dnasequence ACGT
\dnasequence ACGT
\dnasequence ACGT
\dnasequence ACGT
\dnasequence ACGT
\dnasequence ACGT

\startdnasequence
ACGT ACGT ACGT ACGT ACGT ACGT ACGT
\stopdnasequence

\stoptext

As you can see, my genome is quite simple, but don't patent it, 

I'm sure that others can come up with alternatives; it also depends on the
way you provide the input. 

Hans

PS. Of course you can make a random generator [possible in context]. 
-------------------------------------------------------------------------
                                  Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-05-25  0:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-24 17:23 Prettyprinting DNA sequences Johannes Huesing
2001-05-25  0:24 ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).