| 1 |
.. _bedtobam: |
| 2 |
|
| 3 |
############### |
| 4 |
*bedtobam* |
| 5 |
############### |
| 6 |
**bedToBam** converts features in a feature file to BAM format. This is useful as an efficient means of |
| 7 |
storing large genome annotations in a compact, indexed format for visualization purposes. |
| 8 |
|
| 9 |
========================================================================== |
| 10 |
Usage and option summary |
| 11 |
========================================================================== |
| 12 |
Usage: |
| 13 |
|
| 14 |
:: |
| 15 |
|
| 16 |
bedToBam [OPTIONS] -i <BED/GFF/VCF> -g <GENOME> > <BAM> |
| 17 |
|
| 18 |
=========================== =============================================================================================================================================================================================================== |
| 19 |
Option Description |
| 20 |
=========================== =============================================================================================================================================================================================================== |
| 21 |
**-mapq** Set a mapping quality (SAM MAPQ field) value for all BED entries. *Default: 255* |
| 22 |
**-ubam** Write uncompressed BAM output. The default is write compressed BAM output. |
| 23 |
**-bed12** Indicate that the input BED file is in BED12 (a.k.a "blocked" BED) format. In this case, bedToBam will convert blocked BED features (e.g., gene annotations) into "spliced" BAM alignments by creating an appropriate CIGAR string. |
| 24 |
=========================== =============================================================================================================================================================================================================== |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
========================================================================== |
| 30 |
Default behavior |
| 31 |
========================================================================== |
| 32 |
The default behavior is to assume that the input file is in unblocked format. For example: |
| 33 |
|
| 34 |
:: |
| 35 |
|
| 36 |
head -5 rmsk.hg18.chr21.bed |
| 37 |
chr21 9719768 9721892 ALR/Alpha 1004 + |
| 38 |
chr21 9721905 9725582 ALR/Alpha 1010 + |
| 39 |
chr21 9725582 9725977 L1PA3 3288 + |
| 40 |
chr21 9726021 9729309 ALR/Alpha 1051 + |
| 41 |
chr21 9729320 9729809 L1PA3 3897 - |
| 42 |
|
| 43 |
bedToBam -i rmsk.hg18.chr21.bed -g human.hg18.genome > rmsk.hg18.chr21.bam |
| 44 |
|
| 45 |
samtools view rmsk.hg18.chr21.bam | head -5 |
| 46 |
ALR/Alpha 0 chr21 9719769 255 2124M * 0 0 * * |
| 47 |
ALR/Alpha 0 chr21 9721906 255 3677M * 0 0 * * |
| 48 |
L1PA3 0 chr21 9725583 255 395M * 0 0 * * |
| 49 |
ALR/Alpha 0 chr21 9726022 255 3288M * 0 0 * * |
| 50 |
L1PA3 16 chr21 9729321 255 489M * 0 0 * * |
| 51 |
|
| 52 |
|
| 53 |
========================================================================== |
| 54 |
Creating "spliced" BAM entries from "blocked" BED features |
| 55 |
========================================================================== |
| 56 |
Optionally, **bedToBam** will create spliced BAM entries from "blocked" BED features by using the |
| 57 |
-bed12 option. This will create CIGAR strings in the BAM output that will be displayed as "spliced" |
| 58 |
alignments. The image illustrates this behavior, as the top track is a BAM representation (using |
| 59 |
bedToBam) of a BED file of UCSC genes. |
| 60 |
|
| 61 |
For example: |
| 62 |
|
| 63 |
:: |
| 64 |
|
| 65 |
bedToBam -i knownGene.hg18.chr21.bed -g human.hg18.genome -bed12 > knownGene.bam |
| 66 |
|
| 67 |
samtools view knownGene.bam | head -2 |
| 68 |
uc002yip.1 16 chr21 9928614 2 5 5 |
| 69 |
|
| 70 |
298M1784N71M1411N93M3963N80M1927N106M3608N81M1769N62M11856N89M98N82M816N61M6910N65M |
| 71 |
738N64M146N100M1647N120M6478N162M1485N51M6777N60M9274N54M880N54M1229N54M2377N54M112 |
| 72 |
68N58M2666N109M2885N158M * 0 0 * * |
| 73 |
uc002yiq.1 16 chr21 9928614 2 5 5 |
| 74 |
|
| 75 |
298M1784N71M1411N93M3963N80M1927N106M3608N81M1769N62M11856N89M98N82M816N61M6910N65M |
| 76 |
738N64M146N100M1647N120M6478N162M1485N51M6777N60M10208N54M1229N54M2377N54M11268N58M |
| 77 |
2666N109M2885N158M * 0 0 * * |
| 78 |
|
| 79 |
|