-
Notifications
You must be signed in to change notification settings - Fork 75
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
Floating point values are allowed as file offsets #41
Comments
No problem. I'll take a look today and figure this out. Are you trying to slice using floats or is this behavior produced when using integer indices?
|
Never mind. Saw your updates after I had my coffee. I'll reproduce the issue and fix it. Thanks for the issue report! |
It would be helpful if you can provide the link to the Fasta file that you are using. |
Are you perhaps setting the Fasta |
I am using `read_ahead', and may well be setting it to a float.
The float vs int thing is somewhat annoying. I tend to use exponential notation literals like |
Yes, I believe that the issue is the read_ahead buffer value since I can't reproduce this issue without setting read_ahead to a float (and your traceback definitely has this set to some value). If this doesn't solve your case, then I'd be glad to look at it given that you can send me the fasta file you're using! |
Ok... I can see how that could cause problems. BTW: The fasta file I'm using in this case the AgamP4 reference: PS: The task I'm doing is just quickly counting Ns and soft-masked (repeats) in windows across the chromosomes. Using pyfaidx, it takes just a few lines of code and is Impressively fast. |
Yes, it's a great idea and I've implemented it in d7ed52e. I think raising an error is the least surprising thing to do, and appreciate your help finding this bug. |
Using python 3.4.0 and whatever version of pyfaidx is currently grabbed by pip (you should add
__version__
to the module)...Simple access (and slicing) both end up trying to use floats where ints are required.
A quick fix (perhaps a hack) is to cast
start
andend
to ints infrom_file
:and
Sorry, no time at the moment to thoroughly test, much less fork your most current code and proved you with a proper diff.
PS: The title of this issue isn't quite correct... It is a call to
read
where the error gets tripped, not an index.PPS: Useful module! Thanks. Not super complicated, but thanks for doing it right and saving the rest of us from having to reinvent the wheel (or use SeqIO where it really isn't appropriate IMO).
The text was updated successfully, but these errors were encountered: