dictyBase Developers

Solving one problem at a time

Integrate dictyBase Headers and Footers in Gbrowse2

Setup header and footer

  • checkout asset repository
1
2
cd /home/share
git clone git@github.com:dictyBase/dictyAssets.git
  • Serve it through nginx
1
2
3
4
5
## in nginx.conf
location /assets {
    alias /home/share/dictyAssets;
    expires 30d;
}
  • open configuration file for each genome and the following code to the header and footer section. For example, in purpureum.conf. Assume nginx is deployed in localhost
1
2
3
4
5
6
7
8
header = sub {
               use LWP::Simple;
               return LWP::Simple::get("http://localhost/assets/include/purpureum/page-header.html")
          }
footer = sub {
               use LWP::Simple;
               return LWP::Simple::get("http://localhost/assets/include/purpureum/page-footer.html")
          }
  • Note: Had issue with both LWP::Simple and LWP::UserAgent in getting the response, so switched to HTTP::Tiny
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
cpanm HTTP::Tiny

header = sub {
               use HTTP::Tiny;
               my $resp = HTTP::Tiny->new->get("http://localhost/assets/include/purpureum/page-header.html");
               if ($resp->{success}) {
                  return $resp->{content};
               }
          }

footer = sub {
               use HTTP::Tiny;
               my $resp = HTTP::Tiny->new->get("http://localhost/assets/include/purpureum/page-footer.html");
               if ($resp->{success}) {
                  return $resp->{content};
               }
          }
  • Run plack
1
2
plackup  -MLWP::Simple -s FCGI --nproc 10 --listen /tmp/gbrowse.sock --pid /tmp/fcgi_gb2.pid --daemonize \
                     $GBROWSE_ROOT/$GBROWSE_VERSION/conf/GBROWSE.psgi

Replace LWP::Simple with HTTP::Tiny if needed