paulsengroup / hictk

Blazing fast toolkit to work with .hic and .cool files
MIT License
23 stars 1 forks source link

Make sure cooler::File::close() does not attempt to finalize files twice #291

Closed robomics closed 3 weeks ago

robomics commented 3 weeks ago

Finalizing .cool files more than once does not do any harm, however it can result in "scary" warnings such as

The following error occurred while closing file /tmp/4DNFIYECESRC.50000.cool: Unable to create the attribute "assembly": (Attribute) Object already exists
File is likely corrupted or incomplete

So it is best if once finalize() has been called, the _finalize flag is set to false before the file handle is closed for real.

codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.25%. Comparing base (cda8f37) to head (76384dd). Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
...ctk/cooler/include/hictk/cooler/impl/file_impl.hpp 90.90% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #291 +/- ## ========================================== - Coverage 79.33% 79.25% -0.08% ========================================== Files 173 173 Lines 17003 17012 +9 Branches 2309 2309 ========================================== - Hits 13489 13483 -6 - Misses 2513 2522 +9 - Partials 1001 1007 +6 ``` | [Flag](https://app.codecov.io/gh/paulsengroup/hictk/pull/291/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=paulsengroup) | Coverage Δ | | |---|---|---| | [tests | integration](https://app.codecov.io/gh/paulsengroup/hictk/pull/291/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=paulsengroup) | `69.71% <90.90%> (-0.06%)` | :arrow_down: | | [tests | unittests](https://app.codecov.io/gh/paulsengroup/hictk/pull/291/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=paulsengroup) | `77.25% <90.90%> (-0.16%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=paulsengroup#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.