summaryrefslogtreecommitdiff
blob: cb7dfb08a84d3dc16933e20fc33315fee70e1abd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Hello,

I see Shaun Jackmans' (abyss-)sam2afg script is available within the 
Amos source repository. I find this very useful for coercing output from 
assemblers which which don't track read location into amos by remapping 
reads against the assembly and converting to afg - not ideal but better 
than nothing when you don't have the 'real' read locations to work with.

This fails, however when reads are aligned with 'bwa mem', which can 
output multi-part alignments. sam2afg checks for reuse of the same read 
id (presumably to prevent the generation of non-unique eid values), 
consequently encountering multiple alignments for a read causes it to die.

The following one-line patch allows sam2afg to skip these secondary 
alignments present in 'bwa mem' output, provided bwa mem has been run 
with the '-M' argument which sets the SAM 'secondary alignment' flag on 
the alignments in question.

Hopefully this will also be of use to others...

Best Regards,
James

-- 
Dr. James Abbott
Lead Bioinformatician
Bioinformatics Support Service
Imperial College, London


--- abyss-1.3.6/bin/abyss-samtoafg.ori	2015-05-23 23:43:46.797747928 +0200
+++ abyss-1.3.6/bin/abyss-samtoafg	2015-05-23 23:44:09.227747743 +0200
@@ -105,6 +105,7 @@
 	die unless defined $qqual;
 
 	$tstart--; # convert to zero-based coordinate
+        next if $flag & 0x100; # secondary alignment
 	$qid .= "/1" if $flag & 0x40; #FREAD1
 	$qid .= "/2" if $flag & 0x80; #FREAD2