Home > Community > When using cutadapt, can I specify an R2 adapter as optional when I have a required R1 adapter?
Upvote

22

Downvote
+ Bioinformatics
+ Sequencing
Posted by
Adlai Armundsen

When using cutadapt, can I specify an R2 adapter as optional when I have a required R1 adapter?

Chuck Smallman  Follow

This is not possible in a single cutadapt call, but can be done fairly seamlessly with a pipe between two calls and with cutadapt's interleaving feature. (Thanks to the author for help with this.)


Giving the R2 3' adapter to one cutadapt command and interleaving the read pairs to piped output, a second cutadapt command can take that interleaved output and use both of R1's adapters as a linked adapter:

cutadapt -A GGGGGGGG --interleaved example.R{1,2}.fastq | \cutadapt -a "^AAAAAAAA...TTTTTTTT" --interleaved --discard-untrimmed -o out.R1.fastq -p out.R2.fastq -

Now I can add other filters to the second call.

An additional read pair that should be filtered:

R1:

@read4 would be kept but R2 is too shortAAAAAAAACAATTTTTACTCTAGAAATGTCTGTGCTCATCACCCCGACACCGAATAGCTATGACTCAC+FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

R2:

@read4CTACTAGACATATACCCTGGGGGGGGTTCCCCGTGAAGACGGTTACGATGTGGACAAGCACTCCAGCG+FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

I can now give a minimum length that applies to both in each pair:

cutadapt -A GGGGGGGG --interleaved example.R{1,2}.fastq | \cutadapt -a "^AAAAAAAA...TTTTTTTT" --interleaved --discard-untrimmed --minimum-length 30 -o out.R1.fastq -p out.R2.fastq -

With that I get read1 and read3 in the output, as intended.

More

Upvote

VOTE

Downvote