Entering edit mode
Guest User
★
13k
@guest-user-4897
Last seen 11.2 years ago
Hello,
I would like to get all the substrings of a patternmatch on a
XStringSet-class. I now use the following code, but this ignores
multiple matches and I have the feeling there is a better way to do it
that uses biostrings fuctions.
I load a fastafile into a XStringSet-class object and then search for
a specific string using the vmatchPattern function:
genes <- readDNAStringSet(File = "filename", format = "fasta",
use.names = T)
view <- vmatchPattern(pattern = "CCGGA", genes)
matches <- unlist(view, recursive = T, use.names = T)
m <- as.matrix(matches)
I retrieve a substring starting at the match and 20 positions upward:
subseq(genes[rownames(m),], start = m[rownames(m),1], width = 20)
What is a better way to do this that includes all possible matches?
-- output of sessionInfo():
x
--
Sent via the guest posting facility at bioconductor.org.
