FelixHeinrich / MIDESP

Mutual information based detection of epistatic SNP pairs
GNU General Public License v3.0
3 stars 2 forks source link

index out of bounds error #1

Closed raqueldias closed 9 months ago

raqueldias commented 9 months ago

Hi, I'm trying to use MIDESP v1.2 on UK Biobank data, but I get the following error. Any clues on what can be causing this?

java -jar ~/bin/MIDESP_1.2.jar MI_input_c22_b0_v3.tped ukb22828_c22_CeliacPheno.tfam Reading data from files Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484) at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:542) at java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:567) at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:670) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateParallel(ReduceOps.java:927) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) at midesp.objects.SNP.readTPed(SNP.java:110) at midesp.Main.execMIDESP(Main.java:71) at midesp.Main.main(Main.java:45) Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at midesp.objects.SNP.lambda$0(SNP.java:97) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1006) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ReduceOps$ReduceTask.doLeaf(ReduceOps.java:960) at java.base/java.util.stream.ReduceOps$ReduceTask.doLeaf(ReduceOps.java:934) at java.base/java.util.stream.AbstractTask.compute(AbstractTask.java:327) at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:754) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

raqueldias commented 9 months ago

The same error happens in the tuberculosis dataset you provided:

$plink --allow-no-sex --cow --out Tuberculosis_Filtered_Pruned --recode transpose --bfile Tuberculosis_Filtered_Pruned PLINK v2.00a5LM AVX2 Intel (7 Jul 2023) www.cog-genomics.org/plink/2.0/ (C) 2005-2023 Shaun Purcell, Christopher Chang GNU General Public License v3 Logging to Tuberculosis_Filtered_Pruned.log. Options in effect: --allow-no-sex --bfile Tuberculosis_Filtered_Pruned --cow --export transpose --out Tuberculosis_Filtered_Pruned

Start time: Mon Feb 12 11:43:21 2024 Note: --allow-no-sex no longer has any effect. (Missing-sex samples are automatically excluded from association analysis when sex is a covariate, and treated normally otherwise.) 514740 MiB RAM detected, ~362404 available; reserving 257370 MiB for main workspace. Using up to 64 threads (change this with --threads). 1151 samples (0 females, 0 males, 1151 ambiguous; 1151 founders) loaded from Tuberculosis_Filtered_Pruned.fam. 358086 variants loaded from Tuberculosis_Filtered_Pruned.bim. 1 binary phenotype loaded (592 cases, 559 controls). Writing Tuberculosis_Filtered_Pruned.tfam ... done. --export tped to Tuberculosis_Filtered_Pruned.tped ... done. End time: Mon Feb 12 11:43:22 2024

$ java -jar ~/bin/MIDESP_1.2.jar Tuberculosis_Filtered_Pruned.tped Tuberculosis_Filtered_Pruned.tfam Reading data from files Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484) at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:542) at java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:567) at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:670) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateParallel(ReduceOps.java:927) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) at midesp.objects.SNP.readTPed(SNP.java:110) at midesp.Main.execMIDESP(Main.java:71) at midesp.Main.main(Main.java:45) Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at midesp.objects.SNP.lambda$0(SNP.java:97) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.nio.file.FileChannelLinesSpliterator.forEachRemaining(FileChannelLinesSpliterator.java:133) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ReduceOps$ReduceTask.doLeaf(ReduceOps.java:960) at java.base/java.util.stream.ReduceOps$ReduceTask.doLeaf(ReduceOps.java:934) at java.base/java.util.stream.AbstractTask.compute(AbstractTask.java:327) at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:754) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

FelixHeinrich commented 9 months ago

Hi, the cause of this error is the PLINK version that you are using. When I wrote this program I used PLINK v1.9 for my data. The new version of PLINK v2 changes the default separator in the .tped/.tfam files from single space to tabulator. https://github.com/FelixHeinrich/MIDESP/blob/0d2c4c4ad2a97a79fdeb55a35c10ce1ee2db9b1a/src/midesp/objects/SNP.java#L96 Since my program is splitting on a single space it will fail if another separator is used. I'm not sure yet if I will change my code to be more flexible in this regard since it would lead to a reduced performance while reading the files. In the meantime you can use the PLINK option 'spaces' to change the separator back to a single space: ./plink2 --allow-no-sex --cow --out Tuberculosis_Filtered_Pruned --recode transpose 'spaces' --bfile Tuberculosis_Filtered_Pruned

raqueldias commented 9 months ago

Thank you so much for your response. Switching to plink1.9 solved the issue.