GBrowse
view release on metacpan or search on metacpan
lib/Bio/Graphics/Browser2/UserTracks.pm view on Meta::CPAN
warn "remote_bigbed_conf";
return <<END;
[$dbname:database]
db_adaptor = Bio::DB::BigBed
db_args = -bigbed $url
search options = none
>>>>>>>>>>>>>> cut here <<<<<<<<<<<<
[$track_id]
database = $dbname
feature = region
glyph = segments
label density = 50
feature_limit = 500
bump = fast
stranded = 1
height = 4
bgcolor = $color
fgcolor = $color
key = $filename segments
description =
[$track_id\_coverage]
database = $dbname
feature = summary
glyph = wiggle_whiskers
fgcolor = black
height = 50
autoscale = chromosome
key = $filename coverage
description =
END
}
sub _print_url {
my $self = shift;
my ($agent, $url, $fh) = @_;
$agent->get($url,':content_cb' => sub { print $fh shift; });
}
# Sharing Link (File ID) - Generates the sharing link for a specific file.
sub sharing_link {
my $self = shift;
my $file = shift or return;
return CGI::url(-full => 1, -path_info => 1) . "?share_link=" . $file;
}
# These methods are replaced by methods in Filesystem.pm and Database.pm
# Many of these functions are called asynchronously, if you want to connect an AJAX call to one of these functions add a hook in Action.pm
sub get_file_id { warn "get_file_id() has been called, without properly inheriting subclass Database.pm"; }
sub filename { warn "filename() has been called, without properly inheriting a subclass (like Filesystem.pm or Database.pm)"; }
sub nowfun { warn "nowfun() has been called, without properly inheriting subclass Database.pm"; }
sub get_uploaded_files { warn "get_uploaded_files() has been called, without properly inheriting a subclass (like Filesystem.pm or Database.pm)"; }
sub get_public_files { warn "get_public_files() has been called, without properly inheriting subclass Database.pm"; }
sub get_imported_files { warn "get_imported_files() has been called, without properly inheriting a subclass (like Filesystem.pm or Database.pm)"; }
sub get_shared_files { warn "get_shared_files() has been called, without properly inheriting subclass Database.pm"; }
sub share { warn "share() has been called, without properly inheriting subclass Database.pm"; }
sub unshare { warn "unshare() has been called, without properly inheriting subclass Database.pm"; }
sub field { warn "field() has been called, without properly inheriting subclass Database.pm"; }
sub update_modified { warn "update_modified() has been called, without properly inheriting subclass Database.pm"; }
sub created { warn "created() has been called, without properly inheriting a subclass (like Filesystem.pm or Database.pm)"; }
sub modified { warn "modified() has been called, without properly inheriting a subclass (like Filesystem.pm or Database.pm)"; }
sub description { warn "description() has been called, without properly inheriting a subclass (like Filesystem.pm or Database.pm)"; }
sub add_file { warn "add_file() has been called, without properly inheriting a subclass (like Filesystem.pm or Database.pm)"; }
sub delete_file { warn "delete_file() has been called, without properly inheriting a subclass (like Filesystem.pm or Database.pm)"; }
sub is_imported { warn "is_imported() has been called, without properly inheriting a subclass (like Filesystem.pm or Database.pm)"; }
sub permissions { warn "permissions() has been called, without properly inheriting subclass Database.pm"; }
sub is_mine { warn "is_mine() has been called, without properly inheriting a subclass (like Filesystem.pm or Database.pm)"; }
sub owner { warn "owner() has been called, without properly inheriting a subclass (like Filesystem.pm or Database.pm)"; }
sub is_shared_with_me { warn "is_shared_with_me() has been called, without properly inheriting subclass Database.pm"; }
sub file_type { warn "file_type() has been called, without properly inheriting a subclass (like Filesystem.pm or Database.pm)"; }
sub shared_with { warn "shared_with() has been called, without properly inheriting subclass Database.pm"; }
sub file_exists { warn "file_exists() has been called, without properly inheriting subclass Filesystem.pm"; }
sub change_userid { warn "change_userid() has been called, without properly inheriting a subclass (like Filesystem.pm or Database.pm)"; }
sub change_uploadsid { warn "change_uploadsid() has been called, without properly inheriting a subclass (like Filesystem.pm or Database.pm)"; }
sub close_database { } # do nothing
package Bio::Graphics::Browser2::UserConf;
use base 'Tie::Handle';
use Symbol;
sub fh {
my $class = shift;
my $path = shift;
my $g = gensym;
tie(*$g,$class,$path);
return $g;
}
sub TIEHANDLE {
my $class = shift;
my $path = shift;
open my $f,$path or die "$path:$!";
return bless {
fh => $f,
seen_cut => 0,
_db => {}, # remember db names
-didx => 0, # db indexes
},$class;
}
sub READLINE {
my $self = shift;
my $fh = $self->{fh};
while (my $line = <$fh>) {
$self->{_db}{$1} = $self->{_didx}++ if $line =~ /^\[(.+):database/;
if ($line =~ /cut here/i) {
$self->{seen_cut}++;
next;
}
next unless $self->{seen_cut};
$line =~ s/database\s*=\s*(.+)/database = database_$self->{_db}{$1} # do not change this!/;
$line =~ s/\[(\w+?)_.+_(\d+)(:\d+)?\]/[$1_$2$3]/;
return $line;
}
return;
}
( run in 1.037 second using v1.01-cache-2.11-cpan-39bf76dae61 )