pgxcentre / manhattan_generator

Manhattan plot Generator
Other
24 stars 8 forks source link

Not compatible on TTYs lacking interactive backends #2

Open PikalaxALT opened 6 years ago

PikalaxALT commented 6 years ago

Python version: 2.7.5 Package version: 1.7.2 (16 Mar 2016) OS: CentOS Linux release 7.3.1611 (Core)

Exception:

$ manhattan_generator --twopoint /data/Scott/sylvia_smc_ec/sqtls_smc_covars.txt --col-chr "# chromosome" --col-name snp_id --col-pos ref_start --col-pvalue ftest_pval -o smc_manhattan.pdf --use-pvalues --bp --format pdf 
Traceback (most recent call last):
  File "/home/scnorton/MAJIQ_NEW/bin/manhattan_generator", line 11, in <module>
    load_entry_point('manhattan-generator==1.7.2', 'console_scripts', 'manhattan_generator')()
  File "/home/scnorton/MAJIQ_NEW/lib/python2.7/site-packages/manhattan_generator.py", line 937, in safe_main
    main()
  File "/home/scnorton/MAJIQ_NEW/lib/python2.7/site-packages/manhattan_generator.py", line 186, in main
    create_manhattan_plot(two_point, multi_point, args)
  File "/home/scnorton/MAJIQ_NEW/lib/python2.7/site-packages/manhattan_generator.py", line 281, in create_manhattan_plot
    from _tkinter import TclError
ImportError: No module named _tkinter

Suggested solution: Add an option to select an alternative backend, and pass that to matplotlib.use on first import.

lemieuxl commented 6 years ago

Pushed a fix to dev.

The Agg backend is automatically used when the --no-annotation option is present (i.e. no draggable annotations).

I thought that Tkinter was always installed in Linux, so I was looking at TclError to notify the user that no display was available.

Please try the fix and if it works, I'll create a new release of the tool.