I have a multi-sample bcf file which I would like to split into smaller files per gene so I can use this for some downstream eQTL analysis.
I've started a bash script which pipes bcftools query -f '%SAMPLE\t%POS\t%REF\t%ALT\t%GT\n' into an awk script where I subsequently re-code the genotype, and then in theory make a multi-sample text file per gene (+/- 1MB), by running this in a while loop with a GTF file.
However this is proving difficult! And I wasn't sure if I've missed a function or package somewhere that can do this for me.
Any help is appreciated - I also can easily convert this file to vcf or split by sample depending on the approach.