Skip to content

BGZF RecursionError - #1767

Merged
peterjc merged 2 commits into
biopython:masterfrom
rtf-const:bgzf_avoid_recursion
Aug 23, 2018
Merged

peterjc merged 2 commits into
biopython:masterfrom
rtf-const:bgzf_avoid_recursion

Conversation

@rtf-const

Copy link
Copy Markdown
Contributor

This pull request addresses issue #1701

  • I hereby agree to dual licence this and any previous contributions under both
    the Biopython License Agreement AND the BSD 3-Clause License.

  • I have read the CONTRIBUTING.rst file and understand that AppVeyor and
    TravisCI will be used to confirm the Biopython unit tests and flake8 style
    checks pass with these changes.

  • I have added my name to the alphabetical contributors listings in the files
    NEWS.rst and CONTRIB.rst as part of this pull request, am listed
    already, or do not wish to be listed. (This acknowledgement is optional.)

@rtf-const
rtf-const requested a review from peterjc as a code owner August 22, 2018 18:42
@codecov

codecov Bot commented Aug 22, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #1767 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1767      +/-   ##
==========================================
- Coverage   85.43%   85.43%   -0.01%     
==========================================
  Files         331      331              
  Lines       50204    50203       -1     
==========================================
- Hits        42891    42889       -2     
- Misses       7313     7314       +1
Impacted Files Coverage Δ
Bio/bgzf.py 93.12% <100%> (-0.41%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f93043f...c112335. Read the comment docs.

Comment thread Tests/test_bgzf.py Outdated

h.close()

def test_bug_1701(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename that to something like test_many_blocks_in_one_read_call?

@peterjc

peterjc commented Aug 23, 2018

Copy link
Copy Markdown
Member

This looks great - the fix is along the lines I was expecting/hoping would work, but you've made a nice reproducible test case which it the bit I was blocked on.

I noticed you haven't added your self to the NEWS and CONTRIB file, and don't put your name on your GitHub profile. If you want to be acknowledged as just @rtf-const that's fine - or leave it as is.

@mdshw5 is it easy for you to test this fix locally with pyfaidx, or would you prefer I merge it first?

@mdshw5

mdshw5 commented Aug 23, 2018

Copy link
Copy Markdown
Contributor

I'll test this locally, but it looks like this will provide a fix for BGZF in pyfaidx, so feel free to merge.

@peterjc

peterjc commented Aug 23, 2018

Copy link
Copy Markdown
Member

Thanks @mdshw5 - I'll look forward to your test results 👍

Comment thread Bio/bgzf.py
# (lazy loading, don't load the next block unless we have too)
data = self._buffer[self._within_block_offset:self._within_block_offset + size]
self._within_block_offset += size
assert data # Must be at least 1 byte

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future it might be nice to have an Exception here in case the assertion is false. Something like ValueError("Expected data at byte %d." % self.tell()). For now I think this looks fine.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, yes.

Comment thread Tests/test_bgzf.py Outdated

h.close()

def test_bug_1701(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for writing this test. I've had this in the back of my mind for almost a year and always procrastinated. This is really helpful!

@rtf-const

Copy link
Copy Markdown
Contributor Author

If you want to be acknowledged as just @rtf-const that's fine - or leave it as is.

No, I have no special issues with that. I added my name to CONTRIB and NEWS and renamed the test method

@peterjc
peterjc merged commit 0a439fa into biopython:master Aug 23, 2018
@peterjc

peterjc commented Aug 23, 2018

Copy link
Copy Markdown
Member

Thank you 👍

This was referenced Aug 23, 2018
peterjc added a commit to peterjc/biopython that referenced this pull request Aug 14, 2019
Original author Lenna X. Peterson (and Thomas Hamelryck on whose Bio.PDB
tests this was in part based), and all the contributors since as tracked
with version control have agreed:

 - Carlos Pena (@carlosp420)
   biopython#898 (comment)
 - Christian Brueffer (@cbrueffer)
   biopython#898 (comment)
 - Fábio Madeira (@biomadeira)
   biopython#898 (comment)
 - Francesco Gastaldello (@Gasta88)
   biopython#1063
 - João Rodrigues (@JoaoRodrigues)
   biopython#898 (comment)
 - Lenna Peterson (@lennax)
   biopython#898 (comment)
 - Michiel de Hoon (@mdehoon)
   biopython#898 (comment)
 - Peter Cock (@peterjc)
   biopython#898 (comment)
 - Konstantin Vdovkin (@rtf-const)
   biopython#1767
 - Stefans Mezulis (@StefansM)
   biopython#1445
 - Sunhwan Jo (@sunhwan)
   biopython#898 (comment)
 - Thomas Hamelryck (CVS username nisse)
   https://mailman.open-bio.org/pipermail/biopython/2018-September/016546.html
@peterjc peterjc mentioned this pull request Aug 22, 2019
3 tasks done
peterjc added a commit that referenced this pull request Aug 29, 2019
Original author Bertrand Frottier, named copyright holders, and all
contributors since as tracked with version control have agreed:

 - Bertrand Frottier
   https://mailman.open-bio.org/pipermail/biopython/2019-August/016662.html
 - Brad Chapman (@chapmanb)
   http://mailman.open-bio.org/pipermail/biopython-dev/2013-July/019903.html
 - Carlos Pena (@carlosp420)
   #898 (comment)
 - Christian Brueffer (@cbrueffer)
   #898 (comment)
 - Christof Winter (@winterschlaefer)
   #898 (comment)
 - Francesco Gastaldello (@Gasta88)
   #1063
 - Iddo Friedberg (@idoerg)
   #898 (comment)
 - Konstantin Vdovkin (@rtf-const)
   #1767
 - Lenna Peterson (@lennax)
   #898 (comment)
 - Michiel de Hoon (@mdehoon)
   #898 (comment)
 - @morrme
   #1172 (comment)
 - Nick Negretti (@nimne)
   #1768 (comment)
 - Nick Semenkovich (@semenko)
   #898 (comment)
 - Peter Cock (@peterjc)
   #898 (comment)
 - Sergei Lebedev (@superbobry)
   #898 (comment)
 - Sergio Valqui (@svalqui)
   #1749
 - Terry Jones (@terrycojones)
   #898 (comment)
 - Travis Wrightsman (@twrightsman)
   #898 (comment)
peterjc added a commit that referenced this pull request Aug 29, 2019
Original author Lenna X. Peterson (and Thomas Hamelryck on whose Bio.PDB
tests this was in part based), and all the contributors since as tracked
with version control have agreed:

 - Carlos Pena (@carlosp420)
   #898 (comment)
 - Christian Brueffer (@cbrueffer)
   #898 (comment)
 - Fábio Madeira (@biomadeira)
   #898 (comment)
 - Francesco Gastaldello (@Gasta88)
   #1063
 - João Rodrigues (@JoaoRodrigues)
   #898 (comment)
 - Lenna Peterson (@lennax)
   #898 (comment)
 - Michiel de Hoon (@mdehoon)
   #898 (comment)
 - Peter Cock (@peterjc)
   #898 (comment)
 - Konstantin Vdovkin (@rtf-const)
   #1767
 - Stefans Mezulis (@StefansM)
   #1445
 - Sunhwan Jo (@sunhwan)
   #898 (comment)
 - Thomas Hamelryck (CVS username nisse)
   https://mailman.open-bio.org/pipermail/biopython/2018-September/016546.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants