diff --git a/README b/README index 187232f..6dea733 100755 --- a/README +++ b/README @@ -16,6 +16,7 @@ R packages (HiddenMarkov 1.3-1, zoo 1.6-2, R.methodsS3 1.2.0 and R.oo 1.7.3) ### Installation instructions ### git clone git://github.com/JaneliaSciComp/msg.git cd msg +copy or link version 0.1.9 of samtools into the msg directory make ### Toy Example ### diff --git a/make-pileups.sh b/make-pileups.sh index 22b9e48..f870165 100755 --- a/make-pileups.sh +++ b/make-pileups.sh @@ -17,6 +17,8 @@ true=0 false="false" all=$false +script_dir=$(dirname $0) + while getopts "ai:d:p:q:" opt do @@ -44,19 +46,19 @@ species=par1 file=$dir/aln_${indiv}_${species}-filtered echo "$file" -[ -e $parent1.fai ] || samtools faidx $parent1 +[ -e $parent1.fai ] || $script_dir/samtools faidx $parent1 [ -e $file-sorted.bam ] || { echo "samtools view -bt $parent1.fai $file.sam | samtools sort - $file-sorted" - samtools view -bt $parent1.fai $file.sam | samtools sort - $file-sorted + $script_dir/samtools view -bt $parent1.fai $file.sam | $script_dir/samtools sort - $file-sorted } -[ -e $file-sorted.bam.bai ] || samtools index $file-sorted.bam +[ -e $file-sorted.bam.bai ] || $script_dir/samtools index $file-sorted.bam for ref in $refs ; do [ -e $file-$ref-sorted.pileup ] || { echo "Making pileup for $species contig $ref" - samtools view -bu $file-sorted.bam $ref | samtools sort - $file-$ref-sorted - samtools index $file-$ref-sorted.bam - samtools pileup -cf $parent1 $file-$ref-sorted.bam > $file-$ref-sorted.pileup + $script_dir/samtools view -bu $file-sorted.bam $ref | samtools sort - $file-$ref-sorted + $script_dir/samtools index $file-$ref-sorted.bam + $script_dir/samtools pileup -cf $parent1 $file-$ref-sorted.bam > $file-$ref-sorted.pileup rm $file-$ref-sorted.bam $file-$ref-sorted.bam.bai } done diff --git a/msg.pl b/msg.pl index 8683a37..548b1e2 100755 --- a/msg.pl +++ b/msg.pl @@ -16,8 +16,8 @@ sub system_call { GetOptions( 'barcodes|b=s' => \$barcodes, - 're_cutter=s' => \$re_cutter, - 'linker_system=s' => \$linker_system, + 're_cutter=s' => \$re_cutter, + 'linker_system=s' => \$linker_system, 'reads|i=s' => \$raw_read_data, 'update|u' => \$update_genomes, 'parent1=s' => \$parent1_genome, @@ -116,7 +116,7 @@ sub system_call { &system_call("bwa", "index", "-a", $genome_index{$sp}, "$genomes_fa{$sp}.msg") unless( -e "$genomes_fa{$sp}.msg.bwt" and -e "$genomes_fa{$sp}.msg.ann" ); - &system_call("samtools", "faidx", "$genomes_fa{$sp}.msg") ; + &system_call("$src/samtools", "faidx", "$genomes_fa{$sp}.msg") ; unless (-e "$out.sam") { &system_call("bwa", "aln", "-t", $update_nthreads, "$genomes_fa{$sp}.msg", $reads_for_updating_fq{$sp}, "> $out.sai") ; @@ -125,10 +125,10 @@ sub system_call { &system_call("$src/filter-sam.py", "-i", "$out.sam", "-o", "$out.filtered.sam") ; - &system_call("samtools", "view", "-bt", "$genomes{$sp}.msg.fai", "-o $out.bam", "$out.filtered.sam") ; - &system_call("samtools", "sort", "$out.bam", "$out.bam.sorted") ; - &system_call("samtools", "index", "$out.bam.sorted.bam") ; - &system_call("samtools", "pileup", "-f", "$genomes_fa{$sp}.msg", "$out.bam.sorted.bam", "-c", "> $out.pileup") ; + &system_call("$src/samtools", "view", "-bt", "$genomes{$sp}.msg.fai", "-o $out.bam", "$out.filtered.sam") ; + &system_call("$src/samtools", "sort", "$out.bam", "$out.bam.sorted") ; + &system_call("$src/samtools", "index", "$out.bam.sorted.bam") ; + &system_call("$src/samtools", "pileup", "-f", "$genomes_fa{$sp}.msg", "$out.bam.sorted.bam", "-c", "> $out.pileup") ; } diff --git a/test_dependencies_executable.sh b/test_dependencies_executable.sh index e8b5029..966970d 100644 --- a/test_dependencies_executable.sh +++ b/test_dependencies_executable.sh @@ -20,9 +20,15 @@ if ! which bwa >/dev/null 2>/dev/null ; then exit 1 fi -if ! which samtools >/dev/null 2>/dev/null ; then - echo "Please install samtools somewhere in your PATH" - exit 1 +samtools_required_version="Version: 0.1.9 (r783)" +if ! [ -e $(dirname $0)/samtools ] ; then + echo "Please install samtools ($samtools_required_version) within the msg directory" + exit 1 +fi +samtools_version=`$(dirname $0)/samtools 2>&1 | grep 'Version:'` +if [ "$samtools_version" != "$samtools_required_version" ] ; then + echo "The samtools found within the msg directory is $samtools_version. It must be $samtools_required_version" + exit 1 fi echo "All required executables found in PATH"