Pls suggest to get Postscript o/p perfectly in Perl

simon andrews (BI) simon.andrews at bbsrc.ac.uk
Tue Sep 24 11:31:31 UTC 2002


From: LENA GANESH [mailto:lenaganesh2k2 at yahoo.com]
Subject: Pls suggest to get Postscript o/p perfectly in Perl

 
> I'm Developing Perl program to run the emboss commands in Web Browser.
> when i'm trying this command in Pel
> *****************
> $cmd="/emboss/bin/dottup F1.TXT F2.TXT -wordsize 4 -graph ps";
> system($cmd);
> *****************
> I'm getting only ps script file, but not dotted image.If i run same this 
> command in shell, i'm getting the result perfectly. Is there any alternate > way?

I'm not sure what you mean here.  If you say you're getting the dottup.ps file created, then that IS the 'dotted image', it's just in postscript format, which requires that you open it in a suitable viewer.

If you want to display the output of dottup on a web page then postscript format is not much help as most browsers won't know what to do with it.  You'd be better off using PNG format.  Unfortunately there doesn't seem to be a way to make dottup output its PNG to STDOUT, so you'll have to let it create dottup.1.png, then read it and pass it back to the browser.

Something like this should get you started.  Just put it in your cgi-bin directory, and alter the path on line 5 to wherever your F1 and F2 files are situated.  You will also need to ensure that the user you web server runs under has permission to create files in that directory. Watch for long lines being wrapped:

#########################################################################
#!/usr/bin/perl -w
use strict;
use CGI::Carp qw(fatalsToBrowser);

$ENV{'PLPLOT_LIB'}='/emboss/share/EMBOSS';

chdir('/wherever/your/files/are') || die "Couldn't change directory: $!";

system ('/emboss/bin/dottup F1.TXT F2.TXT -wordsize 4 -data 0 -auto -graph png > /dev/null');

unless (-e 'dottup.1.png') {
	die "No output created by dottup - check web server error logs";
}

# If running on non-unix systems you will also
# need to binmode() all filehandles for PNG output

open (PNG,'dottup.1.png') || die "Couldn't read PNG file: $!";

print "Content-type:Image/png\n\n";

print while (<PNG>);

##########################################################################

If you are just trying to make a general EMBOSS interface then are you aware that there are several in existence already?  Have a look at
http://www.hgmp.mrc.ac.uk/Software/EMBOSS/interfaces.html for a list of them.

Hope this helps

Simon.




More information about the EMBOSS mailing list