#PBS -q dl560g10q@vm-pbs2
#PBS -l select=1:ncpus=5:mem=10g
#PBS -l walltime=01:00:00
#PBS -l cput=01:00:00

source ~/programms/ame/bin/activate
WORK_DIR=~/loxP_project/2022-06-14_rings/
cd $WORK_DIR;
mkdir cutadapt;
# Declare a string array with type
declare -a files=("HAP8VIR_sub11" "HAP8VIR_sub17" "HAP8VIR_sub26" "HAP8VIR_sub30" "HAP8VIR_sub9" "HAP8VIR_sub14" "HAP8VIR_sub19" "HAP8VIR_sub27" "HAP8VIR_sub4" "HAP8VIR_sub15" "HAP8VIR_sub20" "HAP8VIR_sub28" "HAP8VIR_sub5" "HAP8VIR_sub16" "HAP8VIR_sub21" "HAP8VIR_sub29" "HAP8VIR_sub7")

for file in "${files[@]}"
do
cutadapt -a AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC -A AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGATCTCGGTGGTCGCCGTATCATT -o $WORK_DIR/cutadapt/cutIL_${file}_R1.fq.gz -p $WORK_DIR/cutadapt/cutIL_${file}_R2.fq.gz $WORK_DIR/raw/${file}/${file}_*_1.fq.gz $WORK_DIR/raw/${file}/${file}_*_2.fq.gz -m 8;
wait;
cutadapt -g ada1=AAACGAGTTTTAATGACTCCAACTTAAGTGTATGTAAACTTCCGACTTCAACTGTA -y '{name}' -g ada2=ATGTCAGGAATTGTGAAAAAGTGAGTTTAAATGTATTTGGCTAAGGTGTATGTAAACTTCCGACTTCAACTGTA -y '{name}' -G ada1=AAACGAGTTTTAATGACTCCAACTTAAGTGTATGTAAACTTCCGACTTCAACTGTA -y '{name}' -G ada2=ATGTCAGGAATTGTGAAAAAGTGAGTTTAAATGTATTTGGCTAAGGTGTATGTAAACTTCCGACTTCAACTGTA -y '{name}' -o $WORK_DIR/cutadapt/cut_barc_praimers_cutIL_${file}_R1.fq.gz -p $WORK_DIR/cutadapt/cut_barc_praimers_cutIL_${file}_R2.fq.gz $WORK_DIR/cutadapt/cutIL_${file}_R1.fq.gz $WORK_DIR/cutadapt/cutIL_${file}_R2.fq.gz --overlap 20;
done
