Complement a DNA sequence

后端 未结 7 1760
情书的邮戳
情书的邮戳 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:23

    The Bioconductor package Biostrings has many useful functions for this sort of operation. Install once:

    source("http://bioconductor.org/biocLite.R")
    biocLite("Biostrings")
    

    then use

    library(Biostrings)
    dna = DNAStringSet(c("ATCTCGGCGCGCATCGCGTACGCTACTAGC", "ACCGCTA"))
    complement(dna)
    

提交回复
热议问题