From: Victor S. <Str...@aa...> - 2010-03-25 19:19:21
|
On Thursday March 25 2010 2:50 pm, manoj-samanta wrote: > I have gbrowse 2.0.3 installed on my server. I would like to run it from > another code and parse the results. What is the best way to proceed? > > I am reasonably familiar with the details of gbrowse code. So, please feel > free to suggest any odd hack, if necessary. Manoj, It works on gbrowse_img like this: my $content= getURL($url); # if we want to join several GBrowse thumbs in one HTML page, # we need to make tag ID system unique if( $content=~/map/ ) { my $addon= $PID; if( $BlockImageMap ) { $content=~s/(<img\s+[^>]*\W)ismap/$1 /ig; $content=~s/(<img\s+[^>]*\W)usemap\s*=\s*"\s*\#\w+\s*"/$1/ig; } else { $content=~s/(<img\s+.*\Wusemap\s*=\s*"\s*\#\w+)(\s*")/$1$addon$2/ig; } $content=~s/(<map[^>]*\Wname\s*=\s*"\s*\w+)(\s*")/$1$addon$2/ig; $content=~s/(<map[^>]*\Wid\s*=\s*"\s*\w+)(\s*")/$1$addon$2/ig; $content=~s/<area[^>]*\Wtitle\s*=\s*"Browse\s+Region"[^>]*>//ig; } if( $FieldArray{'embed'} ) { my @lines= split("\n",$content); ...whatever you do with retrieved content comes here... sub getURL { my($url)= @_; unless( $url=~m|^http://[^/]+/|i ) { my $server= 'flybase.net'; if( $ENV{'SERVER_ADDR'} ) { $server= $ENV{'SERVER_ADDR'}; } elsif( $ENV{'SERVER_NAME'} ) { $server= $ENV{'SERVER_NAME'}; } my $port= ($ENV{'SERVER_PORT'}) ? $ENV{'SERVER_PORT'} : '80'; $url= 'http://'.$server.':'.$port.$url; } use lib "$ENV{SERVER_PATH}/../../common/perl/lib"; # std FB install #use LWP::Simple; use LWP::Simple qw(!head); # this way only - otherwise overlaps withCGI::head print " retrieving $url\n" if $main::debug; my $content= get $url; if( wantarray() ) { return('text/html;charset=UTF-8',$content); } return($content); } V. Strelets FlyBase Consortium |