GBrowse
view release on metacpan or search on metacpan
bin/make_das_conf.pl view on Meta::CPAN
ucsc_assembly ucsc_ensgene ucsc_refgene
ucsc_sanger22 ucsc_sanger22pseudo
ucsc_softberry ucsc_twinscan ucsc_unigene);
my $proxy;
GetOptions('proxy=s' => \$proxy) or usage_statement();
my $url = shift;
$url or usage_statement();
$url =~ m!^http:.+das(/\w+)?$! or usage_statement("This doesn't look like a DAS URL to me.");
$ENV{HTTP_PROXY} ||= $proxy;
list_sources($url) && exit 0 if $url =~ m!das/?$!;
generate_config_file($url);
exit 0;
sub usage_statement {
my $error = shift;
$error .= "\n" if $error;
die <<END;
${error}Usage: $0 <das URL to load>
Options: -proxy <http proxy to use>
This utility attempts to contact a DAS source and to create a starter
configuration file for gbrowse. If you don\'t know the list of data sources
it will retrieve them and ask you to select one.
If you need an HTTP proxy, set the HTTP_PROXY environment variable to
the host and port number, in the form "http://proxy.host:port/", or
pass the proxy URL to the -proxy option.
END
; }
sub list_sources {
my $url = shift;
my $das = Bio::Das->new($url);
warn "proxy = $ENV{HTTP_PROXY}";
$das->proxy($ENV{HTTP_PROXY}) if $ENV{HTTP_PROXY};
my @sources = $das->sources or bad_request_exit($das);
print "The following DAS URLs are available at this server. Please call the script again\n";
print "using one of the following URLs:\n\n";
for my $s (@sources) {
print $s->url,"\n";
print "\t",$s->description,"\n\n";
}
1;
}
sub generate_config_file {
my $url = shift;
my ($server,$dsn) = $url=~ m[^(.+/das)/(\w+)];
my $das = Bio::Das->new($server=>$dsn);
$das->proxy($ENV{HTTP_PROXY}) if $ENV{HTTP_PROXY};
my @sources = $das->sources or bad_request_exit($das);
my ($source) = grep {$_->id eq $das->default_dsn} @sources;
my @types = $das->types or bad_request_exit($das);
$source or bad_request_exit($das);
my %seenit;
my @aggregators = grep {!$seenit{$_}++}
map {
bin/make_das_conf.pl view on Meta::CPAN
} @types;
my $aggregators = join "\n ",@aggregators;
my $description = $source->description;
my $mapmaster = $source->master;
my @entry_points = sort {"$a" cmp "$b"} $das->entry_points;
foreach (@entry_points) { # remove coordinates
s/:\d+,\d+$//;
}
my $proxy = $ENV{HTTP_PROXY} ? "-proxy $ENV{HTTP_PROXY}" : '';
# top part of the config file
print <<END;
[GENERAL]
description = $description
db_adaptor = Bio::Das
db_args = -source $server
-dsn $dsn
$proxy
( run in 0.503 second using v1.01-cache-2.11-cpan-71847e10f99 )