Skip to content

Commit

Permalink
- code cleanup for 3D vis classes and templates
Browse files Browse the repository at this point in the history
- improved mutation type mappings (fixed issue cBioPortal#60)
  • Loading branch information
onursumer committed Nov 2, 2016
1 parent 2b4ce6b commit bd10fba
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 331 deletions.
139 changes: 0 additions & 139 deletions build/mutationMapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7818,9 +7818,7 @@ var Mutation3dVisView = Backbone.View.extend({
var self = this;
var mut3dVis = self.options.mut3dVis;

// initially hide the 3d visualizer container
var container3d = self.$el;
//container3d.hide();

// initially hide the residue warning message
self.hideResidueWarning();
Expand Down Expand Up @@ -7856,14 +7854,6 @@ var Mutation3dVisView = Backbone.View.extend({

// format toolbar elements

// var spinChecker = self.$el.find(".mutation-3d-spin");
// spinChecker.change(function(){
// if (mut3dVis != null)
// {
// mut3dVis.toggleSpin();
// }
// });

// mutation style controls
self._initMutationControls();

Expand Down Expand Up @@ -7954,34 +7944,6 @@ var Mutation3dVisView = Backbone.View.extend({
var self = this;
var mut3dVis = self.options.mut3dVis;

// var centerSelected = self.$el.find(".mutation-3d-center-selected");
//
// centerSelected.button(
// {icons: {primary: "ui-icon-arrow-4"},
// text: false});
//
// centerSelected.click(function() {
// // center on the selected mutation
// mut3dVis.center();
// });
//
// var centerDefault = self.$el.find(".mutation-3d-center-default");
//
// centerDefault.button(
// {icons: {primary: "ui-icon-arrowreturn-1-w"},
// text: false});
//
// centerDefault.click(function() {
// // restore to the default center
// mut3dVis.resetCenter();
// });
//
// var qtipOpts = self._generateTooltipOpts("NA");
// qtipOpts.content = {attr: 'alt'};
//
// centerSelected.qtip(qtipOpts);
// centerDefault.qtip(qtipOpts);

// init help text controls

var helpContent = self.$el.find(".mutation-3d-vis-help-content");
Expand Down Expand Up @@ -8061,26 +8023,6 @@ var Mutation3dVisView = Backbone.View.extend({
}
});

// var colorByType = self.$el.find(".mutation-3d-mutation-color-by-type");
// // handler for color type checkbox
// colorByType.change(function() {
// var color = colorByType.is(":checked");
// var type = "byMutationType";
//
// // if not coloring by mutation type, then use default atom colors
// if (!color)
// {
// type = "byAtomType";
// }
//
// if (mut3dVis)
// {
// // update and reapply visual style
// mut3dVis.updateOptions({colorMutations: type});
// mut3dVis.reapplyStyle();
// }
// });

// add info tooltip for the color and side chain checkboxes
self._initMutationColorInfo();
self._initSideChainInfo();
Expand Down Expand Up @@ -8213,45 +8155,6 @@ var Mutation3dVisView = Backbone.View.extend({
}
});
},
/**
* Initializes the zoom slider with default values.
*/
_initZoomSlider: function()
{
var self = this;
var zoomSlider = self.$el.find(".mutation-3d-zoom-slider");
var mut3dVis = self.options.mut3dVis;

// helper function to transform slider value into an actual zoom value
var transformValue = function (value)
{
if (value < 0)
{
return 100 + value;
}
else
{
return 100 + (value * 5);
}
};

// handler function for zoom slider events
var zoomHandler = function(event, ui)
{
if (mut3dVis)
{
mut3dVis.zoomTo(transformValue(ui.value));
}
};

// init y-axis slider controls
zoomSlider.slider({value: 0,
min: -80,
max: 80,
stop: zoomHandler,
slide: zoomHandler
});
},
/**
* Updates the 3D visualizer content for the given gene,
* pdb id, and chain.
Expand Down Expand Up @@ -8372,10 +8275,6 @@ var Mutation3dVisView = Backbone.View.extend({
// reload the new pdb structure
else
{
// reset zoom slider
//var zoomSlider = self.$el.find(".mutation-3d-zoom-slider");
//zoomSlider.slider("value", 0);

// show loader image
self.showLoader();

Expand Down Expand Up @@ -13591,9 +13490,6 @@ function Mutation3dVis(name, options)
// spin indicator (initially off)
var _spin = "OFF";

// used for show/hide option (workaround)
var _prevTop = null;

// used for glow effect on highlighted mutations
var _glowInterval = null;

Expand Down Expand Up @@ -13739,24 +13635,6 @@ function Mutation3dVis(name, options)
{
_container.show();
}

// // this is a workaround. see the hide() function below for details
//
// var currentTop = parseInt(_container.css('top'));
//
// // update the top position only if it is negative
// if (currentTop < 0)
// {
// if (_prevTop != null && _prevTop > 0)
// {
// _container.css('top', _prevTop);
// }
// else
// {
// _container.css('top', 0);
// }
// }
//}
}

/**
Expand All @@ -13768,23 +13646,6 @@ function Mutation3dVis(name, options)
{
_container.hide();
}

// jQuery.hide function is problematic after Jmol init
// Reloading the PDB data throws an error message (Error: Bad NPObject as private data!)
// see https://code.google.com/p/gdata-issues/issues/detail?id=4820
// So, the current workaround is to reposition instead of hiding
//if (_container != null)
//{
// //_container.hide();
// var currentTop = parseInt(_container.css('top'));
//
// if (currentTop > 0)
// {
// _prevTop = currentTop;
// }
//
// _container.css('top', -9999);
//}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion build/mutationMapperTemplates.js

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions src/css/mutation_3d.css
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,6 @@
.mutation-3d-zoom-label {
text-align: right;
}
.mutation-3d-zoom-slider {
margin-left: 2px;
width: 80px;
}
.mutation-3d-protein-style-menu {
border-right: 1px solid #AAAAAA;
}
Expand Down
47 changes: 0 additions & 47 deletions src/html/mutation_3d_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,6 @@
</table>
</div>
<div class='mutation-3d-vis-help-content'></div>
<table>
<tr>
<!--td>
<input class='mutation-3d-spin' type='checkbox'>
<label>Spin</label>
</td>
<td class='mutation-3d-buttons'>
<button class='mutation-3d-button mutation-3d-center-selected'
alt='Center the view on the highlighted residue'></button>
<button class='mutation-3d-button mutation-3d-center-default'
alt='Restore the view to its default center'></button>
</td>
<td class='mutation-3d-zoom-label'>
<label>Zoom</label>
</td>
<td>
<div class='mutation-3d-zoom-slider'></div>
</td-->
</tr>
</table>
<table class="mutation-3d-controls-menu" cellpadding="0">
<tr>
<td class='mutation-3d-protein-style-menu' valign='top'>
Expand Down Expand Up @@ -162,33 +142,6 @@
</tr>
<tr>
<td>
<!--table cellpadding="0">
<tr>
<td>
<label>Color:</label>
</td>
<td>
<label>
<input class='mutation-3d-mutation-color-by-type'
type='checkbox'
checked='checked'>
mutation type
</label>
<img class='mutation-type-color-help' src='{{helpImage}}'
alt='Help (mutation type coloring)' />
</td>
</tr>
<tr>
<td></td>
<td>
<label>
<input class='mutation-3d-mutation-color-by-atom'
type='checkbox'>
atom type
</label>
</td>
</tr>
</table-->
<label>Color:</label>
<select class='mutation-3d-mutation-color-select'
title='Select 3d protein mutation color'>
Expand Down
38 changes: 0 additions & 38 deletions src/js/component/Mutation3dVis.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ function Mutation3dVis(name, options)
// spin indicator (initially off)
var _spin = "OFF";

// used for show/hide option (workaround)
var _prevTop = null;

// used for glow effect on highlighted mutations
var _glowInterval = null;

Expand Down Expand Up @@ -212,24 +209,6 @@ function Mutation3dVis(name, options)
{
_container.show();
}

// // this is a workaround. see the hide() function below for details
//
// var currentTop = parseInt(_container.css('top'));
//
// // update the top position only if it is negative
// if (currentTop < 0)
// {
// if (_prevTop != null && _prevTop > 0)
// {
// _container.css('top', _prevTop);
// }
// else
// {
// _container.css('top', 0);
// }
// }
//}
}

/**
Expand All @@ -241,23 +220,6 @@ function Mutation3dVis(name, options)
{
_container.hide();
}

// jQuery.hide function is problematic after Jmol init
// Reloading the PDB data throws an error message (Error: Bad NPObject as private data!)
// see https://code.google.com/p/gdata-issues/issues/detail?id=4820
// So, the current workaround is to reposition instead of hiding
//if (_container != null)
//{
// //_container.hide();
// var currentTop = parseInt(_container.css('top'));
//
// if (currentTop > 0)
// {
// _prevTop = currentTop;
// }
//
// _container.css('top', -9999);
//}
}

/**
Expand Down
25 changes: 24 additions & 1 deletion src/js/util/MutationViewsUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ var MutationViewsUtil = (function()
style: "fusion",
mainType: "other",
priority: 10},
silent: {label: "Silent",
longName: "Silent",
style: "other_mutation",
mainType: "other",
priority: 11},
// this
default: {label: "Other",
longName: "Other",
style: "other_mutation",
mainType: "other",
priority: 11},
// mutations mapped to "other" will be labelled
// with their original data value
other: {style: "other_mutation",
mainType: "other",
priority: 11}
Expand All @@ -126,19 +139,25 @@ var MutationViewsUtil = (function()
"nonsense_mutation": _mutationStyleMap.nonsense,
"nonsense": _mutationStyleMap.nonsense,
"stopgain_snv": _mutationStyleMap.nonsense,
"stop_gained": _mutationStyleMap.nonsense,
"splice_site": _mutationStyleMap.splice_site,
"splice": _mutationStyleMap.splice_site,
"splice site": _mutationStyleMap.splice_site,
"splicing": _mutationStyleMap.splice_site,
"splice_site_snp": _mutationStyleMap.splice_site,
"splice_site_del": _mutationStyleMap.splice_site,
"splice_site_indel": _mutationStyleMap.splice_site,
"splice_region_variant": _mutationStyleMap.splice_site,
"translation_start_site": _mutationStyleMap.nonstart,
"initiator_codon_variant": _mutationStyleMap.nonstart,
"start_codon_snp": _mutationStyleMap.nonstart,
"start_codon_del": _mutationStyleMap.nonstart,
"nonstop_mutation": _mutationStyleMap.nonstop,
"stop_lost": _mutationStyleMap.nonstop,
"in_frame_del": _mutationStyleMap.in_frame_del,
"in_frame_deletion": _mutationStyleMap.in_frame_del,
"in_frame_ins": _mutationStyleMap.in_frame_ins,
"in_frame_insertion": _mutationStyleMap.in_frame_ins,
"indel": _mutationStyleMap.in_frame_del,
"nonframeshift_deletion": _mutationStyleMap.inframe,
"nonframeshift": _mutationStyleMap.inframe,
Expand All @@ -147,8 +166,12 @@ var MutationViewsUtil = (function()
"targeted_region": _mutationStyleMap.inframe,
"inframe": _mutationStyleMap.inframe,
"truncating": _mutationStyleMap.truncating,
"feature_truncation": _mutationStyleMap.truncating,
"fusion": _mutationStyleMap.fusion,
"other": _mutationStyleMap.other
"silent": _mutationStyleMap.silent,
"synonymous_variant": _mutationStyleMap.silent,
"any": _mutationStyleMap.default,
"other": _mutationStyleMap.default
};

/**
Expand Down
Loading

0 comments on commit bd10fba

Please sign in to comment.