brentp / vcfanno

annotate a VCF with other VCFs/BEDs/tabixed files
https://genomebiology.biomedcentral.com/articles/10.1186/s13059-016-0973-5
MIT License
365 stars 56 forks source link

'Index out of range' does not point to exact annotation #56

Open sergiigladchuk opened 7 years ago

sergiigladchuk commented 7 years ago

vcfanno version 0.2.3 [built with go1.8] In case of having wrong column index in [[annotation]] like:

[[annotation]]
file="data/radar/radar_hg38_v2_sorted.bed.gz"
columns=[5]
names=["radar"]
ops=["uniq"]

,where 5 is more than I have in my .bed file. The error message:

panic: runtime error: index out of range

goroutine 75 [running]:
github.com/brentp/vcfanno/api.collect(0x7f2faa27e468, 0xc4201ddb90, 0xc422339160, 0x1, 0x1, 0xc420018a00, 0x1, 0x0, 0x1, 0x115a3c24b66, ...)
    /home/brentp/go/src/github.com/brentp/vcfanno/api/api.go:309 +0x171c
github.com/brentp/vcfanno/api.(*Annotator).AnnotateOne(0xc42001acc0, 0x92d4e0, 0xc4201ddb90, 0x3a2c01, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/brentp/go/src/github.com/brentp/vcfanno/api/api.go:399 +0x1ed
github.com/brentp/vcfanno/api.(*Annotator).AnnotateEnds(0xc42001acc0, 0x92d4e0, 0xc4201ddb90, 0x0, 0x0, 0x0, 0x0)
    /home/brentp/go/src/github.com/brentp/vcfanno/api/api.go:734 +0xdda
main.main.func1(0x92d4e0, 0xc4201ddb90)
    /home/brentp/go/src/github.com/brentp/vcfanno/vcfanno.go:154 +0x71
github.com/brentp/irelate.PIRelate.func1.1(0xc42020ef60, 0xc4228c4c80, 0x55, 0x190, 0xc422cb9680)
    /home/brentp/go/src/github.com/brentp/irelate/parallel.go:202 +0x5f
created by github.com/brentp/irelate.PIRelate.func1
    /home/brentp/go/src/github.com/brentp/irelate/parallel.go:207 +0x89

Does not point to exact annotation block which should be either corrected or removed. This would be really helpful in case there are a lot of annotation blocks to review.

brentp commented 7 years ago

hmm, yeah. this is a problem. there are a few places where error messages need improving and I'd like to get that into next release. This one is hard because it's and index error which (as you see) is a panic in go.

I'll try to figure out how to add more info here

huangk3 commented 4 years ago

Hi Brent,

I got this same issue and came across this thread. The same command runs well against the original GRCh37 version of the annotation bed file. Then I used liftOver to convert it from GRCh37 to GRCh38. The error came up when I use the liftover-ed bed file as the annotation source. I'd like to ask if there is any clue on where the error may comes from? Thanks!

panic: runtime error: index out of range

goroutine 45 [running]:
github.com/brentp/vcfgo.(*Reader).Parse(0xc00137ac00, 0xc001df70a0, 0x9, 0x9, 0x4db24d)
    /home/brentp/go/src/github.com/brentp/vcfgo/reader.go:223 +0xae5
github.com/brentp/bix.(*Bix).toPosition(0xc0032cf0e0, 0xc001df70a0, 0x9, 0x9, 0x101, 0x0)
    /home/brentp/go/src/github.com/brentp/bix/bix.go:204 +0x77
github.com/brentp/bix.bixerator.Next(0x88cd40, 0xc003778e70, 0xc0032cf2c0, 0xc0032cf0e0, 0x88f900, 0xc0031772c0, 0xf, 0xb346c0, 0x0, 0xc0000cb620)
    /home/brentp/go/src/github.com/brentp/bix/bix.go:342 +0x11c
github.com/brentp/irelate.newMerger(0x81ecc8, 0x0, 0xc003177280, 0x2, 0x2, 0x55e780)
    /home/brentp/go/src/github.com/brentp/irelate/irelate.go:235 +0x12e
github.com/brentp/irelate.IRelate(0x81ecc0, 0x0, 0x81ecc8, 0xc003177280, 0x2, 0x2, 0x10000, 0x10000)
    /home/brentp/go/src/github.com/brentp/irelate/irelate.go:143 +0x5d
github.com/brentp/irelate.PIRelate.func3.1(0xc003746300, 0x81ec90, 0xc0032aa120, 0xc003177280, 0x2, 0x2)
    /home/brentp/go/src/github.com/brentp/irelate/parallel.go:245 +0x7b
created by github.com/brentp/irelate.PIRelate.func3
    /home/brentp/go/src/github.com/brentp/irelate/parallel.go:242 +0x10f 
brentp commented 4 years ago

can you show the relevant parts of your config and a few lines of your bed file?

huangk3 commented 4 years ago

The bed file actually has some malformatted lines with fewer columns than expected. The error is fixed after I regenerated the bed file. Sorry about the mistake and thanks!