bcftools subset by ids stored in a unix variable
1
0
Entering edit mode
4.1 years ago
curious ▴ 820

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 • 1.9k views
ADD COMMENT
0
Entering edit mode
4.1 years 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: 1777 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