This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to subset a FASTQ file based on a list of sequences

I have a file1.txt (one sequence per line) which I want to use as a reference to filter out entries from a file.fastq. To clarify, I want to keep the file.fastq entries that perfectly match the sequences in file1.txt

I know BBMap has filterbyname.sh for filtering by ID's. Is there some tool that I could use for sequence based filtering? Thanks in advance :)

fastq filter

Slightly convoluted. You may be able to use BBMap to align against those sequences. Set minid=0.95 and collect sequences that do not map by using outu= in a file. Then filter those out of the original file.

There are lots of ways to code this. Have you tried anything, or have any coding/command line experience?

I do have command line experience. Can you suggest a code?

1 answer

You can use Bowtie2. Set parameters for as strict an alignment as you like, then use the --al option to write a fastq file for the successful alignments and the --un option to write a fastq file for the unsuccessful alignments.

Log in to answer this question.