Add cwl and docker files
[lightning.git] / cwl / annotation / src / getcount.sh
1 #!/bin/bash
2 # Copyright (C) The Lightning Authors. All rights reserved.
3 #
4 # SPDX-License-Identifier: AGPL-3.0
5
6 set -e
7 set -o pipefail
8
9 sample=$1
10 vcf=$2
11
12 total=`zcat $vcf | awk '!(/^#/)' | wc -l`
13 rsid=`zcat $vcf | awk '(!(/^#/) && /rs/)' | wc -l`
14 gnomad=`zcat $vcf | awk '(!(/^#/) && /AF/)' | wc -l`
15 rsidpercentage=`awk -v n="$rsid" -v d="$total" 'BEGIN {print n/d*100}'`
16 gnomadpercentage=`awk -v n="$gnomad" -v d="$total" 'BEGIN {print n/d*100}'`
17
18 echo "$sample: $total total variants, $rsid variants ($rsidpercentage%) have rsID, $gnomad variants ($gnomadpercentage%) have gnomad AF"