diff --git a/format.c b/format.c index 2379a00..29138d1 100644 --- a/format.c +++ b/format.c @@ -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; } diff --git a/main.c b/main.c index e1a113c..ced4c0b 100644 --- a/main.c +++ b/main.c @@ -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 diff --git a/minimap2.1 b/minimap2.1 index ca5f4ba..cfcfb1d 100644 --- a/minimap2.1 +++ b/minimap2.1 @@ -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 diff --git a/misc/paftools.js b/misc/paftools.js index 75ed5bd..4fe692e 100755 --- a/misc/paftools.js +++ b/misc/paftools.js @@ -1,6 +1,6 @@ #!/usr/bin/env k8 -var paftools_version = '2.15-r916-dirty'; +var paftools_version = '2.15-r921-dirty'; /***************************** ***** Library functions ***** @@ -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; @@ -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]; @@ -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;