Permalink
Browse files

Merge commit 'ae97ff9' into development

  • Loading branch information...
2 parents 4adc84c + ae97ff9 commit df95f63975ed52ad6c85f0ca17e44ba97b922928 @lstein lstein committed Jul 18, 2011
View
@@ -1,15 +1,15 @@
do{ my $x = {
- 'OpenIDConsumerSecret' => '461864190732256',
'config_done' => 1,
+ 'OpenIDConsumerSecret' => '461864190732256',
'registration_done' => 1,
'cgibin' => '/home/aelnaiem/GBrowse/cgi-bin',
- 'databases' => '/var/lib/gbrowse2/databases',
'wwwuser' => 'www-data',
+ 'databases' => '/var/lib/gbrowse2/databases',
'installconf' => 'y',
- 'conf' => '/home/aelnaiem/GBrowse/conf',
- 'htdocs' => '/home/aelnaiem/GBrowse/htdocs',
- 'tmp' => '/tmp/gbrowse2',
'portdemo' => 8000,
+ 'tmp' => '/tmp/gbrowse2',
+ 'htdocs' => '/home/aelnaiem/GBrowse/htdocs',
+ 'conf' => '/home/aelnaiem/GBrowse/conf',
'persistent' => '/var/lib/gbrowse2',
'apachemodules' => '/usr/lib/apache2/modules',
'installetc' => 'y'
View
@@ -235,3 +235,7 @@ path = yeast_renderfarm.conf
description = Population Display Demo
path = pop_demo.conf
+[volvox]
+description = Tutorial database
+path = volvox.conf
+
View
@@ -0,0 +1,76 @@
+[GENERAL]
+db_adaptor = Bio::DB::SeqFeature::Store
+db_args = -adaptor memory
+ -dir '/home/aelnaiem/GBrowse/htdocs/databases/volvox'
+
+# just the basic track dumper plugin
+plugins = TrackDumper
+
+# list of tracks to turn on by default
+default features = ExampleFeatures
+
+# size of the region
+region segment = 10000
+
+# examples to show in the introduction
+examples = ctgA
+
+# feature to show on startup
+initial landmark = ctgA:5000..10000
+
+########################
+# Default glyph settings
+########################
+
+[TRACK DEFAULTS]
+glyph = generic
+height = 10
+bgcolor = lightgrey
+fgcolor = black
+font2color = blue
+label density = 25
+bump density = 100
+# where to link to when user clicks in detailed view
+link = AUTO
+
+################## TRACK CONFIGURATION ####################
+# the remainder of the sections configure individual tracks
+###########################################################
+
+[ExampleFeatures]
+feature = remark
+glyph = generic
+stranded = 1
+bgcolor = blue
+height = 10
+key = Example Features
+
+[TransChip]
+feature = microarray_oligo microarray_oligo3 microarray_oligo2
+glyph = xyplot
+graph_type = line
+fgcolor = sub {
+ my $feature = shift;
+ my ($sample) = $feature->primary_tag;
+ return 'springgreen' if $sample eq "microarray_oligo";
+ return 'skyblue' if $sample eq "microarray_oligo2";
+ return 'salmon' if $sample eq "microarray_oligo3"
+ }
+bgcolor = sub {
+ my $feature = shift;
+ my ($sample) = $feature->primary_tag;
+ return 'springgreen' if $sample eq "microarray_oligo";
+ return 'skyblue' if $sample eq "microarray_oligo2";
+ return 'salmon' if $sample eq "microarray_oligo3"
+ }
+scale_color = silver
+overlay = 1
+autoscale = none
+height = 50
+min_score = 0
+max_score = 1000
+scale = right
+group_on = display_name
+category = Quantitative Data
+key = Transcriptional Profile
+
@@ -35,7 +35,7 @@ IMG.trackimg {
}
.subtrack {
z-index:11;
- position:absolute;
+ /*position:absolute; Changed by Ahmed Elnaiem to allow for legends on overlapped xyplots*/
font-weight:bold;
font-size: 9pt;
}
Oops, something went wrong.
@@ -0,0 +1,20 @@
+##gff-version 3
+##Note: See http://song.sourceforge.net
+
+# file: volvox1.gff3
+ctgA example contig 1 50000 . . . Name=ctgA
+ctgA example remark 1659 1984 . + . Name=f07;Note=This is an example
+ctgA example remark 3014 6130 . + . Name=f06;Note=This is another example
+ctgA example remark 4715 5968 . - . Name=f05;Note=Ok! Ok! I get the message.
+ctgA example remark 13280 16394 . + . Name=f08
+ctgA example remark 15329 15533 . + . Name=f10
+ctgA example remark 19157 22915 . - . Name=f13
+ctgA example remark 22132 24633 . + . Name=f15
+ctgA example remark 23072 23185 . + . Name=f14
+ctgA example remark 24562 28338 . + . Name=f02
+ctgA example remark 36034 38167 . + . Name=f09
+ctgA example remark 36649 40440 . - . Name=f03
+ctgA example remark 37242 38653 . + . Name=f04
+ctgA example remark 44705 47713 . - . Name=f01
+ctgA example remark 46990 48410 . - . Name=f11
+ctgA example remark 49758 50000 . - . Name=f12
@@ -530,7 +530,7 @@ var GBrowseController = Class.create({
if( get_tracks)
Controller.get_multiple_tracks(track_keys);
else
- Controller.idle();
+ Controller.idle();;
}
});
return true;
@@ -703,6 +703,7 @@ var GBrowseController = Class.create({
Controller.get_remaining_tracks(track_keys,time_out*decay,decay,time_key)
} ,time_out);
} else {
+ Controller.linkTrackLegend();
Controller.idle();
}
} // end onSuccess
@@ -215,23 +215,25 @@ GBrowseController.addMethods({
function(){
// The source, session, and snapshot information are stored
var browser_source = Controller.findParameter("source");
- var session = Controller.findParameter("id");
- var snapshot = Controller.findParameter("snapshot");
+ var upload = Controller.findParameter("id");
+ var snapcode = Controller.findParameter("snapcode");
+ var snapname = Controller.findParameter("snapname");
- if(browser_source != null && session != null && snapshot != null){
+ if(browser_source != null && upload != null && snapcode != null && name != null){
// An asynchronous request loads the snapshot into the browser
new Ajax.Request(document.URL, {
method: 'POST',
asynchronous:true,
parameters: {
action: 'load_url',
- name: snapshot,
- id: session,
+ snapcode: snapcode,
+ snapname: snapname,
+ id: upload,
browser_source: browser_source,
},
onSuccess: function(transport) {
$('busy_indicator').show();
- Controller.setSnapshot(snapshot);
+ Controller.setSnapshot(snapname);
},
on504: function() {
alert("GBrowse could not find the provided session or snapshot");
@@ -243,9 +245,11 @@ GBrowseController.addMethods({
},
findParameter:
- function(param){
- // Searches the URL for the value of the parameter passed in
- var search = window.location.search.substring(1);
+ function(param, search){
+ if(search == null){
+ // Searches the URL for the value of the parameter passed in
+ search = window.location.search.substring(1);
+ }
if(search.indexOf('&') > -1) {
var params = search.split('&');
for(var i = 0; i < params.length; i++) {
@@ -285,7 +289,34 @@ GBrowseController.addMethods({
} else {
return false;
}
- }
+ },
+
+ linkTrackLegend:
+ function(){
+ var subtrack_groups = $$('.subtrack_group');
+
+ subtrack_groups.each(function(subtrack_group) {
+ var subtracks = subtrack_group.childElements();
+ if(subtracks.size() > 1){
+ subtracks.each(function(subtrack) {
+ var label = subtrack.down().down().innerHTML;
+ var track_div = subtrack.ancestors()[2];
+ var map = track_div.down('map');
+ areas = map.childElements()
+ areas.each(function(area) {
+ var href = area.readAttribute('href');
+ href = href.replace(/;/g, "&");
+ var param = Controller.findParameter('name', href);
+ if(param == label){
+ subtrack.down().href = href.replace(/&/g, ";");
+ area.remove();
+ throw $break;
+ }
+ });
+ });
+ }
+ });
+ }
});
@@ -15,7 +15,7 @@ use constant DEBUG => 0;
use Data::Dumper;
use Storable qw(dclone);;
use POSIX;
-
+use Digest::MD5 'md5_hex';
sub new {
my $class = shift;
@@ -367,7 +367,11 @@ sub ACTION_save_session {
# Updating the snapshots hash
$session->{snapshots}->{$name}->{session_time}=$UTCtime;
$session->{snapshots}->{$name}->{image_url} = $imageURL;
-
+
+ # Each snapshot has a unique snapshot_id (currently just an md5 sum of the unix time it is created
+ my $snapshot_id = md5_hex(time);
+ $session->{snapshots}->{$name}->{snapshot_id} = $snapshot_id;
+
$self->session->flush;
$self->ACTION_set_session($q);
@@ -385,6 +389,10 @@ sub ACTION_set_session {
# $settings->{current_session} = $name;
%{$settings} = %{dclone $session->{snapshots}->{$name}};
+
+ # The snapshot_id is not stored in the current session information
+ delete $settings->{snapshot_id};
+
my @tracks = @{$settings->{tracks}};
my @selected_tracks = ();
@@ -407,10 +415,24 @@ sub ACTION_send_session {
my $settings = $self->state;
my $source = $settings->{source};
+ my $session = $self->session->session->{'_DATA'}->{$source};
my $id = $self->session->uploadsid;
+ my $globals = $self->render->globals;
+ my $dir = $globals->user_dir;
+
+ my $filename = $session->{snapshots}->{$name}->{snapshot_id};
+
+ mkdir File::Spec->catfile($dir,$source,$id);
+
+ #Storing the snapshot as a string and saving it to a textfile. Typical directory /var/lib/gbrowse2/userdata/{source}/{uploadid}:
+ my $snapshot = Dumper($session->{snapshots}->{$name});
+ open SNAPSHOT, ">$dir/$source/$id/$filename.txt" or die "Can't open $dir: $!";
+ print SNAPSHOT "$snapshot";
+ close SNAPSHOT;
+
# The snapshot information is embedded into the URL
- $url = "$url?id=$id&snapshot=$name&source=$source";
+ $url = "$url?id=$id&snapname=$name&snapcode=$filename&source=$source";
$url =~ s/ /%20/g;
$self->session->flush;
@@ -426,14 +448,27 @@ sub ACTION_mail_session {
my $settings = $self->state;
my $source = $settings->{source};
+ my $session = $self->session->session->{'_DATA'}->{$source};
my $id = $self->session->uploadsid;
+
+ my $globals = $self->render->globals;
+ my $dir = $globals->user_dir;
+
+ my $filename = $session->{snapshots}->{$name}->{snapshot_id};
+
+ mkdir File::Spec->catfile($dir,$source,$id);
+
+ #Storing the snapshot as a string and saving it to a textfile. Typical directory /var/lib/gbrowse2/userdata/{source}/{uploadid}:
+ my $snapshot = Dumper($session->{snapshots}->{$name});
+ open SNAPSHOT, ">$dir/$source/$id/$filename.txt" or die "Can't open $dir: $!";
+ print SNAPSHOT "$snapshot";
+ close SNAPSHOT;
# The snapshot information is embedded into the URL
- $url = "$url?id=$id&snapshot=$name&source=$source";
+ $url = "$url?id=$id&snapname=$name&snapcode=$filename&source=$source";
$url =~ s/ /%20/g;
- my $globals = $self->render->globals;
- my $subject = "Genome Browser Snapshot: $name";
+ my $subject = "Genome Browser Snapshot";
my $contents = "Please follow this link to load the GBrowse snapshot: $url";
# An email is sent containing the snapshot information
@@ -452,26 +487,35 @@ sub ACTION_load_url {
my $self = shift;
my $q = shift;
my $source = $q->param('browser_source');
- my $name = $q->param('name');
- $name =~ s/%20/ /g;
+ my $filename = $q->param('snapcode');
+ my $name = $q->param('snapname');
+ $filename =~ s/%20/ /g;
my $from_id = $q->param('id');
my $settings = $self->state;
my $userid = $settings->{userid};
# The snapshot is loaded from the global variable
my $globals = $self->render->globals;
- my $session = $globals->session($from_id);
- my $snapshot = $session->{session}->{_DATA}->{$source}->{'snapshots'}->{$name};
+ my $dir = $globals->user_dir;
+ my $snapshot_data;
+
+ open SNAPSHOT, "<$dir/$source/$from_id/$filename.txt" or die "Can't open $dir: $!";
+ $snapshot_data = do { local $/; <SNAPSHOT> };
+ close SNAPSHOT;
+ my $snapshot = eval "my $snapshot_data";
- if (!$snapshot || !$session){
+ if (!$snapshot){
return(504,'text/plain',undef);
} else {
my $UTCtime = strftime("%Y-%m-%d %H:%M:%S\n", gmtime(time));
$snapshot->{session_time} = $UTCtime;
$snapshot->{userid} = $userid;
-
+
+ my $snapshot_id = md5_hex(time);
+ $snapshot->{snapshot_id} = $snapshot_id;
+
# The snapshot is saved after updates to some of the information have been made
$self->session->session->{'_DATA'}->{$source}->{snapshots}->{$name} = $snapshot;
@@ -2135,7 +2135,6 @@ sub reconfigure_track {
: $state->{features}{$label}{semantic_override}{"$semantic_low:$semantic_hi"} = {};
my $glyph = param('conf_glyph') || '';
-
for my $s ( grep {/^conf_/} param()) {
my @values = param($s);
my $value = $values[-1]; # last one wins
@@ -2172,7 +2171,7 @@ sub reconfigure_track {
}
}
}
- unless (defined $o->{autoscale} && $o->{autoscale} eq 'none') {
+ if (defined $o->{autoscale} && $o->{autoscale} eq 'local') {
undef $o->{min_score};
undef $o->{max_score}
}
Oops, something went wrong.

0 comments on commit df95f63

Please sign in to comment.