Hey,Ive been working on extracting Sequences from a fasta file for some days now and finally decided to post my problem here. I have a fasta file containing approximately 15000 Sequences and I'd like to split these Sequences based on a certain pattern. I'm using the Biostrings package in R with the following functions:
library(Biostrings)
fasta <- readDNAStringSet("~/Downloads/NGS/IgsubPrimer/fasta", "fasta")
matched <- vmatchPattern("GACCACGTTCCCATCT", fasta, max.mismatch=1)
In the docus I find that vmatchPattern gives back an MIndex file on which basis it is possible to extract all matching sequences and write them to a new fasta file. Ive tried extractAllMatches(fasta, matched) which seems just to work with XString files and not in this case. Ive also tried the following line from some documentary:
x <- lapply(seq(along=fasta), function(x) as.character(Views(fasta[[x]], start(matched[[x]]), end(matched[[x]]))))
which gives:
Error in fromXStringViewsToStringSet(x, out.of.limits = out.of.limits, :
'x' has "out of limits" views
For a hint I would be very grateful, I'm really stock atm... :(
biostrings
sequencing
r