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

export PATH=$PATH:~/programms/bwa-0.7.17;
source activate nn_Polina_tf2
WORK_DIR=/mnt/storage/home/psbelokopytova/scratch/202312241147Polina/4c_plasmid/2023-03-14/
cd $WORK_DIR; 
cd align;
# Declare a string array with type
declare -a files=("CS_(100_ng_lig)" "new_CS" "new_CS_(100_ng_lig)")

for file in "${files[@]}"
do
echo ${file}
#[ -d stat ] || mkdir $WORK_DIR/remake_21.11.23/align/${file};

## align 
bwa mem -t 5 -M /mnt/storage/home/psbelokopytova/scratch/202312241147Polina/4c_plasmid/genome/hg38_NP_seq WORK_DIR/remake_21.11.23/cutadapt/ada1_mse_cut3prime_${file}_R1.fq -p $WORK_DIR/remake_21.11.23/cutadapt/ada2_nla_cut3prime_${file}_R2.fq | samtools view -bS -@ 5 | samtools sort > $WORK_DIR/remake_21.11.23/align/${file}/${file}_raw.sorted.bam
##create index
samtools index $WORK_DIR/remake_21.11.23/align/${file}/${file}_raw.sorted.bam > $WORK_DIR/align/${file}/${file}_raw.sorted.bam.bai;
done
