#!/usr/bin/env bash
set -euo pipefail
while IFS= read -r line; do
    species="$(echo $line | cut -d ',' -f 1)"
    proteome="$(echo $line | cut -d ',' -f 2)"
    gff3="$(echo $line | cut -d ',' -f 3)"
    blastp="$(echo $line | cut -d ',' -f 4)"
    echo Launching for $species
    nextflow run run_one.nf -resume -profile conda --species "$species" --proteome "$proteome" --gff3 "$gff3" --blastp "$blastp"
done < "input.csv"
echo "Species,Genes,Duplicates,Singletons,Families,LargestFamily,TAG0,TAG1,TAG0 Genes,TAG1 Genes,Largest TAG0" > concat.csv
cat results/*.csv >> concat.csv
