Skip to content

Instantly share code, notes, and snippets.

@keithwhor
Created January 3, 2017 09:13
Show Gist options
  • Save keithwhor/cf7f04b6a04a9706204d6afb1873e2fc to your computer and use it in GitHub Desktop.
Save keithwhor/cf7f04b6a04a9706204d6afb1873e2fc to your computer and use it in GitHub Desktop.
stdlib NtSeq Parallelized Map Function
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