Sara Kamali
2011-Aug-16 20:15 UTC
[R] count dinucleotides in DNA using "count " function in "seqinr" package
Dear all I want to count the number of dinucleotides of multiple DNA sequences from a csv file seprately using "count" function in "seqinr" package . it works for one sequence , but when I put this function in a for loop it gives zero for all nucleotides . i would be thankful if someone can help me. here is my code: #there are 4 DNA sequences in my CSV file. seq<-read.csv("F:/input.csv",head=TRUE,sep=",") row<-nrow(seq) col<-ncol(seq) for(i in 1:row) { #p<-s2c(seq[i]) x=count(seq[1]$head[i], 2 , alphabet = s2c("acgt")) print(x) } and here is the output : aa ac ag at ca cc cg ct ga gc gg gt ta tc tg tt 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 aa ac ag at ca cc cg ct ga gc gg gt ta tc tg tt 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 aa ac ag at ca cc cg ct ga gc gg gt ta tc tg tt 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 aa ac ag at ca cc cg ct ga gc gg gt ta tc tg tt 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 awaiting for your help Regards [[alternative HTML version deleted]]