Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -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 ###
Expand Down
14 changes: 8 additions & 6 deletions make-pileups.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ true=0
false="false"

all=$false
script_dir=$(dirname $0)


while getopts "ai:d:p:q:" opt
do
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions msg.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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") ;
Expand All @@ -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") ;

}

Expand Down
12 changes: 9 additions & 3 deletions test_dependencies_executable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down