To search for 2 oligonucleotides in a fastq file using R, you can use the ShortRead
package. Here's an example code to search for 2 oligonucleotides (oligo1
and oligo2
) in a fastq file (fastq_file
):
main.r943 chars32 lines
This code defines the 2 oligos, creates a DNAStringSet
object from the oligos, opens a connection to the fastq file, loops over each read in the fastq file, extracts the DNA sequence from the read, searches for the 2 oligos in the DNA sequence using the matchPattern
function, and prints out the read ID and oligo match positions if both oligos are present in the DNA sequence.
gistlibby LogSnag