[BioC] dumb question: using Biostrings (or something else) to translate DNA bases to amino acid codes

Robert Gentleman rgentlem at fhcrc.org
Sat Jan 26 06:27:01 CET 2008


for reasonably short sequences (like most genes)

library(Biostrings)
  DNA2AA = function(DNAseq) {
     if(length(DNAseq) > 1 ) stop("only length one sequences, please")
     nc = nchar(DNAseq)
     Dtriples = substring(DNAseq, seq(1, nc, by=3), seq(3, nc, 3))
     paste(GENETIC_CODE[Dtriples], collapse="")
  }

  will do it. The restriction to length one sequences is due to the 
semantics of substring

  best wishes
    Robert



lamon at fhcrc.org wrote:
> Try the seqinr package.
> Lynn
> 
> 
> Quoting Paul Shannon <pshannon at systemsbiology.org>:
> 
>> I was so sure I could find this capability in Biostrings.  It may be  
>> there, or
>> elsewhere, but lots of looking has not revealed it to me.  Is there a  
>> package
>> which implements the genetic code?
>>
>> Sheepishly,
>>
>>   - Paul
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives:
>> http://news.gmane.org/gmane.science.biology.informatics.conductor
>>
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
> 

-- 
Robert Gentleman, PhD
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
PO Box 19024
Seattle, Washington 98109-1024
206-667-7700
rgentlem at fhcrc.org



More information about the Bioconductor mailing list