Skip to content

Commit f62be03

Browse files
committed
[ENSWEB-3350] fix jump to region on alignslice view
1 parent a90482b commit f62be03

File tree

3 files changed

+24
-25
lines changed

3 files changed

+24
-25
lines changed

htdocs/components/10_ZMenu.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,19 @@ Ensembl.Panel.ZMenu = Ensembl.Panel.extend({
5454

5555
if (this.drag) {
5656
params = this.href.split('|');
57-
n = parseInt(params[1], 10) - 1;
58-
57+
n = parseInt(params[1], 10) - 1;
5958
this.speciesPath = params[3].replace(/-/, '/');
6059
this.species = this.speciesPath.split('/').pop();
6160
this.chr = params[4];
6261
this.start = parseInt(params[5], 10);
6362
this.end = parseInt(params[6], 10);
6463
this.strand = parseInt(params[7], 10);
6564
this.multi = area.klass.multi ? n : false;
66-
6765
if (!this.speciesPath.match(/^\//)) {
6866
this.speciesPath = '/' + this.speciesPath;
6967
}
7068
}
71-
69+
7270
area = null;
7371

7472
delete this.areaCoords.a;
@@ -122,7 +120,7 @@ Ensembl.Panel.ZMenu = Ensembl.Panel.extend({
122120

123121
// The location parameter that is due to be changed has its value replaced with %s
124122
this.baseURL = window.location.href.replace(/&/g, ';').replace(/#.*$/g, '').replace(r, '$1%s;').replace(/[\?;]$/g, '');
125-
123+
126124
// Add r parameter if it doesn't exist already
127125
if (!this.baseURL.match(/%s/)) {
128126
this.baseURL += (this.baseURL.match(/\?/) ? ';' : '?') + 'r=%s';
@@ -378,7 +376,7 @@ Ensembl.Panel.ZMenu = Ensembl.Panel.extend({
378376
var scale = (max - min + 1) / (this.areaCoords.r - this.areaCoords.l);
379377
var url = this.baseURL;
380378
var menu, caption, start, end, tmp, cls;
381-
379+
382380
// Gene, transcript views
383381
function notLocation() {
384382
var view = end - start + 1 > Ensembl.maxRegionLength ? 'Overview' : 'View';
@@ -405,7 +403,8 @@ Ensembl.Panel.ZMenu = Ensembl.Panel.extend({
405403
var label = start ? 'region' : 'location';
406404
label += panel.species === Ensembl.species ? '' : ' on ' + Ensembl.species.replace(/_/g, ' ');
407405

408-
menu = [ '<a href="' + url.replace(/%s/, Ensembl.coreParams.r + ';align_start=' + start + ';align_end=' + end) + '">Jump to best aligned ' + label + '</a>' ];
406+
menu = [ '<a class="loc-icon-a" href="' + url.replace(/%s/, Ensembl.coreParams.r + ';align_start=' + start + ';align_end=' + end) +
407+
'"><span class="loc-icon loc-change"></span>Jump to best aligned ' + label + '</a>' ];
409408
caption = 'Alignment: ' + (start ? start + '-' + end : panel.location);
410409
}
411410

@@ -432,13 +431,12 @@ Ensembl.Panel.ZMenu = Ensembl.Panel.extend({
432431
start = this.end + this.start - end;
433432
end = this.end + this.start - tmp;
434433
}
435-
436-
if (this.align === true) {
434+
435+
if (this.align) {
437436
align();
438437
} else {
439438
url = url.replace(/%s/, this.chr + ':' + start + '-' + end);
440439
caption = 'Region: ' + this.chr + ':' + start + '-' + end;
441-
442440
if (!locationView) {
443441
notLocation();
444442
} else if (this.multi !== false) {
@@ -457,14 +455,15 @@ Ensembl.Panel.ZMenu = Ensembl.Panel.extend({
457455
}
458456
}
459457

460-
if (this.multi === false) {
461-
menu.unshift('<a class="_location_mark loc-icon-a" href="' + Ensembl.updateURL({mr: this.chr + ':' + start + '-' + end}, window.location.href) + '"><span class="loc-icon loc-mark"></span>Mark region (' + (end - start + 1) + ' bp)</a>');
458+
if (this.multi === false && !this.align) {
459+
var no_bases = ' (' + (end - start + 1) + ' bp)';
460+
menu.unshift('<a class="_location_mark loc-icon-a" href="' + '"><span class="loc-icon loc-mark"></span>Mark region' + no_bases + '</a>');
462461
}
463462

464463
} else { // Point select
465464
this.location = Math.floor(min + (this.coords.x - this.areaCoords.l) * scale);
466465

467-
if (this.align === true) {
466+
if (this.align) {
468467
url = this.zoomURL(1/10);
469468
align();
470469
} else {
@@ -608,7 +607,7 @@ Ensembl.Panel.ZMenu = Ensembl.Panel.extend({
608607
start = this.start;
609608
}
610609

611-
if (this.align === true) {
610+
if (this.align) {
612611
return this.baseURL.replace(/%s/, Ensembl.coreParams.r + ';align_start=' + start + ';align_end=' + end);
613612
} else {
614613
return this.baseURL.replace(/%s/, (this.chr || Ensembl.location.name) + ':' + start + '-' + end);
@@ -652,7 +651,6 @@ Ensembl.Panel.ZMenu = Ensembl.Panel.extend({
652651
showExisting: function (data) {
653652
this.event = data.event;
654653
this.coords = data.coords;
655-
656654
if (this.group || this.drag || this.event.shiftKey) {
657655
if (this.elLk.header) {
658656
this.elLk.header.remove();

modules/EnsEMBL/Web/Factory/MultipleLocation.pm

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,11 @@ sub best_guess {
286286
my ($self, $slice, $id, $species, $seq_region_name) = @_;
287287

288288
my $width = $slice->end - $slice->start + 1;
289-
my $production_species = $self->species_defs->get_config($species, 'SPECIES_PRODUCTION_NAME');
290-
291-
foreach my $method ($seq_region_name && $species eq $self->species ? 'LASTZ_PATCH' : (), qw(BLASTZ_NET LASTZ_NET TRANSLATED_BLAT TRANSLATED_BLAT_NET BLASTZ_RAW LASTZ_RAW BLASTZ_CHAIN)) {
292-
my ($seq_region, $cp, $strand);
289+
290+
foreach my $method ($seq_region_name && $species eq $self->species ? 'LASTZ_PATCH' : (), qw(BLASTZ_NET LASTZ_NET TRANSLATED_BLAT TRANSLATED_BLAT_NET BLASTZ_RAW LASTZ_RAW BLASTZ_CHAIN CACTUS_HAL_PW)) { my ($seq_region, $cp, $strand);
293291

294292
eval {
295-
($seq_region, $cp, $strand) = $self->dna_align_feature_adaptor->interpolate_best_location($slice, $production_species, $method, $seq_region_name);
293+
($seq_region, $cp, $strand) = $self->dna_align_feature_adaptor->interpolate_best_location($slice, $species, $method, $seq_region_name);
296294
};
297295

298296
if ($seq_region) {

modules/EnsEMBL/Web/ZMenu/Contig.pm

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,19 @@ sub content {
3333
my $slice_type = $slice->coord_system_name;
3434
my $top_level_slice = $slice->project('toplevel')->[0]->to_Slice;
3535
my $action = $slice->length > $threshold ? 'Overview' : 'View';
36-
36+
3737
$self->caption($slice_name);
3838

3939
$self->add_entry({
4040
label => "Centre on $slice_type $slice_name",
4141
link => $hub->url({
4242
type => 'Location',
4343
action => $action,
44-
region => $slice_name
44+
region => $slice_name,
45+
r => sprintf '%s:%s-%s', map $top_level_slice->$_, qw(seq_region_name start end)
4546
})
4647
});
47-
48+
4849
$self->add_entry({
4950
label => "Export $slice_type sequence/features",
5051
link_class => 'modal_link',
@@ -55,7 +56,7 @@ sub content {
5556
r => sprintf '%s:%s-%s', map $top_level_slice->$_, qw(seq_region_name start end)
5657
})
5758
});
58-
59+
5960
foreach my $cs (@{$db_adaptor->get_CoordSystemAdaptor->fetch_all || []}) {
6061
next if $cs->name eq $slice_type; # don't show the slice coord system twice
6162
next if $cs->name eq 'chromosome'; # don't allow breaking of site by exporting all chromosome features
@@ -77,7 +78,9 @@ sub content {
7778
link => $hub->url({
7879
type => 'Location',
7980
action => $action,
80-
region => $new_slice_name
81+
region => $new_slice_name,
82+
r => sprintf '%s:%s-%s', map $new_slice->$_, qw(seq_region_name start end)
83+
8184
})
8285
});
8386

0 commit comments

Comments
 (0)