control: tag -1 patch * Paul Gevers:
> With a recent upload of python-intervaltree the autopkgtest of > python-intervaltree-bio fails in testing when that autopkgtest is run > with the binary packages of python-intervaltree from unstable. It passes > when run with only packages from testing. In tabular form: > pass fail > python-intervaltree from testing 3.0.2-1 > python-intervaltree-bio from testing 1.0.1-2 > all others from testing from testing Oops, my fault, sorry about that. And hooray for autopkgtests, I guess. Apparently, the .search() method was removed in intervaltree-3.0. Replacing all instances of .search(B,E) with .overlap(B,E) in the intervalltree-bio test code makes the tests pass once more. Here's a patch. Cheers, -Hilko
>From 1fef621d6ec368fbd51f82eecbf98376b69055d4 Mon Sep 17 00:00:00 2001 From: Hilko Bengen <ben...@debian.org> Date: Sat, 26 Jan 2019 22:56:49 +0100 Subject: [PATCH] Replace all .search() calls with .overlap() in tests and documentation --- README.rst | 2 +- intervaltree_bio/__init__.py | 10 +++++----- tests/genomeintervaltree_test.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index b0f249f..b5ee422 100644 --- a/README.rst +++ b/README.rst @@ -34,7 +34,7 @@ The core example is loading the transcription regions of the ``knownGene`` table It is then possible to use the data structure to search known genes within given intervals:: - >> result = knownGene[b'chr1'].search(100000, 138529) + >> result = knownGene[b'chr1'].overlap(100000, 138529) It is possible to load other UCSC tables besides ``knownGene`` or specify custom URL or file to read the table from. Consult the docstring of the ``GenomeIntervalTree.from_table`` method for more details. diff --git a/intervaltree_bio/__init__.py b/intervaltree_bio/__init__.py index 083baca..ac8fe4d 100644 --- a/intervaltree_bio/__init__.py +++ b/intervaltree_bio/__init__.py @@ -125,10 +125,10 @@ class GenomeIntervalTree(defaultdict): >>> gtree = GenomeIntervalTree.from_bed(BytesIO(data)) >>> len(gtree) 1732 - >>> assert gtree[b'chr10'].search(22610878) == set([Interval(22610878, 22611813, [b'.', b'1000', b'.', b'471.725544438908', b'-1', b'3.21510858105313', b'389']), Interval(22610878, 22611813, [b'.', b'791', b'.', b'123.885507169449', b'-1', b'3.21510858105313', b'596'])]) - >>> assert gtree[b'chr10'].search(22611813) == set([]) - >>> assert gtree[b'chr1'].search(145036590, 145036594) == set([Interval(145036593, 145037123, [b'.', b'247', b'.', b'38.6720804428054', b'-1', b'3.06233123683911', b'265'])]) - >>> assert gtree[b'chr10'].search(145036594, 145036595) == set([]) + >>> assert gtree[b'chr10'].overlap(22610878) == set([Interval(22610878, 22611813, [b'.', b'1000', b'.', b'471.725544438908', b'-1', b'3.21510858105313', b'389']), Interval(22610878, 22611813, [b'.', b'791', b'.', b'123.885507169449', b'-1', b'3.21510858105313', b'596'])]) + >>> assert gtree[b'chr10'].overlap(22611813) == set([]) + >>> assert gtree[b'chr1'].overlap(145036590, 145036594) == set([Interval(145036593, 145037123, [b'.', b'247', b'.', b'38.6720804428054', b'-1', b'3.06233123683911', b'265'])]) + >>> assert gtree[b'chr10'].overlap(145036594, 145036595) == set([]) ''' # We collect all intervals into a set of lists, and then put them all at once into the tree structures @@ -187,7 +187,7 @@ class GenomeIntervalTree(defaultdict): >> knownGene = GenomeIntervalTree.from_table() >> len(knownGene) 82960 - >> result = knownGene[b'chr1'].search(100000, 138529) + >> result = knownGene[b'chr1'].overlap(100000, 138529) >> len(result) 1 >> list(result)[0].data['name'] diff --git a/tests/genomeintervaltree_test.py b/tests/genomeintervaltree_test.py index c016760..363ba9f 100644 --- a/tests/genomeintervaltree_test.py +++ b/tests/genomeintervaltree_test.py @@ -23,7 +23,7 @@ def test_knownGene(base_url): knownGene_localurl = 'file:///%s' % os.path.abspath(knownGene_file) knownGene = GenomeIntervalTree.from_table(url=knownGene_localurl, decompress=True) # Py3 downloads .gz files to local files with names not ending with .gz assert len(knownGene) == 82960 - result = knownGene[b'chr1'].search(100000, 138529) + result = knownGene[b'chr1'].overlap(100000, 138529) assert len(result) == 1 assert list(result)[0].data['name'] == b'uc021oeg.2' @@ -33,7 +33,7 @@ def test_knownGene(base_url): knownGene = GenomeIntervalTree.from_table(url=knownGene_localurl, mode='exons', decompress=True) assert len(knownGene) == 742493 - result = list(knownGene[b'chr1'].search(134772, 140566)) + result = list(knownGene[b'chr1'].overlap(134772, 140566)) assert len(result) == 3 assert result[0].data == result[1].data and result[0].data == result[2].data -- 2.19.1