#!/bin/bash

function usage {
	echo "filter-ODIN <BED> <THRESHOLD>"
	echo ""
	echo "Consider BED file of differential peaks of ODIN."
	echo "Output only raws with p-value score (-log_10(p-value)) "
	echo "higher than <THRESHOLD>."
	echo ""
	echo "Error:" $1
	echo ""
}


if [ $# -ne 2 ]; then
	usage "exact 2 parameters required:"
	exit 2
fi

BED=$1
THRESHOLD=$2

awk -v t=${THRESHOLD} '{split($11,a,",")} a[3]>t {print}' ${BED}
