Commit 0c52e1d7 authored by flothoni's avatar flothoni Committed by Mathieu Giraud

bioseq.js; Add a function to get the number of match of an alignment

parent 167f0a25
......@@ -324,3 +324,21 @@ function bsa_cigar2str(cigar)
s.push((cigar[k]>>4).toString() + "MIDNSHP=XB".charAt(cigar[k]&0xf));
return s.join("");
}
/**
* Return the number of match from an alignment cigar
*/
function bsa_cigar2match(cigar)
{
var sum = 0
for (var k = 0; k < cigar.length; ++k){
var match = (cigar[k]>>4 )
var type = (cigar[k]&0xf)
if (type == 0){
sum += match
}
}
return sum
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment