joiningdata / lollipops

Lollipop-style mutation diagrams for annotating genetic variations.
GNU General Public License v3.0
186 stars 70 forks source link

Cannot produce output .png #44

Closed vwongjun closed 4 years ago

vwongjun commented 4 years ago

I've been trying to output in png but I got the following error message:

Drawing diagram to out.png
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x1c8 pc=0x1265d61]

goroutine 1 [running]:
github.com/golang/freetype/truetype.(*Font).Bounds(0x0, 0xc000000280, 0x200, 0xc0005be000)
    /Users/jeremy/src/github.com/golang/freetype/truetype/truetype.go:364 +0x11
github.com/golang/freetype/truetype.NewFace(0x0, 0xc0000c7820, 0x13691a0, 0x156e580)
    /Users/jeremy/src/github.com/golang/freetype/truetype/face.go:198 +0x2dd
github.com/pbnjay/lollipops/drawing.(*diagram).png(0xc0000102a0, 0x1368b20, 0xc0003de028)
    /Users/jeremy/src/github.com/pbnjay/lollipops/drawing/png.go:72 +0x3af
github.com/pbnjay/lollipops/drawing.(*Settings).DrawPNG(0x154ab80, 0x1368b20, 0xc0003de028, 0x4052000000000000, 0xc000090160, 0x2, 0x2, 0xc0000101e0)
    /Users/jeremy/src/github.com/pbnjay/lollipops/drawing/png.go:58 +0x12f
github.com/pbnjay/lollipops/drawing.DrawPNG(0x1368b20, 0xc0003de028, 0x4052000000000000, 0xc000090160, 0x2, 0x2, 0xc0000101e0)
    /Users/jeremy/src/github.com/pbnjay/lollipops/drawing/png.go:37 +0x83
main.main()
    /Users/jeremy/src/github.com/pbnjay/lollipops/main.go:226 +0x7ef

This is the command line I used: ./lollipops -labels -o=out.png OTOF R1495Ter Gly887Arg

Maybe I'm doing something wrong. Any idea how to fix this?

pbnjay commented 4 years ago

What version of lollipops are you using? v1.5.1 release download or development master? What Operating System are you using?

Also, please paste all of the output from the command, there should be some logging lines above the Drawing diagram to out.png that may also help. I suspect this issue is caused by a missing font which should have been displayed as an error.

vwongjun commented 4 years ago

I'm using lollipops-v1.5.1-mac64 release download, my OS is MacOSX 10.10.5 but I have also been trying to produce a .png output on Ubuntu 18.04.3 and I have the same error.

Here is the complete output from the command I ran on MacOSX:

$ ./lollipops -o=out.png -labels OTOF R1495Ter Gly887Arg
ERROR: Unable to find Arial.ttf - Which is required for accurate font sizing.
       Please use -f=/path/to/arial.ttf or the TrueType (.ttf) font of your choice.
HGNC Symbol:  OTOF
Uniprot/SwissProt Accession:  Q9HC10
Drawing diagram to out.png
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x1c8 pc=0x1265d61]

goroutine 1 [running]:
github.com/golang/freetype/truetype.(*Font).Bounds(0x0, 0xc000000280, 0x200, 0xc00016a000)
    /Users/jeremy/src/github.com/golang/freetype/truetype/truetype.go:364 +0x11
github.com/golang/freetype/truetype.NewFace(0x0, 0xc0000cb820, 0x13691a0, 0x156e580)
    /Users/jeremy/src/github.com/golang/freetype/truetype/face.go:198 +0x2dd
github.com/pbnjay/lollipops/drawing.(*diagram).png(0xc00033e180, 0x1368b20, 0xc00000e028)
    /Users/jeremy/src/github.com/pbnjay/lollipops/drawing/png.go:72 +0x3af
github.com/pbnjay/lollipops/drawing.(*Settings).DrawPNG(0x154ab80, 0x1368b20, 0xc00000e028, 0x4052000000000000, 0xc000096160, 0x2, 0x2, 0xc00033e0c0)
    /Users/jeremy/src/github.com/pbnjay/lollipops/drawing/png.go:58 +0x12f
github.com/pbnjay/lollipops/drawing.DrawPNG(0x1368b20, 0xc00000e028, 0x4052000000000000, 0xc000096160, 0x2, 0x2, 0xc00033e0c0)
    /Users/jeremy/src/github.com/pbnjay/lollipops/drawing/png.go:37 +0x83
main.main()
    /Users/jeremy/src/github.com/pbnjay/lollipops/main.go:226 +0x7ef
pbnjay commented 4 years ago

As I suspected, yes please follow the directions at the top of the output:

   Please use -f=/path/to/arial.ttf or the TrueType (.ttf) font of your choice.

I've pushed a new release which makes this a fatal error, since PNG output needs the font to work: https://github.com/joiningdata/lollipops/releases/latest

vwongjun commented 4 years ago

Thank you for your help.