From c83c5741caba37c1c67d49b0fb97b66d4a2b9f24 Mon Sep 17 00:00:00 2001 From: SooLee Date: Tue, 3 Oct 2017 16:40:28 -0400 Subject: [PATCH 1/4] fragment_4dnpairs.pl column index fixed --- util/fragment_4dnpairs.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/fragment_4dnpairs.pl b/util/fragment_4dnpairs.pl index d0537d2f..cd1388fb 100755 --- a/util/fragment_4dnpairs.pl +++ b/util/fragment_4dnpairs.pl @@ -91,11 +91,11 @@ elsif($headers[$i] eq 'frag2') { $frag2_colindex=$i-1; } } print STDERR "$frag1_colindex, $frag2_colindex\n"; # Soo - if($frag1_colindex == -1) { $frag1_colindex=$#headers+1; print OUTFILE "$_ frag1\n"; next; } - elsif($frag2_colindex == -1) { $frag2_colindex=$#headers+1; print OUTFILE "$_ frag2\n"; next; } + if($frag1_colindex == -1) { $frag1_colindex=$#headers; print OUTFILE "$_ frag1\n"; next; } + elsif($frag2_colindex == -1) { $frag2_colindex=$#headers; print OUTFILE "$_ frag2\n"; next; } else { print OUTFILE "$_\n"; next; } } - else { $frag1_colindex=$#headers+1; $frag2_colindex=$#headers+2; print OUTFILE "$_ frag1 frag2\n"; next; } + else { $frag1_colindex=$#headers; $frag2_colindex=$#headers+1; print OUTFILE "$_ frag1 frag2\n"; next; } } elsif(/^#/) { print OUTFILE "$_\n"; next; } my @original_record = split; From 73bf9e1a96761b6303b6e85ba1f541f27f7e67ef Mon Sep 17 00:00:00 2001 From: SooLee Date: Tue, 3 Oct 2017 16:41:54 -0400 Subject: [PATCH 2/4] updated readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 54182496..5ad378a0 100644 --- a/README.md +++ b/README.md @@ -609,6 +609,9 @@ ulimit -n 2000 ## Version history +### 0.3.0 +* The problem with `fragment_4dnpairs.pl` of adding an extra column is now fixed. + ### 0.2.9 * `pairix` can now take 1D query for 2D data. e.g.) `pairix file.gz 'chr22:50000-60000'` is equivalent to `pairix file.gz 'chr22:50000-60000|chr22:50000-60000'` if file.gz is 2D indexed. From dd805b681a441e86e390f56c516f2d08ca022c98 Mon Sep 17 00:00:00 2001 From: Carl Vitzthum Date: Wed, 4 Oct 2017 11:53:39 -0400 Subject: [PATCH 3/4] Updated version numbers, fixed test issue with unicode literals and 1D query on 2D data bad test result --- README.md | 3 ++- VERSION.txt | 2 +- src/pairix.h | 2 +- test/test.py | 18 +++++++++--------- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 5ad378a0..710f839e 100644 --- a/README.md +++ b/README.md @@ -611,6 +611,7 @@ ulimit -n 2000 ### 0.3.0 * The problem with `fragment_4dnpairs.pl` of adding an extra column is now fixed. +* Fixed bug with 1D querying. ### 0.2.9 * `pairix` can now take 1D query for 2D data. e.g.) `pairix file.gz 'chr22:50000-60000'` is equivalent to `pairix file.gz 'chr22:50000-60000|chr22:50000-60000'` if file.gz is 2D indexed. @@ -619,7 +620,7 @@ ulimit -n 2000 * `pairix` now has option `-a` (autoflip) that flips the query in case the matching chromosome pair doesn't exist in the file. * `pairix` now has option `-W` that prints out region split character use for indexing a specific file. * `merge-pairs.sh` is now included in `util`. -* ~`pairix` can now take 1D query for 2D data. e.g.) `pairix file.gz 'chr22:50000-60000'` is equivalent to `pairix file.gz 'chr22:50000-60000|chr22:50000-60000'` if file.gz is 2D indexed.~  This one currently does not work. +* ~`pairix` can now take 1D query for 2D data. e.g.) `pairix file.gz 'chr22:50000-60000'` is equivalent to `pairix file.gz 'chr22:50000-60000|chr22:50000-60000'` if file.gz is 2D indexed.~  This one currently does not work. ### 0.2.6 * Two utils are added: `duplicate_header_remover.pl` and `column_remover.pl` for pairs file format correction. diff --git a/VERSION.txt b/VERSION.txt index 1866a362..0d91a54c 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -0.2.9 +0.3.0 diff --git a/src/pairix.h b/src/pairix.h index 387eb0f8..54cc8aba 100644 --- a/src/pairix.h +++ b/src/pairix.h @@ -28,7 +28,7 @@ #ifndef __TABIDX_H #define __TABIDX_H -#define PACKAGE_VERSION "0.2.9" +#define PACKAGE_VERSION "0.3.0" #include #include "kstring.h" diff --git a/test/test.py b/test/test.py index 58202f33..576f166a 100755 --- a/test/test.py +++ b/test/test.py @@ -18,7 +18,7 @@ 4DN: chr1[1] pos1[2] chr2[3] pos2[4] """ - +from __future__ import unicode_literals import unittest import gzip import sys @@ -150,17 +150,17 @@ def get_result(regions, chrom, start, end): def get_result_2D(regions, chrom, start, end, chrom2, start2, end2): retval = [] - for r in regions: - if r[0] == chrom and overlap1(r[1], r[2], start, end) and r[3] == chrom2 and overlap1(r[4], r[5], start2, end2): - retval.append(r) + for reg in regions: + if reg[0] == chrom and overlap1(reg[1], reg[2], start, end) and reg[3] == chrom2 and overlap1(reg[4], reg[5], start2, end2): + retval.append(reg) return retval -def get_result_2D_4DN(regions, chrom, start, end, chrom2, start2, end2): +def get_result_1D_on_2D(regions, chrom, start, end, chrom2, start2, end2): retval = [] - for r in regions: - if r[1] == chrom and overlap1(r[2], r[2], start, end) and r[3] == chrom2 and overlap1(r[4], r[4], start2, end2): - retval.append(r) + for reg in regions: + if reg[0] == chrom and overlap1(reg[2], reg[2], start, end) and reg[3] == chrom2 and overlap1(reg[4], reg[4], start2, end2): + retval.append(reg) return retval @@ -409,7 +409,7 @@ class PairixTest_1_on_2(unittest.TestCase): chrom2 = chrom start2 = start end2 = end - result = get_result_2D_4DN(regions, chrom, start, end, chrom2, 0, sys.maxsize) + result = get_result_1D_on_2D(regions, chrom, start, end, chrom2, start2, end2) pr = pypairix.open(TEST_FILE_2D_4DN_2) def test_querys(self): From 6d6bc71622866e1d51f893697ff7a83cc076dd20 Mon Sep 17 00:00:00 2001 From: Carl Vitzthum Date: Wed, 4 Oct 2017 12:03:30 -0400 Subject: [PATCH 4/4] Slight README change --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 710f839e..b6a3f3a7 100644 --- a/README.md +++ b/README.md @@ -611,7 +611,7 @@ ulimit -n 2000 ### 0.3.0 * The problem with `fragment_4dnpairs.pl` of adding an extra column is now fixed. -* Fixed bug with 1D querying. +* Fixed bug with 1D querying on 2D data. ### 0.2.9 * `pairix` can now take 1D query for 2D data. e.g.) `pairix file.gz 'chr22:50000-60000'` is equivalent to `pairix file.gz 'chr22:50000-60000|chr22:50000-60000'` if file.gz is 2D indexed.