Monday, September 29, 2014

reverse complementary sequences in R seqinr

##
## Show that comp() does *not* return the reverve complementary strand:
##
c2s(comp(s2c("aaaattttggggcccc")))
##
## Show how to get the reverse complementary strand:
##
c2s(rev(comp(s2c("aaaattttggggcccc"))))
##
## Show what happens with non allowed values:
##
c2s(rev(comp(s2c("aaaaXttttYggggZcccc"))))
##
## Show what happens with ambiguous bases:
##
allbases <- s2c("abcdghkmstvwn")
comp(allbases) # NA are produced

comp(allbases, ambiguous = TRUE) # No more NA


my code: _get_double_strand.R

setwd("~/github/ctls/sequences")
install.packages("seqinr")
library(seqinr);
list.files()

seqs = read.fasta("panda16srDNA.fasta")
str(seqs);

seqs[[1]]
length(seqs[[1]])
c2s( rev( comp(seqs[[1]]) ) )

c2s(seqs[[1]][1:120])
c2s(comp(seqs[[1]][1:120]))




No comments:

Post a Comment