异常信息

问题起源于 signalp-4.1 调用 gnuplot 进行画图,在画图的时候提示不支持 png 格式结果:

  1. $ gnuplot
  2. G N U P L O T
  3. Version 5.0 patchlevel 0 last modified 2015-01-01
  4. Copyright (C) 1986-1993, 1998, 2004, 2007-2015
  5. Thomas Williams, Colin Kelley and many others
  6. gnuplot home: http://www.gnuplot.info
  7. faq, bugs, etc: type "help FAQ"
  8. immediate help: type "help" (plot window: hit 'h')
  9. Terminal type set to 'x11'
  10. gnuplot> set term png font "Helvetica,12" # 您必须在绘图前设置终端和输出文件名
  11. Terminal type set to 'unknown'
  12. ^
  13. unknown or ambiguous terminal type; type just 'set terminal' for a list
  14. gnuplot> set term png font "Helvetica,12";
  15. Terminal type set to 'unknown'
  16. ^
  17. unknown or ambiguous terminal type; type just 'set terminal' for a list
  18. gnuplot> set terminal # 查看 gnuplot 支持的设置格式
  19. Available terminal types:
  20. canvas HTML Canvas object
  21. cgm Computer Graphics Metafile
  22. context ConTeXt with MetaFun (for PDF documents)
  23. corel EPS format for CorelDRAW
  24. dumb ascii art for anything that prints text
  25. dxf dxf-file for AutoCad (default size 120x80)
  26. eepic EEPIC -- extended LaTeX picture environment
  27. emf Enhanced Metafile format
  28. emtex LaTeX picture environment with emTeX specials
  29. epslatex LaTeX picture environment using graphicx package
  30. fig FIG graphics language for XFIG graphics editor
  31. hpgl HP7475 and relatives [number of pens] [eject]
  32. latex LaTeX picture environment
  33. mf Metafont plotting standard
  34. mp MetaPost plotting standard
  35. pcl5 HP Designjet 750C, HP Laserjet III/IV, etc. (many options)
  36. ......

因此考虑重装 gnuplot,以支持 png, jpeg, and gif terminals,具体步骤如下。

安装 GD library 库

