Reference Code backup Executable files
Reports the total read base count (i.e. the sum of per base read depths) for each genomic region specified in the supplied BED file.
samtools bedcov [INPUT BED] [INPUT BAM1] ... [INPUT BAMn] > [OUTPUT]
Reports the total read base count (i.e. the sum of per base read depths) for each genomic region specified in the supplied BED file. The regions are output as they appear in the BED file and are 0-based. Counts for each alignment file supplied are reported in separate columns. Compared to bedtools coverage
, samtools bedcov
returns the sum of per-base coverage in each region instead of the number of reads in each region.
samtools index
)Here is a bed file with 6 columns:
$ head -n 5 C1_1_bidirectional_peaks.bed chr1 605407 605585 Stringent(qval) 605571 605440 chr1 778535 778929 Stringent(qval) 778923 778637 chr1 826728 826910 Relaxed 826909 826732 chr1 827276 827351 Stringent(pval) 827301 827327 chr1 827415 827791 Stringent(qval) 827699 827505
We can use samtools bedcov
to calculate the coverages in each input files. The coverages (in bold) for each bam file will be appended to the end of each row.
$ samtools bedcov C1_1_bidirectional_peaks.bed ENCFF112MXH.bam ENCFF244IZS.bam | head -n 5 chr1 605407 605585 Stringent(qval) 605571 605440 338 61 chr1 778535 778929 Stringent(qval) 778923 778637 81634 3276 chr1 826728 826910 Relaxed 826909 826732 443 135 chr1 827276 827351 Stringent(pval) 827301 827327 2834 69 chr1 827415 827791 Stringent(qval) 827699 827505 15242 1284