Created
January 3, 2017 09:13
-
-
Save keithwhor/cf7f04b6a04a9706204d6afb1873e2fc to your computer and use it in GitHub Desktop.
stdlib NtSeq Parallelized Map Function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Nt = require('ntseq'); // NtSeq library | |
module.exports = (params, callback) => { | |
// Get query and genome sequences, as well as offset | |
let q = (params.kwargs.q || '') + ''; | |
let seq = (params.kwargs.seq || '') + ''; | |
let offset = Math.max(0, parseInt(params.kwargs.offset) || 0); | |
// Read sequences | |
let query = new Nt.Seq().read(q); | |
let sequence = new Nt.Seq().read(seq); | |
// Let NtSeq do the sequence alignment mapping for us | |
let map = sequence | |
.mapSequence(query, offset) | |
.initialize(); | |
// Return metadata and results | |
return callback(null, { | |
meta: map.__debug, | |
data: map.results() | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment