1#!/bin/bash
2
3vcftools --vcf $1 --depth --out $2
4
5CUTOFF=$(mawk '!/IN/' $2.idepth | cut -f3 | sort -rn | perl -e '$d=.85;@l=<>;print $l[int($d*$#l)]')
6mawk -v x=$CUTOFF '$3 < x' $2.idepth | cut -f1 > lowDP.indv
7
8vcftools --vcf $1 --remove lowDP.indv --recode --recode-INFO-all --out $2
9