bcftools subset by ids stored in a unix variable
1
0
Entering edit mode
8 months ago
curious ▴ 570

I have been trying to subset a vcf by ids stored in a variable, is this even possible

IFS=
ids=$(bcftools query -f '%ID\n' my.vcf)
bcftools view -i "ID=@${ids}" my_other_vcf

error I get: -bash: /usr/local/bin/bcftools: Argument list too long`

what am I missing here? I realize this is probably more of a bash question sorry

bcftools • 318 views
ADD COMMENT
0
Entering edit mode
8 months ago

I think you want:

bcftools query -f '%ID\n' my.vcf > ids.txt
bcftools view -i "ID=@ids.txt" my_other_vcf
ADD COMMENT
0
Entering edit mode

Thanks I knew that would work I was just wondering if there is a way to store the values in a variable and avoid the temporary file

ADD REPLY

Login before adding your answer.

Traffic: 1292 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6