Skip to main content

LGvar: Large-scale Genomic VARiation

Conda version Appatiner Image Version License release

Quick Start

Why LGvar

LGvar is a comprehensive toolset designed for large-scale structural variant (SV) detection based on genome assemblies. It excels in cross-species variant identification, particularly demonstrating superior performance in inversion detection compared to existing tools.

  • Easily use: Only FASTA and chromosome pairs (.tsv) are needed for input (users can alternatively provide pre-aligned PAF files).
  • Comprehensive and fast: LGvar detects not only insertions, deletions, inversions, translocations, duplications, INDELs and SNVs, but also detects structurally divergent regions (SDRs) and nested-inversions (INV-INV).
  • More efficient in detection of inversions: LGvar performs realignment within SDRs to detect inversions missed in initial alignment.

Installation

Option 1: Conda (Recommended)

# You can install LGvar from anaconda.org
conda install -c conda-forge -c bioconda lgvar
# Or you can directly create a new environment
# Clone the repository  
git clone https://github.com/YafeiMaoLab/LGvar.git 
cd LGvar
# Create and activate environment  
conda env create -f env.yml  
conda activate LGvar

Option 2: Singularity

# If conda is not available, use our pre-built images:
singularity pull library://feifeizhou/tool/lgvar:v1.3.0 
# Execution example:  
singularity exec lgvar_v1.3.0.sif /LGVAR/LGVAR [subcommands]

Usage & Examples

  • LGvar provides several subcommands to streamline the genomic analysis pipeline:

    Subcommands List (click to expand)
    Command Function
    run Run SV identification. Detects SDRs, DELs, INSs, INVs, DUPs, INDELs, SNVs etc.
    plot Syntenic Plot. Visualizes the alignment between genomes. Blue regions represent syntenic blocks, while orange regions represent inversions.
    pair Homology Mapping. Generates homologous chromosome pair files.
    reverse RC-Check. Identifies and reverse-complements misoriented chromosomes.

1. Reverse-complement the genome

  • Before calling SVs, using LGvar reverse to check if query chromosomes need reverse-complementing to ensure inversion calling accuracy, this step identifies a chromosome as needing reverse complementation by checking if the total length of alignments mapped to the reverse strand exceeds half the chromosome’s total length in the PAF file.
    # Recommended: align first then check orientation  
    LGVAR reverse -p align.paf -r reverse.txt -g original.genome.fa -n new.genome.fa
    # Or use the script
    bash /src/scripts/rc_chrom.sh align.paf reverse.txt original.genome.fa new.genome.fa
    #Then use new.genome.fa as query genome to do SV calling
    
    reverse.txt contains the chromosomes that need to be reverse-complemented.

2. Generate orthologous chromosome pairs

  • LGvar identifies variants between each pair of orthologous chromosomes. If you do not have a tab-delimited TSV file containing ref query columns, you can generate the orthologous chromosome TSV file using the LGvar pair command.
    LGVAR pair -p align.paf -l 1000000 -o pair
    
    where the -l parameter specifies the minimum alignment length (in base pairs) required to define a reliable orthologous chromosome pair; only alignments meeting or exceeding this 1Mbp threshold will be used to determine the corresponding relationships between chromosomes. It is recommended to increase this value when analyzing two species with a large evolutionary divergence (e.g. human vs. lemur, -l can be set to 5Mbp).

3. Whole genome SV identification

  • Once you have prepared the reference genome, query genome and orthologous chromosome pair files, you can use LGVAR run to perform genome-wide variant detection. You may optionally provide files containing centromere and telomere coordinates of the reference genome to mask highly repetitive regions, thus improving running efficiency.

    LGVAR run \
        -r ref.fa \
        -q1 query.hap1.fa \
        -q2 query.hap2.fa \
        -cp1 query.hap1.pair.tsv \
        -cp2 query.hap2.pair.tsv \
        -m sensitive \
        -s query
    

    Centromere and telomere coordinate files for T2T-CHM13 are available under the examples/data directory, namely chm13_cen.tsv and chm13_telo.tsv.

  • Here is an running example. The test data is located in examples/. We'll use Human chromosome 21(T2T-CHM13) as reference and Chimpanzee (PTR) as query.

    # 1. Setup working directory  
    mkdir LGvar_work
    # 2. Decompress test genomes  
    cd examples/genome && gunzip *.gz  
    cd LGvar_work
    # 3. Execution (Example with existing PAF alignments)  
    LGVAR run \  
        -r /examples/genome/chr21.chm13.fa \ 
        -q1 /examples/genome/chr21.ptr.hap1.fa \  
        -q2 /examples/genome/chr21.ptr.hap2.fa \  
        -p1 /examples/align/align_hap1.paf \  
        -p2 /examples/align/align_hap2.paf \
        -cp1 /examples/data/PTR_hap1_pairs.tsv \
        -cp2 /examples/data/PTR_hap2_pairs.tsv \
        -m sensitive \
        -s PTR
    

4. Output Files

  • Results are saved in the ${work_dir}/results folder:

    results
    File Function
    sortLGvar_all.vcf Combined results of SNVs, INDELs and SVs for both haplotypes.
    LGvarhap1(2).vcf Haplotype-specific SV details.
    LGvarhap1(2).bed Haplotype-specific SV details (with SDRs, DUPs, TRANs).
    LGvar.bed Merged variant regions (Hap1 + Hap2).
    Label Description
    SNVs Single Nucleotide Variation
    INDELs Small insertions and deletions (Length < 50bp)
    DELs/INSs Deletions and Insertions (filtered at 50bp threshold)
    INVs/INV-INV Simple and Nested Inversions
    DUP Duplications
    TRANS Translocations
    SDRs Structurally Divergent Regions

5. Plot whole genome alignment synteny

  • You can visualize whole-genome alignments using PAF and PAIR files.
    LGVAR plot -p align.paf -f pair.tsv -o align.pdf
    
    This is an example using T2T-CHM13 as reference and chimpanzee hap1 as query genome. https://github.com/YafeiMaoLab/LGvar/images/alignment.png

Benchmarking

  • We benchmarked LGvar in many genomes include simulated, population and cross-species data (see forthcoming paper). See Analysis.md:

Getting help

Citing LGvar

Metadata

Release files for lgvar 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lgvar 1.3.0
File Size Uploaded
lgvar-1.3.0.tar.gz 8.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lgvar 1.3.0
File Interpreter ABI Platform
lgvar-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.2 kB

Release files / lgvar-1.3.0.tar.gz

Download URL lgvar-1.3.0.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fcbf221b260bbd795391280c3db76397219e5f42a57f1198117d1fa99238fd2d
BLAKE2b-256 checksum
How to use checksums
31c2e797fcfe3924453cce6bc71be3836d41ebdb76d059136b3dfd2ba19f9e4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / lgvar-1.3.0-py3-none-any.whl

Download URL lgvar-1.3.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8668843c61664c944246053758aaa7fbccb1b8bb3ddd17ba82fae706fcd9290
BLAKE2b-256 checksum
How to use checksums
76ed9ff308d92826d6e6d6efa7d1335207cb84516b29edc756c6f0fef2d52a61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release history Release notifications | RSS feed

1.4.0

2 release files

This release

1.3.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page