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

Mappy index file error #372

Closed
DrQuestion opened this issue Apr 4, 2019 · 3 comments
Closed

Mappy index file error #372

DrQuestion opened this issue Apr 4, 2019 · 3 comments

Comments

@DrQuestion
Copy link

Hello Doctor Li,
I'm a fan of this brilliant software, and I've been using the python module without creating the index file, at least so far. When I wanted to test if the indexing was actually faster when creating the index file, I tried to run both the ways (with and without the fn_idx_out option given). But, when the path to an index file was given, I was given this error:
index=mappy.Aligner(fn_idx_in=database, preset='map-ont', fn_idx_out=IDXFILE) File "python/mappy.pyx", line 145, in mappy.Aligner.__cinit__ TypeError: expected bytes, str found, where IDXFILE is of the form path/to/file/index.mmi.
Am I misinterpreting the option?
Thank you for your attention,
Alessio.
Ps.
I looked at the code, at the line raising the error (r = cmappy.mm_idx_reader_open(str.encode(fn_idx_in), &self.idx_opt, fn_idx_out)), and I was wondering if a str.encode was necessary also for the fn_idx_out option.

@lh3
Copy link
Owner

lh3 commented May 1, 2019

Sorry for the delay. Could you help to check if using str.encode(fn_idx_out) helps to fix the issue? I guess that is the cause. Thanks!

lh3 added a commit that referenced this issue May 1, 2019
Needs someone to confirm
@lh3
Copy link
Owner

lh3 commented May 1, 2019

I have added str.encode() anyway in 1895555, but it would be good for someone to confirm.

@DrQuestion
Copy link
Author

Hello Doctor Li,
thank you so much for your attention.
I didn't test the new version, but I think it should work, since with a little workaround in my python code,
fn_idx_out=bytes('path/name_of_index_file', encode='utf-8'),
which I just tried, it worked well, creating the index file.

@lh3 lh3 closed this as completed May 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants