Skip to content

Commit

Permalink
r921: output unmapped reads in full PAF
Browse files Browse the repository at this point in the history
  • Loading branch information
lh3 committed Feb 27, 2019
1 parent 90b7b83 commit 55e39c2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion format.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ void mm_write_paf3(kstring_t *s, const mm_idx_t *mi, const mm_bseq1_t *t, const
{
s->l = 0;
if (r == 0) {
mm_sprintf_lite(s, "%s\t%d", t->name, t->l_seq);
mm_sprintf_lite(s, "%s\t%d\t0\t0\t*\t*\t0\t0\t0\t0\t0\t0", t->name, t->l_seq);
if (rep_len >= 0) mm_sprintf_lite(s, "\trl:i:%d", rep_len);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "mmpriv.h"
#include "ketopt.h"

#define MM_VERSION "2.15-r917-dirty"
#define MM_VERSION "2.15-r921-dirty"

#ifdef __linux__
#include <sys/resource.h>
Expand Down
4 changes: 3 additions & 1 deletion minimap2.1
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,9 @@ Filter out query sequences longer than
.IR NUM .
.TP
.B --paf-no-hit
In PAF, output query name and length for an unmapped sequence.
In PAF, output unmapped queries; the strand and the reference name fields are
set to `*'. Warning: some paftools.js commands may not work with such output
for the moment.
.TP
.B --version
Print version number to stdout
Expand Down
20 changes: 11 additions & 9 deletions misc/paftools.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env k8

var paftools_version = '2.15-r916-dirty';
var paftools_version = '2.15-r921-dirty';

/*****************************
***** Library functions *****
Expand Down Expand Up @@ -433,6 +433,7 @@ function paf_call(args)
while (file.readline(buf) >= 0) {
var line = buf.toString();
var m, t = line.split("\t", 12);
if (t.length < 12 || t[5] == '*') continue; // unmapped
for (var i = 6; i <= 11; ++i)
t[i] = parseInt(t[i]);
if (t[10] < min_cov_len || t[11] < min_mapq) continue;
Expand Down Expand Up @@ -680,13 +681,12 @@ function paf_asmstat(args)
var t = line.split("\t");
t[1] = parseInt(t[1]);
if (t[1] < min_query_len) continue;
if (t.length >= 2) {
query[t[0]] = t[1];
if (qinfo[t[0]] == null) qinfo[t[0]] = {};
qinfo[t[0]].len = t[1];
qinfo[t[0]].bp = [];
}
if (t.length < 9) continue;
if (t.length < 2) continue;
query[t[0]] = t[1];
if (qinfo[t[0]] == null) qinfo[t[0]] = {};
qinfo[t[0]].len = t[1];
qinfo[t[0]].bp = [];
if (t.length < 9 || t[5] == "*") continue;
if (!/\ttp:A:[PI]/.test(line)) continue;
if ((m = /\tcg:Z:(\S+)/.exec(line)) == null) continue;
var cigar = m[1];
Expand Down Expand Up @@ -967,7 +967,9 @@ function paf_stat(args)
var t = line.split("\t", 12);
var m, rs, cigar = null, is_pri = false, is_sam = false, is_rev = false, tname = null;
var atlen = null, aqlen, qs, qe, mapq, ori_qlen;
if (t[4] == '+' || t[4] == '-') { // PAF
if (t.length < 2) continue;
if (t[4] == '+' || t[4] == '-' || t[4] == '*') { // PAF
if (t[4] == '*') continue; // unmapped
if (!/\ts2:i:\d+/.test(line)) {
++n_2nd;
continue;
Expand Down

0 comments on commit 55e39c2

Please sign in to comment.