monarch-initiative / Squirls

Interpretable prioritization of splice variants in diagnostic next-generation sequencing
https://squirls.readthedocs.io/en/master
Other
15 stars 4 forks source link

Error: java.lang.NullPointerException: null #43

Open kvn95ss opened 2 years ago

kvn95ss commented 2 years ago

Hello,

I tried to run the tool on the test vcf -

java -jar squirls-cli.jar annotate-vcf -d resources example.vcf test_out.vcf

I get the following error -

12:55:30.491 [main] INFO  o.m.squirls.cli.cmd.ProgressReporter - Processed 6 alleles in 0m 0s (647 totalMillis) at 9.27 items/s
12:55:30.514 [main] ERROR o.m.s.c.c.a.AnnotateVcfCommand - Error:
java.lang.NullPointerException: null
        at java.base/java.nio.file.Files.provider(Files.java:101)
        at java.base/java.nio.file.Files.isDirectory(Files.java:2229)
        at org.monarchinitiative.squirls.cli.cmd.AnnotatingSquirlsCommand.prepareOutputOptions(AnnotatingSquirlsCommand.java:143)
        at org.monarchinitiative.squirls.cli.cmd.annotate_vcf.AnnotateVcfCommand.call(AnnotateVcfCommand.java:321)
        at org.monarchinitiative.squirls.cli.cmd.annotate_vcf.AnnotateVcfCommand.call(AnnotateVcfCommand.java:120)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
        at picocli.CommandLine.access$1200(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
        at picocli.CommandLine.execute(CommandLine.java:2058)
        at org.monarchinitiative.squirls.cli.Main.main(Main.java:124)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)

I tried the latest build from github (2.0.1-SNAPSHOT) locally and got a the same error. I even created a docker image and built the jar, but got a different error -

07:28:01.609 [main] INFO  o.m.squirls.cli.cmd.ProgressReporter - Processed 6 alleles in 0m 0s (226 totalMillis) at 26.55 items/s
07:28:01.625 [main] ERROR o.m.s.c.c.a.AnnotateVcfCommand - Error:
java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.getFileSystem()" because "path" is null
        at java.base/java.nio.file.Files.provider(Files.java:105)
        at java.base/java.nio.file.Files.isDirectory(Files.java:2316)
        at org.monarchinitiative.squirls.cli.cmd.AnnotatingSquirlsCommand.prepareOutputOptions(AnnotatingSquirlsCommand.java:143)
        at org.monarchinitiative.squirls.cli.cmd.annotate_vcf.AnnotateVcfCommand.call(AnnotateVcfCommand.java:321)
        at org.monarchinitiative.squirls.cli.cmd.annotate_vcf.AnnotateVcfCommand.call(AnnotateVcfCommand.java:120)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
        at picocli.CommandLine.access$1200(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
        at picocli.CommandLine.execute(CommandLine.java:2058)
        at org.monarchinitiative.squirls.cli.Main.main(Main.java:124)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
kvn95ss commented 2 years ago

EDIT: saw this issue - #37 I think I was facing errors due to this behavior.

It might actually be nice to have something like --out-dir and --out-prefix, where by default, --out-dir is current working directory (NOT the current behavior) and --out-prefix is squirls (part of the current behavior). So, to get the output in current working directory I just have to use -

java -jar squirls-cli.jar annotate-vcf -d resources example.vcf test_out

instead of java -jar squirls-cli.jar annotate-vcf -d resources example.vcf /full/path/test_out

I also admit its nice to have only one CLI argument for output, but that implies the output directory and working directory are the same. Also, in the documentation the wording is as follows -

To annotate variants in the example.vcf file (an example VCF file with 6 variants stored in Squirls repository), run:

$ java -jar squirls-cli.jar annotate-vcf -d $SQUIRLS_DATA example.vcf path/to/output/file

  • -d | --data-directory - path to Squirls data directory
  • path to the VCF file with variants
  • output prefix for the generated files

The last line talks only about the prefix for generated files, and doesn't indicate anything about the directories they should be in. The example provided makes sense only in retrospect.

ielis commented 2 years ago

Hi @kvn95ss , thanks for pointing out the issue. It looks like the succinctness of the current CLI comes at the expense of user-friendliness. I use absolute paths almost everywhere which led me to missing the bug you described above.

The short term fix for the issue is to use an absolute path as part of the prefix. However, for the long term I'll add --out-dir option. If missing, the --out-dir will fall back to the current working directory.

It is not possible to add default value for the output prefix because positional parameters are required. I do not want to remove CLI options at this time but I'll do that in the next major release.

Thanks a lot again & cheers!