length of a DNAString
I am doing something extremely basic and stupid. I can call a fasta seq using this
x <- readDNAStringSet(file.choose())
file gets opened, and then I type this
But when I use view, I can see nicely that it has 11405 bp.
I can use seqinr to get the length, like
But, I can't do anything more, how do I extract the sequence only? And how do I convert it to a DNAString?
readDNAStringSet() reads a set of sequences from a file into an XStringSet object. To see the help page of the XStringSet-class, use:
There you will find why
length(x) returned 1:
length(x): The number of sequences in x.
For an DNAStringSet object, the function you want is
width(). If you want a DNAString, you may extract just one element of the DNAStringSet and assign it to a new variable:
xString <- x[]
length(xString) will show the sequence length.
Traffic: 1222 users visited in the last hour