Commit 38664e95 authored by Daria Zenkova's avatar Daria Zenkova

pcaplot works better, synchronous request need to be fixed, but i still don't know why it's there

parent e599771c
This diff is collapsed.
...@@ -169,8 +169,7 @@ morpheus.Dataset.prototype = { ...@@ -169,8 +169,7 @@ morpheus.Dataset.prototype = {
else { else {
var protoMessage = morpheus.DatasetUtil.toProtoMessage(this); var protoMessage = morpheus.DatasetUtil.toProtoMessage(this);
var blob = new Blob(new Uint8Array(protoMessage), {type: "application/octet-stream"});
saveAs(blob, "test.bin");
var req = ocpu.call("createES", protoMessage, function (session) { var req = ocpu.call("createES", protoMessage, function (session) {
console.log(session); console.log(session);
_this.esSession = session; _this.esSession = session;
......
...@@ -822,37 +822,36 @@ morpheus.DatasetUtil.getMetadataArray = function (dataset) { ...@@ -822,37 +822,36 @@ morpheus.DatasetUtil.getMetadataArray = function (dataset) {
var participantID = []; var participantID = [];
var labelDescription = []; var labelDescription = [];
var columnMeta = dataset.getColumnMetadata(); var columnMeta = dataset.getColumnMetadata();
var n = columnMeta.getMetadataCount(); var features = columnMeta.getMetadataCount();
var m = dataset.columns; var participants = dataset.getColumnCount();
var vecPartID = columnMeta.getByName("participant_id");
for (var i = 0; i < n; i++) { for (var i = 0; i < participants; i++) {
var vecI = columnMeta.get(i); participantID.push({
if (vecI.getName() == "participant_id") { strval : vecPartID.getValue(i),
for (var j = 0; j < m; j++) { isNA : false
participantID.push({ });
strval : vecI.getValue(j), }
isNA : false for (var j = 0; j < features; j++) {
}); var vecJ = columnMeta.get(j);
} if (vecJ.getName() == "participant_id") {
} continue;
else { }
for (j = 0; j < m; j++) { for (var l = 0; l < participants; l++) {
pDataArray.push({ pDataArray.push({
strval : vecI.getValue(j).toString(), strval : vecJ.getValue(l).toString(),
isNA : false
});
}
labelDescription.push({
strval : vecI.getName(),
isNA : false isNA : false
}); });
} }
labelDescription.push({
strval : vecJ.getName(),
isNA : false
});
} }
var rowMeta = dataset.getRowMetadata(); var rowMeta = dataset.getRowMetadata();
var rowNames = []; var rowNames = [];
var rowNamesVec = rowMeta.getByName("id"); var rowNamesVec = rowMeta.getByName("id");
for (j = 0; j < dataset.rows; j++) { for (j = 0; j < dataset.getRowCount(); j++) {
rowNames.push({ rowNames.push({
strval : rowNamesVec.getValue(j), strval : rowNamesVec.getValue(j),
isNA : false isNA : false
...@@ -863,6 +862,7 @@ morpheus.DatasetUtil.getMetadataArray = function (dataset) { ...@@ -863,6 +862,7 @@ morpheus.DatasetUtil.getMetadataArray = function (dataset) {
morpheus.DatasetUtil.toProtoMessage = function (dataset) { morpheus.DatasetUtil.toProtoMessage = function (dataset) {
var array = morpheus.DatasetUtil.getContentArray(dataset); var array = morpheus.DatasetUtil.getContentArray(dataset);
var meta = morpheus.DatasetUtil.getMetadataArray(dataset); var meta = morpheus.DatasetUtil.getMetadataArray(dataset);
console.log(meta);
var messageJSON = { var messageJSON = {
rclass : "LIST", rclass : "LIST",
rexpValue : [{ rexpValue : [{
...@@ -879,7 +879,7 @@ morpheus.DatasetUtil.toProtoMessage = function (dataset) { ...@@ -879,7 +879,7 @@ morpheus.DatasetUtil.toProtoMessage = function (dataset) {
attrName : "dim", attrName : "dim",
attrValue : { attrValue : {
rclass : "INTEGER", rclass : "INTEGER",
intValue : [dataset.getColumnMetadata().getMetadataCount() - 1, dataset.columns] intValue : [dataset.getColumnCount(), dataset.getColumnMetadata().getMetadataCount() - 1]
} }
}, { }, {
rclass : "STRING", rclass : "STRING",
...@@ -918,5 +918,6 @@ morpheus.DatasetUtil.toProtoMessage = function (dataset) { ...@@ -918,5 +918,6 @@ morpheus.DatasetUtil.toProtoMessage = function (dataset) {
rexp = builder.build("rexp"), rexp = builder.build("rexp"),
REXP = rexp.REXP; REXP = rexp.REXP;
return new REXP(messageJSON); var proto = new REXP(messageJSON);
return proto;
}; };
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment