#PBS -q xl230g9q
#PBS -l select=1:ncpus=5:mem=10g
#PBS -l walltime=03:00:00
#PBS -l cput=30:00:00

source ~/programms/ame/bin/activate
WORK_DIR=~/loxP_project/2022-03-11_rings/
cd $WORK_DIR;
#mkdir cutadapt;

declare -a files=("DOXL1" "S20W3" "VIR4" "DOXL1_1" "S20W3_1" "VIR4_1" "DOXL2" "S20W4" "WT1" "DOXL2_1" "S20W4_1" "WT1_1" "DOXL3" "WT2" "DOXL3_1" "WT2_1" "DOXL4" "VIR1" "WT3" "DOXL4_1" "VIR1_1" "WT3_1" "S20W1" "VIR2" "WT4" "S20W1_1" "VIR2_1" "WT4_1" "S20W2" "VIR3" "S20W2_1" "VIR3_1")

for i in "${files[@]}"
do
cutadapt -a AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC -A AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGATCTCGGTGGTCGCCGTATCATT -o $WORK_DIR/cutadapt/cutIL_${i}_R1.fq.gz -p $WORK_DIR/cutadapt/cutIL_${i}_R2.fq.gz $WORK_DIR/raw/${i}/*_1.fq.gz $WORK_DIR/raw/${i}/*_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_${i}_R1.fq.gz -p $WORK_DIR/cutadapt/cut_barc_praimers_cutIL_${i}_R2.fq.gz $WORK_DIR/cutadapt/cutIL_${i}_R1.fq.gz $WORK_DIR/cutadapt/cutIL_${i}_R2.fq.gz --overlap 20;
done
