Skip to content

Extend Faidx so it can be backed by memory mapped file #95

Open
@dhauge

Description

@dhauge

It would be nice if a Faidx instance could be constructed that accesses the fasta file via a memory mapped file rather than explicit file seek/read. This would have several benefits, including

  • Removing the need to protect reads against multiple threads
  • Avoiding the need to make system calls for each sequence read

I'd imagine adding a parameter 'file_mapped=True' to the 'Faidx' constructor, and leveraging the 'mutable' parameter to determine if the memory mapping is read-only. The 'Faidx.file' object should probably be wrapped in a small object that implements random access read/write of sequences, which could then work for both normal file access and memory mapped access.

If you would consider this an acceptable addition, and would accept a patch, I should be able to provide a potential implementation in the next few days.

Thanks,
Doug

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions