Add cwl and docker files
[lightning.git] / cwl / annotation / src / totalcounts.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 counts=( "$@" )
10
11 export allrsid="0"
12 export allgnomad="0"
13 export alltotal="0"
14
15 cat ${counts[@]}
16
17 for count in ${counts[@]}; do
18   rsid=`cut -d' ' -f5 $count`
19   gnomad=`cut -d' ' -f10 $count`
20   total=`cut -d' ' -f2 $count`
21   allrsid=`echo $(($allrsid + $rsid))`
22   allgnomad=`echo $(($allgnomad + $gnomad))`
23   alltotal=`echo $(($alltotal + $total))`
24 done
25 rsidpercentage=`awk -v n="$allrsid" -v d="$alltotal" 'BEGIN {print n/d*100}'`
26 gnomadpercentage=`awk -v n="$allgnomad" -v d="$alltotal" 'BEGIN {print n/d*100}'`
27
28 echo "overall: $alltotal total variants, $allrsid variants ($rsidpercentage%) have rsID, $allgnomad variants ($gnomadpercentage%) have gnomad AF"