Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specialized Python exceptions #36

Merged
merged 8 commits into from
Apr 13, 2024

Conversation

nvictus
Copy link
Collaborator

@nvictus nvictus commented Apr 10, 2024

  • Replaces base Exception raises with ValueError, KeyError, BBIFileClosed or BBIReadError.
  • Unit test refactoring
    • Added fixtures for bigwig and bigbed files
  • Numpydoc-style docstrings for methods.
  • b.chroms(chrom) will raise a KeyError instead of returning None if chrom does not exist. This seems less surprising to me. The former behavior can be achieved more explicitly with b.chroms().get(chrom).
  • Let open support pathlib.Path objects.
  • Make chrom and end args optional for b.values() as in records and zoom_records.

@nvictus nvictus force-pushed the pybigtools_refactor branch from 3b837f0 to 29e9dc6 Compare April 10, 2024 05:31
Comment on lines +1462 to 1603
BBIReadRaw::BigBedFile(_) | BBIReadRaw::BigBedFileLike(_) => {
return Err(BBIFileClosed::new_err("Not a bigWig."))
}
#[cfg(feature = "remote")]
BBIReadRaw::BigBedRemote(_) => return Err(BBIFileClosed::new_err("Not a bigWig.")),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Are these error types / messages correct?

Copy link
Owner

Choose a reason for hiding this comment

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

Ah that doesn't look right. Not sure the right exception but it shouldn't be file closed.

Thinking about it, could make BigWig and BigBed subclasses which effectively have no differences except extra methods.

Or just also implement this for bigBeds akin to values.

@nvictus nvictus force-pushed the pybigtools_refactor branch 3 times, most recently from 1d796d9 to 8318a0c Compare April 10, 2024 21:56
@nvictus nvictus requested a review from jackh726 April 10, 2024 21:59
@nvictus nvictus force-pushed the pybigtools_refactor branch 4 times, most recently from a84f7cc to f4160f4 Compare April 12, 2024 19:14
nvictus added 4 commits April 12, 2024 15:27
Update test_bigwig tests

Linting

Update tests

Update tests

Add bigbed fixture

Update tests

Add test for info method
@nvictus nvictus force-pushed the pybigtools_refactor branch from f4160f4 to 4241744 Compare April 12, 2024 19:27
ci: Install pybigtools[test] for testing
@nvictus nvictus force-pushed the pybigtools_refactor branch from 4241744 to 0591832 Compare April 12, 2024 19:36
@jackh726 jackh726 merged commit 6ff71df into jackh726:pybigtools_refactor Apr 13, 2024
4 checks passed
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.

2 participants