Skip to content

Commit

Permalink
New build for version 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
iimog committed Sep 7, 2016
1 parent d725edb commit 114648f
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 55 deletions.
55 changes: 29 additions & 26 deletions build/biom.js

Large diffs are not rendered by default.

Binary file modified build/biom.min.gz.js
Binary file not shown.
8 changes: 4 additions & 4 deletions build/biom.min.js

Large diffs are not rendered by default.

53 changes: 28 additions & 25 deletions lib/biojs-io-biom.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
* Version
* @type {string} version of this module
*/
var VERSION = exports.VERSION = '1.0.0';
var VERSION = exports.VERSION = '1.0.1';

/**
* Default Biom Object for empty initialization
Expand Down Expand Up @@ -312,9 +312,6 @@ var Biom = exports.Biom = function () {
var dim_rows = ['rows', 'observation'];
var dim_cols = ['columns', 'sample'];
var setMetadatum = function setMetadatum(element, value) {
if (element.metadata === null) {
element.metadata = {};
}
element.metadata[_attribute] = value;
};
if (_attribute === null) {
Expand Down Expand Up @@ -416,11 +413,11 @@ var Biom = exports.Biom = function () {
var rowIndex = this._indexByID(rowID, true);
if (rowIndex === null) {
throw new Error('unknown rowID: ' + rowID);
};
}
var colIndex = this._indexByID(colID, false);
if (colIndex === null) {
throw new Error('unknown colID: ' + colID);
};
}
if (this.matrix_type === 'dense') {
return this.data[rowIndex][colIndex];
} else if (this.matrix_type === 'sparse') {
Expand Down Expand Up @@ -469,11 +466,11 @@ var Biom = exports.Biom = function () {
var rowIndex = this._indexByID(rowID, true);
if (rowIndex === null) {
throw new Error('unknown rowID: ' + rowID);
};
}
var colIndex = this._indexByID(colID, false);
if (colIndex === null) {
throw new Error('unknown colID: ' + colID);
};
}
if (this.matrix_type === 'dense') {
this.data[rowIndex][colIndex] = value;
} else if (this.matrix_type === 'sparse') {
Expand Down Expand Up @@ -512,7 +509,7 @@ var Biom = exports.Biom = function () {
var rowIndex = this._indexByID(rowID, true);
if (rowIndex === null) {
throw new Error('unknown rowID: ' + rowID);
};
}
if (this.matrix_type === 'dense') {
return this.data[rowIndex];
} else if (this.matrix_type === 'sparse') {
Expand Down Expand Up @@ -562,7 +559,7 @@ var Biom = exports.Biom = function () {
var rowIndex = this._indexByID(rowID, true);
if (rowIndex === null) {
throw new Error('unknown rowID: ' + rowID);
};
}
if (values.length !== this.shape[1]) {
throw new Error('length of values does not equal the number of columns');
}
Expand Down Expand Up @@ -631,7 +628,7 @@ var Biom = exports.Biom = function () {
var colIndex = this._indexByID(colID, false);
if (colIndex === null) {
throw new Error('unknown colID: ' + colID);
};
}
if (this.matrix_type === 'dense') {
var col = Array();
var _iteratorNormalCompletion6 = true;
Expand Down Expand Up @@ -707,7 +704,7 @@ var Biom = exports.Biom = function () {
var colIndex = this._indexByID(colID, false);
if (colIndex === null) {
throw new Error('unknown colID: ' + colID);
};
}
if (values.length !== this.shape[0]) {
throw new Error('length of values does not equal the number of rows');
}
Expand Down Expand Up @@ -873,9 +870,9 @@ var Biom = exports.Biom = function () {
body: '{"to": "hdf5", "content": "' + b64content + '"}',
url: _conversionServer,
encoding: undefined,
method: "POST",
method: 'POST',
headers: {
"Content-Type": "application/json"
'Content-Type': 'application/json'
}
}, function done(err, resp, body) {
if (err !== null) {
Expand Down Expand Up @@ -1096,12 +1093,15 @@ var Biom = exports.Biom = function () {
if (Object.prototype.toString.call(rows) !== '[object Array]') {
throw new TypeError('rows must be an Array');
}
var new_id_dict = new Object();
var new_id_dict = {};
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
if (typeof row.id === 'undefined') {
throw new TypeError('every row has to have an id');
};
}
if (typeof row.metadata === 'undefined' || row.metadata === null) {
row.metadata = {};
}
if (typeof new_id_dict[row.id] !== 'undefined') {
throw new Error('duplicate row id: ' + row.id);
}
Expand All @@ -1111,7 +1111,7 @@ var Biom = exports.Biom = function () {
if (typeof this.data !== 'undefined') {
var new_data = Array();
var old_rows = this.rows;
var old_id_dict = new Object();
var old_id_dict = {};
for (var _i6 = 0; _i6 < old_rows.length; _i6++) {
old_id_dict[old_rows[_i6].id] = _i6;
}
Expand Down Expand Up @@ -1204,12 +1204,15 @@ var Biom = exports.Biom = function () {
if (Object.prototype.toString.call(columns) !== '[object Array]') {
throw new TypeError('columns must be an Array');
}
var new_id_dict = new Object();
var new_id_dict = {};
for (var i = 0; i < columns.length; i++) {
var col = columns[i];
if (typeof col.id === 'undefined') {
throw new TypeError('every column has to have an id');
};
}
if (typeof col.metadata === 'undefined' || col.metadata === null) {
col.metadata = {};
}
if (typeof new_id_dict[col.id] !== 'undefined') {
throw new Error('duplicate column id: ' + col.id);
}
Expand All @@ -1219,7 +1222,7 @@ var Biom = exports.Biom = function () {
if (typeof this.data !== 'undefined') {
var new_data = Array();
var old_cols = this.columns;
var old_id_dict = new Object();
var old_id_dict = {};
for (var _i7 = 0; _i7 < old_cols.length; _i7++) {
old_id_dict[old_cols[_i7].id] = _i7;
}
Expand Down Expand Up @@ -1414,7 +1417,7 @@ var Biom = exports.Biom = function () {
}
if (this.matrix_type === 'dense') {
if (data.length !== this.shape[0]) {
throw new Error("This data matrix has wrong number of rows (dense).");
throw new Error('This data matrix has wrong number of rows (dense).');
}
var _iteratorNormalCompletion13 = true;
var _didIteratorError13 = false;
Expand All @@ -1426,7 +1429,7 @@ var Biom = exports.Biom = function () {

var cols = this.shape[1];
if (row.length !== cols) {
throw new Error("This data matrix has wrong number of cols in at least one row (dense).");
throw new Error('This data matrix has wrong number of cols in at least one row (dense).');
}
}
} catch (err) {
Expand Down Expand Up @@ -1454,7 +1457,7 @@ var Biom = exports.Biom = function () {
var entry = _step14.value;

if (entry[0] >= shape[0] || entry[1] >= shape[1]) {
throw new Error("This data matrix has out of bounds value (sparse): " + entry[0] + "," + entry[0]);
throw new Error('This data matrix has out of bounds value (sparse): ' + entry[0] + ',' + entry[0]);
}
}
} catch (err) {
Expand Down Expand Up @@ -1601,9 +1604,9 @@ var Biom = exports.Biom = function () {
body: '{"to": "json", "content": "' + b64content + '"}',
url: _conversionServer,
encoding: undefined,
method: "POST",
method: 'POST',
headers: {
"Content-Type": "application/json"
'Content-Type': 'application/json'
}
}, function done(err, resp, body) {
if (err !== null) {
Expand Down

0 comments on commit 114648f

Please sign in to comment.