apr144-bam
Version:
Parser for BAM and BAM index (bai) files
24 lines • 751 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseHeaderText = void 0;
function parseHeaderText(text) {
const lines = text.split(/\r?\n/);
const data = [];
for (const line of lines) {
const [tag, ...fields] = line.split(/\t/);
if (tag) {
data.push({
tag: tag.slice(1),
data: fields.map(f => {
const r = f.indexOf(':');
const fieldTag = f.slice(0, r);
const value = f.slice(r + 1);
return { tag: fieldTag, value };
}),
});
}
}
return data;
}
exports.parseHeaderText = parseHeaderText;
//# sourceMappingURL=sam.js.map