Skip to content

Commit

Permalink
Fix default read group to respect SAM spec
Browse files Browse the repository at this point in the history
When using bwameth with bwa >=0.7.16 and not specifying `--read-group`,
I'm getting the error already reported in

brentp#44 (comment)

i.e.:

```
[E::bwa_set_rg] the read group line contained literal <tab> characters -- replace with escaped tabs: \t
Traceback (most recent call last):
  File "/path/bin/bwa-meth-0.10/bwameth.py", line 601, in <module>
    main(sys.argv[1:])
  File "/path/bin/bwa-meth-0.10/bwameth.py", line 586, in main
    set_as_failed=args.set_as_failed)
  File "/path/bwa-meth-0.10/bwameth.py", line 259, in bwa_mem
    as_bam(cmd, fa, prefix, calmd, set_as_failed)
  File "/path/bin/bwa-meth-0.10/bwameth.py", line 293, in as_bam
    raise Exception("bad or empty fastqs")
Exception: bad or empty
```

This is due to the following change in bwa:

lh3/bwa#84
  • Loading branch information
nsoranzo committed Nov 3, 2017
1 parent c839fab commit 3ce128f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bwameth.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def bwa_mem(fa, mfq, extra_args, threads=1, rg=None,
raise BWAMethException("first run bwameth.py index %s" % fa)

if not rg is None and not rg.startswith('@RG'):
rg = '@RG\tID:{rg}\tSM:{rg}'.format(rg=rg)
rg = '@RG\\tID:{rg}\\tSM:{rg}'.format(rg=rg)

# penalize clipping and unpaired. lower penalty on mismatches (-B)
cmd = "|bwa mem -T 40 -B 2 -L 10 -CM "
Expand Down

0 comments on commit 3ce128f

Please sign in to comment.