Skip to content

Commit

Permalink
bug fix -- token length test in feature parsers, could fail on partia…
Browse files Browse the repository at this point in the history
…l lines. Important for tabix
  • Loading branch information
jrobinso committed Jul 23, 2020
1 parent d9a9ae0 commit ff77ccc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions js/feature/featureParsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ function decodeBed(tokens, ignore) {
*/
function decodeRepeatMasker(tokens, ignore) {

if (tokens.length < 15) return undefined;
if (tokens.length <= 15) return undefined;

const feature = {
swScore: Number.parseInt(tokens[1]),
Expand Down Expand Up @@ -547,7 +547,7 @@ function decodeGenePred(tokens, ignore) {

var shift = this.shift === undefined ? 0 : 1;

if (tokens.length < 9 + shift) return undefined;
if (tokens.length <= 9 + shift) return undefined;

const cdStart = parseInt(tokens[5 + shift])
const cdEnd = parseInt(tokens[6 + shift])
Expand Down Expand Up @@ -590,7 +590,7 @@ function decodeGenePredExt(tokens, ignore) {

var shift = this.shift === undefined ? 0 : 1;

if (tokens.length < 11 + shift) return undefined;
if (tokens.length <= 11 + shift) return undefined;

const cdStart = parseInt(tokens[5 + shift])
const cdEnd = parseInt(tokens[6 + shift])
Expand Down Expand Up @@ -631,7 +631,7 @@ function decodeReflat(tokens, ignore) {

var shift = this.shift === undefined ? 0 : 1;

if (tokens.length < 10 + shift) return undefined;
if (tokens.length <= 10 + shift) return undefined;

const cdStart = parseInt(tokens[6 + shift])
const cdEnd = parseInt(tokens[7 + shift])
Expand Down Expand Up @@ -686,8 +686,8 @@ function decodePeak(tokens, ignore) {
var tokenCount, chr, start, end, strand, name, score, qValue, signal, pValue;

tokenCount = tokens.length;
if (tokenCount < 9) {
return null;
if (tokenCount <= 9) {
return undefined;
}

chr = tokens[0];
Expand All @@ -712,7 +712,7 @@ function decodeBedGraph(tokens, ignore) {

var chr, start, end, value;

if (tokens.length < 3) return null;
if (tokens.length <= 3) return undefined;

chr = tokens[0];
start = parseInt(tokens[1]);
Expand Down

0 comments on commit ff77ccc

Please sign in to comment.