bcftools icon indicating copy to clipboard operation
bcftools copied to clipboard

[Feature Request] -i/-e flags to accept file containing expression

Open blex-max opened this issue 3 years ago • 3 comments

Hello, thanks for maintaining bcftools!

Would it be possible to allow the -i/-e flags to accept a text file containing the expression to perform inclusion/exclusion by? I'm aware that this can be done with perl scripts but what we're looking for is a simple, reproducible way for our scientists (i.e. not necessarily programming-proficient people) to filter VCFs. Very often they want to filter by a pretty standard set of conditions, and it would be great if we could maintain a local repository of 'filtering configs'.

Thanks

blex-max avatar Jul 13 '22 11:07 blex-max

We could also do this on a local fork if it's preferable - any pointers to the appropriate code would be much appreciated.

blex-max avatar Jul 13 '22 11:07 blex-max

I (pending review) have solved my own issue by writing a bash wrapper for bcftools that handles passing a file to -i/-e amongst other things, but I'll leave it open for now in case it's interesting

blex-max avatar Jul 13 '22 19:07 blex-max

This is easy to add in principle, the only question is what the syntax would look like.

Maybe use the @ symbol which is already used to reference a file in other expressions, for example

bctools view -i '@expressions.txt'

Alternatively, the program could check directly for an existence of a file, it is very unlikely for a file to be named to match a valid expression.

pd3 avatar Jul 20 '22 12:07 pd3