https://github.com/arjunrajlaboratory/RajLabSeqTools
Revision c8f87f9522de6de5f612a588270bc22857f78cf5 authored by Arjun Raj on 29 December 2014, 18:53:29 UTC, committed by Arjun Raj on 29 December 2014, 18:53:29 UTC
1 parent 30d379c
Raw File
Tip revision: c8f87f9522de6de5f612a588270bc22857f78cf5 authored by Arjun Raj on 29 December 2014, 18:53:29 UTC
Fixed STARFLAGS so that it passes along multiple arguments.
Tip revision: c8f87f9
unzipAndConcatenateZippedFastq.sh
#!/bin/bash

ZIPFILEDIRECTORY=$1

OUTFASTADIRECTORY=$2

for dirname in $ZIPFIELDIRECTORY/* ; do
    cd $dirname

    INPUT=`ls *001_R1*`
    SAMPLE=${INPUT%%_*}  # Cuts filename string after first '_'

    if [ ! -d $OUTFASTADIRECTORY/raw ]; then
        mkdir $OUTFASTADIRECTORY/raw
    fi

    if [ ! -d $OUTFASTADIRECTORY/raw/$SAMPLE ]; then
        mkdir $OUTFASTADIRECTORY/raw/$SAMPLE
    fi

    for i in *.gz; do
        gunzip -c $i > ${i%.*}
    done

    FASTQR1=${SAMPLE}_R1.fastq
    FASTQR2=${SAMPLE}_R2.fastq

    cat *R1*fastq > $OUTFASTADIRECTORY/raw/$SAMPLE/$FASTQR1
    cat *R2*fastq > $OUTFASTADIRECTORY/raw/$SAMPLE/$FASTQR2

done

back to top