# How can I systematically detect unknown barcode/adapter sequences within a set of samples?

I have often downloaded datasets from the SRA where the authors failed to mention which adapters were trimmed during the processing.

Local alignments tend to overcome this obstacle, but it feels a bit barbaric.

fastQC works occasionally to pick them up, but sometimes fails to find the actual adapter sequences.

Usually, I ended up looking up the kits they used and trying to grep for all the possible barcodes.

Is there a more robust/efficient way to do this?

• This doesn't answer your question, but I hope there is a possibility to report such problems to SRA so that they ask the authors to publish the missing information. – bli May 31 '17 at 10:24
• Why do you feel that local alignment is a bit barbaric? It should be the default method in this day and age, unless you’re working with smallRNA sequencing. I tend to trim adapters to be on the safe side but I did lots of work without bothering, and just relying on local alignment. – Konrad Rudolph May 31 '17 at 11:01

The minion utility from the kraken/reaper toolkit may be helpful for this: http://wwwdev.ebi.ac.uk/enright-dev/kraken/reaper/src/reaper-latest/doc/minion.html

• This looks like exactly the right type of tool. Although too bad it was designed mainly for the 3' end adapter. I wonder if you could just flip all your reads and apply it to the 5' end. – story Jun 2 '17 at 14:43

You mention that FastQC "fails to find the actual adapter sequences" - I guess you mean in the Adapter Sequence Contamination plot. However, the kmer and Sequence Content Plots are often useful even when the former fails. I've used these in the past - you can sometimes just read off the adapter sequence from the start of the Sequence Content Plot (or at least see how many bases to trim).

I'm not aware of any existing methods to do this, but here are a couple of ideas about how it might be done:

Canu has a method of adapter trimming which involves looking for the absence of overlap for reads. If there are no other reads which share sequence across a particular region, then the read is broken up at the point of low coverage, and small pieces are discarded. It would be possible to use a method like this to hunt for possible adapter/barcode sequences by preserving the short reads.

Another option is to do a kmer search at the start of reads, and see if any of the high-abundance kmers can be assembled together and/or matched to existing known adapters or barcodes.

If you happen to know a sequence that should be highly abundant in the library, you can grep its beginning or end (with pattern match highlighting) and see if the same sequence systematically comes just before or just after respectively. This kind of visual inspection can help you finding the adaptor.

For instance, in a previous lab, we were working on D. melanogaster small RNA sequencing data and my colleague knew from previous experience with this kind of data that the following small RNA was likely to be abundant: http://flybase.org/reports/FBgn0065042.html

We just had to grep it in the fastq file to see many lines with this sequence, next to another sequence that happened to be always the same: the unknown adapter.

• May I know the reason of the downvote? I've seen this method applied in a case of small RNA-seq, where one highly abundant sequence was expected. Visually inspecting the output of grep of this sequence (with pattern highlight) gave a very good hint of what the adaptor was (the non-highlighted part). – bli Jun 1 '17 at 12:29
• The question is asking about how to detect unknown adapter sequences, so the OP will not know about abundant sequences in advance. That's kind of the point of the question... – ewels Jun 2 '17 at 7:49
• @tallphil I don't see the link between not knowing the adapter and not knowing of an abundant sequence expected to be present in the data. If I remember well, in the example I mention in my comment, my colleague knew from previous experience with this kind of data that the following small RNA was likely to be abundant: flybase.org/reports/FBgn0065042.html We just had to grep it in the fastq file to see many lines with this sequence, next to another sequence that happened to be always the same: the unknown adapter. – bli Jun 2 '17 at 8:04
• Actually I just re-read your post and now I see what you meant. This is a reasonable idea. However, I think you explained it poorly in the sense that a reader might be confused and think you meant that searching for the most abundant sequence might come up with the barcode. You should have specified that the "abundant sequence" in this case was a known nucleic acid sequence that would be expected to have adapters ligated to one or both ends. – story Jun 2 '17 at 14:36
• I tried to clarify my explanations. – bli Jun 3 '17 at 9:10