Skip to content

Commit

Permalink
image viewer: add option to only view links found in all searches
Browse files Browse the repository at this point in the history
  • Loading branch information
mriffle committed Jul 15, 2021
1 parent e27b9d5 commit 45e425f
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,16 @@ circlePlotViewer.prototype.drawMonolinks = function( svgRootSnapSVGObject ) {
link.protein1 = proteinId;
link.position1 = parseInt( position ); // looks like monolink positions are strings?
link.uid1 = imagePagePrimaryRootCodeObject_LocalCopy.getVariable__v_indexManager().getUIDForIndex( i );


var lsearches = imagePagePrimaryRootCodeObject_LocalCopy.getVariable__v_proteinMonolinkPositions()[ link.protein1 ][ link.position1 ];

// skip this link if the users has selected to only include links found in all searches
// and this wasn't found in all searches
if ( $( "input#only-show-links-in-all-searches" ).is( ':checked' ) ) {
if(lsearches.length !== imagePagePrimaryRootCodeObject_LocalCopy.getVariable__v_projectSearchIds().length) {
continue;
}
}

this.drawMonolink( i, link, svgRootSnapSVGObject );
}
Expand Down Expand Up @@ -821,7 +830,17 @@ circlePlotViewer.prototype.drawLooplinks = function( svgRootSnapSVGObject ) {
link.position1 = fromPosition;
link.position2 = toPosition;
link.uid1 = imagePagePrimaryRootCodeObject_LocalCopy.getVariable__v_indexManager().getUIDForIndex( i );


var lsearches = imagePagePrimaryRootCodeObject_LocalCopy.getVariable__v_proteinLooplinkPositions()[ link.protein1 ][ link.protein1 ][ link.position1 ][ link.position2 ];

// skip this link if the users has selected to only include links found in all searches
// and this wasn't found in all searches
if ( $( "input#only-show-links-in-all-searches" ).is( ':checked' ) ) {
if(lsearches.length !== imagePagePrimaryRootCodeObject_LocalCopy.getVariable__v_projectSearchIds().length) {
continue;
}
}

var looplink = this.drawCrosslink( i, fromPosition, i, toPosition, link, svgRootSnapSVGObject );
looplink.attr( { "stroke-dasharray":"4,2" });
}
Expand Down Expand Up @@ -868,7 +887,17 @@ circlePlotViewer.prototype.drawCrosslinks = function( svgRootSnapSVGObject ) {
link.position2 = toPosition;
link.uid1 = imagePagePrimaryRootCodeObject_LocalCopy.getVariable__v_indexManager().getUIDForIndex( i );
link.uid2 = imagePagePrimaryRootCodeObject_LocalCopy.getVariable__v_indexManager().getUIDForIndex( j );


var lsearches = imagePagePrimaryRootCodeObject_LocalCopy.getVariable__v_proteinLinkPositions()[ link.protein1 ][ link.protein2 ][ link.position1 ][ link.position2 ];

// skip this link if the users has selected to only include links found in all searches
// and this wasn't found in all searches
if ( $( "input#only-show-links-in-all-searches" ).is( ':checked' ) ) {
if(lsearches.length !== imagePagePrimaryRootCodeObject_LocalCopy.getVariable__v_projectSearchIds().length) {
continue;
}
}

this.drawCrosslink( i, fromPosition, j, toPosition, link, svgRootSnapSVGObject );
}

Expand Down Expand Up @@ -928,7 +957,17 @@ circlePlotViewer.prototype.drawSelfCrosslinks = function( svgRootSnapSVGObject )
link.position2 = toPosition;
link.uid1 = imagePagePrimaryRootCodeObject_LocalCopy.getVariable__v_indexManager().getUIDForIndex( i );
link.uid2 = link.uid1;


var lsearches = imagePagePrimaryRootCodeObject_LocalCopy.getVariable__v_proteinLinkPositions()[ link.protein1 ][ link.protein2 ][ link.position1 ][ link.position2 ];

// skip this link if the users has selected to only include links found in all searches
// and this wasn't found in all searches
if ( $( "input#only-show-links-in-all-searches" ).is( ':checked' ) ) {
if(lsearches.length !== imagePagePrimaryRootCodeObject_LocalCopy.getVariable__v_projectSearchIds().length) {
continue;
}
}

