Skip to content

4.5.4 Read density

Read density files are transcript-level tables that represent RNA-seq coverage or Ribo-seq P-site density. They are the core inputs for density merging, periodicity, metaplot, coverage, correlation, gene-level analysis, codon-level analysis, and smORF analysis.

rna_Density

Function

rna_Density converts RNA-seq BAM alignments into transcript-level read density using an RNA offset table.

Input files

Input Description
BAM file Filtered BAM file generated by rpf_Check.
Offset table RNA-seq offset table generated by rna_Offset.
Transcript annotation Normalized transcript annotation file, usually gene.norm.txt.
Transcript FASTA Normalized transcript sequence file, usually gene.norm.rna.fa.

Parameters

Parameter Required Description
-t Yes Input transcript annotation file in TXT format.
-s Yes Input transcript sequence file in FASTA format.
-b Yes Input BAM file.
-p Yes Input P-site/offset table in TXT format.
-o Yes Output prefix. The output file is <prefix>_rna.txt.
-l No Retain only the transcript with the longest CDS for each gene. Disabled by default.
-m No Minimum read length to keep. Default is 25.
-M No Maximum read length to keep. Default is 150.
-r No Calculate density once per ribosome width. This is mainly suitable for long RNA-seq reads. Disabled by default.
--pe No Treat data as paired-end RNA-seq reads. Disabled by default.
--thread No Number of threads. Default is 1; increasing it may require more memory.

Output files

Output Description
<prefix>_rna.txt RNA-seq transcript density file.
<prefix>.log Running log if redirected by the user.

Example

for bam in ../01.check/*.bam
do
    prefix_name=$(basename ${bam} .bam)

    rna_Density \
        -b ${bam} \
        -t ../../../1.reference/norm/gene.norm.txt \
        -s ../../../1.reference/norm/gene.norm.rna.fa \
        -p ../03.offset/${prefix_name}_offset.txt \
        -o ${prefix_name} \
        -m 25 \
        -M 150 \
        --thread 10 \
        &> ${prefix_name}.log
done

rpf_Density

Function

rpf_Density converts Ribo-seq BAM alignments into transcript-level P-site density using a P-site offset table and optional offset-quality filters.

Input files

Input Description
BAM file Filtered Ribo-seq BAM file generated by rpf_Check.
P-site offset table Ribo-seq offset table, usually <sample>_SSCBM_offset.txt or <sample>_RSBM_offset.txt.
Transcript annotation Normalized transcript annotation file, usually gene.norm.txt.
Transcript FASTA Normalized transcript sequence file, usually gene.norm.rna.fa.

Parameters

Parameter Required Description
-t Yes Input transcript annotation file in TXT format.
-s Yes Input transcript sequence file in FASTA format.
-b Yes Input BAM file.
-p Yes Input P-site offset table in TXT format.
-o Yes Output prefix. The output file is <prefix>_rpf.txt.
-l No Retain only the transcript with the longest CDS for each gene. Disabled by default.
-m No Minimum read length to keep. Default is 27.
-M No Maximum read length to keep. Default is 33.
--period No Minimum 3-nt periodicity threshold for retained reads or transcript positions. Default is 40.
--min-confidence No Minimum offset confidence to keep when the offset file contains a confidence column. Default is 50.0.
--drop-warning No Drop offset rows whose warning column is not PASS when the offset file contains a warning column. Disabled by default.
--silence No Suppress warning information. Disabled by default.
--thread No Number of threads. Default is 1; increasing it may require more memory.

Output files

Output Description
<prefix>_rpf.txt Ribo-seq P-site density file.
<prefix>.log Running log if redirected by the user.

Example

for bam in ../01.check/*.bam
do
    prefix_name=$(basename ${bam} .bam)

    rpf_Density \
        -b ${bam} \
        -t ../../../1.reference/norm/gene.norm.txt \
        -s ../../../1.reference/norm/gene.norm.rna.fa \
        -p ../03.offset/${prefix_name}_SSCBM_offset.txt \
        -o ${prefix_name} \
        -m 27 \
        -M 33 \
        --period 40 \
        --thread 12 \
        &> ${prefix_name}.log
done

Notes

  • RNA-seq density represents transcript coverage, whereas Ribo-seq density represents offset-corrected ribosome P-site positions.
  • Use consistent transcript annotation and transcript FASTA files across all samples.
  • Ribo-seq density should be validated with periodicity and metagene analysis before codon-level interpretation.