SAM and BAM Alignment Viewer
Drop a BAM or SAM file to see the header, references and alignment records, a mapping summary and a depth plot, then filter by region, SAM flags and mapping quality and save the matching reads as SAM or BAM.
S'executa al teu navegador. Els fitxers mai no surten del dispositiu. Mira com comprovar-ho
…
Com es fa
- 1Open
Drop a .bam or .sam file.
- 2Summary
Check mapped, duplicate and MAPQ figures.
- 3Filter
Set a region, flags and minimum MAPQ.
- 4Inspect
Read the coverage plot and records.
- 5Export
Save the subset as SAM or BAM.
Sobre aquesta eina
The SAM and BAM Alignment Viewer opens read alignments without samtools or a genome browser. SAM is the text form and BAM the compressed binary form of the same records. A file that starts with the gzip signature is read as BAM: its BGZF blocks are decompressed one after another into memory and the binary header, reference list and records are decoded. A file named .sam.gz is unzipped and read as SAM text, and anything else is read as SAM text too. An index file (.bai or .csi) is not used; opening one on its own gives a message asking for the .bam itself. Up to 2,000,000 alignments are read, with a warning if the file holds more. For each record the viewer keeps the read name, flag, reference, position, mapping quality, CIGAR string, mate reference and position, template length, sequence, base qualities and optional tags. BAM tag types A, c, C, s, S, i, I, f, Z, H and B arrays are decoded, and integer types are shown as i in the SAM style. The summary card lists the format, the number of alignments, how many are mapped with the percentage, paired and properly paired counts, duplicates, secondary and supplementary records, the mean MAPQ of the mapped records and the number of references. Below it are the filters. A region box takes a reference name on its own or a range such as chr1:10,000-20,000; a warning appears if the name is not in the header. A minimum MAPQ box drops low-confidence reads. Two rows of tick boxes cover all twelve SAM flags: one row leaves out reads with a flag and the other keeps only reads with it. By default unmapped, secondary, duplicate and supplementary reads are left out. The count of matching alignments updates as you change anything.
Coverage, records and header
The Coverage tab plots read depth along the region, or along the reference with the most mapped reads if no region is set, in up to 500 bins, with the mean depth and the share of bins covered in the title. Only aligned bases count: M, = and X operations add depth, while deletions and N skips move along the reference without adding any, and soft clips and insertions do not take up reference positions. A table lists every reference with its length, mapped reads and a Show button. The Alignments tab pages through the filtered records 100 at a time with read name, flag (hover for its meaning), reference, position, MAPQ, CIGAR and the first 60 bases. The Header tab shows the header text.
The sample results
A small test file with two references, chr1 of 1,000 bases and chr2 of 500, holds four records. r1 maps to chr1 at 100 with 10M, r2 on the reverse strand at 105 with 5M2D5M, r3 is unmapped and r4 is a duplicate on chr2. The summary shows 4 alignments, 3 mapped, 1 duplicate and a mean MAPQ of 50, the average of the three mapped reads. The default filters keep r1 and r2. Filtering to chr1:101-104 with unmapped and duplicate reads left out keeps only r1, because r2 starts at 105. Depth from 100 to 119 reads 1 for five bases, 2 for five bases where the reads overlap, 0 at the two deleted bases, 1 for five bases and 0 after. Converted to BAM, the four records make a 272-byte file that reads back with identical names, flags, positions, CIGARs, sequences and qualities.
Exports
Export SAM writes the header with blank lines removed, one @PG line for this tool, replacing any it added before, and the filtered records. Array tags stay arrays in both exports. Export BAM writes the same records as BGZF blocks with the end-of-file marker, readable by samtools and genome browsers, though you need to sort and index it there before random access. Coverage CSV saves the binned depth and Print / PDF gives a summary with the coverage chart and the reference table. Filter settings can be saved as a project.
Who this is for
Bioinformatics students learning flags and CIGAR strings, lab staff checking whether an alignment run worked, and researchers who need a quick subset from a small BAM file on a computer without command-line tools.
Limits
The whole file is decompressed in memory, so very large BAM files may not fit; use samtools view with an index for whole genomes. There is no reference sequence, so mismatches and pileups are not shown. The viewer is for research and teaching, not clinical reporting, and its counts are not advice on variant calls or sample quality.
Exemple resolt
Test file with 4 records on chr1 (1,000 bp) and chr2 (500 bp): 3 mapped, 1 duplicate, mean MAPQ 50; region chr1:101-104 keeps r1; depth over 100-119 shows 0 at the 2 deleted bases of r2's 5M2D5M.
En resum
- Categoria: Matemàtiques i ciència
- S'executa al navegador, sense registre, sense pujar res.
- La informació que introdueixes es queda al dispositiu.
- Disponible en anglès.
- Contingut revisat per última vegada:
- Font oficial: Sequence Alignment/Map Format Specification (SAMv1, hts-specs) including BGZF
Preguntes freqüents
Does it need the .bai index?
No. The whole BAM file is decompressed and read in memory, so no index is used. Opening a .bai or .csi file on its own shows a message asking for the .bam.
Which reads are hidden by default?
Unmapped, secondary, duplicate and supplementary reads, as most coverage counts do. Untick them in the first row of flag boxes to bring them back.
How do I write a region?
As a reference name from the header, such as chr1, or with a range, such as chr1:10,000-20,000. Commas are allowed. Positions are 1-based, as in SAM.
What counts toward coverage?
Bases in M, = and X operations of mapped reads that pass the filters. Deletions and N skips move along the reference without adding depth, so a deletion shows as a dip.
Can I export a subset as BAM?
Yes. Export BAM writes the filtered records as BGZF with the end-of-file block. Sort and index it with samtools if you need random access in a genome browser.
Is the data uploaded?
No. The file is read and filtered in this browser, and exports are made on your computer.
