Graphical Fragment Assembly (GFA) for Ruby
Ruby
Switch branches/tags
Nothing to show
Latest commit df8e8e4 Mar 26, 2016 @lmrodriguezr code-climate fix
Permalink
Failed to load latest commit information.
data gfa/graph docs Mar 24, 2016
lib v0.1.2: Full test coverage Mar 25, 2016
test v0.1.2: Full test coverage Mar 25, 2016
.codeclimate.yml code-climate fix Mar 25, 2016
.gitignore rdocs integration Mar 25, 2016
.travis.yml code-climate fix Mar 25, 2016
Gemfile Gem cutter initiated Mar 25, 2016
LICENSE Initial commit Mar 22, 2016
README.md minor +docs Mar 25, 2016
Rakefile Gem cutter initiated Mar 25, 2016
gfa.gemspec rdocs integration Mar 25, 2016

README.md

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.