Skip to content

Commit

Permalink
do a repetitive GapClose & SSpace scaffolding to improve a soap assse…
Browse files Browse the repository at this point in the history
…mbly
  • Loading branch information
mfiers committed May 25, 2012
1 parent e4acab4 commit 533abc3
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 0 deletions.
85 changes: 85 additions & 0 deletions template2/soapdenovo_postprocess.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
### run

echo "Prepare the SSPace library file"
echo "" > sspace.config
libname=""
libcount=0
while read line
do
if [[ $line == \[* ]]; then
if [[ -n "$libname" ]];
then
echo $libname $fq1 $fq2 $insert 0.25 FR >> sspace.config
fi
let libcount+=1
libname=`echo $line | sed 's/[^[:alnum:]]//g'`$libcount
elif [[ $line == q1* ]]; then
fq1=`echo -n $line | sed "s/q1=//"`
elif [[ $line == q2* ]]; then
fq2=`echo -n $line | sed "s/q2=//"`
elif [[ $line == avg_ins* ]]; then
insert=`echo -n $line | sed "s/avg_ins=//"`
fi
done < {{ soapdir }}/soap.config

if [[ -n "$libname" ]];
then
echo $libname $fq1 $fq2 $insert 0.25 FR >> sspace.config
fi


echo "Start iterating"

lastScaff={{ soapdir }}/output.scafSeq

[[ -f before.stats ]] || \
fastaInfo -s -i $lastScaff length ncount > before.stats

counter=0
for x in `seq 1 {{ noruns }}`; do
let counter+=1

newScaff="output.scafSeq.gap.$x"

echo "GapCloser run $x"
if [[ -f $newScaff ]]
then
echo "Skipping $newScaff - file exists"
else
time GapCloser -a $lastScaff \
-b {{ soapdir }}/soap.config \
-t {{ threads }} \
-o $newScaff > gapcloser.${x}.report \
|| true
fi

lastScaff=$newScaff
newScaff="output.scafSeq.scaf.$x.final.scaffolds.fasta"

echo "Scaffolder run $x"
if [[ -f "$newScaff" ]]
then
echo "Skipping $newScaff - file exists"
else
time {{ sspace_executable }} \
-l sspace.config \
-s ${lastScaff} \
-b output.scafSeq.scaf.$x \
{{ sspace_extra_variables }} \
-x 1 -T {{ threads }} -p 1 > sspace.${x}.output \
|| true
fastaInfo -s -i $newScaff length ncount > $newScaff.stats
fi
lastScaff=$newScaff
done

echo "Run gapcloser one last time"
echo "on $lastScaff"

GapCloser -a $lastScaff \
-b {{ soapdir }}/soap.config \
-t {{ threads }} \
-o output.final.fasta \
> gapcloser.final.report || true

fastaInfo -s -i output.final.fasta length ncount > output.final.stats
33 changes: 33 additions & 0 deletions template2/soapdenovo_postprocess.moa
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
author: Mark Fiers
backend: ruff
commands:
run:
help: 'Postprocess - run GapCloser & SSpace'
mode: simple
creation_date: Mon, 21 Nov 2011 12:47:16
description: Run Soapdenovo
moa_id: soapdenovo_postprocess
modification_date: Mon, 21 Nov 2011 12:47:22
name: soapdenovo_postprocess
parameters:
soapdir:
help: directory where soap ran
optional: false
threads:
default: 8
help: 'no threads to use'
optional: true
type: integer
noruns:
default: 2
help: 'no times to run gapcloser & SSPace'
type: integer
optional: true
sspace_executable:
default: SSPACE_Basic_v2.0.pl
optional: true
help: SSPace executable
sspace_extra_variables:
default: ''
optional: true
help: Extra variables to pass to Sspace

0 comments on commit 533abc3

Please sign in to comment.