rpf_Bam2bw¶
rpf_Bam2bw converts genome-aligned BAM/SAM reads into P-site density tracks in bedGraph or WIG format.
Function¶
Use this command to generate genome-browser-compatible signal tracks from genome alignment files. The command reads a BAM/SAM file, assigns each read to a P-site according to a P-site offset table, separates plus and minus strand signals, optionally normalizes density to RPM, and writes bedGraph or WIG output.
Input¶
Required input files:
- A coordinate-sorted genome alignment file in BAM or SAM format.
- A P-site offset table generated by RiboParser offset analysis.
The offset table should contain read-length-specific P-site offsets. The current parser expects columns such as:
Only read lengths present in the offset table are used for P-site assignment.
Parameters¶
| Parameter | Required | Meaning |
|---|---|---|
-b |
yes | Input genome alignment file in BAM or SAM format. |
-o |
yes | Output prefix. If omitted, output naming may be incomplete in the current implementation. |
-p |
no | P-site offset file in TXT/TSV format. |
-f |
no | Output format: bedgraph or wig. Default: bedgraph. |
-n |
no | Normalize read density to RPM. Default: disabled. |
-m |
no | Merge plus and minus strand density into one output file. Default: disabled. |
-t |
no | Maximum allowed NH tag value for multi-mapped reads. Reads with NH greater than this value are discarded. Default: 3. |
--second |
no | Discard secondary alignments. Default: disabled. |
--supply |
no | Discard supplementary alignments. The flag name is --supply in the current command-line interface. Default: disabled. |
Output¶
When plus and minus strands are kept separate, the command writes:
or, when -f wig is used:
When -m is used, plus and minus strand records are merged into one file:
or:
For bedGraph output, the columns are written without a header:
Minus-strand density values are written as negative values when strands are kept separate.
Examples¶
Create strand-specific bedGraph files:
rpf_Bam2bw \
-b sample1.Aligned.sortedByCoord.out.bam \
-p sample1_RSBM_offset.txt \
-f bedgraph \
-o sample1
Create RPM-normalized bedGraph files and keep only uniquely mapped reads:
rpf_Bam2bw \
-b sample1.Aligned.sortedByCoord.out.bam \
-p sample1_RSBM_offset.txt \
-t 1 \
--second \
--supply \
-f bedgraph \
-n \
-o sample1.unique.rpm
Merge plus and minus strands into one bedGraph file:
rpf_Bam2bw \
-b sample1.Aligned.sortedByCoord.out.bam \
-p sample1_RSBM_offset.txt \
-m \
-n \
-o sample1.merged.rpm
Write WIG output:
rpf_Bam2bw \
-b sample1.Aligned.sortedByCoord.out.bam \
-p sample1_RSBM_offset.txt \
-f wig \
-o sample1
Notes¶
- Use a P-site offset file that matches the same sample type and read-length range used for the BAM/SAM file.
- Use
-t 1when only uniquely mapped reads should be retained according to theNHtag. - The command writes bedGraph/WIG-style signal tracks. Convert bedGraph to bigWig with external tools such as
bedGraphToBigWigif a.bwfile is required. - For genome browser display, make sure chromosome names match the genome assembly used by the browser.