ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Cc: ntg-context@ntg.nl
Subject: Re: Prettyprinting DNA sequences
Date: Fri, 25 May 2001 02:24:11 +0200	[thread overview]
Message-ID: <3.0.6.32.20010525022411.009bf9d0@server-1> (raw)
In-Reply-To: <20010524192354.A1610@ruhrau.de>

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
-------------------------------------------------------------------------


      reply	other threads:[~2001-05-25  0:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-24 17:23 Johannes Huesing
2001-05-25  0:24 ` Hans Hagen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3.0.6.32.20010525022411.009bf9d0@server-1 \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).