this.drawCrosslink( i, fromPosition, i, toPosition, link, svgRootSnapSVGObject );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ var ImagePagePrimaryRootCodeClass = function() {
/*
* The version number to pass along in the JSON for check for compatibility
*/
var _JSON_VERSION_NUMBER = 2;
var _JSON_VERSION_NUMBER = 3;
/**
* Default exclude link type "No Links"
*/
Expand Down Expand Up @@ -590,6 +590,7 @@ var ImagePagePrimaryRootCodeClass = function() {
"link_exclusion_data_current" : "A",
"removeNonUniquePSMs" : "B",
"minPSMs" : "C",
"onlyShowLinksInAllSearches" : "D",

// For future additions, please continue the single character approach instead of using mnemonic or acronym
// 1) It will keep the overall JSON string shorter
Expand Down Expand Up @@ -1114,6 +1115,9 @@ var ImagePagePrimaryRootCodeClass = function() {
if ( $( "input#shade-by-counts" ).is( ':checked' ) ) {
hashObjectManager.setOnHashObject( HASH_OBJECT_PROPERTIES["shade-by-counts"], true );
}
if ( $( "input#only-show-links-in-all-searches" ).is( ':checked' ) ) {
hashObjectManager.setOnHashObject( HASH_OBJECT_PROPERTIES["onlyShowLinksInAllSearches"], true );
}
if ( $( "input#view-as-circle-plot" ).is( ':checked' ) ) {
hashObjectManager.setOnHashObject( HASH_OBJECT_PROPERTIES["view-as-circle-plot"], true );
} else {
Expand Down Expand Up @@ -2137,6 +2141,11 @@ var ImagePagePrimaryRootCodeClass = function() {
if( 'shade-by-counts' in json ) {
$( "input#shade-by-counts" ).prop('checked', json[ 'shade-by-counts' ] );
}
if( 'onlyShowLinksInAllSearches' in json ) {
$( "input#only-show-links-in-all-searches" ).prop('checked', json[ 'shade-by-counts' ] );
} else {
$( "input#only-show-links-in-all-searches" ).prop('checked', false );
}
// handle the scale factor visibility items
if ( json[ 'automatic-sizing' ] != undefined && json[ 'automatic-sizing' ] === false ) {
$( "input#automatic-sizing" ).prop('checked', false );
Expand Down Expand Up @@ -4625,6 +4634,15 @@ var ImagePagePrimaryRootCodeClass = function() {
var fromPp = fromProteinPositionInt;
var toPp = toProteinPositionInt;
var lsearches = _proteinLinkPositions[ fromProteinId ][ toProteinId ][ fromProteinPosition ][ toProteinPosition ];

// skip this link if the users has selected to only include links found in all searches
// and this wasn't found in all searches
if ( $( "input#only-show-links-in-all-searches" ).is( ':checked' ) ) {
if(lsearches.length !== _projectSearchIds.length) {
continue;
}
}

// for display to user
var searchIdArray = convertProjectSearchIdArrayToSearchIdArray( lsearches );
var getCrosslinkLineColorParams = {
Expand Down Expand Up @@ -4768,6 +4786,15 @@ var ImagePagePrimaryRootCodeClass = function() {
var fromPp = fromProteinPositionInt;
var toPp = toProteinPositionInt;
var lsearches = _proteinLinkPositions[ proteinBarProteinId ][ proteinBarProteinId ][ fromProteinPosition ][ toProteinPosition ];

// skip this link if the users has selected to only include links found in all searches
// and this wasn't found in all searches
if ( $( "input#only-show-links-in-all-searches" ).is( ':checked' ) ) {
if(lsearches.length !== _projectSearchIds.length) {
continue;
}
}

// for display to user
var searchIdArray = convertProjectSearchIdArrayToSearchIdArray( lsearches );
var link = {
Expand Down Expand Up @@ -4881,6 +4908,15 @@ var ImagePagePrimaryRootCodeClass = function() {
var fromPp = fromProteinPositionInt;
var toPp = toProteinPositionInt;
var lsearches = _proteinLooplinkPositions[ proteinBarProteinId ][ proteinBarProteinId ][ fromProteinPosition ][ toProteinPosition ];

// skip this link if the users has selected to only include links found in all searches
// and this wasn't found in all searches
if ( $( "input#only-show-links-in-all-searches" ).is( ':checked' ) ) {
if(lsearches.length !== _projectSearchIds.length) {
continue;
}
}

// for display to user
var searchIdArray = convertProjectSearchIdArrayToSearchIdArray( lsearches );
var link = {
Expand Down Expand Up @@ -4989,6 +5025,15 @@ var ImagePagePrimaryRootCodeClass = function() {
var fromP = _proteinNames[ proteinBarProteinId ];
var fromPp = proteinPositionInt;
var lsearches = _proteinMonolinkPositions[ proteinBarProteinId ][ proteinPosition ];

// skip this link if the users has selected to only include links found in all searches
// and this wasn't found in all searches
if ( $( "input#only-show-links-in-all-searches" ).is( ':checked' ) ) {
if(lsearches.length !== _projectSearchIds.length) {
continue;
}
}

var searchIdArray = convertProjectSearchIdArrayToSearchIdArray( lsearches );
var link = {
type : 'monolink',
Expand Down Expand Up @@ -5850,6 +5895,15 @@ var ImagePagePrimaryRootCodeClass = function() {
throw e;
}
});
$( "input#only-show-links-in-all-searches" ).change( function() {
try {
updateURLHash( false /* useSearchForm */ );
drawSvg();
} catch( e ) {
reportWebErrorToServer.reportErrorObjectToServer( { errorException : e } );
throw e;
}
});
$( "input#show-scalebar" ).change( function() {
try {
updateURLHash( false /* useSearchForm */ );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@
><input type="checkbox" id="view-as-circle-plot"
>View as Circle Plot</span></label>

<label><span style="white-space:nowrap;"
class="tool_tip_attached_jq" data-tooltip="If checked, only links found in all searches will be shown"
><input type="checkbox" id="only-show-links-in-all-searches"
>Only Show Links in All Searches</span></label>

<%-- Select for "color by" with options of by search or by region --%>
&nbsp;&nbsp;&nbsp;&nbsp;
<span style="white-space: nowrap;">
Expand Down

0 comments on commit 45e425f

Please sign in to comment.