Thomas hace 4 años
padre
commit
f807a28628
Se han modificado 2 ficheros con 3 adiciones y 0 borrados
  1. 2 0
      index.js
  2. 1 0
      index.ts

+ 2 - 0
index.js

@@ -82,6 +82,8 @@ const clusterSam = (input_sam, threshold, minReads) => {
                     firstPos = e.position;
                 }
                 if (Math.abs(e.position - ((_a = a[i - 1]) === null || _a === void 0 ? void 0 : _a.position)) > threshold) {
+                    if (typeof posAll[name] === 'undefined')
+                        posAll[name] = {};
                     posAll[name][String(cluster)] = firstPos + '-' + ((_b = a[i - 1]) === null || _b === void 0 ? void 0 : _b.position);
                     cluster = cluster + 1;
                     firstPos = e.position;

+ 1 - 0
index.ts

@@ -96,6 +96,7 @@ const clusterSam = (
                             firstPos = e.position
                         }
                         if (Math.abs(e.position - a[i-1]?.position) > threshold) {
+                            if(typeof posAll[name] === 'undefined') posAll[name] = {}
                             posAll[name][String(cluster)] = firstPos + '-' + a[i-1]?.position
                             cluster = cluster + 1
                             firstPos = e.position