Skip to main content

generate_read_pair

Function generate_read_pair 

Source
pub fn generate_read_pair(
    fragment: &Fragment,
    contig_name: &str,
    read_num: u64,
    read_length: usize,
    paired: bool,
    adapter_r1: &[u8],
    adapter_r2: &[u8],
    model: &impl ErrorModel,
    simple_names: bool,
    rng: &mut impl Rng,
) -> ReadPair
Expand description

Generate a simulated read pair from a fragment.

Extracts R1 and optionally R2 bases from the fragment, applies the error model, constructs read names with truth information, and computes CIGARs from the fragment’s reference coordinate mapping.

§Arguments

  • fragment — The source fragment with bases and reference positions.
  • contig_name — Contig name for read naming.
  • read_num — 1-based read pair number.
  • read_length — Desired read length.
  • paired — Whether to generate both R1 and R2.
  • adapter_r1 — Adapter sequence for R1.
  • adapter_r2 — Adapter sequence for R2.
  • error_model — Error model to apply.
  • simple_names — Use simple names instead of encoded truth names.
  • rng — Random number generator.