cutadapt icon indicating copy to clipboard operation
cutadapt copied to clipboard

Mixing file-based adapter and literal adapter in linked adapter

Open whatever60 opened this issue 6 months ago • 2 comments

First, thank you to the developers for creating and maintaining this incredible tool. It has been fundamental to many of the bioinformatics pipelines I’ve written.

One niche use case that Cutadapt does not support yet (correct me if I’m wrong) is mixing file-based and literal adapters in linked adapter arguments.

For example, it would be really nice if one could do:

cutadapt -A "^'file:~/data/barcode.fasta'...AGATCGGAAGAGCGTCGTGT"

This would allow for more sophisticated configurations, such as: ^'file:~/data/barcode.fasta'...p5=AGATCGGAAGAGCGTCGTGT;optional;min_overlap=5;e=1;noindels.

Right now, the best workaround I can find is either running Cutadapt twice or doing:

cutadapt \
    -A "AGATCGGAAGAGCGTCGTGT" \
    -G "^file:~/data/barcode.fasta" \
    --times 2

which has drawbacks compared to linked adapters as already explained in the documents.

whatever60 avatar Jun 25 '25 09:06 whatever60

Hi, this is not exactly what you are asking, but what you can do right now is to put everything that you would otherwise have specified on the command line into the FASTA file. So you can have a FASTA file adapters.fasta like this:

>barcode01
^AACCGGTT;e=0;min_overlap=3...AGATCGGAAGAGCGTCGTGT;optional;min_overlap=5;e=1;noindels

and use it with -a file:adapters.fasta.

You still have to repeat the AGATCGGAAGAGCGTCGTGT and the options for every barcode, so something like what you suggest would be nice, but you do not have to use separate -a and -g arguments with --times=2.

marcelm avatar Jun 25 '25 09:06 marcelm

Ah, thank you for the super quick reply! I hadn’t even considered that Cutadapt might recognize a FASTA file like that lol.

That said, it does feel a bit unintuitive, since the format isn’t exactly a standard FASTA.

If you think this is a feature worth supporting more explicitly, I’d be happy to open a pull request. But I’ll defer to you on whether it makes sense to keep this issue open.

Thanks again!

whatever60 avatar Jun 25 '25 09:06 whatever60