Last active
November 17, 2018 22:22
-
-
Save janxkoci/a21298b9b21f185901ce22d7c63e986b to your computer and use it in GitHub Desktop.
AWK script to parse info on a single sample and position from a VCF file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# bash awk_vcf_anim_chrom_pos.sh in.vcf sample chrom pos | |
echo vcf: "$1" | |
echo sample: "$2" | |
echo chrom: "$3" | |
echo pos: "$4" | |
awk -v sample=$2 -v chrom="$3" -v pos=$4 \ | |
'/#CHROM/ {for(i=1;i<=NF;i++) if ($i~sample) f=i;next} ($1==chrom && $2==pos) {print $1 "_" $2 ": " $f " (" $9 ")"}' $1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FORMAT field could be added to the output by adding $9 to the print statement, for easier interpretation of the output
Edit: DONE