<commit_before>"use strict";

///////////////////////////////////////////

var circlePlotViewer = function() {	
	this.initialize();
};


circlePlotViewer.prototype.initialize  = function(  ) {
	
};

circlePlotViewer.prototype.CONSTANTS = { 

		_DEFAULT_VIEWPORT_HEIGHT : 800,
		_DEFAULT_VIEWPORT_WIDTH : 800,
		
		_GAP_BETWEEN_BARS : 2,			// gap between proteins bars in degrees
		_HEIGHT_OF_PROTEIN_BARS : 40,	// height of protein bars in pixels
		_GAP_BETWEEN_BARS_AND_LINKS : 2, // gap in pixels between protein bars and start of drawn links
		_MINIMUM_CROSSLINK_LOOP_HEIGHT: 60, // minimum height of crosslink loops in pixels
		_MONOLINK_HEIGHT:15,			// height of monolinks in pixels
		
		_LINKABLE_POSITION_COLOR:"#ffffff",	// color to use for linkable positions
		_LINKABLE_POSITION_OPACITY:0.5,	// opacity to use for linkable positions
		
		_SCALE_BAR_HEIGHT:10,		// height of scale bar in pixels
		_SCALE_BAR_FONT_HEIGHT:12,	// height of scale bar font in pixles
		_GAP_BETWEEN_SCALE_BAR_AND_TEXT:5,	// gap (in pixels) between scale bar and scale bar label
		_GAP_BETWEEN_SCALE_BAR_AND_PROTEIN_BAR:5,	// gap (in pixels) between scale bar and protein bar
		
		_LEGEND_WIDTH:200,			// width to allocate for the legend when coloring by search
		_LEGEND_GAP:10,				// space between legend and drawing
		_LEGEND_HEADER_HEIGHT:16,	// height of the font of the legend header
		_LEGEND_FONT_HEIGHT:14,		// height of the font of the legend text
		_LEGEND_INDENT:5,			// indentation for legend items under header
		_LEGEND_RADIUS:7,			// pixels of radius of legend indicator (circle)
		
		// colors to use when coloring by search
		_SEARCH_COLORS: {
			"1" : "#995d5d",	// redish
			"2" : "#5d6499",	// blueish
			"3" : "#b5af00",	// yellowish
			
			"12" : "#cd83c7",	// purpleish
			"13" : "#35bec0",	// orangeish
			"23" : "#5d9960",	// greenish
			
			"123" : "#3a3a3a",	// grey
		},
		
		_FEATURE_ANNOTATION_HEIGHT:15,	// height of the feature annotation bar
		_DISOPRED_COLOR: "#3a3a3a",			// color to use for disopred annotations
		_PSIPRED_ALPHA_COLOR: "#5d9960",	// color to use for alpha helices in psipred annotations
		_PSIPRED_BETA_COLOR: "#5d6499"		// color to use for beta sheets in psipred annotations
};

/**
 * Draw the diagram
 */
circlePlotViewer.prototype.draw  = function(  ) {

	// our SVG object onto which we're drawing
	var svgRootSnapSVGObject = this.inializeSVGObject();
	
	// if this object is undefined or empty, we couldn't draw so do nothing
	if( !svgRootSnapSVGObject ) {
		return;
	}
	
	this.setViewerDimensions( svgRootSnapSVGObject );
	
	this.drawProteinBars( svgRootSnapSVGObject );
	
	
	if( this.isFeatureAnnotationShown() ) {
		this.drawFeatureAnnotationData( svgRootSnapSVGObject );
	}
		
	if ( $( "input#show-scalebar" ).is( ':checked' ) ) {
		this.drawScaleBars( svgRootSnapSVGObject );
	}
	
	if ( $( "input#show-linkable-positions" ).is( ':checked' ) ) {
		this.drawLinkablePositions( svgRootSnapSVGObject );
	}
	
	if ( $( "input#show-self-crosslinks" ).is( ':checked' ) ) {
		this.drawSelfCrosslinks( svgRootSnapSVGObject );
	}

	if ( $( "input#show-crosslinks" ).is( ':checked' ) ) {
		this.drawCrosslinks( svgRootSnapSVGObject );
	}
	
	if ( $( "input#show-looplinks" ).is( ':checked' ) ) {
		this.drawLooplinks( svgRootSnapSVGObject );
	}
	
	if ( $( "input#show-monolinks" ).is( ':checked' ) ) {
		this.drawMonolinks( svgRootSnapSVGObject );
	}
	
	if ( $( "input#show-tryptic-cleavage-positions" ).is( ':checked' ) ) {
		this.drawTrypticPositions( svgRootSnapSVGObject );
	}
	
	if( this.isColorBySearch() ) {
		this.drawLegend( svgRootSnapSVGObject );
	}
	
	
	
};

