Entering edit mode
9.1 years ago
bioguy24
▴
230
I can run the below vcftools command to count individual variant types in vcf.gz files
zcat /home/cmccabe/Desktop/vcf/file1.vcf.gz | vcf-annotate --fill-type | grep -oP "TYPE=\w+" | sort | uniq -c > /home/cmccabe/Desktop/vcf/file1_variant_counts.bed
However when I try a bash loop the command does not run at all and I can not seem to figure out why, I think it looks right? Thank you :).
for f in /home/cmccabe/Desktop/vcf/*.vcf.gz ; do
bname=`basename $f`
pref=${bname%%.vcf.gz
zcat /home/cmccabe/Desktop/vcf/$f | vcf-annotate --fill-type | grep -oP "TYPE=\w+" | sort | uniq -c > /home/cmccabe/Desktop/vcf/${pref}_variant_counts.bed
done
I think I see it now, I missed a closing brace in the pref=.... Thank you :).
Exactly. The closing brace was the problem. Nice use of
%%
BTW :)In your loop,
f=/home/cmccabe/Desktop/vcf/*.vcf.gz;
in your zcat command you openIt must be
zcat $f