Skip to content

Repository files navigation

lrSAGA (long-read Single Amplified Genome Assembly)

install with bioconda

Jamie McGowan, 2026

jamie.mcgowan@ucd.ie

lrSAGA is an assembly toolkit designed to assemble long-read sequencing datasets generated from MDA (multiple displacement amplification) amplified DNA, which have extremely high rates of chimeras. It takes as input an assembly graph in GFA format (e.g., generated by MBG) and iteratively simplifies the graph by removing putative chimeras, along with tips, bubbles, and transitive edges, to generate contigs.

Dependencies

  • python
  • gfapy
  • mbg
  • networkx

You can install lrSAGA with Conda from the Bioconda channel:

conda create -n lrSAGA -c bioconda lrSAGA
conda activate lrSAGA

lrSAGA.py --help

Alternatively, you can install dependencies using conda with the provided yaml file conda_env.yaml, which will create a conda environment called lrSAGA:

git clone https://github.com/jamiemcg/lrSAGA
cd lrSAGA

conda env create -f conda_env.yaml
conda activate lrSAGA

python lrSAGA.py --help

Usage

usage: lrSAGA.py -i INPUT -o OUTPUT [-h] [-v] [--save-intermediate] [--tip-len TIP_LEN] [--tip-cov TIP_COV] [--pop-bubbles] [--max-bubble-len MAX_BUBBLE_LEN]
                 [--inverted-chimera-len INVERTED_CHIMERA_LEN] [--inverted-chimera-cov INVERTED_CHIMERA_COV] [--transitive-node-len TRANSITIVE_NODE_LEN] [--transitive-node-cov TRANSITIVE_NODE_COV]
                 [--by-property-len BY_PROPERTY_LEN] [--by-property-cov BY_PROPERTY_COV] [--isolated-len ISOLATED_LEN] [--isolated-cov ISOLATED_COV] [--remove-list REMOVE_LIST]
                 [--vlevel {0,1,2,3}]

lrSAGA - simplify and process a GFA assembly graph to remove chimeras

Required arguments:
  -i, --input INPUT     Input GFA file (required)
  -o, --output OUTPUT   Output GFA file (required)

Optional arguments:
  -h, --help            Show this help message and exit
  -v, --verbose         Write verbose log file (appends to <output>.verbose.log)
  --save-intermediate   Saves intermediate GFA files to <output>.intermediate.gfa
  --tip-len TIP_LEN     Remove tips shorter than --tip-len (requires --tip-cov)
  --tip-cov TIP_COV     Remove tips with coverage less than --tip-cov (requires --tip-len)
  --pop-bubbles         Pop simple bubbles
  --max-bubble-len MAX_BUBBLE_LEN
                        If defined, don't discard bubble longer than this
  --inverted-chimera-len INVERTED_CHIMERA_LEN
                        Remove inverted chimeras shorter than --inverted-chimera-len (requires --inverted-chimera-cov)
  --inverted-chimera-cov INVERTED_CHIMERA_COV
                        Remove inverted chimeras with coverage less than --inverted-chimera-cov (requires --inverted-chimera-len)
  --transitive-node-len TRANSITIVE_NODE_LEN
                        Remove transitive nodes shorter than --transitive-node-len (requires --transitive-node-cov)
  --transitive-node-cov TRANSITIVE_NODE_COV
                        Remove transitive nodes with coverage less than --transitive-node-cov (requires --transitive-node-len)
  --by-property-len BY_PROPERTY_LEN
                        Remove nodes with length shorter than --by-property-len (requires --by-property-cov)
  --by-property-cov BY_PROPERTY_COV
                        Remove nodes with coverage less than --by-property-cov (requires --by-property-len)
  --isolated-len ISOLATED_LEN
                        Remove isolated nodes (no edges) with length shorter than --isolated-len (requires --isolated-cov)
  --isolated-cov ISOLATED_COV
                        Remove isolated nodes (no edges) with coverage less than --isolated-cov (requires --isolated-len)
  --remove-list REMOVE_LIST
                        Provide a plain text file containing a list of nodes to remove
  --vlevel {0,1,2,3}    Validation level for GFA parsing (0, 1, 2, or 3, default: 0)

Example usage:

python lrSAGA.py -i input.gfa -o output.gfa --tip-len 10000 --tip-cov 10 --inverted-chimera-len 15000 --inverted-chimera-cov 15 --transitive-node-len 15000 --transitive-node-cov 15 --pop-bubbles --max-bubble-len 20000 --isolated-len 5000 --isolated-cov 3

This iteratively removes:

  • tips that are <= 10,000 bp in length with coverage depth <= 15x
  • putative inverted chimeras that are <= 15,000 bp with coverage depth <= 15x
  • transitive nodes that are <= 15,000 bp with coverage depth <= 15x
  • simple bubbles that are <= 20,000 bp
  • isolated nodes that are <= 5,000 bp with <= 3x coverage depth

merges linear paths, and repeats until no more changes are made.

Tutorial

See tutorial/README.md for a more extensive tutorial.

Utilities

gfa_stats.py

The script gfa_stats.py can help to choose suitable parameters. It reports assembly coverage, length, and connectivity statistics.

gfa_stats.py -i input.gfa

We also recommend visualising the assembly graphs using Bandage to decide on suitable parameters. Better performance can be expected by iteratively running lrSAGA, starting with conservative options (e.g., start by removing very low-coverage and short tips: --tip-len 1500 --tip-cov 3)

gfa_to_fasta.py

To convert the output GFA file to FASTA format, you can use the included gfa_to_fasta.py script:

gfa_to_fasta.py -i assembly.gfa -o assembly.fasta --rename

preprocess_mbg_gfa.py

GFA files created by MBG have float values in the FC (Fragment count) field. This causes gfapy to throw an error if validation is performed when importing a graph (--vlevel >=1) as it expects integer values. The script preprocess_mbg_gfa.py edits the FC tags to replace "FC:f:" with "FC:i:".

preprocess_mbg_gfa.py -i input.gfa -o temp.gfa
mv temp.gfa input.gfa

About

lrSAGA (long-read Single Amplified Genome Assembly)

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages