BWA | SAMtools | GATK debugging help
2
1
Entering edit mode
3 months ago

Hello! I am working on a script for a VCF pipeline.

I currently receive the following error in my bwa step....

line 22: 3354610 Killed bwa mem bwaParts my_lovely_file_trimmed.fq > $bwa_sam

...This is a memory issue that I need to speak to my supervisor about, nonetheless because of this, the SAMtools and GATK commands downstream don't work.

Even though I am dealing with this error early in the pipeline I still want to know if the samtools and GATK syntax is correct, and will work once the memory issue is resolved.

Here is the code

samtools sort $bwa_sam -o $sam_sam
gatk AddOrReplaceReadGroups -I sorted_sam -O GATK_bam -RGLB lib1 --RGPL illumina --RGPU unit1 --RGSM file

If you're well seasoned- like a steak at Gordan Ramsey's restaurants- at these commands, please take a peak for my sanity.

All the best, Gilgy

P.S bwaParts are the amb,ann,bwt,pac,sa files from the bwa index command.

alignment mapping vcf • 775 views
ADD COMMENT
1
Entering edit mode
3 months ago

you should never use AddOrReplaceReadGroups when using bwa, and you avoid to use SAM but BAM. An invocation of bwa could be:

bwa mem  -t <cpus> -R '@RG\tID:<sample>\tSM:<sample>\tPL:ILLUMINA' reference.fa f1.fq.gz f2.fq.gz |\
samtools sort  -m '10G' --threads <cpus2> -o out.bam -O BAM -T tmp -
ADD COMMENT
0
Entering edit mode

Hey Pierre,

How come using AddOrReplaceReadGroups with BWA is discouraged? Also, thank you for the recommendation on using BAM, I will try with .bam files.

edit: Seem to be getting an error that makes no sense.

bwa mem bwaRef my_lovely_file_trimmed.fq > $bwa_bam

returns a 'killed' or 'segmentation fault - core dumped', even at 32 threads & 128G

Meanwhile

bwa mem bwaRef.fa my_lovely_file_trimmed.fq > $bwa_bam 

returns an indexing error.

ADD REPLY
0
Entering edit mode

How come using AddOrReplaceReadGroups with BWA is discouraged?

because read groups should be already set at the beginning with the option '-R' of bwa mem. Using AddOrReplaceReadGroups is an extra time-consumming step.

ADD REPLY
1
Entering edit mode
3 months ago

Hey, if anyones wallowing in a similar error, here are some things that helped.

For the bwa mem command itself, use Pierre's lovely slice of code removes the error but simply hides the BWA software crash inside your file.

Our solution was simply to delete the reference and re-index it.

ADD COMMENT
0
Entering edit mode

Please accept the answer so the question is marked solved on the website. To do that, click on the green check mark on the left side of the answer.

ADD REPLY
0
Entering edit mode

Turns out Pierre that piping removes the error but results in an unusable file! There is no answer for this BWA bug yet, although I can supply my code if you would like to replicate.

ADD REPLY

Login before adding your answer.

Traffic: 1531 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6