seppinho / nft-vcf

nf-test plugin to provide support for VCF files.
MIT License
4 stars 1 forks source link

java.io.IOException: Index 9 out of bounds for length 8 - suggestion for clearer error message #9

Open ToonRosseel opened 1 month ago

ToonRosseel commented 1 month ago

Hi, I used path("file.vcf.gz").vcf.variantsMD5 on some VCF's with an empty VCF FORMAT field. The only error message I got was java.io.IOException: Index 9 out of bounds for length 8. It would be nice to include a clearer error message as it took me a while to figure out what the cause was :pray:

seppinho commented 1 month ago

Hi, Thanks! Can you please share the file with me? The following content did work for me:

#CHROM  POS     ID      REF     ALT     QUAL    FILTER  INFO
1       240001049       .       A       G       .       .       . 

Best. Sebastian

ToonRosseel commented 1 month ago

Hi Sebastian, the content was something like this:

#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  Sample
21  6164734 chr21:6164734-61992510  .   <DEL>   .   .   SVTYPE=DEL;END=6199251;BF=5.5;NEXONS=2;READSEXP=296;READSOBS=15;READRATIO=0.0507;EXONSENS=DOP1B_2,DOP1B_3       

So with an empty (even no ".") format field. All the best, Toon

seppinho commented 1 month ago

I created a file from this line and it worked for me.

    test("variantsmd5") {

        when {
          process {
          """
          input[0] = file("${projectDir}/tests/data/invalid/test.vcf.gz")
          """
          }
        }

        then {
          def filename = process.out.vcf.get(0)
              with(path(filename).vcf) {
            assert snapshot(
              variantsMD5
            ).match()
            }
        }   
    }