Skip to content

Instantly share code, notes, and snippets.

@molpopgen
Last active August 29, 2015 13:56
Show Gist options
  • Save molpopgen/9126441 to your computer and use it in GitHub Desktop.
Save molpopgen/9126441 to your computer and use it in GitHub Desktop.
Skip intermediate "sai" files via use of implicit pipes when doing paired-end alignment (Linux/bash)
#!sh
#Must be executed with bash shell.
#If sh bwapetrick1.sh fails, then say bash bwapetrick1.sh
#bwa 0.7.5a-r405
#samtools 0.1.19
LEFTREADS=NY42_06_21_2010_54_1.fastq.gz
RIGHTREADS=NY42_06_21_2010_54_2.fastq.gz
REFERENCE=dyak-all-chromosome-r1.3-newnames.fasta
BAMFILEBASE=lane0
#Bam file creation in 1 stop via named pipes
bwa sampe $REFERENCE <(bwa aln -t 16 $REFERENCE $LEFTREADS) <(bwa aln -t 16 $REFERENCE $RIGHTREADS) $LEFTREADS $RIGHTREADS | samtools view -bS - | samtools sort -m 50000000 - $BAMFILEBASE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment