INNER CODE UNIT · JavaScript

re

lh3/miniasm · misc/sam2paf.js:45

var re = /(\d+)([MIDSHNX=])/g;

var len = {}, lineno = 0;
while (file.readline(buf) >= 0) {
	var m, n_cigar = 0, line = buf.toString();
	++lineno;
	if (line.charAt(0) == '@') {
		if (/^@SQ/.test(line)) {
			var name = (m = /\tSN:(\S+)/.exec(line)) != null? m[1] : null;
			var l = (m = /\tLN:(\d+)/.exec(line)) != null? parseInt(m[1]) : null;
			if (name != null && l != null) len[name] = l;
		}
		continue;
	}
	var t = line.split("\t");
	var flag = parseInt(t[1]);
	if (t[9] != '*' && t[10] != '*' && t[9].length != t[10].length) throw Error("ERROR at line " + lineno + ": inconsistent SEQ and QUAL lengths - " + t[9].length + " != " + t[10].length);
	if (t[2] == '*' || (flag&4)) continue;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…