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

Liftover should probably sort output VCF #8

Open
davmlaw opened this issue May 1, 2024 · 2 comments
Open

Liftover should probably sort output VCF #8

davmlaw opened this issue May 1, 2024 · 2 comments

Comments

@davmlaw
Copy link

davmlaw commented May 1, 2024

Thanks for the tool, it's extremely fast and seems to work well so far (currently evaluating it)

The output VCF appears to be written variant-by-variant from the source file

Sometimes, the relative order of variants can change. For instance:

GRCh38 input (correct order):

1	13115599	11730	G	A	.	.	.
1	13259273	12448	G	A	.	.	.

GRCh37 output:

1	13183071	11730	G	A	.	.	.
1	13112676	12448	C	T	.	.	FLIP

This produces a file that has

Warning: The file is not sorted, for example 1:13112676 comes after 1:13183071

Workaround

Don't use "-o" on liftover but instead pipe into bcftools sort then output to file

@davmlaw
Copy link
Author

davmlaw commented May 2, 2024

I am not sure about the bcftools convention on whether you should output valid VCFs from each command, or whether you can rely on users running sort. It's in your instructions but people will forget and leave it out (I did!) so I think it's best to output valid VCFs by default

Perhaps you could add an option to not sort, for efficiency if people have sort later in their pipelines

@davmlaw davmlaw changed the title Liftover should sort output VCF Liftover should probably sort output VCF May 2, 2024
@freeseek
Copy link
Owner

freeseek commented May 3, 2024

BCFtools/liftover is designed as a BCFtools plugin which processes each VCF record independently so this would require a large change in the code. One possibility would be to implement in BCFtools the option to sort the output of a plugin but this would need to be a change within the BCFtools repository. I will change the examples when you run bcftools +liftover -h to reflect the need to sort

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