Skip to content

Instantly share code, notes, and snippets.

@seandavi
Created June 13, 2011 13:17
Show Gist options
  • Save seandavi/1022747 to your computer and use it in GitHub Desktop.
Save seandavi/1022747 to your computer and use it in GitHub Desktop.
Call varScan using named pipes (fifos)
#!/bin/bash
#
# Author: Sean Davis <[email protected]>
#
# Uses named pipes (FIFO) to reduce storage needs
# to call varscan somatic
# Some details may need to be edited to meet particular needs
# call with the following parameters
# 1) The FASTA file containing the reference genome
# 2) The Normal bam file
# 3) The tumor bam file
# 4) The output file prefix
# Outputs the varscan snp and indel files as well as the somatic-processed files
REFFILE=$1
TUMORBAM=$3
NORMALBAM=$2
OUTFILE=$4
mkdir -p /scratch/sedavis
mkfifo /scratch/sedavis/${TUMORBAM}.fifo
mkfifo /scratch/sedavis/${NORMALBAM}.fifo
/usr/local/samtools/samtools mpileup -f $REFFILE -q 5 -L 10000 -d 10000 ${TUMORBAM} > /scratch/sedavis/${TUMORBAM}.fifo &
/usr/local/samtools/samtools mpileup -f $REFFILE -q 5 -L 10000 -d 10000 ${NORMALBAM} > /scratch/sedavis/${NORMALBAM}.fifo &
java -jar /data/sedavis/usr/local/jars/VarScan.v2.2.5.jar somatic /scratch/sedavis/${NORMALBAM}.fifo /scratch/sedavis/${TUMORBAM}.fifo ${OUTFILE}
rm /scratch/sedavis/${TUMORBAM}.fifo
rm /scratch/sedavis/${NORMALBAM}.fifo
java -jar /data/sedavis/usr/local/jars/VarScan.v2.2.5.jar processSomatic ${OUTFILE}.snp
java -jar /data/sedavis/usr/local/jars/VarScan.v2.2.5.jar processSomatic ${OUTFILE}.indel
@meraj1
Copy link

meraj1 commented Jun 13, 2011

This is a really good and neat way of running varscan. very impressive..!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment