mirror of
https://github.com/MillironX/sc2-sequencing.git
synced 2024-12-22 03:08:17 +00:00
Make copying script combine fastqs
This commit is contained in:
parent
adce9225b2
commit
798e7693bf
1 changed files with 29 additions and 8 deletions
|
@ -60,16 +60,37 @@ echo "If this is not correct, press CTRL+C within the next 10 seconds to abort..
|
||||||
sleep 10
|
sleep 10
|
||||||
echo "Proceeding..."
|
echo "Proceeding..."
|
||||||
|
|
||||||
|
# Simplify the output paths
|
||||||
|
USBPATH="$USBDRIVE/$FOLDERNAME"
|
||||||
|
FAST5PATH="$USBPATH/fast5"
|
||||||
|
FASTQPATH="$USBPATH/fastq"
|
||||||
|
|
||||||
# Make output directories
|
# Make output directories
|
||||||
mkdir -p "$USBDRIVE/$FOLDERNAME/fast5"
|
mkdir -p "$FAST5PATH"
|
||||||
mkdir -p "$USBDRIVE/$FOLDERNAME/fastq"
|
mkdir -p "$FASTQPATH"
|
||||||
|
|
||||||
# Copy the files
|
# Copy the files
|
||||||
for FASTA in ${KEEPERS[@]}; do
|
for FASTA in ${KEEPERS[@]}; do
|
||||||
cp -n $FOLDERPATH/*/fast5_pass/barcode$FASTA/*.fast5 $USBDRIVE/$FOLDERNAME/fast5 2> /dev/null
|
# Check to see if there are any files here
|
||||||
cp -n $FOLDERPATH/*/fastq_pass/barcode$FASTA/*.fastq $USBDRIVE/$FOLDERNAME/fastq 2> /dev/null
|
if [[ -n $(find $FOLDERPATH -type f \( -name "*.fast5" -o -name "*.fastq" -o -name "*.fastq.gz" \) -path "*_pass*barcode$FASTA*") ]]; then
|
||||||
cp -n $FOLDERPATH/*/fastq_pass/barcode$FASTA/*.fastq.gz $USBDRIVE/$FOLDERNAME/fastq 2> /dev/null
|
# Copy FAST5s
|
||||||
done
|
find $FOLDERPATH -name "*.fast5" -path "*_pass*barcode$FASTA*" -exec cp -n {} $FAST5PATH \;
|
||||||
|
|
||||||
# Make sure we end on a happy note, regardless if there were actually 96 barcodes
|
# Unzip any gzipped fastqs
|
||||||
exit 0
|
find $FOLDERPATH -name "*.fastq.gz" -path "*_pass*barcode$FASTA*" -print0 | xargs -0 -r -L1 -P0 gunzip
|
||||||
|
|
||||||
|
# Get the name of the resulting FASTQ file
|
||||||
|
FASTQRESULT="$FASTQPATH"/"$FOLDERNAME"_pass_barcode"$FASTA".fastq
|
||||||
|
|
||||||
|
# Concatenate the fastqs
|
||||||
|
cat $FOLDERPATH/*/fastq_pass/barcode$FASTA/*.fastq > $FASTQRESULT
|
||||||
|
|
||||||
|
# Zip up the remainders
|
||||||
|
find $FOLDERPATH -name "*.fastq" -path "*_pass*barcode$FASTA*" -print0 | xargs -0 -r -L1 -P0 gzip
|
||||||
|
|
||||||
|
# Zip up the copied fastq
|
||||||
|
gzip $FASTQRESULT
|
||||||
|
else
|
||||||
|
echo "No suitable files found for Barcode $FASTA, skipping"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
Loading…
Reference in a new issue