broadinstitute / pilon

Pilon is an automated genome assembly improvement and variant detection tool
GNU General Public License v2.0
340 stars 60 forks source link

VCF output exception "Can't fetch base outside region" #4

Closed drifty914 closed 7 years ago

drifty914 commented 8 years ago

I seem to be having an issue when saving VCF output using pilon-1.16 (same error with 1.15) after it finishes running on my genome. Doesn't seem to have any problems outputting a corrected FASTA file (as long as VCF output is not turned on) and it seems to be able to save the first 1499 scaffolds fine but I get the following error when it gets to the 1500th:

Finished processing Scaffold1500:1-98983 Writing Scaffold1500:1-98983 VCF to MyGenomePilon.vcf indel ins 211 10 9 8 Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.simontuffs.onejar.Boot.run(Boot.java:340) at com.simontuffs.onejar.Boot.main(Boot.java:166) Caused by: java.lang.IllegalArgumentException: requirement failed: can't fetch base outside region at scala.Predef$.require(Predef.scala:219) at org.broadinstitute.pilon.GenomeRegion.refBase(GenomeRegion.scala:702) at org.broadinstitute.pilon.Vcf.writeRecord(Vcf.scala:94) at org.broadinstitute.pilon.GenomeRegion$$anonfun$writeVcf$1.apply$mcVI$sp(GenomeRegion.scala:559) at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:166) at org.broadinstitute.pilon.GenomeRegion.writeVcf(GenomeRegion.scala:544) at org.broadinstitute.pilon.GenomeFile$$anonfun$processRegions$6$$anonfun$apply$4.apply(GenomeFile.scala:148) at org.broadinstitute.pilon.GenomeFile$$anonfun$processRegions$6$$anonfun$apply$4.apply(GenomeFile.scala:145) at scala.collection.immutable.List.foreach(List.scala:381) at org.broadinstitute.pilon.GenomeFile$$anonfun$processRegions$6.apply(GenomeFile.scala:145) at org.broadinstitute.pilon.GenomeFile$$anonfun$processRegions$6.apply(GenomeFile.scala:138) at scala.collection.immutable.List.foreach(List.scala:381) at org.broadinstitute.pilon.GenomeFile.processRegions(GenomeFile.scala:138) at org.broadinstitute.pilon.Pilon$.main(Pilon.scala:90) at org.broadinstitute.pilon.Pilon.main(Pilon.scala) ... 6 more

The scaffold (ErrorScaff.zip) joins two contigs with a run of ~5k N's in the middle but there doesn't seem to be any invalid characters or formatting etc. from what I can see.

I'm calling the program with the following: java -Xmx220g -jar ~/pilon-1.16.jar --genome Genome.fasta --frags PairedFrags1 --frags PairedFrags2.bam --frags PairedFrags3.bam --frags PairedFrags4 --frags PairedFrags5.bam --jumps Mates.bam --unpaired Strays.bam --unpaired Corrected_PacBio.bam --variant --diploid --threads 32 --output MyGenomePilon

Full debug output for scaffold: DebugOutput.zip

w1bw commented 8 years ago

Very sorry for taking so long to respond to this. From the stack trace, I can tell what is happening but not why, and I haven't see this failure before.

If you still have the test case around, could you please run with adding the --changes argument and send along the .changes file for this scaffold? You can always run it for that scaffold only using the --targets option. Thanks, and sorry you ran into this issue with Pilon!

mmokrejs commented 8 years ago

Same here but on a contig. The output fasta was incomplete, entries since the problematic entry of were missing.

So I ran it to give you the detailed info, but no way.

... --unpaired contigs.bam --changes --vcf --fix bases --targets 14171 ...

Pilon version 1.16 Mon Dec 7 09:45:45 2015 -0500
Genome: reference.fasta
target file: 14171
Target: 14171:1-8966
Fixing bases
Input genome size: 88910963
Processing 14171:1-8966
unpaired 454Contigs.bam: coverage 112
Total Reads: 14020, Coverage: 112, minDepth: 11
Confirmed 8592 of 8966 bases (95,83%)
Corrected 0 snps; 0 ambiguous bases; 0 small insertions totaling 0 bases; 0 small deletions totaling 0 bases
14171:1-8966 log:
Finished processing 14171:1-8966
Writing 14171:1-8966 VCF to pilon3.vcf
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.simontuffs.onejar.Boot.run(Boot.java:340)
        at com.simontuffs.onejar.Boot.main(Boot.java:166)
Caused by: java.lang.IllegalArgumentException: requirement failed: can't fetch base outside region
        at scala.Predef$.require(Predef.scala:219)
        at org.broadinstitute.pilon.GenomeRegion.refBase(GenomeRegion.scala:702)
        at org.broadinstitute.pilon.Vcf.writeRecord(Vcf.scala:86)
        at org.broadinstitute.pilon.GenomeRegion$$anonfun$writeVcf$1.apply$mcVI$sp(GenomeRegion.scala:559)
        at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:166)
        at org.broadinstitute.pilon.GenomeRegion.writeVcf(GenomeRegion.scala:544)
        at org.broadinstitute.pilon.GenomeFile$$anonfun$processRegions$6$$anonfun$apply$4.apply(GenomeFile.scala:148)
        at org.broadinstitute.pilon.GenomeFile$$anonfun$processRegions$6$$anonfun$apply$4.apply(GenomeFile.scala:145)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at org.broadinstitute.pilon.GenomeFile$$anonfun$processRegions$6.apply(GenomeFile.scala:145)
        at org.broadinstitute.pilon.GenomeFile$$anonfun$processRegions$6.apply(GenomeFile.scala:138)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at org.broadinstitute.pilon.GenomeFile.processRegions(GenomeFile.scala:138)
        at org.broadinstitute.pilon.Pilon$.main(Pilon.scala:90)
        at org.broadinstitute.pilon.Pilon.main(Pilon.scala)
        ... 6 more

Unfortunately, the .vcf, .changes and .fasta files are empty. I ran pilon with --targets 14171 so it should have acted on this one only.