pyranges / pyrle

Numerical Run Length Encoding and Arithmetic in Cython
https://biocore-ntnu.github.io/pyranges/an-introduction-to-rles.html
MIT License
16 stars 3 forks source link

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

Open Isy89 opened 5 months ago

Isy89 commented 5 months ago

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 commented 5 months ago

Good catches, thanks!