home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,925 of 2,978   
   Dr John Stockton to All   
   Re: Decoding RNA codons: fastest method    
   13 Oct 05 17:12:43   
   
   From: jrs@merlyn.demon.co.uk   
      
   JRS:  In article <4luqk1h2b8reltasns332spdavt4qheg7l@4ax.com>, dated   
   Wed, 12 Oct 2005 23:06:43, seen in news:comp.lang.pascal.borland, Bart   
    posted :   
      
   >function CodonHash3(const ACodon: tCodon): Word;   
   >// bit 6 and bit 7 are enough to identify the letter !!   
   >// 'A' = 01000001 -> 00   
   >// 'C' = 01000011 -> 01   
   >// 'G' = 01000111 -> 11   
   >// 'U' = 01010101 -> 10   
   >begin   
   >  Result := (((Ord(ACodon[1]) and 7) shr 1) shl 4) +   
   >            (((Ord(ACodon[2]) and 7) shr 1) shl 2) +   
   >            ((Ord(ACodon[3]) and 7) shr 1);   
   >end;   
      
           (* Since bit 8 (1..8) is always the same,   
              it does not really need to be removed. *)   
      
           N := 0 ;   
           for J := 1 to 3 do N := 4*N + (Ord(ACodon[J]) and 6)   
      
   UNTESTED!  Naturally, you write the loop unrolled.   
      
   --   
    © John Stockton, Surrey, UK.  ?@merlyn.demon.co.uk   Turnpike v4.00   MIME. ©   
      TP/BP/Delphi/&c., FAQqy topics & links;   
        RAH Prins : c.l.p.b mFAQ;   
      Timo Salmi's Turbo Pascal FAQ.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca