@jbr950 posted the command line in question to bio-bwa-help, and the problem turned out to be a mistake in how the script was using bwa's -r option.
Hi, I've aligned some data using BWA, and am now trying to convert from sam to bam and am getting an error. Any ideas how to rectify this? See below for information.
Thanks!
samtools view -bS file.sam > file.bam
[samopen] SAM header is present: 93 sequences. Parse error at line 95: missing colon in auxiliary data Aborted
head -96 file.sam | tail -5
@SQ SN:chrUn_gl000226 LN:15008 @SQ SN:chr18_gl000207_random LN:4262 @RG ID: LB: SM: PL:ILLUMINA D3B4KKQ1:406:H0YE0ADXX:2:1101:1198:2135 89 chr8 124262197 37 101M = 124262197 0 GACATACAGTATTAAACTGGACTGAATATGAGGANAANCTCTAGTGGTCATTAAACCCCCTCAGAAAGTCTAAGATTCAGAATGTCTCCATCATATTAGAA CEEEEEDCADCCDECCCCCCDCDCDC>A>==5,,#5,#>@E?DGGIIGIHIGIIHIIIIHFIIIIIHIGIGIIIHHIIIIIHFCCGIIHGHHDEBDFD@@@ RG:Z: XT:A:U NM:i:2 SM:i:37 AM:i:0 X0:i:1 X1:i:0 XM:i:2 XO:i:0 XG:i:0 MD:Z:34C2G63 D3B4KKQ1:406:H0YE0ADXX:2:1101:1198:2135 181 chr8 124262197 0 * = 124262197 0 NTGCCTTNANNNTTNGAGATGTGATTAAGCTTANAACTTTGACCAAAAATTTTACAGTAAAAATTGTTAGAAATGGGTAAAAAAAAAAAAAAAAAAAAAAC ######################################@3(256CDDC@3C@9+38(/DDCC833(>8(3DC?3CA>/BDDDDFHJJJHHHHHFFFFFC@@ RG:Z:
1 answer
The error message is (not especially clearly!) complaining about the empty RG:Z: tag in your SAM records. This is technically invalid in the current SAM specification (though there is no real reason for disallowing it, and I would mildly advocate for relaxing that), and samtools rejects it.
Unless there is another step in your pipeline setting it, the read group tag is set via bwa's -r option (or -R for bwa mem) and it's not obvious how you've managed to get an empty one. If you show us your bwa command line and the version of bwa you're using, we may be able to figure that out.
Log in to answer this question.
I see you've cross-posted this to the bio-bwa-help mailing list. It'd probably be best to choose one or the other...