ngs-bits

repository·master·Indexed 41 days ago

https://github.com/imgag/ngs-bits

A suite of short-read and long-read sequencing tools designed for NGS-based diagnostics. It includes a comprehensive set of QC tools (outputting in qcML format), BAM, BED, FASTQ, VCF, and BEDPE manipulation tools, as well as gene and phenotype handling utilities. Some advanced tools require the Next Generation Sequencing Database (NGSD). The suite also includes the GSvar application and a C++ HTTP API library called cppREST.

Tokens
205.9K
Snippets
457
Records
716
Agent score
50%

What's inside ngs-bits

  1. Overview of the cppREST library

    master

    cppREST is a C++ library designed for implementing HTTP API servers. It leverages the QT framework for socket management.

    Key characteristics:

    • Protocols: Supports both HTTP and HTTPS (note: HTTPS is recommended for production environments; HTTP should be avoided in production).
    • Concurrency Model: The library follows a thread-per-request model, where a new thread is spawned for every incoming request.
  2. Overview of ngs-bits tools

    master

    The ngs-bits repository provides a comprehensive suite of short-read and long-read sequencing tools designed for NGS-based diagnostics. The tools are categorized by the type of genomic data they process (BAM, BED, FASTQ, VCF, etc.) and their specific functional purpose (QC, Gene handling, Phenotype handling, etc.).

    Note on NGSD Dependency: Many advanced tools (e.g., BedAnnotateGenes, PhenotypesToGenes, VariantRanking) require the NGSD (Next Generation Sequencing Database), which contains gene, transcript, and exon data. Installation instructions for NGSD are located in doc/install_ngsd.md.

  3. Untitled record

    master

    SampleIdentity is a tool used to identify if different sequencing datasets (WGS, WES, lrGS, or RNA) originate from the same patient. It achieves this by calculating the identity of 75 specific SNPs that are typically well-covered across these sequencing types.

    Key Constraints & Usage Notes:

    • Genome Support: This tool works for HG38 only.
    • Scope: It is designed strictly for checking sample identity. It cannot determine the relatedness of samples (e.g., kinship) and does not work for sequencing panels.
    • Efficiency: It is optimized to be faster and more memory-efficient than the SampleSimilarity tool.
    • Input Requirements: If providing multiple BAM/CRAM files, you must provide a text file containing one path per line via the -bams parameter.
    # Example usage with a file list
    SampleIdentity -bams input_files.txt -out results.tsv -min_identity 98
  4. Detect Runs of Homozygosity (ROH) with RohHunter

    master

    RohHunter is a tool designed to detect Runs of Homozygosity (ROH) using a variant list in VCF format. It calculates the probability of observing an ROH by chance based on allele frequency information.

    Algorithm Workflow

    1. Filter variants: Removes false genotype calls based on Depth (default $\ge$ 20) and Variant Q score (default $\ge$ 30).
    2. Identify raw stretches: Determines raw stretches of homozygous markers.
    3. Assign probability: Calculates the probability of observing the ROH by chance using allele frequency (e.g., from 1000g or gnomAD).
    4. Filter by probability: Removes regions with low probability (default < Q30).
    5. Merge adjacent ROHs: Merges segments based on:
      • Marker distance (default $\le$ 1 or $\le$ 1% of ROH marker count).
      • Base distance (default $\le$ 50% of ROH base count).
    6. Final filtering: Filters based on:
      • Number of markers (default $\ge$ 20).
      • Size (default $\ge$ 20Kb).
  5. Selecting genes and configuring splice regions

    master

    Because the burden test evaluates variants across many samples for every gene, it is computationally intensive.

    • Gene Limit: It is recommended to select no more than 200 genes to avoid extremely long processing times.
    • Splice Regions: By default, the test uses variants in the exon region plus or minus 20 bases (the splice region). You can adjust this splice region size within the burden test dialog.
  6. Call Uniparental Disomy (UPD) in trio analyses

    master

    When performing a trio analysis, the system calls Uniparental Disomy (UPD) in addition to ROHs using the UpdHunter tool.

    If UPDs are detected, the RE (Runs of Homozygosity/Exclusion) dialog will display a specific dialog containing the following information for each UPD:

    • UPD coordinates: Genomic location.
    • size_kb: UPD size in kilobases.
    • size_markers: UPD size in SNVs.
    • upd_markers: The number of markers indicating a UPD.
    • source: The source of the UPD markers.
    • het_percentage: The percentage of markers with a heterozygous genotype.
    • q-score: The quality of the UPD call (Phred-scaled).
  7. Understand SampleSimilarity metrics

    master

    The SampleSimilarity tool calculates several metrics to measure the similarity between sequencing samples. The specific metrics available depend on the input mode (VCF, GSvar, or BAM):

    • overlap_percent: The percentage of variants found in both samples. This ignores genotype and is only available in VCF and GSvar modes.
    • correlation: The correlation of variant genotypes for variants found in both samples.
    • ibs0: The percentage of variants with zero Identity By State (IBS), such as AA and CC. This is only available in BAM mode.
    • ibs2: The percentage of variants with complete IBS, such as AA and AA. This is only available in BAM mode.

    Note that there are no universal cutoff values for these metrics, as results are highly dependent on factors like ethnicity and enrichment kits.

  8. Interpret ROH results for consanguinity

    master

    RohHunter results can be used to identify potential consanguinity in patients. Large ROHs are strong indicators of parental consanguinity.

    Key Indicator: Based on sequencing data distributions, a total ROH size sum larger than 75Mb is considered a strong indicator for parental consanguinity.

  9. Understand GSvar pre-filtering for WGS

    master

    To prevent GSvar files from becoming excessively large (WGS VCFs can contain ~5 million variants), only variants meeting at least one of the following criteria are included in the GSvar file:

    • VEP impact is HIGH, MODERATE, or LOW.
    • Annotated as pathogenic or likely pathogenic in ClinVar or HGMD.
    • Annotated as class 4, 5, or M in NGSD.
    • gnomAD Allele Frequency (AF) $\le$ 2%.
    • Located on chrMT (mitochondrial DNA).

    Note: Common variants (AF > 2%) that are purely intronic or intergenic are excluded.

  10. Interpret splicing junction event types

    master

    Splicing junctions detected during alignment are visualized as tracks in IGV. When hovering over or clicking a splicing event, the system displays the number of supporting reads and the splicing motif.

    Splicing event classifications:

    • known: Matches a known transcript.
    • exon-truncation: The upstream or downstream exon is truncated (junction occurs inside an exon).
    • exon-skip: At least one exon is skipped.
    • exon-skip-truncation: A combination of exon truncation and skipping.
    • intronic-or-overlap-no-tx: No supporting transcript found; junctions are inside an intronic region (at least one end), suggesting a novel exon.
    • other: Unspecific events, such as those in intergenic regions.
  11. Understand the Structural Variants table annotations

    master

    The Structural Variants dialog provides a table of detected SVs with the following key annotations:

    • genomic position: The location of the SV.
    • quality: The quality score of the call.
    • SV type: The type of structural variant (e.g., DEL, DUP, INV, etc.).
    • filter: The filter status.
    • GENES: All genes overlapping the SV.
    • GENES_BREAKPOINTS: Genes overlapping the SV breakpoints.
    • GENE_INFO: Gene-specific information from NGSD (including gnomAD o/e score and overlap type: complete, intronic/intergenic, or exonic/splicing).
    • NGSD_HOM / NGSD_HET: Frequency of the SV seen homozygous or heterozygous in NGSD.
    • NGSD_AF: Allele-frequency of the SV in NGSD.
    • NGSD_group: Homozygous/heterozygous count of the variant in the same disease group as the current sample.
    • NGSD_SV_BREAKPOINT_DENSITY: Number of SVs in NGSD sharing the same breakpoint(s).
    • NGSD_SV_BREAKPOINT_DENSITY_SYS: Number of SVs in NGSD sharing the same breakpoint(s) within the same disease group.
    • NGSD_PATHOGENIC_SVS: Frequency of the SV annotated as pathogenic (class 4 or 5) in NGSD.
    • OMIM: OMIM genes overlapping the SV.
    • CNV_OVERLAP: Fraction of the SV supported by CNV calls (calculated for DEL and DUP only).
  12. Understand ngs-bits Qt project files and include files

    master

    The src/ directory contains several .pro files used to manage different components of the project, and .pri files used to share settings across these projects.

    Qt Project Files (.pro)

    • libs.pro: Manages code and tests for base libraries (e.g., cppCORE, cppNGD, cppNGSD).
    • tools.pro: Manages code and tests for ngs-bits command-line tools.
    • tools_gui.pro: Manages code for GUI tools, specifically GSvar.
    • tools_server.pro: Manages code and tests for GSvarServer.

    Project Include Files (.pri)

    These files are included in .pro files to share configurations:

    • base.pri: Contains base settings; included by all other .pri files.
    • lib.pri: Settings for libraries.
    • test.pri: Settings for tests.
    • app_cli.pri: Settings for command-line tools.
    • app_gui.pri: Settings for GUI tools.