#!/bin/bash
dir="$(cd "$(dirname "$0")" && pwd)"

input=$1
ids=$2
ref=$3
output=$4

input=($input)

ids=($ids)

first="${input[0]}"

count=0
for current in ${input[@]}
do
	f=$(file $current)
	zipType="Zip archive"
	if [[ "$f" == *"$zipType"* ]]
	then
		id=${ids[$count]}
		unzip $current -d $PWD/$id/ >> $PWD/unziplog.log
		filename="$PWD/gappednt_${id}.txt"
		cat $PWD/$id/*/2_* | cut -f2,4,7 > $filename
		python $dir/script_imgt.py --input $filename --ref $ref --output $output --id $id
	else
		python $dir/script_xlsx.py --input $current --ref $ref --output $output
	fi
	count=$((count+1))
done

