#!/bin/bash

# Copyright (C) 2011-2012 CRS4.
#
# This file is part of Seal.
#
# Seal is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# Seal is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with Seal.  If not, see <http://www.gnu.org/licenses/>.

# You need a working Hadoop cluster to run this.

#set -x
set -o nounset
set -o errexit

TestDir="$(dirname $0)"
source ${TestDir}/../blocks.sh

prep $@

${HADOOP} dfsadmin -safemode wait
${HADOOP} dfs -mkdir "${WD}/bin"
${HADOOP} dfs -put "${TestDir}/input" "${WD}/input"
${SealDir}/bin/prq -D seal.prq.min-bases-per-read=28 -D seal.prq.drop-failed-filter=false -D seal.qseq-input.base-quality-encoding=sanger --num-reducers 1 "${WD}/input" "${WD}/output" 2>/dev/null
${HADOOP} dfs -get "${WD}/output" "${OutputDir}"
${HADOOP} dfs -rmr "${WD}"

process_output
