#vcf #genomics #bioinformatics #command-line-tool #file-path

bin+lib spdi

SPDI is a format to describe a genomic variant. This crate provides a library to get an SPDI format representation of a variant and a command-line utility which adds SPDI format output to an input VCF file.

3 releases

0.1.3 Feb 5, 2024
0.1.1 Feb 4, 2024
0.1.0 Feb 4, 2024

#228 in Biology

Custom license

57KB
1K SLoC

SPDI is a Rust library and a command-line utility for getting the SPDI-format representation of genomic variants.

As a command-line utility

git clone git@github.com:rkimoakbioinformatics/spdi.git
cd spdi
cargo build --release
# Add SPDI representation as OV_SPDI_IDS field in INFO of a VCF file.
./target/release/spdi -t <2bit file path> -f <VCF file path> 1>out.vcf 2>err.txt
# Get SPDI representation of a single variant.
./target/release/spdi -t <2bit file path> -v chr1:99092:C:CT

As a library

To add:

cargo add spdi
cargo add anyhow

To use:

use anyhow::Result;

fn example() -> Result<String> {
    let s = spdi::SPDI::new("path/to/2bit/file")?;
    let spdi_string = s.get_spdi_string("chr1", 99092, "C", "CT")?;
    println!("{}", spdi_string);
}

lib.rs:

Example:

use anyhow::Result;

fn example() -> Result<String> {
    let s = spdi::SPDI::new("path/to/2bit/file")?;
    let spdi_string = s.get_spdi_string("chr1", 99092, "C", "CT")?;
    println!("{}", spdi_string);
}

Dependencies

~6MB
~106K SLoC