diff --git a/Adapting_new_script_for_computing_cluster.sh b/Adapting_new_script_for_computing_cluster.sh index 70fd80a..4d7a125 100755 --- a/Adapting_new_script_for_computing_cluster.sh +++ b/Adapting_new_script_for_computing_cluster.sh @@ -33,8 +33,23 @@ usage() { submit() { mkdir -p $log_dir - for id in $(cd $fastq_dir && ls *.fastq | rev | cut -c 9- | rev | uniq); do - "${MXQSUB[@]}" --stdout "$log_dir/$id.out" "$0" --execute "$id" + shopt -s nullglob + + # input files "blabla_R_1.fastq" , "blabla_R_2.fastq" + # + # --> id "blabla_R" ( "_R" included for historical reasons ) + # --> f1 "blabla_R_1.fastq" + # --> f2 "blabla_R_2.fastq" + # + for f1 in $fastq_dir/*_R_1.fastq; do + id=$(basename ${f1%%_1.fastq})00 + f1=${id}_1.fastq + f2=${id}_2.fastq + if [ ! -e $fastq_dir/$f2 ]; then + echo "no _2.fastq file for $f1" + continue + fi + "${MXQSUB[@]}" --stdout "$log_dir/$id.out" "$0" --execute "$id" "$f1" "$f2" done } @@ -42,6 +57,8 @@ execute() { set -xe id="$1" + f1="$2" + f2="$3" cd $MXQ_JOB_TMPDIR @@ -54,16 +71,16 @@ execute() { : Running FastQC on $id - /project/RNAseq_Mdl_data/Konrad/FastQC/fastqc fastq/${id}_1.fastq --outdir fastqc - /project/RNAseq_Mdl_data/Konrad/FastQC/fastqc fastq/${id}_2.fastq --outdir fastqc + /project/RNAseq_Mdl_data/Konrad/FastQC/fastqc fastq/$f1 --outdir fastqc + /project/RNAseq_Mdl_data/Konrad/FastQC/fastqc fastq/$f2 --outdir fastqc : Trimming $id with trim_galore - prun python3 trim_galore --paired --nextera -j $THREADS fastq/${id}_1.fastq fastq/${id}_2.fastq >> $id.trimmingStats.txt 2>&1 + prun python3 trim_galore --paired --nextera -j $THREADS fastq/$f1.fastq fastq/$f2.fastq >> $id.trimmingStats.txt 2>&1 : Mapping $id with bowtie2 - bowtie2 --very-sensitive-local --no-mixed -p $THREADS --no-discordant --phred33 -I 10 -X 2000 -x $ebwt -1 ${id}_1_val_1.fq -2 ${id}_2_val_2.fq \ + bowtie2 --very-sensitive-local --no-mixed -p $THREADS --no-discordant --phred33 -I 10 -X 2000 -x $ebwt -1 ${f1}_val_1.fq -2 ${f2}_val_2.fq \ -S $id.sam >> $id\.mappingStats.txt 2>&1 : Creating BAM files for $id and filtering for paired and mapped reads @@ -125,8 +142,8 @@ cp dedup_peaks/* $work_dir/dedup_peaks if [ $# = 1 -a "$1" = --submit ]; then submit -elif [ $# = 2 -a "$1" = --execute ]; then - execute "$2" +elif [ $# = 4 -a "$1" = --execute ]; then + execute "$2" "$3" "$4" else usage fi