Get started with pileup CDN
Apache-2.0 licensed
The Pileup library: Lightweight, efficient data rendering for large-scale web apps.
Tags:- genome
- track
- bam
- gene
- bioinformatics
- genomics
- sequencing
- reads
- interactive
Stable version
Copied!
How to start using pileup CDN
// Include the pileup library from the CDN
const Pileup = require('https://cdn.cdnhub.io/pileup/0.7.0/pileup.min.js');
// Read reference genome sequence
const reference = 'AGCTAGCTAGCTAGCTAGCT'; // Replace with your actual reference sequence
// Read BAM file and extract reads
const bamReader = new BAMReader('path/to/your/bamfile.bam');
const reads = [];
bamReader.on('read', (record) => {
if (record.rname && record.seq) {
reads.push({ name: record.rname, sequence: record.seq.toString() });
}
});
bamReader.on('end', () => {
// Perform pileup
const pileupResult = Pileup.call(reference, reads);
// Process pileup result
const pileupColumns = pileupResult[0];
const pileupRows = pileupResult[1];
// Print pileup result for the first position as an example
console.log('Position: 0');
console.log('Reference:', reference[0]);
console.log('Reads:');
pileupColumns.forEach((column, i) => {
console.log(`Read ${i + 1}:`, column.sequence[column.baseCall]);
});
pileupRows.forEach((row, i) => {
console.log(`Read ${i + 1 + reads.length}:`, row.sequence);
});
});
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!