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

Skip to last record using tabix #1231

Open
CreRecombinase opened this issue Feb 13, 2021 · 2 comments
Open

Skip to last record using tabix #1231

CreRecombinase opened this issue Feb 13, 2021 · 2 comments
Assignees

Comments

@CreRecombinase
Copy link

I have many large (indexed) vcfs of the form ${CHROM}_${CHUNK}vcf.gz and was looking for a quick way to get the coordinates spanned by the file. I know that given a region, the index can be used to skip to chunks overlapping that region, but is the reverse possible? Can I use the last entry in the index to get the offset to the last chunk?

@valeriuo
Copy link
Contributor

was looking for a quick way to get the coordinates spanned by the file.

Do you mean something like:

chr1    61772    17129271
chr2    262     6221917

Can I use the last entry in the index to get the offset to the last chunk?

This is a different request. Do you actually need the file offset? It wouldn't make much sense to have it displayed by tabix, but it could be returned by a HTSlib method.

@CreRecombinase
Copy link
Author

In my use case I know that the file doesn't span multiple chromosomes, but yes, that's the idea. My (admittedly poor) understanding of the tabix format (for bcf/vcf files) is that it stores the (genomic) coordinate of the first record in each chunk.

This is a different request. Do you actually need the file offset? It wouldn't make much sense to have it displayed by tabix, but it could be returned by a HTSlib method.

I agree that having tabix export the file offset of the last chunk would be a weird piece of functionality, and I was thinking it would make more sense as an HTSlib method. Now that you mention it though I feel like a tabix view or tabix export that spit out a contents of the index file as like a json file (or something) could be useful in a lot of settings.

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