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

Random access a region in fasta file by fai index #68

Open
wjwei-handsome opened this issue Jun 19, 2023 · 4 comments
Open

Random access a region in fasta file by fai index #68

wjwei-handsome opened this issue Jun 19, 2023 · 4 comments

Comments

@wjwei-handsome
Copy link

Hi,

The fai index file records name/seq_len/byte_offset/line_width/line_byte infomations.

I' working for add an implementation for FastaReader to seek or fetch function to random access the region(chr:start-end).

But when I add a std::io::Seek trait for parse_fastx_reader, I noticed that the std::io::Chain struct didn't satisfied Seek trait.

So I would love to hear your team thoughts on this and if could give me some advices or help.

@audy
Copy link
Contributor

audy commented Jun 19, 2023

Hi @wjwei-handsome. Can you submit a PR of what you have so far? Supporting fai files is an interesting use case but I'm not sure if it will be compatible with current functionality as this library assumes sequential, rather than random, access to data (for example, it's impossible to seek if you're reading from /dev/stdin).

@wjwei-handsome
Copy link
Author

As you say, sequential data is necessary, actually, only plain FASTA file support.

I'm trying to imitate the IndexedReader struct, I still need some time to have a try.

Thanks for your advice!

@wjwei-handsome
Copy link
Author

In addition, I noticed that needletail has a perfect byte positioning system, which theoretically can achieve random access based on fai.

@wjwei-handsome
Copy link
Author

@audy Hi, I just finished this function, please check PR :)

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