fin=$1
windows_file=$2
winsize=$3
step=$4

bedtools map \
    -a $windows_file \
    -b $fin -c 4 -o mean |
     awk -v ws="$winsize" -v  step="$step" \
    '($4 != ".") {pos=$2+int(ws/2-step/2); print $1 "\t" pos "\t" pos+step "\t" $4;}'