Skip to content

Commit

Permalink
Merge pull request #36 from MoTrPAC/nicolerg-patch-1
Browse files Browse the repository at this point in the history
Add docs for BAM to bigWig conversion
  • Loading branch information
archanaraja authored Sep 30, 2020
2 parents 6953106 + 2d0d373 commit 17e8dc9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/bam2bigwig.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# BAM to bigWig conversion

The [bigWig file format](https://genome.ucsc.edu/goldenPath/help/bigWig.html) is a convenient way to view dense, continuous data in a genome browser. Follow these steps to convert BAMs to bigWigs for viewing in a genome browser.

### Dependencies
- [samtools](http://www.htslib.org/)
- [deeptools](https://deeptools.readthedocs.io/en/develop/content/installation.html)

### Usage
1. Download/locate the BAMs you would like to convert.
2. For each BAM file, run [bam2bigwig.sh](../scripts/bam2bigwig.sh) as follows:
```bash
bam=/path/to/${viallabel}.Aligned.sortedByCoord.out.bam
outdir=/path/to/bigwig
bash bam2bigwig.sh ${bam} ${outdir}
```

This will generate `${outdir}/${viallabel}.bw`. Each job requires <1G of memory.
14 changes: 14 additions & 0 deletions scripts/bam2bigwig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# convert a single BAM to bigwig format
# usage: bash bam2bigwig.sh /path/to/90251015803.Aligned.sortedByCoord.out /path/to/bigwigs
# this command will generate /path/to/bigwigs/90251015803.bw
#
# dependencies: samtools, deeptools

bam=$1
outdir=$2

prefix=$(basename ${bam} | sed "s/\.Aligned.*//")
samtools index ${bam}
bamCoverage -b ${bam} -o ${outdir}/${prefix}.bw

0 comments on commit 17e8dc9

Please sign in to comment.