3 SGN::Feature::GBrowse2 - subclass of L<SGN::Feature::GBrowse> that tweaks the apache conf for GBrowse 2
7 package SGN
::Feature
::GBrowse2
;
9 use namespace
::autoclean
;
10 extends
'SGN::Feature::GBrowse';
11 use Class
::Load
':all';
12 use Bio
::Graphics
::FeatureFile
;
14 has
'_data_sources' => (
20 data_sources
=> 'values',
23 ); sub _build__data_sources
{
26 unless( $self->config_master ) {
27 warn __PACKAGE__
.': no master config found, skipping data sources configuration';
31 my $ds_class = __PACKAGE__
.'::DataSource';
32 Class
::Load
::load_class
( $ds_class );
35 foreach my $type ( $self->config_master->configured_types ) {
37 # absolutify the path from the config file
38 my $path = $self->config_master->setting( $type => 'path' )
39 or die "no path configured for [$type] in ".$self->config_master."\n";
40 $path = Path
::Class
::File
->new( $path );
41 unless( $path->is_absolute ) {
42 $path = $self->conf_dir->file( $path );
45 $sources{$type} = $ds_class->new(
47 $_ => $self->config_master->setting( $type => $_ )
48 } $self->config_master->setting( $type )
59 has
'config_master' => (
62 ); sub _build_config_master
{
64 my $master_file = shift->conf_dir->file('GBrowse.conf');
65 unless( -f
$master_file ) {
66 warn __PACKAGE__
.": master conf file $master_file not found";
70 my $ff = Bio
::Graphics
::FeatureFile
->new( -file
=> "$master_file" );
71 $ff->safe( 1 ); #< mark the file as safe, so we can use code refs
75 sub fpc_data_sources
{
77 sort { my ($ad,$bd) = map $_->description =~ m
|(20\d\d
)|,$a,$b; $bd <=> $ad }
78 grep $_->description =~ /FPC/i,
82 # returns a string of apache configuration to be included during
83 # startup. will be part of plugin role
84 around apache_conf
=> sub {
85 my ( $orig, $self ) = @_;
87 my $upstream_conf = $self->$orig();
89 my $static_dir = $self->static_dir;
90 my $static_url = $self->static_url;
92 my $conf = $self->conf_dir;
93 my $cgibin = $self->cgi_bin;
94 my $inc = $self->perl_inc;
95 my $fcgi_inc = @
$inc ?
"DefaultInitEnv PERL5LIB \"".join(':',@
$inc).'"' : '';
96 my $cgi_inc = @
$inc ?
"SetEnv PERL5LIB ".join(':',@
$inc) : '';
97 my $cgi_url = $self->cgi_url;
98 my $tmp = $self->tmp_dir;
102 # Alias /$url_base "$cgibin"
104 # SetHandler perl-script
105 # PerlResponseHandler ModPerl::Registry
106 # PerlOptions +ParseHeaders
107 # PerlSetEnv GBROWSE_CONF "$conf"
111 Alias
$cgi_url "$cgibin"
113 SetHandler fcgid
-script
116 DefaultInitEnv GBROWSE_CONF
"$conf"
119 MaxRequestLen
20971520
123 ScriptAlias
$cgi_url "$cgibin"
124 <Directory
"$cgibin">
126 SetEnv GBROWSE_CONF
"$conf"
133 my $runmode_conf = $runmode_conf{ $self->run_mode }
134 or confess
"invalid run mode '".$self->run_mode."'";
136 return $upstream_conf.<<EOC;
137 Alias "$static_url/i/" "$tmp/images/"
138 Alias "$static_url" "$static_dir"
140 <Location "$static_url">
141 SetHandler default-handler\n"
143 <Directory "$static_dir">
144 Options -Indexes -MultiViews +FollowSymLinks