miniasm Documentation

repository·master·Indexed 18 days ago

https://github.com/lh3/miniasm

A high-speed OLC-based de novo assembler for noisy long reads from PacBio and Oxford Nanopore. It uses minimap2 for read overlapping to generate assembly graphs in GFA format. The tool focuses on fast unitig generation by skipping the consensus step, meaning output base quality remains similar to raw input reads. It is primarily optimized for high-coverage bacterial datasets.

Tokens
1.3K
Snippets
4
Records
5
Agent score
13%

What's inside miniasm

  1. Understand miniasm core concepts and limitations

    master

    Concept: How miniasm works

    Miniasm is a fast assembler that skips the consensus step found in mainstream assemblers. Instead, it concatenates pieces of read sequences to generate final unitig sequences.

    Key characteristics:

    • No Consensus Step: It does not perform base-level error correction during assembly. Consequently, the per-base error rate of the output is similar to the raw input reads.
    • Input/Output: It accepts all-vs-all read self-mappings (PAF format) and outputs an assembly graph in GFA format.
    • Algorithm: It performs crude and fine read selection based on coverage, generates a string graph (pruning tips, dropping weak overlaps, and collapsing bubbles), and merges unambiguous overlaps into unitigs.

    Limitations

    • Base Quality: Consensus base quality is similar to input reads. To improve this, you must use a separate consensus tool after miniasm.
    • Repeat Handling: It is prone to collapsing repeats or segmental duplications that are longer than the input reads.
    • Testing Scope: Currently optimized and tested primarily on high-coverage bacterial datasets (PacBio and ONT).
  2. Assemble noisy long reads with miniasm

    master

    Miniasm is an OLC-based de novo assembler that uses all-vs-all read self-mappings (generated by minimap2) as input to produce a GFA assembly graph.

    Workflow

    1. Overlap: Use minimap2 to generate a PAF file of the reads against themselves.
    2. Layout: Use miniasm to process the PAF file and generate the assembly graph.

    Usage for PacBio reads

    Use the -x ava-pb preset in minimap2.

    Usage for Nanopore (ONT) reads

    Use the -x ava-ont preset in minimap2.

    # 1. Overlap for PacBio reads
    minimap2/minimap2 -x ava-pb -t8 pb-reads.fq pb-reads.fq | gzip -1 > reads.paf.gz
    
    # 2. Layout
    miniasm/miniasm -f reads.fq reads.paf.gz > reads.gfa
  3. Install minimap2 and miniasm

    master

    To use miniasm, you must first install both minimap2 (used for read overlapping) and miniasm itself. Both require gcc and zlib to be installed on your system.

    Follow these steps to clone and build both tools from source:

    git clone https://github.com/lh3/minimap2 && (cd minimap2 && make)
    git clone https://github.com/lh3/miniasm  && (cd miniasm  && make
  4. Use miniasm CLI to assemble reads from PAF

    master

    miniasm is a command-line tool that takes a PAF (Pairwise Alignment Format) file as input and produces an assembly in various formats (bed, paf, sg, or ug). The tool orchestrates a multi-step process including read selection, graph cleaning (transitive reduction, tip cutting, bubble popping), and unitig generation.

    Basic Usage:

    miniasm [options] <in.paf>

    Common Output Formats (-p):

    • bed: Subsequence information.
    • paf: Hit information.
    • sg: Sequence Graph.
    • ug: Unitig Graph (default).

    Key Workflow Stages:

    1. Pre-selection: Filtering reads based on match length, identity, span, or coverage.
    2. Overlap: Refining overlaps using hang length or end-to-end match ratios.
    3. Layout: Cleaning the assembly graph via transitive reduction, tip cutting, and bubble popping.
    4. Unitig Generation: Converting the cleaned graph into unitigs.
    miniasm [options] <in.paf>
  5. Reference: miniasm command-line options

    master

    The following options control the behavior of the miniasm assembly pipeline. Refer to miniasm.1 for detailed descriptions.

    Pre-selection

    FlagArgumentDescription
    -R(none)Prefilter clearly contained reads (requires 2-pass)
    -mINTMinimum match length
    -iFLOATMinimum identity
    -sINTMinimum span
    -cINTMinimum coverage

    Overlap

    FlagArgumentDescription
    -oINTMinimum overlap (defaults to same as -s)
    -hINTMaximum over hang length
    -IFLOATMinimum end-to-end match ratio

    Layout

    FlagArgumentDescription
    -gINTMax gap differences between reads for trans-reduction
    -dINTMax distance for bubble popping
    -eINTSmall unitig threshold
    -fFILERead sequences file
    -nINTRounds of short overlap removal
    -rFLOAT[,FLOAT]Max and min overlap drop ratio
    -FFLOATAggressive overlap drop ratio in the end

    Miscellaneous

    FlagArgumentDescription
    -pSTROutput information: bed, paf, sg or ug
    -b(none)Both directions of an arc are present in input
    -1(none)Skip 1-pass read selection
    -2(none)Skip 2-pass read selection
    -V(none)Print version number
    miniasm -p ug -f reads.fa input.paf