Merging bam files with GATK
1
0
Entering edit mode
3.9 years ago
gubrins ▴ 290

Good afternoon, I'm trying to merge two bam files, one mapped and another unmapped, with gatk (MergeBamAlignment) but I keep having this error all the time:

Inappropriate call if not paired read

Does anybody know why? I found this post (https://gatkforums.broadinstitute.org/gatk/discussion/12259/mergebamalignment-problem) where the user have the same type of problem, but changing the alignment solves it but unluckily I can't do that. When I run ValidateSamFile from Picard, I don't have any errors for both bam files.

Any help is appreaciate it! Thanks in advance!

gatk bam merge • 1.9k views
ADD COMMENT
1
Entering edit mode

is there a java error stackrace associated with this error ?

ADD REPLY
0
Entering edit mode

This is the whole message:

WARNING 2020-05-11 02:35:49 SamAlignmentMerger  Exception merging bam alignment - attempting to sort aligned reads and try again: Inappropriate call if not paired read

And then I get this:

Exception in thread "main" java.lang.IllegalStateException: Inappropriate call if not paired read
    at htsjdk.samtools.SAMRecord.requireReadPaired(SAMRecord.java:893)
    at htsjdk.samtools.SAMRecord.getProperPairFlag(SAMRecord.java:901)
    at picard.sam.AbstractAlignmentMerger.setValuesFromAlignment(AbstractAlignmentMerger.java:839)
    at picard.sam.AbstractAlignmentMerger.transferAlignmentInfoToFragment(AbstractAlignmentMerger.java:666)
    at picard.sam.AbstractAlignmentMerger.transferAlignmentInfoToPairedRead(AbstractAlignmentMerger.java:739)
    at picard.sam.AbstractAlignmentMerger.mergeAlignment(AbstractAlignmentMerger.java:467)
    at picard.sam.SamAlignmentMerger.mergeAlignment(SamAlignmentMerger.java:186)
    at picard.sam.MergeBamAlignment.doWork(MergeBamAlignment.java:358)
    at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:305)
    at picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:103)
    at picard.cmdline.PicardCommandLine.main(PicardCommandLine.java:113)
ADD REPLY
0
Entering edit mode

Yes, I sorted the data of both files by queryname using Picard

ADD REPLY
3
Entering edit mode
3.9 years ago

My guess is that you have some sam records with the sam flag PROPER_PAIR WITHOUT the flag PAIRED_READ.

Test my hypothesis with :

samtools view -b -f 2 src/test/resources/S1.bam |  samtools view  -F 1

the output of a valid BAM should be empty

ADD COMMENT
0
Entering edit mode

I redid all the pipeline and now it worked! Thanks for your help, I imagine I was quite tired yesterday night and I did some type of mistake

ADD REPLY

Login before adding your answer.

Traffic: 1826 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