matthewwiese / apple-phg

A Practical Haplotype Graph (PHG) for apple (Malus domestica)
https://haplotype.net/apple-phg
1 stars 0 forks source link

Cannot invoke "java.util.Map$Entry.getValue()" because "overlappingEntry" is null #2

Closed matthewwiese closed 8 months ago

matthewwiese commented 1 year ago

When attempting to load haplotypes the following error is encountered:

[DefaultDispatcher-worker-1] INFO net.maizegenetics.pangenome.db_loading.LoadHaplotypesFromGVCFPlugin - Attempting to create GVCF Sequence for ./gvcf/input/ASM411538v1.gvcf.gz
[DefaultDispatcher-worker-1] INFO net.maizegenetics.pangenome.db_loading.LoadHaplotypesFromGVCFPlugin - Done setting up variables for file ./gvcf/input/ASM411538v1.gvcf.gz. Moving on to processing reference ranges.
[DefaultDispatcher-worker-1] DEBUG net.maizegenetics.pangenome.fastaExtraction.GVCFSequence - Cannot invoke "java.util.Map$Entry.getValue()" because "overlappingEntry" is null
java.lang.NullPointerException: Cannot invoke "java.util.Map$Entry.getValue()" because "overlappingEntry" is null
        at net.maizegenetics.pangenome.fastaExtraction.GVCFSequence.addRange(GVCFSequence.java:374)
        at net.maizegenetics.pangenome.fastaExtraction.GVCFSequence.parseVariantInfosIntoRangeMap(GVCFSequence.java:331)
        at net.maizegenetics.pangenome.fastaExtraction.GVCFSequence.<init>(GVCFSequence.java:98)
        at net.maizegenetics.pangenome.fastaExtraction.GVCFSequence.instance(GVCFSequence.java:150)
        at net.maizegenetics.pangenome.db_loading.LoadHaplotypesFromGVCFPlugin$processKeyFileEntry$2.invokeSuspend(LoadHaplotypesFromGVCFPlugin.kt:589)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
[pool-1-thread-1] DEBUG net.maizegenetics.pangenome.db_loading.LoadHaplotypesFromGVCFPlugin - GVCFSequence parseVariantContextsIntoRangeMap error converting List<GenotypeTable> to RangeMap
[pool-1-thread-1] DEBUG net.maizegenetics.plugindef.AbstractPlugin - Error writing to the DB:
java.lang.IllegalStateException: Error writing to the DB:
        at net.maizegenetics.pangenome.db_loading.LoadHaplotypesFromGVCFPlugin.processData(LoadHaplotypesFromGVCFPlugin.kt:253)
        at net.maizegenetics.plugindef.AbstractPlugin.performFunction(AbstractPlugin.java:111)
        at net.maizegenetics.plugindef.AbstractPlugin.dataSetReturned(AbstractPlugin.java:2017)
        at net.maizegenetics.plugindef.ThreadedPluginListener.run(ThreadedPluginListener.java:29)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalStateException: GVCFSequence parseVariantContextsIntoRangeMap error converting List<GenotypeTable> to RangeMap
        at net.maizegenetics.pangenome.fastaExtraction.GVCFSequence.parseVariantInfosIntoRangeMap(GVCFSequence.java:344)
        at net.maizegenetics.pangenome.fastaExtraction.GVCFSequence.<init>(GVCFSequence.java:98)
        at net.maizegenetics.pangenome.fastaExtraction.GVCFSequence.instance(GVCFSequence.java:150)
        at net.maizegenetics.pangenome.db_loading.LoadHaplotypesFromGVCFPlugin$processKeyFileEntry$2.invokeSuspend(LoadHaplotypesFromGVCFPlugin.kt:589)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
matthewwiese commented 11 months ago

While debugging this I discovered that the reference_ranges table of the database was empty after following my null values back to phg.getIntervalRangesWithIDForChrom("all") (this line in source).

This was solved by adding the missing outputDir parameter (required by LoadAllIntervalsToPHGdbPlugin during the execution of MakeInitialPHGDBPipelinePlugin): https://github.com/matthewwiese/apple-phg/commit/f0da69bb9fdc4d8e10287c4cc6aa30205c84be55

However, this was ultimately not the cause of why overlappingEntry is null.

matthewwiese commented 8 months ago

Closing as no longer relevant - this project will transition to PHG version 2.