Giter VIP home page Giter VIP logo

gfa's Introduction

Code Climate Test Coverage Build Status Gem Version

Graphical Fragment Assembly (GFA) for Ruby

This implementation follows the specifications of GFA-spec.

Parsing GFA

To parse a file in GFA format:

require "gfa"

my_gfa = GFA.load("assembly.gfa")

To load GFA strings line-by-line:

require "gfa"

my_gfa = GFA.new
fh = File.open("assembly.gfa", "r")
fh.each do |ln|
   my_gfa << ln
end
fh.close

Saving GFA

After altering a GFA object, you can simply save it in a file as:

my_gfa.save("alt-assembly.gfa")

Or line-by-line as:

fh = File.open("alt-assembly.gfa", "w")
my_gfa.each_line do |ln|
   fh.puts ln
end
fh.close

Visualizing GFA

Any GFA object can be exported as an RGL graph using the methods adjacency_graph and implicit_graph. For example, you can render tiny.gfa:

require "gfa"
require "rgl/dot"

my_gfa = GFA.load("data/tiny.gfa")
dg = my_gfa.implicit_graph
dg.write_to_graphic_file("jpg")

tiny_dg

If you don't care about orientation, you can also build an undirected graph without orientation:

ug = my_gfa.implicit_graph(orient:false)
ug.write_to_graphic_file("jpg")

tiny_ug

Installation

gem install gfa

Or add the following line to your Gemfile:

gem "gfa"

and run bundle install from your shell.

Author

Luis M. Rodriguez-R.

License

Artistic License 2.0.

gfa's People

Contributors

lmrodriguezr avatar

Watchers

www 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.