keithwhor / NtSeq

JavaScript (node + browser) bioinformatics library for nucleotide sequence manipulation and analysis.
MIT License
208 stars 25 forks source link

Issue with matchMap using example code in node.js #12

Open ediezben opened 6 years ago

ediezben commented 6 years ago

HI Keith,

great tool Ntseq, we think it could be useful for some of the tools we are developing and wanted to give it a go, but we are facing some issues when running even your example code includede:

var seq = (new Nt.Seq()).read('ATGCCCGACTGCA'); var querySeq = (new Nt.Seq()).read('CCCG'); var maps_seq = seq.mapSequence(querySeq); maps_seq.best().position; // === 3 console.log(maps_seq.best().position)

We keep getting a message:

Uncaught Error: MatchMap must be initialized first. at MatchMap.best (bundle.js:1774) at find_markers (bundle.js:47) at Gunzip. (bundle.js:175) at emitOne (bundle.js:11424) at Gunzip.emit (bundle.js:11502) at addChunk (bundle.js:12548) at readableAddChunk (bundle.js:12535) at Gunzip.Readable.push (bundle.js:12502) at Gunzip.Transform.push (bundle.js:13426) at Zlib.callback (bundle.js:3574)

The two variables seq and querySeq exist and seem to have the right format but maps_seq variable seems to not be initialized.

Thanks for the help.

AABoyles commented 6 years ago

I think the API was changed at some point, but the documentation is from before. Try this:

var seq = (new Nt.Seq()).read('ATGCCCGACTGCA');
var querySeq = (new Nt.Seq()).read('CCCG');
var maps_seq = seq.mapSequence(querySeq);
maps_seq.initialize();
maps_seq.sort();
console.log(maps_seq.best().position)
se99388 commented 5 years ago

Thank you