Skip to content

Commit

Permalink
recursive map uses bowtie2 now
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Fiers committed Aug 2, 2012
1 parent 35cb9ad commit 623463f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
35 changes: 19 additions & 16 deletions template2/recursive_map.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,34 @@ lastreference=$reference
lasti=0

{% for i in range(iterations) %}
{% if i <= (iterations / 2) %}{% set aln_param=param_strict %}
{% else %}{% set aln_param=param_loose %}


{% if i <= (iterations / 2) %}{% set aln_param=param_first %}
{% else %}{% set aln_param=param_second %}
{% endif %}
echo "Iteration {{i}} ---"
echo "With reference: ${reference}"
if [[ ! -f "db.{{i}}.ann" ]]
if [[ ! -f "db.{{i}}.1.bt2" ]]
then
echo "create bwa database {{i}}"
bwa index -p db.{{i}} ${reference}
echo "create bowtie2 database {{i}}"
bowtie2-build ${reference} db.{{i}}
fi

echo "start aligning $i"

bamfiles=""
{% for ffq in fq_forward %}
{% set rfq = fq_reverse[loop.index0] %}
base=`basename {{ ffq }} .fq`
[[ -f "${base}__{{i}}.f.sai" ]] || \
bwa aln {{ aln_param }} -t {{ threads }} \
-f ${base}__{{i}}.f.sai db.{{i}} {{ ffq }}
[[ -f "${base}__{{i}}.r.sai" ]] || \
bwa aln {{ aln_param }} -t {{ threads }} \
-f ${base}__{{i}}.r.sai db.{{i}} {{ rfq }}
[[ -f ${base}__{{i}}.bam ]] || \
bwa sampe db.{{i}} ${base}__{{i}}.f.sai ${base}__{{i}}.r.sai \
{{ ffq }} {{ rfq }} \
| samtools view -Sb -f 2 - \
| samtools sort - ${base}__{{i}}
if [[ ! -f "${base}__{{i}}.bam" ]]
then
echo "start align {{i}} - "
bowtie2 --reorder -p {{ threads }} {{ aln_param }} \
-x db.{{i}} \
-1 {{ ffq }} -2 {{ rfq }} \
| samtools view -Sb -f 2 - \
| samtools sort - ${base}__{{i}}
fi
bamfiles="${bamfiles} ${base}__{{i}}.bam"
{% endfor %}

Expand All @@ -54,7 +55,9 @@ lasti=0
fi

lastreference=$reference

reference=consensus.{{i}}.fasta

lasti={{i}}
{% endfor %}

Expand Down
12 changes: 6 additions & 6 deletions template2/recursive_map.moa
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ parameters:
optional: true
type: integer
default: 4
param_strict:
help: 'Strict parameters for the first half of alignment runs'
param_first:
help: 'First set of parameters - get the low hanging fruit'
optional: true
type: string
default: ''
param_loose:
help: 'Looser parameters for the second half of alignment runs'
default: '--fast'
param_second:
help: 'Second set of parameters - more sensitive'
optional: true
type: string
default: '-e 1 -E 3 -k 3 -O 10'
default: '--very-sensitive'

0 comments on commit 623463f

Please sign in to comment.