Compute positional bias weights (W) that model non-uniform read distribution across transcripts. This is an optional phase that runs before the main EM quantification.

mpaqt_prequant(
  index,
  sr_counts,
  positional_bias = "3p",
  n_bins = 50L,
  max_iter = 100L,
  tolerance = 0.1,
  weight_update_start = 20L,
  convergence_start = 25L,
  verbose = TRUE
)

Arguments

index

An mpaqt_index object

sr_counts

An mpaqt_counts_sr object with short-read EC counts

positional_bias

Type of bias correction: "3p" or "5p"

n_bins

Number of distance bins for bias estimation (default: 50)

max_iter

Maximum iterations for weight optimization (default: 100)

tolerance

Convergence tolerance (default: 1e-1)

weight_update_start

Iteration to start updating positional weights (default: 20)

convergence_start

Iteration to start checking convergence (default: 25)

verbose

Print progress messages (default: TRUE)

Value

An mpaqt_prequant object containing:

  • weights: Estimated positional bias weights

  • quantiles: Distance bin boundaries

  • bias_type: Type of bias ("3p" or "5p")

  • n_bins: Number of bins used

  • converged: Whether optimization converged

  • initial_beta: Initial transcript abundance estimates

Details

Pre-quantification estimates how read density varies with position along transcripts. This is useful for correcting:

  • 3' bias: Common in poly-A selected RNA-seq, where 3' ends have higher coverage

  • 5' bias: Can occur with certain library prep methods

The weights are computed by:

  1. Running a preliminary EM to get initial abundance estimates

  2. Binning transcript positions by distance from 3'/5' end

  3. Optimizing bin weights to maximize Poisson likelihood

When to Use

Pre-quantification is recommended when:

  • You observe strong positional bias in your data

  • Transcript length varies significantly in your annotation

  • You want more accurate short transcript quantification

Skip pre-quantification when:

  • Your library prep minimizes positional bias

  • You're working with very short transcripts only

  • Computational time is a concern

Examples

if (FALSE) { # \dontrun{
idx <- mpaqt_read_index("my_index/mpaqt.index.rds")
sr <- mpaqt_read_short_read_counts("short_read.rds")

# Run pre-quantification with 3' bias correction
prequant <- mpaqt_prequant(
    index = idx,
    sr_counts = sr,
    positional_bias = "3p"
)

# Use weights in post-quantification
result <- mpaqt_postquant(
    index = idx,
    sr_counts = sr,
    prequant = prequant
)
} # }