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

in to_ranges function line 199 pr.from_dfs -> module pyranges has no attribute from_dfs #9

Open
Isy89 opened this issue Apr 7, 2024 · 1 comment

Comments

@Isy89
Copy link

Isy89 commented Apr 7, 2024

Hi I was solving an issue in pyranges and sow this:

In pyrle.methods in to_ranges function line 199 pr.from_dfs -> module pyranges has no attribute from_dfs
This affects the function _to_bigwig in pyranges.out because when the to_ranges function fails to return a PyRanges objects, gr is not a PyRanges but a Dataframe and does not have a chromosomes attribute.

fix:

original:

pr.from_dfs(dfs)

updated:

pr.PyRanges(dfs)

further suggestion:

Since the name of the function is to_ranges, one expects a PyRanges object, but in case of an exception, the code returns a pandas Dataframe. Furthermore, the exception is caught but not raised or logged, I think something like logging.warning(msg) may help.

Thanks for the grate package !

@endrebak
Copy link
Collaborator

endrebak commented Apr 7, 2024

Good catches, thanks!

Isy89 added a commit to Isy89/pyrle that referenced this issue Apr 7, 2024
… causing to_ranges function to return a pandas Dataframe instead of PyRanges object (pyranges#9)

- Logging exception in case the to_ranges function fails at creating the pr.PyRanges object
- adding Exception (PEP 8: E722)
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

No branches or pull requests

2 participants