Skip to content

gradebins.sh error with gtdb #28

Description

@michoug

Hi
When running

gradebins.sh ref=myo.fa in=bin_dir gff=my.gff gtdb=gtdbtk_output_dir/ report=out.tsv clade=f

I got this error

Loading myo.gff
Loading tax tree from /scratch/gmichoud/HF_bact/.pixi/envs/default/opt/bbmap-39.81-1/resources//tree.taxtree.gz
6.910 seconds.
Made size map.
Exception in thread "main" java.lang.NullPointerException: Cannot read the array length because "bytes" is null
        at java.base/java.lang.String.<init>(String.java:546)
        at parse.LineParser1.parseString(LineParser1.java:233)
        at bin.GTDBLine.<init>(GTDBLine.java:32)
        at bin.GradeBins.loadGTDBFile(GradeBins.java:1263)
        at bin.GradeBins.loadGTDBDir(GradeBins.java:1238)
        at bin.GradeBins.process(GradeBins.java:346)
        at bin.GradeBins.main(GradeBins.java:66)

An AI agent suggested that the error may be :

Root cause identified via bytecode inspection: the classification field is parsed using the semicolon-delimited LineParser1 (lpsemi) instead of the tab-delimited one (lptab), and lpsemi is never .set() with any bytes before use.

The single-arg constructor GTDBLine(byte[]) builds two parsers:

new LineParser1(9)    // tab-delimited, .set() with the line bytes  → lptab
new LineParser1(59)   // semicolon-delimited, never .set() with anything → lpsemi

The two-arg constructor GTDBLine(LineParser1, LineParser1) then does:

name           = lptab.parseString(0);   // correct
classification = lpsemi.parseString(1);  // BUG — should be lptab.parseString(1)

Since lpsemi was never given any bytes via .set(), its internal bytes array is null, and calling parseString(1) on it triggers the NPE inside String's constructor — unconditionally, on every input line, regardless of content.

Cheers
Greg

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions