function parseDilutionTransfersLims(str) {
	var rowArray = parseCsv(str, ",");
	var firstDataRow;
	// Find the header row:
	for(var i=0, n=rowArray.length; i<n; i++) {
		if(rowArray[i][0] === "Sample Name") {
			firstDataRow = i + 1;
			break;
		}
	}
	if(firstDataRow === undefined) {
		throw "UnableToParseTransferTableException: Missing header row"
	}
	rowArray = rowArray.slice(firstDataRow);
	// Alternatively: rowArray.splice(0, firstDataRow);
	rowArray.sort(transferSorter(1,2));
	var transferArrays = [];
	// Add the array that will hold the buffer transfers:
	transferArrays.push([]);
	var plateSet = {};
	var sourceIndex;
	var diluentWell = convertCoords("A1");
	for(var i=0, n=rowArray.length; i<n; i++) {
		var row = rowArray[i];
		var sourcePlate, sourceWell, sourceVolume;
		var destinationPlate, destinationWell, diluentVolume;
		try {
			sourcePlate = row[1].trim();
			sourceWell = convertCoordsRegExp(row[2]);
			destinationPlate = row[6].trim();
			destinationWell = convertCoordsRegExp(row[7]);
			// A missing value should be treated as 0 volume:
			try {
				sourceVolume = parseNumber(row[5], 3);
			} catch(e) {
				if(row[5] === "") {
					sourceVolume = 0;
				} else {
					throw e;
				}
			}
			try {
				diluentVolume = parseNumber(row[11], 3);
			} catch(e) {
				if(row[11] === "") {
					diluentVolume = 0;
				} else {
					throw e;
				}
			}
		} catch(e) {
			throw "UnableToParseTransferTableException:" + e;
		}
		var newTip;
		if(diluentVolume > 0) {
			newTip = (transferArrays[0].length === 0);
			transferArrays[0].push(new Transfer("diluent_reservoir",
				diluentWell, diluentVolume, destinationWell, destinationPlate, newTip));
		}
		if(!(sourcePlate in plateSet)) {
			plateSet[sourcePlate] = sourcePlate;
			sourceIndex = transferArrays.push([]) - 1;
		}
		if(sourceVolume > 0) {
			newTip = (sourceIndex > 1 || transferArrays[sourceIndex].length > 0);
			transferArrays[sourceIndex].push(new Transfer(sourcePlate, sourceWell,
				sourceVolume, destinationWell, destinationPlate, newTip));
		}
	}
	return transferArrays;
}
/*
 Creates an array of Transfer objects from a csv file with a format matching
 what the normalization process of the GenoLogics Clarity LIMS produces
*/
Creates an array of Transfer objects from a csv file with a format matching
what the normalization process of the GenoLogics Clarity LIMS produces
Creates an array of Transfer objects from a csv file with a format matching what the normalization process of the GenoLogics Clarity LIMS produces
function parseDilutionTransfersLims(str) {
	var rowArray = parseCsv(str, ",");
	var firstDataRow;
	for(var i=0, n=rowArray.length; i<n; i++) {
		if(rowArray[i][0] === "Sample Name") {
			firstDataRow = i + 1;
			break;
		}
	}
	if(firstDataRow === undefined) {
		throw "UnableToParseTransferTableException: Missing header row"
	}
	rowArray = rowArray.slice(firstDataRow);
	rowArray.sort(transferSorter(1,2));
	var transferArrays = [];
	transferArrays.push([]);
	var plateSet = {};
	var sourceIndex;
	var diluentWell = convertCoords("A1");
	for(var i=0, n=rowArray.length; i<n; i++) {
		var row = rowArray[i];
		var sourcePlate, sourceWell, sourceVolume;
		var destinationPlate, destinationWell, diluentVolume;
		try {
			sourcePlate = row[1].trim();
			sourceWell = convertCoordsRegExp(row[2]);
			destinationPlate = row[6].trim();
			destinationWell = convertCoordsRegExp(row[7]);
			try {
				sourceVolume = parseNumber(row[5], 3);
			} catch(e) {
				if(row[5] === "") {
					sourceVolume = 0;
				} else {
					throw e;
				}
			}
			try {
				diluentVolume = parseNumber(row[11], 3);
			} catch(e) {
				if(row[11] === "") {
					diluentVolume = 0;
				} else {
					throw e;
				}
			}
		} catch(e) {
			throw "UnableToParseTransferTableException:" + e;
		}
		var newTip;
		if(diluentVolume > 0) {
			newTip = (transferArrays[0].length === 0);
			transferArrays[0].push(new Transfer("diluent_reservoir",
				diluentWell, diluentVolume, destinationWell, destinationPlate, newTip));
		}
		if(!(sourcePlate in plateSet)) {
			plateSet[sourcePlate] = sourcePlate;
			sourceIndex = transferArrays.push([]) - 1;
		}
		if(sourceVolume > 0) {
			newTip = (sourceIndex > 1 || transferArrays[sourceIndex].length > 0);
			transferArrays[sourceIndex].push(new Transfer(sourcePlate, sourceWell,
				sourceVolume, destinationWell, destinationPlate, newTip));
		}
	}
	return transferArrays;
}
function parseDilutionTransfersLims ( str ) { var rowArray = parseCsv ( str , "," ) ; var firstDataRow ; for ( var i = 0 , n = rowArray . length ; i < n ; i ++ ) { if ( rowArray [ i ] [ 0 ] === "Sample Name" ) { firstDataRow = i + 1 ; break ; } } if ( firstDataRow === undefined ) { throw "UnableToParseTransferTableException: Missing header row" } rowArray = rowArray . slice ( firstDataRow ) ; rowArray . sort ( transferSorter ( 1 , 2 ) ) ; var transferArrays = [ ] ; transferArrays . push ( [ ] ) ; var plateSet = { } ; var sourceIndex ; var diluentWell = convertCoords ( "A1" ) ; for ( var i = 0 , n = rowArray . length ; i < n ; i ++ ) { var row = rowArray [ i ] ; var sourcePlate , sourceWell , sourceVolume ; var destinationPlate , destinationWell , diluentVolume ; try { sourcePlate = row [ 1 ] . trim ( ) ; sourceWell = convertCoordsRegExp ( row [ 2 ] ) ; destinationPlate = row [ 6 ] . trim ( ) ; destinationWell = convertCoordsRegExp ( row [ 7 ] ) ; try { sourceVolume = parseNumber ( row [ 5 ] , 3 ) ; } catch ( e ) { if ( row [ 5 ] === "" ) { sourceVolume = 0 ; } else { throw e ; } } try { diluentVolume = parseNumber ( row [ 11 ] , 3 ) ; } catch ( e ) { if ( row [ 11 ] === "" ) { diluentVolume = 0 ; } else { throw e ; } } } catch ( e ) { throw "UnableToParseTransferTableException:" + e ; } var newTip ; if ( diluentVolume > 0 ) { newTip = ( transferArrays [ 0 ] . length === 0 ) ; transferArrays [ 0 ] . push ( new Transfer ( "diluent_reservoir" , diluentWell , diluentVolume , destinationWell , destinationPlate , newTip ) ) ; } if ( ! ( sourcePlate in plateSet ) ) { plateSet [ sourcePlate ] = sourcePlate ; sourceIndex = transferArrays . push ( [ ] ) - 1 ; } if ( sourceVolume > 0 ) { newTip = ( sourceIndex > 1 || transferArrays [ sourceIndex ] . length > 0 ) ; transferArrays [ sourceIndex ] . push ( new Transfer ( sourcePlate , sourceWell , sourceVolume , destinationWell , destinationPlate , newTip ) ) ; } } return transferArrays ; }
Creates an array of Transfer objects from a csv file with a format matching
what the normalization process of the GenoLogics Clarity LIMS produces
Creates an array of Transfer objects from a csv file with a format matching what the normalization process of the GenoLogics Clarity LIMS produces
// Find the header row: // Alternatively: rowArray.splice(0, firstDataRow); // Add the array that will hold the buffer transfers: // A missing value should be treated as 0 volume: