#!/bin/bash
#SBATCH --time=20:00:00
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=10
#SBATCH --mem=400000
#change into sample directory

mkdir /scratch/cmp1g20/Neuroblastoma_RNAseq/All_bam_files

cat sampleInfo | while read read1 read2 timepoint treatment sampleID;
do
#change into dir
cd /scratch/cmp1g20/Neuroblastoma_RNAseq/01.RawData/"$sampleID"
#index bam file
samtools index *.bam
#copy bam file into bam file directory
cp ./*.bam /scratch/cmp1g20/Neuroblastoma_RNAseq/All_bam_files
cp ./*.bam.bai /scratch/cmp1g20/Neuroblastoma_RNAseq/All_bam_files
cd ../
done

