My aim was to run freebayes on my .bam files generated with bwa, but I got the error:
Error: cannot construct subsequence with negative offset or length < 1(attempting start = 66 and length = -8)
So I think there is something wrong with my .bam file. The output of ValidateSamFile.jar from picard is like this:
ERROR: Read groups is empty
ERROR: Record 42921, Read name SRR033861.69041, CIGAR M operator maps off end of reference
ERROR: Record 42922, Read name SRR033861.809038, CIGAR M operator maps off end of reference
ERROR: Record 42923, Read name SRR033861.607221, CIGAR M operator maps off end of reference
ERROR: Record 42949, Read name SRR033861.481003, CIGAR M operator maps off end of reference
...
I have tried to filter this reads out with samtools view -f 0x200 myfile.bam
to filter out reads not passing quality controls, but there is no read with this flag.
Is there any tool to filter out this violation of the .bam file? Or you know the reason for the Error message?
Thank you for your efforts in advance
Phil
Can you please share. how did you fix this ?