How to use the locutus/php/strings/sprintf function in locutus

To help you get started, we’ve selected a few locutus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gaitat / GenomeUPlot / js / GenomePlot / GenomePlot.js View on Github external
var sizes = GenomePlot.chromosomes[ d.toString() ];

					// the space between adjacent chroms
					var space = GenomePlot.MAX_CHROMOSOME_BASE - sizes.chromSizeLeft - sizes.chromSizeRight;

					return GenomePlot.linearGenomicToPaddedPixelScaleX( sizes.chromSizeLeft + space/2 ).toFixed(GenomePlot.FLOAT_PRECISION);
				} )
				.attr( "y1", function( d ) { return GenomePlot.linearWindowPixelToPaddedPixelScaleY( (d === 23 ? 12 : (d-1)) * GenomePlot.pixelsPerLine ).toFixed(GenomePlot.FLOAT_PRECISION); } )
				.attr( "y2", function( d ) { return GenomePlot.linearWindowPixelToPaddedPixelScaleY( (d === 23 ? 13 : (d)) * GenomePlot.pixelsPerLine ).toFixed(GenomePlot.FLOAT_PRECISION); } )
		;

		divs.exit().remove();
	}

	var endTime = performance.now();
	if( GenomePlot.debug ) console.info( sprintf( "%-20s duration: %.4f seconds", "drawVerticalDividers():", ((endTime-startTime)/1000) ) );
}	// drawVerticalDividers
github gaitat / GenomeUPlot / js / GenomePlot / GenomePlot.js View on Github external
.done (function () {
				GenomePlot.matepairDataStartTime = performance.now();
				console.info( sprintf( "%-20s Started loading Mate Pair data file: %s at %.4fms", "initData():", GenomePlot.matepairDataFile, GenomePlot.matepairDataStartTime ) );

				// load pipeline file, synchronously
				GenomePlot.matepairData = $.ajaxJSONSync (GenomePlot.matepairDataFile);

				var endTime = performance.now();
				console.info( sprintf( "%-20s Finished loading Mate Pair data file: %s at %.4fms (duration: %.4f seconds)", "initData():", GenomePlot.matepairDataFile, endTime, ( ( endTime - GenomePlot.matepairDataStartTime ) / 1000 ) ) );

				// initGUI should be initialized
				if( GenomePlot.matepairData === undefined || GenomePlot.matepairData === null
				||	GenomePlot.gui === undefined )
					return;

				// change the file paths to be relative to the directory the files were copied to
				for( var record in GenomePlot.matepairData ) {
					if( typeof GenomePlot.matepairData[record] !== "string" )
						continue;

					GenomePlot.matepairData[record] =
						GenomePlot.prefixFile + "/" + GenomePlot.matepairData[record].basename();
				}

				GenomePlot.copyNumber30000DataFile = GenomePlot.matepairData["cnvBinned30KJson"];
github gaitat / GenomeUPlot / js / GenomePlot / GenomePlot.js View on Github external
.call( GenomePlot.axisY_R );

		// fix the resulting text
		yAxisNode_R.selectAll("text")
			.style( {
				"stroke": "none",
				"fill": "black",
				"cursor": "pointer",
			} )
			.each( vCenter( GenomePlot.scale * GenomePlot.pixelsPerLine ) )
			.each( hCenter( GenomePlot.margin.right - 5, 1 ) )
		;
	}

	var endTime = performance.now();
	if( GenomePlot.debug ) console.info( sprintf( "%-20s duration: %.4f seconds", "drawAxis():", ((endTime-startTime)/1000) ) );
};	// drawAxis
github gaitat / GenomeUPlot / js / GenomePlot / GenomePlot.js View on Github external
console.error( sprintf( "%-20s Rejected loading Cytoband file: %s with %s at %.4fms (duration: %.4f seconds)", "initData():", GenomePlot.cytoBandFile, value, endTime, ( ( endTime - GenomePlot.cytoBandDataStartTime ) / 1000 ) ) );
					},
					function( error ) {
						console.error( sprintf( "%-20s Failed to load Cytoband file: %s with %s", "initData():", GenomePlot.cytoBandFile, error ) );
					}
				);
			} )
			.fail (function () {
				console.error( sprintf( "%-18s Failed to find Cytoband file: %s", "initData():", GenomePlot.cytoBandFile ) );
			} );
	}

	// load alterations data
	GenomePlot.alterationsData = undefined;
	if( GenomePlot.alterationsDataFile === undefined ) {
		console.error( sprintf( "%-18s Undefined Alterations file", "initData():" ) );
	}
	else {
		$.ajaxFileExists (GenomePlot.alterationsDataFile)
			.done (function () {
				GenomePlot.alterationsDataStartTime = performance.now();
				console.info( sprintf( "%-20s Started loading Alterations file: %s at %.4fms", "initData():", GenomePlot.alterationsDataFile, GenomePlot.alterationsDataStartTime ) );
				GenomePlot.loadedResources++;

				d3.text( GenomePlot.alterationsDataFile, "text/csv", function( data )
				{
					var endTime = performance.now();
					console.info( sprintf( "%-20s Finished loading Alterations file: %s at %.4fms (duration: %.4f seconds)", "initData():", GenomePlot.alterationsDataFile, endTime, ( ( endTime - GenomePlot.alterationsDataStartTime ) / 1000 ) ) );
					GenomePlot.loadedResources--;

					GenomePlot.alterationsData = GenomePlot.processAlterationsData(data);
github gaitat / GenomeUPlot / js / GenomePlot / processCopyNumberData.js View on Github external
for( var j = 0; j < maskedIndicesRanges.length; j++ )
		{
			GenomePlot.copyNumber30000Data.toLegacy.wdnsMaskedPerChrom[ chrom_id ]
				.push( GenomePlot.copyNumber30000Data.toLegacy.wdnsPerChrom[ chrom_id ][ maskedIndicesRanges[ j ] ] );
		}

		// do the same for the end of the chrom. if the last point does not match the expected value it is masked
		// add it directly to the array
		if( GenomePlot.copyNumber30000Data.toLegacy.wdnsPerChrom[ chrom_id ][ GenomePlot.copyNumber30000Data.toLegacy.wdnsPerChrom[ chrom_id ].length - 1 ] !== (chromosomeEnds - chromosomeStarts) * GenomePlot.copyNumber30000Data.windowSize ) {
			GenomePlot.copyNumber30000Data.toLegacy.wdnsMaskedPerChrom[ chrom_id ]
				.push( GenomePlot.copyNumber30000Data.toLegacy.wdnsPerChrom[ chrom_id ][ GenomePlot.copyNumber30000Data.toLegacy.wdnsPerChrom[ chrom_id ].length - 1 ],
						GenomePlot.chromosomes[ (chrom_id+1).toString() ].genomicSize );	// instead of pushing (chromosomeEnds - chromosomeStarts) * GenomePlot.copyNumber30000Data.windowSize push the actual chrom end since we now we are at the end of the chromosome
		}
	}
	console.info( sprintf( "%-20s     Total CNV elements to draw: %s", "initData():", frqCnt.toLocaleString() ) );

	// for the garbage collector
	GenomePlot.copyNumber30000Data.cnv = null;
	GenomePlot.copyNumber30000Data.normalCnv = null;
	GenomePlot.copyNumber30000Data.toLegacy.wdns = null;
	GenomePlot.copyNumber30000Data.toLegacy.frq = null;

	frqGreaterTwoPerChrom = null;
	maskedIndicesArray = null;
	maskedIndicesRanges = null;
};	// processCopyNumber30000Data
github gaitat / GenomeUPlot / js / GenomePlot / GenomePlot.js View on Github external
GenomePlot.computeChromosomeStartPositions = function ()
{
	if( GenomePlot.graphTypeParams.graphType === "U-Shape" )
	{
		// initialize it every time the function runs; garbage collection will take care of the memory
		GenomePlot.chromPixelStarts = new Array( GenomePlot.NUM_CHROMS );

		GenomePlot.linesPerGraph = 13;

		// height in pixels of one line holding one chromosome (or two)
		GenomePlot.pixelsPerLine = GenomePlot.innerHeight / GenomePlot.linesPerGraph;
		if (GenomePlot.debug) console.log (sprintf ("%-20s pixels/line: %f", "computeChromosomeStartPositions():", GenomePlot.pixelsPerLine));

		// create the start pixels positions of the left chromosomes
		for (var i = 0; i < 13; i++)
		{
			var chrom_id = i+1;

			var cx = 0;
			var cy = (i + 0.5) * GenomePlot.pixelsPerLine;		// computed in the un-padded space

			// x: genomic value; y: pixel value
			if (chrom_id === 13)
				GenomePlot.chromPixelStarts[24-2] = { x: cx, y: cy, adjust: 0 };
			else
				GenomePlot.chromPixelStarts[chrom_id-1] = { x: cx, y: cy, adjust: 0 };
		}
github gaitat / GenomeUPlot / js / GenomePlot / GenomePlot.js View on Github external
GenomePlot.computeGraphSize = function ()
{
	GenomePlot.viewportWidth = viewportSize.getWidth() -
		parseFloat( $("#container").css( "margin-left" ).replace("px", "") ) -
		parseFloat( $("#container").css( "margin-right" ).replace("px", "") );
	GenomePlot.viewportHeight = viewportSize.getHeight();
	if (GenomePlot.debug) console.log (sprintf ("%-20s viewport dims: %d x %d", "computeGraphSize():", GenomePlot.viewportWidth, GenomePlot.viewportHeight));

	if( GenomePlot.viewportWidth <= 640
	||	GenomePlot.viewportHeight <= 480 ) {
		GenomePlot.noGUI = true;

		hideElementDisplay( $(GenomePlot.gui.domElement) );
	}
	else {
		GenomePlot.noGUI = false;

		GenomePlot.viewportWidth -= GenomePlot.gui.adjustWidth;
	}

	GenomePlot.viewportUnitWidth = GenomePlot.viewportWidth / 100;
	GenomePlot.viewportUnitHeight = GenomePlot.viewportHeight / 100;
github gaitat / GenomeUPlot / js / GenomePlot / GenomePlot.js View on Github external
function( error, data ) {
			//	fetchData( GenomePlot.cytoBandFile,
			//		function( data ) {
						var endTime = performance.now();
						console.info( sprintf( "%-20s Finished loading Cytoband file: %s at %.4fms (duration: %.4f seconds)", "initData():", GenomePlot.cytoBandFile, endTime, ( ( endTime - GenomePlot.cytoBandDataStartTime ) / 1000 ) ) );
						GenomePlot.loadedResources--;

						GenomePlot.cytoBandData = data;

						console.info( sprintf( "%-20s     Total Cytoband elements to draw: %s", "initData():", GenomePlot.cytoBandData.length.toLocaleString() ) );
					},
					function( value ) {
github gaitat / GenomeUPlot / js / GenomePlot / GenomePlot.js View on Github external
.done (function (data) {
						var endTime = performance.now();
						console.info( sprintf( "%-20s Finished loading CNV file of window size 30000: %s at %.4fms (duration: %.4f seconds)", "initData():", GenomePlot.copyNumber30000DataFile, endTime, ( ( endTime - GenomePlot.copyNumber30000DataStartTime ) / 1000 ) ) );
						GenomePlot.loadedResources--;

						GenomePlot.processCopyNumber30000Data(data);
					} );
			} )
github gaitat / GenomeUPlot / js / GenomePlot / GenomePlot.js View on Github external
function( error ) {
						console.error( sprintf( "%-20s Failed to load Cytoband file: %s with %s", "initData():", GenomePlot.cytoBandFile, error ) );
					}
				);