Merge pull request #141 from jmarshall/bwasw-nan

Fail to infer insert size distribution when no pairs are within boundaries (re issue 108)
This commit is contained in:
Heng Li 2017-07-30 16:53:04 -04:00 committed by GitHub
commit 87ed015b24
1 changed files with 6 additions and 0 deletions

View File

@ -70,6 +70,12 @@ bsw2pestat_t bsw2_stat(int n, bwtsw2_t **buf, kstring_t *msg, int max_ins)
for (i = x = 0, r.avg = 0; i < k; ++i)
if (isize[i] >= r.low && isize[i] <= r.high)
r.avg += isize[i], ++x;
if (x == 0) {
ksprintf(msg, "[%s] fail to infer the insert size distribution: no pairs within boundaries.\n", __func__);
free(isize);
r.failed = 1;
return r;
}
r.avg /= x;
for (i = 0, r.std = 0; i < k; ++i)
if (isize[i] >= r.low && isize[i] <= r.high)