levitsky / pyteomics

Pyteomics is a collection of lightweight and handy tools for Python that help to handle various sorts of proteomics data. Pyteomics provides a growing set of modules to facilitate the most common tasks in proteomics data analysis.
http://pyteomics.readthedocs.io
Apache License 2.0
105 stars 34 forks source link

Warning is triggered even with `use_index=False` #52

Closed hguturu closed 2 years ago

hguturu commented 2 years ago

https://github.com/levitsky/pyteomics/blob/1ef7a0972934cbafbee32df9f2a635a04502d9b1/pyteomics/auxiliary/file_helpers.py#L918

Is there a way to avoid this warning? I am passing a seekable, non-binary file handle and use_index=False. Specifically a smart_open.open object. It doesn't have a mode attribute when opening s3 objects. It works, just was wondering if I can suppress the warning since the warning doesn't seem to match the issue.

mobiusklein commented 2 years ago

You shouldn't need to worry in your case. This is situation probably needs to be fixed with an unset value to handle default behavior more precisely.

levitsky commented 2 years ago

Thanks for reporting. This checking logic is taking me a lot of attempts to get right. Does the current master behave as expected?

hguturu commented 2 years ago

I was triggering this error on 4.4.2.

Using a master, it looks like the warning is suppressed for use_index=False, shows warning for use_index=None, and it errors out with use_index=True, where it tried to load an IndexedFASTA and I have a regular FASTA. I believe this how it should work?

levitsky commented 2 years ago

I think so! Thank you.