GD (https://github.com/libgd/libgd)是一个用于程序员动态创建和处理图像的开源库。手动安装步骤如下。

  1. $ curl -LjO https://github.com/libgd/libgd/releases/download/gd-2.2.5/libgd-2.2.5.tar.gz
  2. $ tar zvxf libgd-2.2.5.tar.gz
  3. $ cd libgd-2.2.5
  4. $ ./configure --prefix=/Bioinfo/SoftWare/libgd-2.2.5
  5. $ make
  6. $ make install

安装 Gnuplot

官网:http://www.gnuplot.info/
注意:

  1. configure 时需要把前一步安装好的 libgd 加进去;
  2. make install 如遇一下类似 Permission denied, 可忽略,不影响使用。 ```r $ wget http://ftp.cstug.cz/pub/CTAN/graphics/gnuplot/5.2.6/gnuplot-5.2.6.tar.gz $ tar zvxf gnuplot-5.2.6.tar.gz $ cd gnuplot-5.2.6 $ ./configure —prefix=/Bioinfo/SoftWare/gnuplot-5.2.6 —with-gd=/Bioinfo/SoftWare/libgd-2.2.5 LDFLAGS=”-L/Bioinfo//SoftWare/libgd-2.2.5/lib” CPPFLAGS=”-I/Bioinfo/SoftWare/libgd-2.2.5/include” checking for a BSD-compatible install… /usr/bin/install -c checking whether build environment is sane… yes checking for a thread-safe mkdir -p… /bin/mkdir -p checking for gawk… gawk …… ** Configuration summary for gnuplot 5.2.6:

gnuplot will be compiled with the following terminals:

Standalone terminals: yes (always builtin) canvas, cgm, context, dumb, dxf, eepic, emf, emtex, epslatex, fig, hpgl, latex, metafont, metapost, mif, pcl5, postscript, pslatex, pstex, pstricks, qms, svg, tek40xx, tek410x, texdraw, tgif, tkcanvas, tpic, vttek

dot-matrix terminals: no (use —with-bitmap-terminals to enable) epson, nec, okidata, tandy, and seiko dp414 printers hp500c, hpdj, hpljii, hppj, pbm, sixel, starc

X Window System terminal: yes (with multi-byte fonts) (enable plotting to windows opened by external apps) (with application defaults, in /etc/X11/app-defaults/) linux terminal (vga console): no (use —with-linux-vga to enable) vgagl terminal ((s)vga console): no (use —with-linux-vga to enable) ggi terminal: no (use —with-ggi to enable, requires libggi) gpic terminal: no (use —with-gpic to enable) mif terminal: no (use —with-mif to enable) caca terminal: no (use —with-caca to enable) aqua terminal (OSX): no libgd-based png, jpeg, and gif terminals: yes (with animated gif) cairo-based terminals: no (requires cairo>=1.2, pango>=1.22, glib>=2.28) lua/TikZ terminal: no wxt terminal: no (requires C++, wxWidgets>2.6, cairo>0.9, pango>1.22) Qt terminal: yes (qt4)

Additional platform-specific or older terminals omitted by default: gpic, mif (FrameMaker 3), hp2623a, hp2648, imagen, kyocera pm (makefile.os2), be (BeOS), svga (MSDOS/djgpp) windows (several options)

gnuplot will be compiled with the following configurable features:

Mouse support in interactive terminals: yes Typing in plot window raises console Placement of rectangles and other objects: yes Readline library: GNU readline library with -lncurses Command-line history file: yes Check current directory for .gnuplot file: no (use —with-cwdrc to enable) Sort help/subtopic tables by column: no (use —without-row-help to enable) cerf() and other special functions: no (libcerf not found) plugin support for loading external functions: yes Use TeX kpsexpand to search for fonts: no (use —with-kpsexpand to enable) Hidden3d optimization (gridbox/quadtree/none): quadtree Allow deprecated syntax: no (use —enable-backwards-compatibility) Statistical summary of data (“stats” command): yes …… $ make $ make install

如遇一下 Permission denied, 可忽略,不影响使用

…… make[3]: Nothing to be done for install-exec-am'. /bin/mkdir -p '/Bioinfo/APPS/texlive/texmf-local/tex/latex/gnuplot' /bin/mkdir: cannot create directory/Bioinfo/APPS/texlive/texmf-local/tex/latex/gnuplot’: Permission denied make[3]: [install-texDATA] Error 1 make[3]: Leaving directory `/Bioinfo/Pipeline/src/pkgs/gnuplot-5.2.6/share/LaTeX’ make[2]: [install-am] Error 2 make[2]: Leaving directory /Bioinfo/Pipeline/src/pkgs/gnuplot-5.2.6/share/LaTeX' make[1]: *** [install-recursive] Error 1 make[1]: Leaving directory/Bioinfo/Pipeline/src/pkgs/gnuplot-5.2.6/share’ make: * [install-recursive] Error 1

  1. ![image.png](https://cdn.nlark.com/yuque/0/2022/png/126032/1663222947063-d960a6f7-74ef-4688-b7a0-694ead095544.png#clientId=uf1e50890-2745-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=647&id=u90f66fe8&margin=%5Bobject%20Object%5D&name=image.png&originHeight=647&originWidth=694&originalType=binary&ratio=1&rotation=0&showTitle=true&size=54440&status=done&style=none&taskId=udb188b3f-8144-4fd1-9fb1-8044f5092dd&title=%E6%B3%A8%E6%84%8F%EF%BC%9Aconfigure%20%E7%9A%84%E6%8F%90%E7%A4%BA%EF%BC%88libgd-based%20png%2C%20jpeg%2C%20and%20gif%20terminals%3A%20yes%EF%BC%89&width=694 "注意:configure 的提示(libgd-based png, jpeg, and gif terminals: yes)")
  2. 3. 集群运行时,如遇上以下报错,执行一下`**ldd /Bioinfo/SoftWare/gnuplot-5.2.6/bin/gnuplot**`,把缺失的对应指向的 libQt*.so 拷贝到一个指定目录,然后增加一个`**export LD_LIBRARY_PATH=/Bioinfo/SoftWare/gnuplot-5.2.6/customlib:$LD_LIBRARY_PATH**`即可。
  3. ```r
  4. gnuplot: error while loading shared libraries: libQtNetwork.so.4: cannot open shared object file: No such file or directory

image.png

简单绘图

安装完成后,进入 gnuplot 简单画图并保存为 plot.png。

  1. gnuplot> set term png font "Helvetica,12"
  2. Terminal type is now 'png'
  3. Options are 'nocrop enhanced size 640,480 font "Helvetica,12.0" '
  4. gnuplot> set output "plot.png"
  5. gnuplot> plot sin(x)
  6. gnuplot> exit

image.png