%%%%
%
% This is a translater of J.Craig Venter's DNA encoding. From DNA to 
% ASCII letters. You also see as an example the four watermarks of their
% M.m. JCVI-sny1.0.
% written by SPTH (http://spth.virii.lu/) in october 2013
%
% with help of these two texts:
% http://genomevolution.org/wiki/index.php/Mycoplasma_mycoides_JCVI-syn1.0_Decoded
% http://www.righto.com/2010/06/using-arc-to-decode-venters-secret-dna.html
%
%%%%

watermark1=['TTAACTAGCTAAGTTCGAATATTTCTATAGCTGTACATATTGTAATGCTGATAACTAATACTGTGCGCTTGACTGTGATCCTGATAAATAACTTCTTCTGTAGGGTAGAGTTTTATTTAAGGCTACTCACTGGTTGCAAACCAATGCCGTACATTACTAGCTTGATCCTTGGTCGGTCATTGGGGGATATCTCTTACTAATAGAGCGGCCTATCGCGTATTCTCGCCGGACCCCCCTCTCCCACACCAGCGGTGTAGCATCACCAAGAAAATGAGGGGAACGGATGAGGAACGAGTGGGGGCTCATTGCTGATCATAATGACTGTTTATATACTAATGCCGTCAACTGTTTGCTGTGATACTGTGCTTTCGAGGGCGGGAGATTCGTTTTTGACATACATAAATATCATGACAAAACAGCCGGTCATGACAAAACAGCCGGTCATAATAGATTAGCCGGTGACTGTGAAACTAAAGCTACTAATGCCGTCAATAAATATGATAATAGCAACGGCACTGACTGTGAAACTAAAGCCGGCACTCATAATAGATTAGCCGGAGTCGTATTCATAGCCGGTAGATATCACTATAAGGCCCAGGATCATGATGAACACAGCACCACGTCGTCGTCCGAGTTTTTTTGCTGCGACGTCTATACCACGGAAGCTGATCATAAATAGTTTTTTTGCTGCGGCACTAGAGCCGGACAAGCACACTACGTTTGTAAATACATCGTTCCGAATTGTAAATAATTTAATTTCGTATTTAAATTATATGATCACTGGCTATAGTCTAGTGATAACTACAATAGCTAGCAATAAGTCATATATAACAATAGCTGAACCTGTGCTACATATCCGCTATACGGTAGATATCACTATAAGGCCCAGGACAATAGCTGAACTGACGTCAGCAACTACGTTTAGCTTGACTGTGGTCGGTTTTTTTGCTGCGACGTCTATACGGAAGCTCATAACTATAAGAGCGGCACTAGAGCCGGCACACAAGCCGGCACAGTCGTATTCATAGCCGGCACTCATGACAAAACAGCGGCGCGCCTTAACTAGCTAA'];
watermark2=['TTAACTAGCTAACAACTGGCAGCATAAAACATATAGAACTACCTGCTATAAGTGATACAACTGTTTTCATAGTAAAACATACAACGTTGCTGATAGTACTCCTAAGTGATAGCTTAGTGCGTTTAGCATATATTGTAGGCTTCATAATAAGTGATATTTTAGCTACGTAACTAAATAAACTAGCTATGACTGTACTCCTAAGTGATATTTTCATCCTTTGCAATACAATAACTACTACATCAATAGTGCGTGATATGCCTGTGCTAGATATAGAACACATAACTACGTTTGCTGTTTTCAGTGATATGCTAGTTTCATCTATAGATATAGGCTGCTTAGATTCCCTACTAGCTATTTCTGTAGGTGATATACGTCCATTGCATAAGTTAATGCATTTAACTAGCTGTGATACTATAGCATCCCCATTCCTAGTGCATATTTTCATCCTAGTGCTACGTGATATAATTGTACTAATGCCTGTAGATAATTTAATGCCTGGCTCGTTTGTAGGTGATAATTTAGTGCCTGTAAAACATATACCTGAGTGCTCGTTGCGTGATAGTTCGTTCATGCATATACAACTAGGCTGCTGTGATATGGTCACTGCCCTTACTGTGCTACATATTACTGCGAGGGGGATGACGTATAAACCTGTTGTAAGTGATATGACGTATATAACTACTAGTGATATGACGTATAGGCTAGAACAACGTGATATGACGTATATGACTACTGTCCCAAACATCAGTGATATGACGTATACTATAATTTCTATAATAGTGATAAATAAACCTGGGCTAAATACGTTCCTGAATACGTGGCATAAACCTGGGCTAACGAGGAATACCCATAGTTTAGCAATAAGCTATAGTTCGTCATTTTTAAGGCGCGCCTTAACTAGCTAA'];
watermark3=['TTAACTAGCTAATTTAACCATATTTAAATATCATCCTGATTTTCACTGGCTCGTTGCGTGATATAGATTCTACTGTAGTGCTAGATAGTTCTGTACTAGGTGATACTATAGATTTCATAGATAGCACTACTGGCTTCATGCTAGGCATCCCAATAGCTAGTGATAGTTTAGTGCATACAACGTCATGTGATACAACGTTGCTGGCTGTAGATACAACGTCGTATTCTGTAAGTGATACAATAGCTATTGCTGTGCATAGGCCTATAGTGGCTGTAACTAGTGATATCACGTAACAACCATATAAGTTAGATTTAATGCCCCTGACTGAACGCTCGTTGCGTGATAGTTTAGGCTCGTTGCATACAACTGTGATTTTCATAAAACAACGTGATAATTTAGTGCTAGATAAGTTCCGCTTAGCAAGTGATAGTTTCCGCTTGACTGTGCATAGTTCGTTCATGCGCTCGTTGCGTGATAAACTAGGCAGCTTCACAACTGATAATTTAATTGCTGATATTGCTGGCTGTCTAGTGCTAGTGATCATAGTGCGTGATAGTTTAAGCTGCTCTGTTTTAGATATCACGTGCTTGATAATGAAACTAACTAGTGATACTACGTAGTTAACTATGAATAGGCCTACTGTAAATTCAATAGTGCGTGATATTGAACTAGATTCTGCAACTGCTAATATGCCGTGCTGCACGTTTGGTGATAGTTTAGCATGCTTCACTATAATAAATATGGTAGTTGTAACTACTGCGAATAGGGGGAGCTTAATAAATATGATCACTGTGCTACGCTATATGCCGTTGAATATAGGCTATATGATCATAACATATATAGCTATAAGTGATAAGTTCCTGAATATAGGCTATATGATCATAACATATACAACTGTACTCATGAATAAGTTAACGAGGATTAACTAGCTAA'];
watermark4=['TTAACTAGCTAATTTCATTGCTGATCACTGTAGATATAGTGCATTCTATAAGTCGCTCCCACAGGCTAGTGCTGCGCACGTTTTTCAGTGATATTATCCTAGTGCTACATAACATCATAGTGCGTGATAAACCTGATACAATAGGTGATATCATAGCAACTGAACTGACGTTGCATAGCTCAACTGTGATCAGTGATATAGATTCTGATACTATAGCAACGTTGCGTGATATTTTCACTACTGGCTTGACTGTAGTGCATATGATAGTACGTCTAACTAGCATAACTAGTGATAGTTATATTTCTATAGCTGTACATATTGTAATGCTGATAACTAGTGATATAATCCAACTAGATAGTCCTGAACTGATCCCTATGCTAACTAGTGATAAACTAACTGATACATCGTTCCTGCTACGTGATAGCTTCACTGAGTTCCATACATCGTCGTGCTTAAACATCAGTGATAACACTATAGAGTTCATAGATACTGCATTAACTAGTGATATGACTGCAAATAGCTTGACGTTTTGCAGTCTAAAACAACGTGATAATTCTGTAGTGCTAGATACTATAGATTTCCTGCTAAGTGATAAGTCTACTGATTTACTAATGAATAGCTTGGTTTTGGCATACACTGTGCGCTGCACTGGTGATAGCTTTTCGTTGATGAATAATTTCCCTAGCACTGTGCGTGATATGCTAGATTCTGTAGATAGGCTAAATTCGTCTACGTTTGTAGGTGATAGTTTAGTTGCTGTAACTAATATTATCCCTGTGCCGTTGCTAAGCTGTGATATCATAGTGCTGCTAGATATGATAAGCAAACTAATAGAGTCGAGGGGGAGTCTCATAGTGAATACTGATATTTTAGTGCTGCCGTTGAATAAGTTCCCTGAACATTGTGATACTGATATTTTAGTGCTGCCGTTGAATATCCTGCATTTAACTAGCTTGATAGTGCATTCGAGGAATACCCATACTACTGTTTTCATAGCTAATTATAGGCTAACATTGCCAATAGTGCGGCGCGCCTTAACTAGCTAA'];

DNAcode=watermark4;
NewSplit={};
for i=1:length(DNAcode)/3
    NewSplit{i}=DNAcode(3*(i-1)+1:3*(i-1)+3);
end


ddres=[];
for i=1:length(NewSplit)
    switch NewSplit{i}
        case 'TAG'
            ddres=[ddres 'a'];
        case 'AGT'
            ddres=[ddres 'b'];
        case 'TTT'
            ddres=[ddres 'c'];
        case 'ATT'
            ddres=[ddres 'd'];
        case 'TAA'
            ddres=[ddres 'e'];

        case 'GGC'
            ddres=[ddres 'f']; 
        case 'TAC'
            ddres=[ddres 'g']; 
        case 'TCA'
            ddres=[ddres 'h']; 
        case 'CTG'
            ddres=[ddres 'i']; 
        case 'GTT'
            ddres=[ddres 'j'];    
            
        case 'GCA'
            ddres=[ddres 'k'];  
        case 'AAC'
            ddres=[ddres 'l'];  
        case 'CAA'
            ddres=[ddres 'm'];  
        case 'TGC'
            ddres=[ddres 'n'];  
        case 'CGT'
            ddres=[ddres 'o'];       
            
        case 'ACA'
            ddres=[ddres 'p'];   
        case 'TTA'
            ddres=[ddres 'q']; 
        case 'CTA'
            ddres=[ddres 'r']; 
        case 'GCT'
            ddres=[ddres 's']; 
        case 'TGA'
            ddres=[ddres 't'];     
            
        case 'TCC'
            ddres=[ddres 'u'];       
        case 'TTG'
            ddres=[ddres 'v'];    
        case 'GTC'
            ddres=[ddres 'w'];    
        case 'GGT'
            ddres=[ddres 'x'];    
        case 'CAT'
            ddres=[ddres 'y'];    
        case 'TGG'
            ddres=[ddres 'z'];  
            
        case 'TCT'
            ddres=[ddres '0'];         
        case 'CTT'
            ddres=[ddres '1']; 
        case 'ACT'
            ddres=[ddres '2']; 
        case 'AAT'
            ddres=[ddres '3']; 
        case 'AGA'
            ddres=[ddres '4']; 
        case 'GCG'
            ddres=[ddres '5']; 
        case 'GCC'
            ddres=[ddres '6']; 
        case 'TAT'
            ddres=[ddres '7']; 
        case 'CGC'
            ddres=[ddres '8']; 
        case 'GTA'
            ddres=[ddres '9']; 
        case 'ATA'
            ddres=[ddres ' ']; 
        case 'GGG'
            ddres=[ddres char(13)];   
            
        case 'AGC'
            ddres=[ddres '>'];   
        case 'CGG'
            ddres=[ddres '<'];               
        case 'CAC'
            ddres=[ddres '/'];   
        case 'CCA'
            ddres=[ddres '='];   
        case 'CGA'
            ddres=[ddres '.'];        
        case 'GAG'
            ddres=[ddres '!'];                 
        case 'CAG'
            ddres=[ddres ':'];    
        case 'GGA'            
            ddres=[ddres '"'];               
        case 'GTG'
            ddres=[ddres ','];    
        case 'TCG'
            ddres=[ddres '@'];      
        case 'CCC'
            ddres=[ddres '-'];             
        otherwise
            ddres=[ddres '(?' NewSplit{i} '?)'];
    end
end

disp(ddres);
    