mirror of
https://github.com/lh3/minimap2.git
synced 2026-10-02 17:48:11 +08:00
output simulated identity with badread
This commit is contained in:
+4
-3
@@ -2424,8 +2424,8 @@ function paf_badread2fa(args)
|
|||||||
file = new File(args[1]);
|
file = new File(args[1]);
|
||||||
while (file.readline(buf) >= 0) {
|
while (file.readline(buf) >= 0) {
|
||||||
var line = buf.toString();
|
var line = buf.toString();
|
||||||
var m, a = null, is_fq = line[0] == '@'? true : false;
|
var m, tag = '', a = null, is_fq = line[0] == '@'? true : false;
|
||||||
if (!/\schimera\s/.test(line) && (m = /\s(\S+),([+-])strand,(\d+)-(\d+)/.exec(line)) != null) {
|
if (!/\schimera\s/.test(line) && (m = /\s(\S+),([+-])strand,(\d+)-(\d+).*read_identity=([0-9\.]+)%/.exec(line)) != null) {
|
||||||
if (len[m[1]] == null) throw Error("failed to find the contig length of " + m[1]);
|
if (len[m[1]] == null) throw Error("failed to find the contig length of " + m[1]);
|
||||||
m[3] = parseInt(m[3]);
|
m[3] = parseInt(m[3]);
|
||||||
m[4] = parseInt(m[4]);
|
m[4] = parseInt(m[4]);
|
||||||
@@ -2433,6 +2433,7 @@ function paf_badread2fa(args)
|
|||||||
a = [ "S" + (id+1), m[1], m[3], m[4], m[2] ];
|
a = [ "S" + (id+1), m[1], m[3], m[4], m[2] ];
|
||||||
else
|
else
|
||||||
a = [ "S" + (id+1), m[1], len[m[1]] - m[4], len[m[1]] - m[3], m[2] ];
|
a = [ "S" + (id+1), m[1], len[m[1]] - m[4], len[m[1]] - m[3], m[2] ];
|
||||||
|
tag = "ri:f:" + m[5];
|
||||||
}
|
}
|
||||||
file.readline(buf);
|
file.readline(buf);
|
||||||
var seq = buf.toString();
|
var seq = buf.toString();
|
||||||
@@ -2441,7 +2442,7 @@ function paf_badread2fa(args)
|
|||||||
file.readline(buf);
|
file.readline(buf);
|
||||||
}
|
}
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
print(">" + a.join("!"));
|
print(">" + a.join("!"), tag);
|
||||||
print(seq);
|
print(seq);
|
||||||
} else ++n_discard;
|
} else ++n_discard;
|
||||||
++id;
|
++id;
|
||||||
|
|||||||
Reference in New Issue
Block a user