Skip to content

Commit

Permalink
edits from additional feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Eileen Choe committed Mar 8, 2018
1 parent 041c187 commit 889c35f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
16 changes: 6 additions & 10 deletions server/controllers/additional-sheet-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,29 @@ var parseExpressionSheet = function (sheet) {
var geneData = {};
expressionData["time_points"] = sheet.data[0].slice(1);
var numberOfDataPoints = expressionData["time_points"].length;
for (var j = 1; j < sheet.data.length; j++) {
var geneName = sheet.data[j][0];
sheet.data.forEach(function (sheet) {
var geneName = sheet[0];
if (geneName) {
var rowData = sheet.data[j].slice(1);
var rowData = sheet.slice(1);
// Sometimes, missing data is at the end of the row. In this case, pad the
// array with nulls
if (rowData.length < numberOfDataPoints) {
fillArray(null, rowData, numberOfDataPoints);
}
geneData[geneName] = rowData;
}
}
});
expressionData["data"] = geneData;
return expressionData;
};

module.exports = function (workbook) {

var output = {
expression: {}, // expression data
meta: {},
test: {} // 2-column data
};

for (var i = 0; i < workbook.length; i++) {
var sheet = workbook[i];
// Parse meta data in "optimization_parameters" sheet
workbook.forEach(function (sheet) {
if (sheet.name === "optimization_parameters") {
output["meta"] = parseMetaDataSheet(sheet);
// Parse 2-column sheets
Expand All @@ -86,6 +82,6 @@ module.exports = function (workbook) {
} else if (isExpressionSheet(sheet.name)) {
output["expression"][sheet.name] = parseExpressionSheet(sheet);
}
}
});
return output;
};
8 changes: 4 additions & 4 deletions server/controllers/spreadsheet-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,10 @@ var processGRNmap = function (path, res, app) {
Object.assign(network, additionalData);

return (network.errors.length === 0) ?
// If all looks well, return the network with an all clear
res.json(network) :
// If all does not look well, return the network with an error 400
res.json(400, network);
// If all looks well, return the network with an all clear
res.json(network) :
// If all does not look well, return the network with an error 400
res.json(400, network);
};

var grnSightToCytoscape = function (network) {
Expand Down

0 comments on commit 889c35f

Please sign in to comment.