gviz 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gviz.rb +1 -0
- data/lib/gviz/version.rb +1 -1
- data/spec/gviz_spec.rb +6 -0
- metadata +2 -6
- data/examples/arrow.dot +0 -88
- data/examples/color.dot +0 -1302
- data/examples/scraper.rb +0 -59
- data/examples/shape.dot +0 -108
data/examples/scraper.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require "nokogiri"
|
3
|
-
require "open-uri"
|
4
|
-
|
5
|
-
module Gviz
|
6
|
-
class Scraper
|
7
|
-
URL = "http://www.graphviz.org/content/"
|
8
|
-
|
9
|
-
class << self
|
10
|
-
def build(path)
|
11
|
-
@html ||= get(URL+path)
|
12
|
-
parse @html
|
13
|
-
end
|
14
|
-
|
15
|
-
def get(url)
|
16
|
-
@html = Nokogiri::HTML(open url)
|
17
|
-
rescue OpenURI::HTTPError => e
|
18
|
-
STDERR.puts "HTTP Access Error:#{e}"
|
19
|
-
exit
|
20
|
-
end
|
21
|
-
|
22
|
-
def parse(html)
|
23
|
-
q = []
|
24
|
-
|
25
|
-
# ## shapes
|
26
|
-
# html.css("div.content>table td>a").each do |a|
|
27
|
-
# q << a.text
|
28
|
-
# end
|
29
|
-
# return q.uniq
|
30
|
-
|
31
|
-
## arrows
|
32
|
-
html.css("table").each_with_index do |tbl, i|
|
33
|
-
if i == 5
|
34
|
-
tbl.css("td").each do |e|
|
35
|
-
txt = e.text.strip.chomp
|
36
|
-
q << txt unless txt.empty?
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
return q.uniq
|
41
|
-
|
42
|
-
# ## X11 colors scheme
|
43
|
-
# table = html.at("div.content>table").css('td>a').each do |color|
|
44
|
-
# txt = color.text.gsub(' ','')
|
45
|
-
# q << txt unless txt.match(/^\d+$/)
|
46
|
-
# end
|
47
|
-
# return q.sort.uniq.group_by { |c| c[/^\D+/]; $& }
|
48
|
-
# .flat_map { |k, v| v.sort_by { |c| c[/\d+/].to_i } }
|
49
|
-
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
if __FILE__ == $0
|
56
|
-
# puts Gviz::Scraper.build("node-shapes")
|
57
|
-
puts Gviz::Scraper.build("arrow-shapes")
|
58
|
-
# puts Gviz::Scraper.build("color-names")
|
59
|
-
end
|
data/examples/shape.dot
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
digraph G {
|
2
|
-
node[style="filled",fillcolor="orchid"];
|
3
|
-
edge[arrowhead="none"];
|
4
|
-
box[shape="box"];
|
5
|
-
polygon[shape="polygon"];
|
6
|
-
ellipse[shape="ellipse"];
|
7
|
-
oval[shape="oval"];
|
8
|
-
circle[shape="circle"];
|
9
|
-
point[shape="point"];
|
10
|
-
egg[shape="egg"];
|
11
|
-
triangle[shape="triangle"];
|
12
|
-
plaintext[shape="plaintext"];
|
13
|
-
diamond[shape="diamond"];
|
14
|
-
trapezium[shape="trapezium"];
|
15
|
-
parallelogram[shape="parallelogram"];
|
16
|
-
house[shape="house"];
|
17
|
-
pentagon[shape="pentagon"];
|
18
|
-
hexagon[shape="hexagon"];
|
19
|
-
septagon[shape="septagon"];
|
20
|
-
octagon[shape="octagon"];
|
21
|
-
doublecircle[shape="doublecircle"];
|
22
|
-
doubleoctagon[shape="doubleoctagon"];
|
23
|
-
tripleoctagon[shape="tripleoctagon"];
|
24
|
-
invtriangle[shape="invtriangle"];
|
25
|
-
invtrapezium[shape="invtrapezium"];
|
26
|
-
invhouse[shape="invhouse"];
|
27
|
-
Mdiamond[shape="Mdiamond"];
|
28
|
-
Msquare[shape="Msquare"];
|
29
|
-
Mcircle[shape="Mcircle"];
|
30
|
-
rect[shape="rect"];
|
31
|
-
rectangle[shape="rectangle"];
|
32
|
-
square[shape="square"];
|
33
|
-
none[shape="none"];
|
34
|
-
note[shape="note"];
|
35
|
-
tab[shape="tab"];
|
36
|
-
folder[shape="folder"];
|
37
|
-
box3d[shape="box3d"];
|
38
|
-
component[shape="component"];
|
39
|
-
promoter[shape="promoter"];
|
40
|
-
cds[shape="cds"];
|
41
|
-
terminator[shape="terminator"];
|
42
|
-
utr[shape="utr"];
|
43
|
-
primersite[shape="primersite"];
|
44
|
-
restrictionsite[shape="restrictionsite"];
|
45
|
-
fivepoverhang[shape="fivepoverhang"];
|
46
|
-
threepoverhang[shape="threepoverhang"];
|
47
|
-
noverhang[shape="noverhang"];
|
48
|
-
assembly[shape="assembly"];
|
49
|
-
signature[shape="signature"];
|
50
|
-
insulator[shape="insulator"];
|
51
|
-
ribosite[shape="ribosite"];
|
52
|
-
rnastab[shape="rnastab"];
|
53
|
-
proteasesite[shape="proteasesite"];
|
54
|
-
proteinstab[shape="proteinstab"];
|
55
|
-
rpromoter[shape="rpromoter"];
|
56
|
-
rarrow[shape="rarrow"];
|
57
|
-
larrow[shape="larrow"];
|
58
|
-
lpromoter[shape="lpromoter"];
|
59
|
-
box -> polygon;
|
60
|
-
polygon -> ellipse;
|
61
|
-
ellipse -> oval;
|
62
|
-
oval -> circle;
|
63
|
-
circle -> point[headlabel="point"];
|
64
|
-
point -> egg;
|
65
|
-
egg -> triangle;
|
66
|
-
triangle -> plaintext;
|
67
|
-
plaintext -> diamond;
|
68
|
-
trapezium -> parallelogram;
|
69
|
-
parallelogram -> house;
|
70
|
-
house -> pentagon;
|
71
|
-
pentagon -> hexagon;
|
72
|
-
hexagon -> septagon;
|
73
|
-
septagon -> octagon;
|
74
|
-
octagon -> doublecircle;
|
75
|
-
doublecircle -> doubleoctagon;
|
76
|
-
doubleoctagon -> tripleoctagon;
|
77
|
-
invtriangle -> invtrapezium;
|
78
|
-
invtrapezium -> invhouse;
|
79
|
-
invhouse -> Mdiamond;
|
80
|
-
Mdiamond -> Msquare;
|
81
|
-
Msquare -> Mcircle;
|
82
|
-
Mcircle -> rect;
|
83
|
-
rect -> rectangle;
|
84
|
-
rectangle -> square;
|
85
|
-
square -> none;
|
86
|
-
note -> tab;
|
87
|
-
tab -> folder;
|
88
|
-
folder -> box3d;
|
89
|
-
box3d -> component;
|
90
|
-
component -> promoter;
|
91
|
-
promoter -> cds;
|
92
|
-
cds -> terminator;
|
93
|
-
terminator -> utr;
|
94
|
-
utr -> primersite;
|
95
|
-
restrictionsite -> fivepoverhang;
|
96
|
-
fivepoverhang -> threepoverhang;
|
97
|
-
threepoverhang -> noverhang;
|
98
|
-
noverhang -> assembly;
|
99
|
-
assembly -> signature;
|
100
|
-
signature -> insulator;
|
101
|
-
insulator -> ribosite;
|
102
|
-
ribosite -> rnastab;
|
103
|
-
rnastab -> proteasesite;
|
104
|
-
proteinstab -> rpromoter;
|
105
|
-
rpromoter -> rarrow;
|
106
|
-
rarrow -> larrow;
|
107
|
-
larrow -> lpromoter;
|
108
|
-
}
|