Coder Social home page Coder Social logo

libvgio's Introduction

libvgio is a library for (de)serializing vg files for use with the vg toolkit (see Sequence variation aware genome references and read mapping with the variation graph toolkit).

This tool is in the development stage, so it may contain bugs and the instructions on how to use it are subject to change.

Compiling

libvgio is implemented in C++11 and is built using CMake.

libvgio's only dependencies are protobuf (Google Protocol Buffers), htslib, and pthreads, all of which can be easily installed on any Unix style system.

libvgio requires htslib 1.10 or greater to avoid a bug in htslib that truncates multi-member GZIP files after the first member. If you build against an older htslib, you will not be able to read all VG and GAM files properly, especially GraphAligner GAMs.

Once protobufs and pthreads are installed, you can build and install libvgio by running the installation script: ./install.sh [INSTALL_LOCATION]. This will install the dynamic library and headers in your home directory unless you provide the script with the optional INSTALL_LOCATION.

Usage

libvgio exposes two header files vg/vg.pb.h and vg/io/basic_stream.hpp. vg/vg.pb.h is the header generated by the vg protobuf (see the vg toolkit Wiki for details) and vg/io/basic_stream.hpp exposes an input stream and an output stream.

The following C++ example reads a vg graph with the input stream and writes it to the standard output with the output stream.

#include <iostream>
#include "vg/vg.pb.h"
#include "vg/io/basic_stream.hpp"

using std::cout;
using std::endl;
using vg::Graph;
using vg::io::inputStream;
using vg::io::outputStream;

int main(int argc, char* argv[])
{
  if (argc != 2) {
    cout << "Usage: " << argv[0] << " VG_FILE" << endl;
    return -1;
  }
  Graph g = inputStream(argv[1]);
  outputStream(g);
  return 0;
}

This can be compiled by linking against libvgio at compile time

g++ -lvgio <myprogram>.cpp

or with CMake

find_package(VGio REQUIRED)
target_link_libraries(myprogram VGio::VGio)

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.