Skip to content

Instantly share code, notes, and snippets.

@drio
Created July 27, 2010 14:57
Show Gist options
  • Save drio/492338 to your computer and use it in GitHub Desktop.
Save drio/492338 to your computer and use it in GitHub Desktop.
for testing bfast hybrid
#!/bin/bash
#
set -e
set -x
dist=`pwd`
#fq="$dist/reads/ecoli.reads.fastq"
#fq="$dist/reads/reads.problem_zlib.fastq"
fq="$dist/reads/hybrid.fastq"
ref_h="/stornext/snfs4/next-gen/solid/bf.references/h/hsap.36.1.hg18/hsap_36.1_hg18.fa"
ref_e="$dist/bfast.indexes/ecoli/ecoli.drio.test.fa"
ref_e_s="$dist/bfast.indexes/one.ecoli/ecoli.drio.test.fa"
ref=$ref_e
ref_bwa="/Users/drio/projects/synthetic.pipe/ecoli/bwa.indexes/ecoli.drio.test.fa"
dwg="/Users/drio/projects/bfast_related/dnaa/dwgsim/dwgsim"
dist="/Users/drio/projects/bfast_hybrid/bfast.git"
bbin="$dist/bfast/bfast"
#bbin="/Users/drio/projects/bfast_related/versions/bfast-0.6.4d/bfast/bfast"
# Recompile if necessary
cd $dist
make
#make distclean; sh ./autogen.sh; ./configure ; make ; make check
cd -
# Change to output dir
o_dir=output
mkdir -p $o_dir
cd $o_dir
echo "$bbin"
# Generate reads
$dwg -c -e 0.08 -N 50000 -1 50 -2 25 $ref ./bwa.read1.fastq ./bwa.read2.fastq ./bf.fastq 2> /dev/null > /dev/null
cat bf.fastq | ruby -ne 'BEGIN{i=1}; puts $_ if i <= 4; i = i == 8 ? 1 : i + 1' > ./50.fastq
cat bf.fastq | ruby -ne 'BEGIN{i=1}; puts $_ if i > 4; i = i == 8 ? 1 : i + 1' > ./25.fastq
# Match different modes
echo "Match 50 (BF)"
$bbin match -T/tmp/ -n8 -i1 -A1 -l -f $ref -r 50.fastq > 50.bmf 2> match.50.log
#echo "to bmf (50)"; $bbin bmfconvert -O1 50.bmf &>/dev/null
echo "Match 25 (BF)"
$bbin match -T/tmp/ -n8 -i1 -A1 -l -f $ref -r 25.fastq > 25.bmf 2> match.25.log
#echo "to bmf (25)"; $bbin bmfconvert -O1 25.bmf &>/dev/null
echo "Match 50+25 (BF)"
$bbin match -T/tmp/ -n8 -i1 -A1 -l -f $ref -r bf.fastq > 50_25.bmf 2> match.50_25.log
echo "Match 25 (BWA)"
$bbin bwaaln -c -n3 -t8 $ref_bwa bwa.read2.fastq > bwa.25.bmf 2> match.25.bf-bwa.log
# localalign different modes
echo "Local (hybrid)"
$bbin localalign -A1 -t -f $ref -n 8 -O 50.bmf -T bwa.25.bmf > la.hybrid.baf 2> la.hybrid.log
echo "Local (regular MP)"
$bbin localalign -A1 -t -f $ref -n 8 -m 50_25.bmf > la.50_25.baf 2> la.50_25.log
# PP different modes
echo "pp (hybrid)"
$bbin postprocess -f $ref -i la.hybrid.baf -a 3 -O 1 > out.hybrid.sam 2> post.hybrid.log
echo "pp (regular BF)"
$bbin postprocess -f $ref -i la.50_25.baf -a 3 -O 1 > out.50_25.sam 2> post.50_25.log
# stats
echo "stats (hybrid)"
echo "--------------"
samtools view -b -S out.hybrid.sam > out.hybrid.bam 2>/dev/null
/Users/drio/projects/drd.bio.toolbox/bam.stats.sh -i out.hybrid.bam -e 2 > stats.hybrid.txt 2>/dev/null
cat stats.hybrid.txt
echo "stats (Regular)"
echo "--------------"
samtools view -b -S out.50_25.sam > out.50_25.bam 2>/dev/null
/Users/drio/projects/drd.bio.toolbox/bam.stats.sh -i out.50_25.bam -e 2 > stats.50_25.txt 2>/dev/null
cat stats.50_25.txt
#samtools flagstat out.bam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment