How to use the ve-sequence-utils/annotationTypes.forEach function in ve-sequence-utils

To help you get started, we’ve selected a few ve-sequence-utils 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 TeselaGen / openVectorEditor / app / ve-sequence-utils / prepareCircularViewData.js View on Github external
module.exports = function prepareCircularViewData(sequenceData) {
    var clonedSeqData = cloneDeep(sequenceData)
    annotationTypes.forEach(function(annotationType){
        if (annotationType !== 'cutsites') {
            var {maxYOffset} = getYOffsetsForPotentiallyCircularRanges(clonedSeqData[annotationType]);
            clonedSeqData[annotationType].maxYOffset = maxYOffset;
        }
    });
    return clonedSeqData;
}
github TeselaGen / openVectorEditor / src / VectorEditor / utils / prepareRowData.js View on Github external
var totalRows = Math.ceil(sequenceLength / bpsPerRow) || 1; //this check makes sure there is always at least 1 row!
    var rows = [];
    var rowMap = {};
    annotationTypes.forEach(function (type) {
      rowMap[type] = mapAnnotationsToRows(sequenceData[type], sequenceLength, bpsPerRow)
    })

    for (var rowNumber = 0; rowNumber < totalRows; rowNumber++) {
        var row = {};
        row.rowNumber = rowNumber;
        row.start = rowNumber * bpsPerRow;
        row.end = (rowNumber + 1) * (bpsPerRow) - 1 < sequenceLength ? (rowNumber + 1) * (bpsPerRow) - 1 : sequenceLength - 1;
        if (row.end < 0) {
            row.end = 0
        }
        annotationTypes.forEach(function (type) {
          row[type] = rowMap[type][rowNumber] || []
        })
        row.sequence = sequenceData.sequence.slice(row.start, (row.end + 1));
        
        rows[rowNumber] = row;
    }
    return rows;
}