Giter Club home page Giter Club logo

rs-vgaligner's Introduction

rs-vgaligner

Aligns reads to a Variation Graph by combining Seed-and-Extend approaches with Partial Order Alignment (POA).

How it works

There are three main steps in this program:

  1. Indexing - We first build an index over the input graph, which contains all of the kmers (of a given size k) encoded by it, and their positions w.r.t. the linearized forward/reverse sequence. These positions are stored in a memory-efficient Minimal Perfect Hash Function.
  2. Mapping - We then split the query into kmers, and find perfect maches between these kmers and the linearization ("anchors"). Anchors that are close together are grouped into approximate alignments ("chains"). This step is inspired by Minimap2.
  3. Alignment - In order to convert chains into base-level alignments, we align the subgraph implied by the chain to the query. We use abPOA (or more specifically its Rust bindings) to perform the sequence-to-graph alignment.

Usage

This crate is mostly inteded to be used as an executable, but you can also use its functions if you may want to do so.

In order to install vgaligner as an executable, clone this repository, move to its main folder and run:

cargo install --path .

Graphs must be sorted in order to ensure that vgaligner works correctly. You can do so with odgi:

odgi sort -i unsorted_graph.gfa -o - -p Ygs -P | odgi view -i - -g > sorted_graph.gfa

Index

Generate the index with the following command:

vgaligner index -k {kmer-size} -i {input.gfa} -o {index.idx}

There are also additional parameters to limit the number of nodes/edges to be traversed, you can use vgaligner index --help to see them all.

Mapping and Alignment

Map reads to the graph with the following command:

vgaligner map -i {index.idx} -f {reads.fa/fq} -o {output.gaf}

This will output the chains in GAF format.

If you also want to perform the alignment with abPOA (this is highly recommended!), you will need to pass the --also-align parameter. This will generate an additional GAF file which contains the alignment.

You can see all of the available parameters with vgaligner map --help.

Validation

This tool has been tested on graphs obtained from HLA-zoo.

The validation pipeline uses snakemake, and can be executed by using the following commands:

cd experiments-snakemake && snakemake -k --cores {cores_to_be_used}

We recommend having at least 16 GB RAM and a CPU with 4+ cores.

rs-vgaligner's People

Contributors

hopedwall avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.