/**
 * Draw the selected annotation data on the image
 * @param svgRootSnapSVGObject
 */
circlePlotViewer.prototype.drawFeatureAnnotationData = function( svgRootSnapSVGObject ) {
	var selectedProteins = getAllSelectedProteins();
	var annoType = $("#annotation_type").val();	
	var radii = this.getFeatureAnnotationRadii();		// the radii to use for drawing the feature annotation curved bars
	
	for( var i = 0; i < selectedProteins.length; i++ ) {
		
		var segments;
		if( annoType === SELECT_ELEMENT_ANNOTATION_TYPE_DISOPRED3 ) {
		
			segments = getDisorderedRegionsDisopred_3( selectedProteins[ i ] );

		} else if( annoType === SELECT_ELEMENT_ANNOTATION_TYPE_PSIPRED3 ) {
			
			segments = getSecondaryStructureRegions( selectedProteins[ i ] );
			
		} else if( annoType === SELECT_ELEMENT_ANNOTATION_TYPE_SEQUENCE_COVERAGE ) {
			
			segments = _ranges[ selectedProteins[ i ] ];
			
		} else {
			console.log( "Error, unknown feature annotation type selected." );
			return;
		}
		
		if( segments == undefined ) {
			console.log( "Error, got undefined for segments." );
			
			console.log( "protein: " + selectedProteins[ i ] );
			consoloe.log( "annoType: " + annoType );
			
			return;
		}
		
		// draw the segments
		for( var s = 0; s < segments.length; s++ ) {
			
			var segment = segments[ s ];

			// get the color to use for this segment
			var color;
			if( annoType === SELECT_ELEMENT_ANNOTATION_TYPE_DISOPRED3 ) {
				
				color = this.CONSTANTS._DISOPRED_COLOR;

			} else if( annoType === SELECT_ELEMENT_ANNOTATION_TYPE_PSIPRED3 ) {
				
				if ( segment.type === BETA_SHEET ) {
					color = this.CONSTANTS._PSIPRED_BETA_COLOR;
				} else {<commit_msg>Fixed typo in console debugging message.<commit_after>"use strict";

///////////////////////////////////////////

var circlePlotViewer = function() {	
	this.initialize();
};


circlePlotViewer.prototype.initialize  = function(  ) {
	
};

circlePlotViewer.prototype.CONSTANTS = { 

		_DEFAULT_VIEWPORT_HEIGHT : 800,
		_DEFAULT_VIEWPORT_WIDTH : 800,
		
		_GAP_BETWEEN_BARS : 2,			// gap between proteins bars in degrees
		_HEIGHT_OF_PROTEIN_BARS : 40,	// height of protein bars in pixels
		_GAP_BETWEEN_BARS_AND_LINKS : 2, // gap in pixels between protein bars and start of drawn links
		_MINIMUM_CROSSLINK_LOOP_HEIGHT: 60, // minimum height of crosslink loops in pixels
		_MONOLINK_HEIGHT:15,			// height of monolinks in pixels
		
		_LINKABLE_POSITION_COLOR:"#ffffff",	// color to use for linkable positions
		_LINKABLE_POSITION_OPACITY:0.5,	// opacity to use for linkable positions
		
		_SCALE_BAR_HEIGHT:10,		// height of scale bar in pixels
		_SCALE_BAR_FONT_HEIGHT:12,	// height of scale bar font in pixles
		_GAP_BETWEEN_SCALE_BAR_AND_TEXT:5,	// gap (in pixels) between scale bar and scale bar label
		_GAP_BETWEEN_SCALE_BAR_AND_PROTEIN_BAR:5,	// gap (in pixels) between scale bar and protein bar
		
		_LEGEND_WIDTH:200,			// width to allocate for the legend when coloring by search
		_LEGEND_GAP:10,				// space between legend and drawing
		_LEGEND_HEADER_HEIGHT:16,	// height of the font of the legend header
		_LEGEND_FONT_HEIGHT:14,		// height of the font of the legend text
		_LEGEND_INDENT:5,			// indentation for legend items under header
		_LEGEND_RADIUS:7,			// pixels of radius of legend indicator (circle)
		
		// colors to use when coloring by search
		_SEARCH_COLORS: {
			"1" : "#995d5d",	// redish
			"2" : "#5d6499",	// blueish
			"3" : "#b5af00",	// yellowish
			
			"12" : "#cd83c7",	// purpleish
			"13" : "#35bec0",	// orangeish
			"23" : "#5d9960",	// greenish
			
			"123" : "#3a3a3a",	// grey
		},
		
		_FEATURE_ANNOTATION_HEIGHT:15,	// height of the feature annotation bar
		_DISOPRED_COLOR: "#3a3a3a",			// color to use for disopred annotations
		_PSIPRED_ALPHA_COLOR: "#5d9960",	// color to use for alpha helices in psipred annotations
		_PSIPRED_BETA_COLOR: "#5d6499"		// color to use for beta sheets in psipred annotations
};

/**
 * Draw the diagram
 */
circlePlotViewer.prototype.draw  = function(  ) {

	// our SVG object onto which we're drawing
	var svgRootSnapSVGObject = this.inializeSVGObject();
	
	// if this object is undefined or empty, we couldn't draw so do nothing
	if( !svgRootSnapSVGObject ) {
		return;
	}
	
	this.setViewerDimensions( svgRootSnapSVGObject );
	
	this.drawProteinBars( svgRootSnapSVGObject );
	
	
	if( this.isFeatureAnnotationShown() ) {
		this.drawFeatureAnnotationData( svgRootSnapSVGObject );
	}
		
	if ( $( "input#show-scalebar" ).is( ':checked' ) ) {
		this.drawScaleBars( svgRootSnapSVGObject );
	}
	
	if ( $( "input#show-linkable-positions" ).is( ':checked' ) ) {
		this.drawLinkablePositions( svgRootSnapSVGObject );
	}
	
	if ( $( "input#show-self-crosslinks" ).is( ':checked' ) ) {
		this.drawSelfCrosslinks( svgRootSnapSVGObject );
	}

	if ( $( "input#show-crosslinks" ).is( ':checked' ) ) {
		this.drawCrosslinks( svgRootSnapSVGObject );
	}
	
	if ( $( "input#show-looplinks" ).is( ':checked' ) ) {
		this.drawLooplinks( svgRootSnapSVGObject );
	}
	
	if ( $( "input#show-monolinks" ).is( ':checked' ) ) {
		this.drawMonolinks( svgRootSnapSVGObject );
	}
	
	if ( $( "input#show-tryptic-cleavage-positions" ).is( ':checked' ) ) {
		this.drawTrypticPositions( svgRootSnapSVGObject );
	}
	
	if( this.isColorBySearch() ) {
		this.drawLegend( svgRootSnapSVGObject );
	}
	
	
	
};

/**
 * Draw the selected annotation data on the image
 * @param svgRootSnapSVGObject
 */
circlePlotViewer.prototype.drawFeatureAnnotationData = function( svgRootSnapSVGObject ) {
	var selectedProteins = getAllSelectedProteins();
	var annoType = $("#annotation_type").val();	
	var radii = this.getFeatureAnnotationRadii();		// the radii to use for drawing the feature annotation curved bars
	
	for( var i = 0; i < selectedProteins.length; i++ ) {
		
		var segments;
		if( annoType === SELECT_ELEMENT_ANNOTATION_TYPE_DISOPRED3 ) {
		
			segments = getDisorderedRegionsDisopred_3( selectedProteins[ i ] );

		} else if( annoType === SELECT_ELEMENT_ANNOTATION_TYPE_PSIPRED3 ) {
			
			segments = getSecondaryStructureRegions( selectedProteins[ i ] );
			
		} else if( annoType === SELECT_ELEMENT_ANNOTATION_TYPE_SEQUENCE_COVERAGE ) {
			
			segments = _ranges[ selectedProteins[ i ] ];
			
		} else {
			console.log( "Error, unknown feature annotation type selected." );
			return;
		}
		
		if( segments == undefined ) {
			console.log( "Error, got undefined for segments." );
			
			console.log( "protein: " + selectedProteins[ i ] );
			console.log( "annoType: " + annoType );
			
			return;
		}
		
		// draw the segments
		for( var s = 0; s < segments.length; s++ ) {
			
			var segment = segments[ s ];

			// get the color to use for this segment
			var color;
			if( annoType === SELECT_ELEMENT_ANNOTATION_TYPE_DISOPRED3 ) {
				
				color = this.CONSTANTS._DISOPRED_COLOR;

			} else if( annoType === SELECT_ELEMENT_ANNOTATION_TYPE_PSIPRED3 ) {
				
				if ( segment.type === BETA_SHEET ) {
					color = this.CONSTANTS._PSIPRED_BETA_COLOR;
				} else {
{'fraction_non_alphanumeric': 0.12107750472589791, 'fraction_numerical': 0.017580340264650284, 'mean_word_length': 3.523728088926892, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5263942', 'n_tokens_mistral': 4310, 'n_tokens_neox': 3708, 'n_words': 881}