Code Monkey home page Code Monkey logo

cigargen's Introduction

Simple dynamic programming implementation of sequence alignment for generating CIGAR strings.

Generates "Compact Idiosyncratic Gapped Alignment Report" (CIGAR) format strings. Implemented using Needleman-Wunsch dynamic programming algorithm. Because of this, query and reference are supposed to be aligned to the left of both sequences, i.e. a result of sequence alignment which can be found in SAM files reports the starting position of an alignment. This location on the reference needs to be used as the beginning of the reference which is passed to GenerateCigar function.

This function is a basic implementation, which is quadratic in both time and memory.

Example usage is given in the cigargen_main.cc file:

  std::string reference = "ACTGCTGCCTGCAAAAAAAAAAA";
  std::string query = "AGTGTGCCCT";
  std::string cigar;
  std::string alignment = "";
  uint32_t alignment_length = 0;
  int32_t edit_distance = GenerateCigar((char *) query.c_str(), query.size(), (char *) reference.c_str(), reference.size(), &cigar, &alignment_length, &alignment);

  printf ("Reference sequence:\t%s\n", reference.c_str());
  printf ("Query sequence:\t\t%s\n", query.c_str());
  printf ("Returned CIGAR: %s\n", cigar.c_str());
  printf ("Alignment: %s\n", alignment.c_str());
  printf ("Alignment length: %d\n", alignment_length);
  printf ("Edit distance: %d\n", edit_distance);

Output of the above code snippet should be:

  Reference sequence:	ACTGCTGCCTGCAAAAAAAAAAA
  Query sequence:		AGTGTGCCCT
  Returned CIGAR: 1M1X2M1D2M1I3M
  Alignment: AxTG-TG+CCT
  Alignment length: 10
  Edit distance: 3

Detailed description of parameters can be found in the cigargen.h file.

Copyright Ivan Sovic, 2014.

Licence type: MIT.

cigargen's People

Contributors

isovic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pityka

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.