From d93cedef8a3e727bc0a089ad6eda4c5734cd55c7 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 11 Oct 2016 15:30:11 +0100 Subject: [PATCH 1/2] Increase min number of columns for pileup sniffing to 5 Fix #3001. --- lib/galaxy/datatypes/tabular.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/datatypes/tabular.py b/lib/galaxy/datatypes/tabular.py index 696a3f3bdb2..0dcaeb8f826 100644 --- a/lib/galaxy/datatypes/tabular.py +++ b/lib/galaxy/datatypes/tabular.py @@ -644,7 +644,7 @@ class Pileup( Tabular ): try: for hdr in headers: if hdr and not hdr[0].startswith( '#' ): - if len( hdr ) < 3: + if len( hdr ) < 5: return False try: # chrom start in column 1 (with 0-based columns) From 3be66005dc4cbd2a7d45e2a482f297dcaf493c02 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 11 Oct 2016 15:37:49 +0100 Subject: [PATCH 2/2] Check that chromosome number is >=0 --- lib/galaxy/datatypes/tabular.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/datatypes/tabular.py b/lib/galaxy/datatypes/tabular.py index 0dcaeb8f826..536b818fa1e 100644 --- a/lib/galaxy/datatypes/tabular.py +++ b/lib/galaxy/datatypes/tabular.py @@ -649,7 +649,8 @@ class Pileup( Tabular ): try: # chrom start in column 1 (with 0-based columns) # and reference base is in column 2 - int( hdr[1] ) + chrom = int( hdr[1] ) + assert chrom >= 0 assert hdr[2] in [ 'A', 'C', 'G', 'T', 'N', 'a', 'c', 'g', 't', 'n' ] except: return False