Skip to content

Error "htsjdk.samtools.SAMException: Malformed query" in VarDictJava

Polina Bevad edited this page Sep 18, 2018 · 1 revision

The error

You receive the exception with similar text while running VarDictJava:

java.util.concurrent.ExecutionException: htsjdk.samtools.SAMException: Malformed query; start point 27662 lies after end point 0 at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at com.astrazeneca.vardict.VarDict.ampVardictParallel(VarDict.java:5595) at com.astrazeneca.vardict.VarDict.start(VarDict.java:86) at com.astrazeneca.vardict.Main.run(Main.java:134) at com.astrazeneca.vardict.Main.main(Main.java:25) Caused by: htsjdk.samtools.SAMException: Malformed query; start point 27662 lies after end point 0 at htsjdk.samtools.reference.IndexedFastaSequenceFile.getSubsequenceAt(IndexedFastaSequenceFile.java:215) at com.astrazeneca.vardict.VarDict.retriveSubSeq(VarDict.java:1056) at com.astrazeneca.vardict.VarDict.getREF(VarDict.java:3258) at com.astrazeneca.vardict.VarDict$ToVarsWorker.call(VarDict.java:5441) at com.astrazeneca.vardict.VarDict$AmpVardictWorker.call(VarDict.java:5525) at com.astrazeneca.vardict.VarDict$AmpVardictWorker.call(VarDict.java:5506) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

The reason

It often appears when you use wrong fasta or BED file (or you choose the wrong region with -R option). Particularly it occurs when end of region in BED is more then the FASTA chromosome end.

The one case is that FASTA file you specify in the command line must be the one the BAM was aligned to.

Another case is that BED file must not contain regions that aren't presented in FASTA file. If FASTA is hg19, then BED file must contain only the regions from hg19. Otherwise, the error will appear when the program will try to read part of FASTA that don't exist in it.