POV-Ray : Newsgroups : povray.binaries.images : DNA Encryption : Re: DNA Encryption Server Time
16 Aug 2024 18:23:52 EDT (-0400)
  Re: DNA Encryption  
From: Grey Knight
Date: 8 Feb 2002 09:01:21
Message: <3C63DA28.866C07E8@namtar.qub.ac.uk>
text2dna code, coming through...

#macro text2dna(Input)
  #local Length=strlen(Input);
  #local Output=""
  #if(Length)
    #debug concat("text2dna: \"",Input,"\"(",istr(strlen(Input)),"
chars)\n\n")
    #local c=1;#while(c<=Length)
      #debug concat("  ",substr(Input,1,c-1))
      //#debug concat("\"",substr(Input,c,1),"\"")
      #debug "*"
      #debug concat(substr(Input,c+1,Length-c),"\r")
      #local temp=asc(strupr(substr(Input,c,1)));
      #if((temp=65)|(temp=69)|(temp=73)|(temp=79)|(temp=85))  //  spot
vowels and process them with a lookup table(for speed)
        #switch(asc(substr(Input,c,1)))
          #case(65)#declare Output=concat(Output,"GAAG")#break
          #case(69)#declare Output=concat(Output,"GAGG")#break
          #case(73)#declare Output=concat(Output,"GACG")#break
          #case(79)#declare Output=concat(Output,"GATT")#break
          #case(85)#declare Output=concat(Output,"GGGG")#break
          
          #case(97)#declare Output=concat(Output,"GCAG")#break
          #case(101)#declare Output=concat(Output,"GCGG")#break
          #case(105)#declare Output=concat(Output,"GCCG")#break
          #case(111)#declare Output=concat(Output,"GCTT")#break
          #case(117)#declare Output=concat(Output,"GTGG")#break
        #end
      #else
        byte2quad(asc(substr(Input,c,1)))
        #declare QuadArray=byte2quad_out
        #local c2=0;#while(c2<4)
          #switch(QuadArray[c2])
            #case(0)#declare Output=concat(Output,"A")#break
            #case(1)#declare Output=concat(Output,"C")#break
            #case(2)#declare Output=concat(Output,"G")#break
            #case(3)#declare Output=concat(Output,"T")#break
            #else#declare Output=concat(Output,"#")
          #end
        #declare c2=c2+1;#end
        //#declare Output=concat(Output,":")
      #end
    #declare c=c+1;#end
  #end
  #debug concat("\ntext2dna finished: ",istr(strlen(Input))," chars
processed, ",istr(strlen(Output))," base pairs created.\n\n")
  Output
#end

-- 
signature{
  "Grey Knight" contact{ email "gre### [at] yahoocom" }
  site_of_week{ url "http://digilander.iol.it/jrgpov" }
}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.