Minimap2: Add option to force pairing of reads regardless of naming convention

Created on 15 Apr 2020  ·  5Comments  ·  Source: lh3/minimap2

Hi, and thanks for making this software. I have a feature request which I hope is not too hard to implement.

I have a pair of fastq files containing forward and the corresponding reverse reads, respectively. I see that minimap2 could work with them in theory. However, the problem is that it assumes that paired-end reads will have the same name except a suffix digit.

My data files don't conform to this naming convention, though: specifically, they have the 1-vs-2 numbering somewhere in the middle of the read name. I still know that they always contain the corresponding pairs in the same order. Could an option be added that skips the naming convention check and assumes that all reads are paired when two read files are specified?

feature-request

All 5 comments

Implementing a feature just for a few users complicates the code and hurts future maintenance. Please follow the convention.

Well, the code is already pretty darn complicated. mm_map_frag is a 120-line function with 9 arguments. But more importantly, I don't decide the format of the files I'm working with, I get them from someplace else.

Every so often, people want bwa or minimap to accept unconventional paired read names, but they never explain what read names they want in the output SAM file. The base read name (without /1 or /2 or equivalent) is what ties read pairs together in SAM, and if the aligner is unaware of the convention used then it can't reliably record the pairing in its output.

This is why the sensible approach is for you to write a script that rewrites your particular form of “1-vs-2 numbering somewhere in the middle” naming as /1 or /2 on the end, and preprocess your FASTQ files into the standard convention before giving them to minimap2.

@jmarshall I would be fine with either of the names (since if the name of one read is known, its position determines the position of the pair, and hence the other read as well).

Of course I can perform the conversion myself, but read files are big. Why should I be forced to waste space and time on that? I work at a company with several dozens of clients, and this number is expected to reach well into the hundreds. It's a pity that I have to create dozens or 100s of gigabyte-sized temporary files and wait additional hours (even with a fast pipeline composed of e.g. ripgrep and gzip -2), just so that some arbitrary naming convention is abided. No other aligner I've ever used expected such a particular, hard-coded, impossible-to-turn-off naming convention.

@jmarshall Good point. Thanks! I haven't thought about that.

@H2CO3 Apparently you haven't got John's point. He is talking about how to generate SAM. Anyway, in bash, you don't have to generate temporary files. You can

minimap2 -axsr ref.fa <(convert.py old1.fq.gz) <(convert.py old2.fq.gz)

As I said, I only implement a user's request when I perceive a sizable user base. I am not paid by your company and is not obliged to solve your or your clients' problems. I am locking this thread.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fritzsedlazeck picture fritzsedlazeck  ·  8Comments

dangchenyuan picture dangchenyuan  ·  5Comments

RAHenriksen picture RAHenriksen  ·  7Comments

a-89 picture a-89  ·  3Comments

gringer picture gringer  ·  5Comments