Complement a DNA sequence

后端 未结 7 1714
情书的邮戳
情书的邮戳 2020-12-31 12:07

Suppose I have a DNA sequence. I want to get the complement of it. I used the following code but I am not getting it. What am I doing wrong ?

s=readline()
AT         


        
相关标签:
7条回答
  • 2020-12-31 12:43

    I've generalised the solution rev(comp(seq)) with the seqinr package:

    install.packages("devtools")
    devtools::install_github("TomKellyGenetics/tktools")
    tktools::revcomp(seq)
    

    This version is compatible with string inputs and is vectorised to handle list or vector input of multiple strings. The output class should match the input, including cases and types. This also support inputs containing "U" for RNA and RNA output sequences.

    > seq <- "ATCTCGGCGCGCATCGCGTACGCTACTAGC"
    > revcomp(seq)
    [1] "GCTAGTAGCGTACGCGATGCGCGCCGAGAT"
    
    > seq <- c("TATAAT", "TTTCGC", "atgcat")
    > revcomp(seq)
      TATAAT   TTTCGC   atgcat 
     "ATTATA" "GCGAAA" "atgcat" 
    

    See the manual or the TomKellyGenetics/tktools github package repository.

    0 讨论(0)
提交回复
热议问题