https://github.com/arjunrajlaboratory/RajLabSeqTools
Revision d9be6290d732288cf940aee2b06241427a4dc260 authored by Sydney Shaffer on 11 November 2014, 15:07:01 UTC, committed by Sydney Shaffer on 11 November 2014, 15:07:01 UTC
1 parent e8a5ca5
Raw File
Tip revision: d9be6290d732288cf940aee2b06241427a4dc260 authored by Sydney Shaffer on 11 November 2014, 15:07:01 UTC
added a variable for user name - to make it easier for people to modify this script for their own work
Tip revision: d9be629
unzipAndConcatenateZippedFastq.sh
#!/bin/bash

ZIPFILEDIRECTORY=$1

OUTFASTADIRECTORY=$2

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

    INPUT=`ls *001_R1*`
    SAMPLE=${INPUT%%_*}

    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