madeline 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +8 -0
- data/README.md +45 -0
- data/Rakefile +35 -0
- data/ext/madeline2-linux-x86_64 +0 -0
- data/lib/madeline.rb +13 -0
- data/lib/madeline/interface.rb +74 -0
- data/madeline.gemspec +30 -0
- data/test/madeline_test.rb +56 -0
- data/test/pedigree.txt +9 -0
- metadata +71 -0
data/Manifest
ADDED
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
Madeline
|
2
|
+
========
|
3
|
+
|
4
|
+
Rails gem for running madeline on a pedigree hash
|
5
|
+
|
6
|
+
Installation
|
7
|
+
------------
|
8
|
+
|
9
|
+
<pre>
|
10
|
+
sudo gem install madeline
|
11
|
+
</pre>
|
12
|
+
|
13
|
+
Usage
|
14
|
+
-----
|
15
|
+
|
16
|
+
The *Madeline::Interface* has a single method, `draw`, which can be passed a string or an open *IO* object, and returns the Madeline XML. The result is returned as a string, or, if a block is passed, yields as an *IO* object for streaming writes.
|
17
|
+
|
18
|
+
<pre>
|
19
|
+
require 'rubygems'
|
20
|
+
require 'madeline'
|
21
|
+
Madeline::Interface.new.draw(File.open('pedigree.txt', 'r'))
|
22
|
+
</pre>
|
23
|
+
|
24
|
+
When creating a *Madeline::Interface*, you can pass [any options that the madeline2 program accepts](http://eyegene.ophthy.med.umich.edu/madeline/documentation.php) to the interface and they'll be forwarded. For example, to create an embedded result:
|
25
|
+
|
26
|
+
<pre>
|
27
|
+
artist = Madeline::Interface.new(:embedded => true)
|
28
|
+
artist.draw(File.open('pedigree.txt', 'r'))
|
29
|
+
</pre>
|
30
|
+
|
31
|
+
The default values of all the madeline2 flags are identical to the command-line version.
|
32
|
+
|
33
|
+
A *Madeline::Error* exception will be raised if draw fails for any reason.
|
34
|
+
|
35
|
+
Madeline Location
|
36
|
+
-----------------
|
37
|
+
|
38
|
+
The *Madeline::Interface* initializer can take a `madeline` option, overriding the location of the madeline2 program.
|
39
|
+
|
40
|
+
<pre>
|
41
|
+
artist = Madeline::Interface.new(
|
42
|
+
:madeline => '/usr/local/bin/madeline2'
|
43
|
+
)
|
44
|
+
</pre>
|
45
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
require 'rake/testtask'
|
5
|
+
require 'rake/rdoctask'
|
6
|
+
|
7
|
+
Echoe.new('madeline','0.1.1') do |p|
|
8
|
+
p.description = "Interface to Madeline2"
|
9
|
+
p.url = "http://github.com/dmauldin/madeline"
|
10
|
+
p.author = "Denise Mauldin"
|
11
|
+
p.email = "denise.mauldin@gmail.com"
|
12
|
+
p.ignore_pattern = ["tmp/*", "script/*"]
|
13
|
+
p.development_dependencies = []
|
14
|
+
end
|
15
|
+
|
16
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext}
|
17
|
+
|
18
|
+
desc 'Default: run unit tests.'
|
19
|
+
task :default => :test
|
20
|
+
|
21
|
+
desc 'Test the madeline plugin.'
|
22
|
+
Rake::TestTask.new(:test) do |t|
|
23
|
+
t.libs << 'lib'
|
24
|
+
t.pattern = 'test/**/*_test.rb'
|
25
|
+
t.verbose = true
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'Generate documentation for the madeline plugin.'
|
29
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
30
|
+
rdoc.rdoc_dir = 'rdoc'
|
31
|
+
rdoc.title = 'Madeline'
|
32
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
33
|
+
rdoc.rdoc_files.include('README')
|
34
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
35
|
+
end
|
Binary file
|
data/lib/madeline.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'stringio'
|
2
|
+
require 'tempfile'
|
3
|
+
|
4
|
+
module Madeline
|
5
|
+
|
6
|
+
class Error < StandardError; end
|
7
|
+
|
8
|
+
class Interface
|
9
|
+
|
10
|
+
DEFAULT_OPTIONS = {}
|
11
|
+
|
12
|
+
def initialize(options={})
|
13
|
+
@madeline = options.delete(:madeline) || MADELINE_COMMAND
|
14
|
+
@options = serialize_options(DEFAULT_OPTIONS.merge(options))
|
15
|
+
end
|
16
|
+
|
17
|
+
def draw(io)
|
18
|
+
tempfile = Tempfile.new('madeline')
|
19
|
+
if io.respond_to? :read
|
20
|
+
while buffer = io.read(4096) do
|
21
|
+
tempfile.write(buffer)
|
22
|
+
end
|
23
|
+
else
|
24
|
+
tempfile.write(io.to_s)
|
25
|
+
end
|
26
|
+
tempfile.flush
|
27
|
+
tempoutfile = Tempfile.new('madeline_output')
|
28
|
+
begin
|
29
|
+
log = `#{command} --outputprefix #{tempoutfile.path} --outputext .xml #{tempfile.path}`
|
30
|
+
unless (log.match(/Pedigree output file is/)) then
|
31
|
+
raise Error, "Madeline failed to run. Check Madeline path."
|
32
|
+
end
|
33
|
+
filename = "#{tempoutfile.path}.xml"
|
34
|
+
if (!File.exists?(filename)) then
|
35
|
+
raise Error, "Output File doesn't exist."
|
36
|
+
end
|
37
|
+
f = File.new(filename,"r")
|
38
|
+
return f.read
|
39
|
+
rescue Exception
|
40
|
+
raise Error, "Madeline failed to run. Tried #{@madeline}"
|
41
|
+
ensure
|
42
|
+
tempfile.close!
|
43
|
+
end
|
44
|
+
unless $?.exitstatus.zero?
|
45
|
+
raise Error, result
|
46
|
+
end
|
47
|
+
|
48
|
+
yield(StringIO.new(result)) if block_given?
|
49
|
+
result
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def serialize_options(options)
|
55
|
+
options.map do |k, v|
|
56
|
+
next if k == 'outputext'
|
57
|
+
next if k == 'outputprefix'
|
58
|
+
if (v == true || v == "true")
|
59
|
+
["--#{k}"]
|
60
|
+
elsif (v.is_a?(Array))
|
61
|
+
v.map {|v2| ["--#{k}", v2.to_s]}
|
62
|
+
else
|
63
|
+
["--#{k}", v.to_s]
|
64
|
+
end
|
65
|
+
end.flatten
|
66
|
+
end
|
67
|
+
|
68
|
+
def command
|
69
|
+
[@madeline, @options].flatten.join(' ')
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
data/madeline.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "madeline"
|
5
|
+
s.version = "0.1.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Denise Mauldin"]
|
9
|
+
s.date = "2011-09-06"
|
10
|
+
s.description = "Interface to Madeline2"
|
11
|
+
s.email = "denise.mauldin@gmail.com"
|
12
|
+
s.extra_rdoc_files = ["README.md", "ext/madeline2-linux-x86_64", "lib/madeline.rb", "lib/madeline/interface.rb"]
|
13
|
+
s.files = ["README.md", "Rakefile", "ext/madeline2-linux-x86_64", "lib/madeline.rb", "lib/madeline/interface.rb", "test/madeline_test.rb", "test/pedigree.txt", "Manifest", "madeline.gemspec"]
|
14
|
+
s.homepage = "http://github.com/dmauldin/madeline"
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Madeline", "--main", "README.md"]
|
16
|
+
s.require_paths = ["lib", "ext"]
|
17
|
+
s.rubyforge_project = "madeline"
|
18
|
+
s.rubygems_version = "1.8.10"
|
19
|
+
s.summary = "Interface to Madeline2"
|
20
|
+
s.test_files = ["test/madeline_test.rb"]
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
s.specification_version = 3
|
24
|
+
|
25
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
else
|
27
|
+
end
|
28
|
+
else
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'stringio'
|
3
|
+
|
4
|
+
class MadelineTest < Test::Unit::TestCase
|
5
|
+
require 'madeline'
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@pedigree_out = "<?xml version=\"1.0\" standalone=\"no\"?>\n <svg version=\"1.1\" id=\"svgDC\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"370.44\" height=\"380.481\" onload=\"init()\" >\n <defs>\n <style type=\"text/css\"><![CDATA[\n\nline{\n\tstroke:#000;\n\tstroke-width:0.5mm;\n\tstroke-linejoin:miter;\n\tstroke-linecap:square;\n}\n\nrect{\n\tstroke:#000;\n\tstroke-width:0.5mm;\n\tstroke-linejoin:miter;\n\tstroke-linecap:square;\n}\n\nellipse{\n\tstroke: #000;\n fill: #fff;\n\tstroke-width:0.25mm;\n}\n\ntext{\n\tfont-family:\"DejaVu Sans\",sans-serif;\n\tfont-size:12px;\n}\n\n.smallText{\n\tfont-family:\"DejaVu Sans\",sans-serif;\n\tfont-size:9px;\n\tfill:#444;\n}\n\n.layer text{\n\tfill:#930;\n}\n\n.layer line{\n\tstroke:#000;\n}\n\n.birthOrder,.unknownTwins{\n\tfont-size: 8px;\n}\n\n.header{\n\tfont-size:18px;\n\tfont-weight:bold;\n}\n\n.keyBox{\n\tfill:#e5e5e5;\n\tstroke:#000;\n\tstroke-width:0.5mm;\n\tstroke-linejoin:miter;\n\tstroke-linecap:square;\n}\n\n.mating:hover{\n\tstroke-width:1mm;\n\tstroke:#d56300;\n}\n\n.selectedIndividual{\n\tstroke-width:1mm;\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#d00;\n fill:none;\n}\n\n.selectedIndividual:hover{\n\tstroke:#d00;\n\tfill:#ffbbbb;\n\tfill-opacity:0.70;\n}\n\n.solid{\n\tstroke-width:0.5mm;\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#000;\n\tfill:none;\n}\n\n.dashed{\n\tstroke-width:0.5mm;\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#98afc7;\n\tstroke-dasharray:2mm,1mm;\n\tstroke-dashoffset:1.0mm;\n\tfill:none;\n}\n\n.solid:hover{\n\tfill:#ffb787;\n\tfill-opacity:0.70;\n\tstroke:#d56300;\n\tstroke-width:1mm;\n}\n\n.dashed:hover{\n\tfill:#ffb787;\n\tfill-opacity:0.70;\n\tstroke:#d56300;\n\tstroke-width:1mm;\n}\n\n.filled{\n\tstroke-width:0.5mm;\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#000;\n\tfill:#000;\n}\n\n.specialIcons{\n\tstroke-width:0.25mm;\n\tstroke-linecap:round;\n\tstroke-linejoin:miter;\n\tstroke:#000;\n\tfill:#fff;\n}\n\n.specialLines{\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#000;\n\tstroke-width:0.5mm;\n\tfill:none;\n}\n\n.thinLine{\n\tfill:none;\n\tstroke: #000;\n\tstroke-width:0.25mm;\n}\n\n.curvedConnector{\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#98afc7;\n\tstroke-width:0.5mm;\n\tstroke-dasharray:2mm,1mm;\n\tstroke-dashoffset:1.0mm;\n\tfill:none;\n}\n\n.curvedConnector:hover{\n\tstroke:#d56300;\n}\n\n.whiteInkLetter_1{\n\tfont-size: 12px;\n\tfill: #fff;\n}\n\n.whiteInkLetter_2{\n\tfont-size: 10px;\n\tfill: #fff;\n}\n\n.whiteInkLetter_3{\n\tfont-size: 8px;\n\tfill: #fff;\n}\n\n.whiteInkLetter{\n\tfont-size: 8px;\n\tfill: #fff;\n}\n\n.blackInkLetter_1{\n\tfont-size: 12px;\n}\n\n.blackInkLetter_2{\n\tfont-size: 10px;\n}\n\n.blackInkLetter_3{\n\tfont-size: 8px;\n}\n\n.blackInkLetter{\n\tfont-size: 8px;\n\tfill: #000;\n}\n\n]]></style>\n <script type=\"text/javascript\" xlink:href=\"javascript/madeline.js\"></script>\n <marker id=\"endArrow\" viewBox=\"0 0 10 10\" refX=\"1\" refY=\"5\" markerUnits=\"strokeWidth\" orient=\"auto\" markerWidth=\"5\" markerHeight=\"4\"> <polyline points=\"0,0 10,5 0,10 1,5\" fill=\"#000\" /> </marker>\n </defs>\n <g class=\"pedigree\" transform=\"translate(-462.86)\">\n\n <g id=\"bottomLayer\" class=\"layer\" >\n\n </g>\n <g id=\"layer0\" class=\"layer\" >\n </g>\n\n <g class=\"drawing\">\n <text x=\"557.36\" y=\"30\" text-anchor=\"middle\" class=\"header\" >madTest</text>\n <rect x=\"500.66\" y=\"38.66\" width=\"22.68\" height=\"22.68\" id=\"g43\" class=\"solid\"/>\n <text x=\"512\" y=\"92.5845\" text-anchor=\"middle\" >g43</text>\n <line x1=\"523.34\" y1=\"50\" x2=\"591.38\" y2=\"50\" />\n<circle cx=\"602.72\" cy=\"50\" r=\"11.34\" id=\"g44\" class=\"solid\"/>\n <text x=\"602.72\" y=\"92.5845\" text-anchor=\"middle\" >g44</text>\n <line class=\"mating\" id=\"g44:g43\" x1=\"557.36\" y1=\"50\" x2=\"557.36\" y2=\"123.907\" />\n <line class=\"solid\" x1=\"512\" y1=\"123.907\" x2=\"512\" y2=\"152.257\" />\n<circle cx=\"512\" cy=\"163.597\" r=\"11.34\" id=\"g47\" class=\"solid\"/>\n <text x=\"512\" y=\"206.181\" text-anchor=\"middle\" >g47</text>\n <line class=\"solid\" x1=\"648.08\" y1=\"123.907\" x2=\"648.08\" y2=\"152.257\" />\n<circle cx=\"648.08\" cy=\"163.597\" r=\"11.34\" id=\"g49\" class=\"solid\"/>\n <text x=\"648.08\" y=\"206.181\" text-anchor=\"middle\" >g49</text>\n <line x1=\"659.42\" y1=\"163.597\" x2=\"727.46\" y2=\"163.597\" />\n <rect x=\"727.46\" y=\"152.257\" width=\"22.68\" height=\"22.68\" id=\"g48\" class=\"solid\"/>\n <text x=\"738.8\" y=\"206.181\" text-anchor=\"middle\" >g48</text>\n <line class=\"mating\" id=\"g49:g48\" x1=\"693.44\" y1=\"163.597\" x2=\"693.44\" y2=\"237.504\" />\n <line class=\"solid\" x1=\"602.72\" y1=\"237.504\" x2=\"602.72\" y2=\"265.854\" />\n<circle cx=\"602.72\" cy=\"277.194\" r=\"11.34\" id=\"g50\" class=\"solid\"/>\n <text x=\"602.72\" y=\"319.778\" text-anchor=\"middle\" >g50</text>\n <line class=\"solid\" x1=\"693.44\" y1=\"237.504\" x2=\"693.44\" y2=\"265.854\" />\n<circle cx=\"693.44\" cy=\"277.194\" r=\"11.34\" id=\"g51\" class=\"solid\"/>\n <text x=\"693.44\" y=\"319.778\" text-anchor=\"middle\" >g51</text>\n <line class=\"solid\" x1=\"784.16\" y1=\"237.504\" x2=\"784.16\" y2=\"265.854\" />\n <rect x=\"772.82\" y=\"265.854\" width=\"22.68\" height=\"22.68\" id=\"g52\" class=\"solid\"/>\n <text x=\"784.16\" y=\"319.778\" text-anchor=\"middle\" >g52</text>\n <line x1=\"602.72\" y1=\"237.504\" x2=\"784.16\" y2=\"237.504\" />\n <line x1=\"512\" y1=\"123.907\" x2=\"648.08\" y2=\"123.907\" />\n </g>\n\n </g>\n </svg>\n\n"
|
9
|
+
@arial_out = "<?xml version=\"1.0\" standalone=\"no\"?>\n <svg version=\"1.1\" id=\"svgDC\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"370.44\" height=\"380.481\" onload=\"init()\" >\n <defs>\n <style type=\"text/css\"><![CDATA[\n\nline{\n\tstroke:#000;\n\tstroke-width:0.5mm;\n\tstroke-linejoin:miter;\n\tstroke-linecap:square;\n}\n\nrect{\n\tstroke:#000;\n\tstroke-width:0.5mm;\n\tstroke-linejoin:miter;\n\tstroke-linecap:square;\n}\n\nellipse{\n\tstroke: #000;\n fill: #fff;\n\tstroke-width:0.25mm;\n}\n\ntext{\n\tfont-family:\"Arial\",sans-serif;\n\tfont-size:12px;\n}\n\n.smallText{\n\tfont-family:\"Arial\",sans-serif;\n\tfont-size:9px;\n\tfill:#444;\n}\n\n.layer text{\n\tfill:#930;\n}\n\n.layer line{\n\tstroke:#000;\n}\n\n.birthOrder,.unknownTwins{\n\tfont-size: 8px;\n}\n\n.header{\n\tfont-size:18px;\n\tfont-weight:bold;\n}\n\n.keyBox{\n\tfill:#e5e5e5;\n\tstroke:#000;\n\tstroke-width:0.5mm;\n\tstroke-linejoin:miter;\n\tstroke-linecap:square;\n}\n\n.mating:hover{\n\tstroke-width:1mm;\n\tstroke:#d56300;\n}\n\n.selectedIndividual{\n\tstroke-width:1mm;\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#d00;\n fill:none;\n}\n\n.selectedIndividual:hover{\n\tstroke:#d00;\n\tfill:#ffbbbb;\n\tfill-opacity:0.70;\n}\n\n.solid{\n\tstroke-width:0.5mm;\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#000;\n\tfill:none;\n}\n\n.dashed{\n\tstroke-width:0.5mm;\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#98afc7;\n\tstroke-dasharray:2mm,1mm;\n\tstroke-dashoffset:1.0mm;\n\tfill:none;\n}\n\n.solid:hover{\n\tfill:#ffb787;\n\tfill-opacity:0.70;\n\tstroke:#d56300;\n\tstroke-width:1mm;\n}\n\n.dashed:hover{\n\tfill:#ffb787;\n\tfill-opacity:0.70;\n\tstroke:#d56300;\n\tstroke-width:1mm;\n}\n\n.filled{\n\tstroke-width:0.5mm;\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#000;\n\tfill:#000;\n}\n\n.specialIcons{\n\tstroke-width:0.25mm;\n\tstroke-linecap:round;\n\tstroke-linejoin:miter;\n\tstroke:#000;\n\tfill:#fff;\n}\n\n.specialLines{\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#000;\n\tstroke-width:0.5mm;\n\tfill:none;\n}\n\n.thinLine{\n\tfill:none;\n\tstroke: #000;\n\tstroke-width:0.25mm;\n}\n\n.curvedConnector{\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#98afc7;\n\tstroke-width:0.5mm;\n\tstroke-dasharray:2mm,1mm;\n\tstroke-dashoffset:1.0mm;\n\tfill:none;\n}\n\n.curvedConnector:hover{\n\tstroke:#d56300;\n}\n\n.whiteInkLetter_1{\n\tfont-size: 12px;\n\tfill: #fff;\n}\n\n.whiteInkLetter_2{\n\tfont-size: 10px;\n\tfill: #fff;\n}\n\n.whiteInkLetter_3{\n\tfont-size: 8px;\n\tfill: #fff;\n}\n\n.whiteInkLetter{\n\tfont-size: 8px;\n\tfill: #fff;\n}\n\n.blackInkLetter_1{\n\tfont-size: 12px;\n}\n\n.blackInkLetter_2{\n\tfont-size: 10px;\n}\n\n.blackInkLetter_3{\n\tfont-size: 8px;\n}\n\n.blackInkLetter{\n\tfont-size: 8px;\n\tfill: #000;\n}\n\n]]></style>\n <script type=\"text/javascript\" xlink:href=\"javascript/madeline.js\"></script>\n <marker id=\"endArrow\" viewBox=\"0 0 10 10\" refX=\"1\" refY=\"5\" markerUnits=\"strokeWidth\" orient=\"auto\" markerWidth=\"5\" markerHeight=\"4\"> <polyline points=\"0,0 10,5 0,10 1,5\" fill=\"#000\" /> </marker>\n </defs>\n <g class=\"pedigree\" transform=\"translate(-462.86)\">\n\n <g id=\"bottomLayer\" class=\"layer\" >\n\n </g>\n <g id=\"layer0\" class=\"layer\" >\n </g>\n\n <g class=\"drawing\">\n <text x=\"557.36\" y=\"30\" text-anchor=\"middle\" class=\"header\" >madTest</text>\n <rect x=\"500.66\" y=\"38.66\" width=\"22.68\" height=\"22.68\" id=\"g43\" class=\"solid\"/>\n <text x=\"512\" y=\"92.5845\" text-anchor=\"middle\" >g43</text>\n <line x1=\"523.34\" y1=\"50\" x2=\"591.38\" y2=\"50\" />\n<circle cx=\"602.72\" cy=\"50\" r=\"11.34\" id=\"g44\" class=\"solid\"/>\n <text x=\"602.72\" y=\"92.5845\" text-anchor=\"middle\" >g44</text>\n <line class=\"mating\" id=\"g44:g43\" x1=\"557.36\" y1=\"50\" x2=\"557.36\" y2=\"123.907\" />\n <line class=\"solid\" x1=\"512\" y1=\"123.907\" x2=\"512\" y2=\"152.257\" />\n<circle cx=\"512\" cy=\"163.597\" r=\"11.34\" id=\"g47\" class=\"solid\"/>\n <text x=\"512\" y=\"206.181\" text-anchor=\"middle\" >g47</text>\n <line class=\"solid\" x1=\"648.08\" y1=\"123.907\" x2=\"648.08\" y2=\"152.257\" />\n<circle cx=\"648.08\" cy=\"163.597\" r=\"11.34\" id=\"g49\" class=\"solid\"/>\n <text x=\"648.08\" y=\"206.181\" text-anchor=\"middle\" >g49</text>\n <line x1=\"659.42\" y1=\"163.597\" x2=\"727.46\" y2=\"163.597\" />\n <rect x=\"727.46\" y=\"152.257\" width=\"22.68\" height=\"22.68\" id=\"g48\" class=\"solid\"/>\n <text x=\"738.8\" y=\"206.181\" text-anchor=\"middle\" >g48</text>\n <line class=\"mating\" id=\"g49:g48\" x1=\"693.44\" y1=\"163.597\" x2=\"693.44\" y2=\"237.504\" />\n <line class=\"solid\" x1=\"602.72\" y1=\"237.504\" x2=\"602.72\" y2=\"265.854\" />\n<circle cx=\"602.72\" cy=\"277.194\" r=\"11.34\" id=\"g50\" class=\"solid\"/>\n <text x=\"602.72\" y=\"319.778\" text-anchor=\"middle\" >g50</text>\n <line class=\"solid\" x1=\"693.44\" y1=\"237.504\" x2=\"693.44\" y2=\"265.854\" />\n<circle cx=\"693.44\" cy=\"277.194\" r=\"11.34\" id=\"g51\" class=\"solid\"/>\n <text x=\"693.44\" y=\"319.778\" text-anchor=\"middle\" >g51</text>\n <line class=\"solid\" x1=\"784.16\" y1=\"237.504\" x2=\"784.16\" y2=\"265.854\" />\n <rect x=\"772.82\" y=\"265.854\" width=\"22.68\" height=\"22.68\" id=\"g52\" class=\"solid\"/>\n <text x=\"784.16\" y=\"319.778\" text-anchor=\"middle\" >g52</text>\n <line x1=\"602.72\" y1=\"237.504\" x2=\"784.16\" y2=\"237.504\" />\n <line x1=\"512\" y1=\"123.907\" x2=\"648.08\" y2=\"123.907\" />\n </g>\n\n </g>\n </svg>\n\n"
|
10
|
+
@embedded_out = " <svg version=\"1.1\" id=\"svgDC\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"370.44\" height=\"380.481\" onload=\"init()\" >\n <defs>\n <style type=\"text/css\"><![CDATA[\n\nline{\n\tstroke:#000;\n\tstroke-width:0.5mm;\n\tstroke-linejoin:miter;\n\tstroke-linecap:square;\n}\n\nrect{\n\tstroke:#000;\n\tstroke-width:0.5mm;\n\tstroke-linejoin:miter;\n\tstroke-linecap:square;\n}\n\nellipse{\n\tstroke: #000;\n fill: #fff;\n\tstroke-width:0.25mm;\n}\n\ntext{\n\tfont-family:\"DejaVu Sans\",sans-serif;\n\tfont-size:12px;\n}\n\n.smallText{\n\tfont-family:\"DejaVu Sans\",sans-serif;\n\tfont-size:9px;\n\tfill:#444;\n}\n\n.layer text{\n\tfill:#930;\n}\n\n.layer line{\n\tstroke:#000;\n}\n\n.birthOrder,.unknownTwins{\n\tfont-size: 8px;\n}\n\n.header{\n\tfont-size:18px;\n\tfont-weight:bold;\n}\n\n.keyBox{\n\tfill:#e5e5e5;\n\tstroke:#000;\n\tstroke-width:0.5mm;\n\tstroke-linejoin:miter;\n\tstroke-linecap:square;\n}\n\n.mating:hover{\n\tstroke-width:1mm;\n\tstroke:#d56300;\n}\n\n.selectedIndividual{\n\tstroke-width:1mm;\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#d00;\n fill:none;\n}\n\n.selectedIndividual:hover{\n\tstroke:#d00;\n\tfill:#ffbbbb;\n\tfill-opacity:0.70;\n}\n\n.solid{\n\tstroke-width:0.5mm;\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#000;\n\tfill:none;\n}\n\n.dashed{\n\tstroke-width:0.5mm;\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#98afc7;\n\tstroke-dasharray:2mm,1mm;\n\tstroke-dashoffset:1.0mm;\n\tfill:none;\n}\n\n.solid:hover{\n\tfill:#ffb787;\n\tfill-opacity:0.70;\n\tstroke:#d56300;\n\tstroke-width:1mm;\n}\n\n.dashed:hover{\n\tfill:#ffb787;\n\tfill-opacity:0.70;\n\tstroke:#d56300;\n\tstroke-width:1mm;\n}\n\n.filled{\n\tstroke-width:0.5mm;\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#000;\n\tfill:#000;\n}\n\n.specialIcons{\n\tstroke-width:0.25mm;\n\tstroke-linecap:round;\n\tstroke-linejoin:miter;\n\tstroke:#000;\n\tfill:#fff;\n}\n\n.specialLines{\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#000;\n\tstroke-width:0.5mm;\n\tfill:none;\n}\n\n.thinLine{\n\tfill:none;\n\tstroke: #000;\n\tstroke-width:0.25mm;\n}\n\n.curvedConnector{\n\tstroke-linecap:square;\n\tstroke-linejoin:miter;\n\tstroke:#98afc7;\n\tstroke-width:0.5mm;\n\tstroke-dasharray:2mm,1mm;\n\tstroke-dashoffset:1.0mm;\n\tfill:none;\n}\n\n.curvedConnector:hover{\n\tstroke:#d56300;\n}\n\n.whiteInkLetter_1{\n\tfont-size: 12px;\n\tfill: #fff;\n}\n\n.whiteInkLetter_2{\n\tfont-size: 10px;\n\tfill: #fff;\n}\n\n.whiteInkLetter_3{\n\tfont-size: 8px;\n\tfill: #fff;\n}\n\n.whiteInkLetter{\n\tfont-size: 8px;\n\tfill: #fff;\n}\n\n.blackInkLetter_1{\n\tfont-size: 12px;\n}\n\n.blackInkLetter_2{\n\tfont-size: 10px;\n}\n\n.blackInkLetter_3{\n\tfont-size: 8px;\n}\n\n.blackInkLetter{\n\tfont-size: 8px;\n\tfill: #000;\n}\n\n]]></style>\n <script type=\"text/javascript\" xlink:href=\"javascript/madeline.js\"></script>\n <marker id=\"endArrow\" viewBox=\"0 0 10 10\" refX=\"1\" refY=\"5\" markerUnits=\"strokeWidth\" orient=\"auto\" markerWidth=\"5\" markerHeight=\"4\"> <polyline points=\"0,0 10,5 0,10 1,5\" fill=\"#000\" /> </marker>\n </defs>\n <g class=\"pedigree\" transform=\"translate(-462.86)\">\n\n <g id=\"bottomLayer\" class=\"layer\" >\n\n </g>\n <g id=\"layer0\" class=\"layer\" >\n </g>\n\n <g class=\"drawing\">\n <text x=\"557.36\" y=\"30\" text-anchor=\"middle\" class=\"header\" >madTest</text>\n <rect x=\"500.66\" y=\"38.66\" width=\"22.68\" height=\"22.68\" id=\"g43\" class=\"solid\"/>\n <text x=\"512\" y=\"92.5845\" text-anchor=\"middle\" >g43</text>\n <line x1=\"523.34\" y1=\"50\" x2=\"591.38\" y2=\"50\" />\n<circle cx=\"602.72\" cy=\"50\" r=\"11.34\" id=\"g44\" class=\"solid\"/>\n <text x=\"602.72\" y=\"92.5845\" text-anchor=\"middle\" >g44</text>\n <line class=\"mating\" id=\"g44:g43\" x1=\"557.36\" y1=\"50\" x2=\"557.36\" y2=\"123.907\" />\n <line class=\"solid\" x1=\"512\" y1=\"123.907\" x2=\"512\" y2=\"152.257\" />\n<circle cx=\"512\" cy=\"163.597\" r=\"11.34\" id=\"g47\" class=\"solid\"/>\n <text x=\"512\" y=\"206.181\" text-anchor=\"middle\" >g47</text>\n <line class=\"solid\" x1=\"648.08\" y1=\"123.907\" x2=\"648.08\" y2=\"152.257\" />\n<circle cx=\"648.08\" cy=\"163.597\" r=\"11.34\" id=\"g49\" class=\"solid\"/>\n <text x=\"648.08\" y=\"206.181\" text-anchor=\"middle\" >g49</text>\n <line x1=\"659.42\" y1=\"163.597\" x2=\"727.46\" y2=\"163.597\" />\n <rect x=\"727.46\" y=\"152.257\" width=\"22.68\" height=\"22.68\" id=\"g48\" class=\"solid\"/>\n <text x=\"738.8\" y=\"206.181\" text-anchor=\"middle\" >g48</text>\n <line class=\"mating\" id=\"g49:g48\" x1=\"693.44\" y1=\"163.597\" x2=\"693.44\" y2=\"237.504\" />\n <line class=\"solid\" x1=\"602.72\" y1=\"237.504\" x2=\"602.72\" y2=\"265.854\" />\n<circle cx=\"602.72\" cy=\"277.194\" r=\"11.34\" id=\"g50\" class=\"solid\"/>\n <text x=\"602.72\" y=\"319.778\" text-anchor=\"middle\" >g50</text>\n <line class=\"solid\" x1=\"693.44\" y1=\"237.504\" x2=\"693.44\" y2=\"265.854\" />\n<circle cx=\"693.44\" cy=\"277.194\" r=\"11.34\" id=\"g51\" class=\"solid\"/>\n <text x=\"693.44\" y=\"319.778\" text-anchor=\"middle\" >g51</text>\n <line class=\"solid\" x1=\"784.16\" y1=\"237.504\" x2=\"784.16\" y2=\"265.854\" />\n <rect x=\"772.82\" y=\"265.854\" width=\"22.68\" height=\"22.68\" id=\"g52\" class=\"solid\"/>\n <text x=\"784.16\" y=\"319.778\" text-anchor=\"middle\" >g52</text>\n <line x1=\"602.72\" y1=\"237.504\" x2=\"784.16\" y2=\"237.504\" />\n <line x1=\"512\" y1=\"123.907\" x2=\"648.08\" y2=\"123.907\" />\n </g>\n\n </g>\n </svg>\n\n"
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_init
|
14
|
+
assert_nothing_raised do
|
15
|
+
madeline = Madeline::Interface.new()
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_construction
|
20
|
+
artist = Madeline::Interface.new()
|
21
|
+
pedigree = artist.draw(File.open('test/pedigree.txt','r'))
|
22
|
+
assert_equal(@pedigree_out, pedigree)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_madeline_location
|
26
|
+
artist = Madeline::Interface.new(:madeline => '/u5/tools/bin/madeline2')
|
27
|
+
pedigree = artist.draw(File.open('test/pedigree.txt','r'))
|
28
|
+
assert_equal(@pedigree_out, pedigree)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_bad_madeline_location
|
32
|
+
artist = Madeline::Interface.new(:madeline => 'jkfldsjkklfa')
|
33
|
+
assert_raises Madeline::Error do
|
34
|
+
artist.draw(File.open('test/pedigree.txt','r'))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_arial
|
39
|
+
artist = Madeline::Interface.new(:font => "Arial")
|
40
|
+
pedigree = artist.draw(File.open('test/pedigree.txt','r'))
|
41
|
+
assert_equal(@arial_out, pedigree)
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_embedded
|
45
|
+
artist = Madeline::Interface.new(:embedded => true)
|
46
|
+
pedigree = artist.draw(File.open('test/pedigree.txt','r'))
|
47
|
+
assert_equal(@embedded_out, pedigree)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_bad_file_location
|
51
|
+
artist = Madeline::Interface.new()
|
52
|
+
assert_raises(Errno::ENOENT,"No such file or directory") do
|
53
|
+
pedigree = artist.draw(File.open('test/blah.txt','r'))
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/test/pedigree.txt
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
FamilyID IndividualID Gender Father Mother C1 C2 C3 1739
|
2
|
+
madTest g44 F . . Y . . non
|
3
|
+
madTest g43 M . . . . . .
|
4
|
+
madTest g50 F g48 g49 . . . .
|
5
|
+
madTest g47 F g43 g44 Y . . non
|
6
|
+
madTest g51 F g48 g49 Y . . non
|
7
|
+
madTest g48 M . . . . . .
|
8
|
+
madTest g52 M g48 g49 Y Y Y non
|
9
|
+
madTest g49 F g43 g44 Y . . non
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: madeline
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Denise Mauldin
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-09-06 00:00:00 Z
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Interface to Madeline2
|
17
|
+
email: denise.mauldin@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.md
|
24
|
+
- ext/madeline2-linux-x86_64
|
25
|
+
- lib/madeline.rb
|
26
|
+
- lib/madeline/interface.rb
|
27
|
+
files:
|
28
|
+
- README.md
|
29
|
+
- Rakefile
|
30
|
+
- ext/madeline2-linux-x86_64
|
31
|
+
- lib/madeline.rb
|
32
|
+
- lib/madeline/interface.rb
|
33
|
+
- test/madeline_test.rb
|
34
|
+
- test/pedigree.txt
|
35
|
+
- Manifest
|
36
|
+
- madeline.gemspec
|
37
|
+
homepage: http://github.com/dmauldin/madeline
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options:
|
42
|
+
- --line-numbers
|
43
|
+
- --inline-source
|
44
|
+
- --title
|
45
|
+
- Madeline
|
46
|
+
- --main
|
47
|
+
- README.md
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
- ext
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: "1.2"
|
63
|
+
requirements: []
|
64
|
+
|
65
|
+
rubyforge_project: madeline
|
66
|
+
rubygems_version: 1.8.10
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: Interface to Madeline2
|
70
|
+
test_files:
|
71
|
+
- test/madeline_test.rb
|