rubydown 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +35 -0
  3. data/.gitignore +3 -0
  4. data/Dockerfile +9 -0
  5. data/Gemfile +8 -0
  6. data/Gemfile.lock +43 -0
  7. data/LICENSE +21 -0
  8. data/README.md +32 -0
  9. data/Rakefile +2 -0
  10. data/_config.yml +1 -0
  11. data/appveyor.yml +25 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +8 -0
  14. data/docs/_config.yml +1 -0
  15. data/docs/index.html +20 -0
  16. data/docs/sidebyside.md +1 -0
  17. data/examples/bio.html +129 -0
  18. data/examples/bio.md +73 -0
  19. data/examples/graph.html +160 -0
  20. data/examples/graph.md +11 -0
  21. data/examples/index.html +217 -0
  22. data/examples/index.md +58 -0
  23. data/examples/numo-gnuplot.ipynb +1515 -0
  24. data/examples/rbplotly-bar.html +146 -0
  25. data/examples/rbplotly-bar.md +54 -0
  26. data/examples/rbplotly-basic.html +134 -0
  27. data/examples/rbplotly-basic.md +43 -0
  28. data/examples/rbplotly-boxplot.html +136 -0
  29. data/examples/rbplotly-boxplot.md +60 -0
  30. data/examples/rbplotly-heatmap.html +95 -0
  31. data/examples/rbplotly-heatmap.md +35 -0
  32. data/examples/rbplotly-hist.html +52 -0
  33. data/examples/rbplotly-hist.md +9 -0
  34. data/examples/rbplotly-line.html +62 -0
  35. data/examples/rbplotly-line.md +19 -0
  36. data/examples/rbplotly-pie.html +100 -0
  37. data/examples/rbplotly-pie.md +40 -0
  38. data/examples/rbplotly-scatter.html +148 -0
  39. data/examples/rbplotly-scatter.md +71 -0
  40. data/examples/rumale-kmeans.html +75 -0
  41. data/examples/rumale-kmeans.md +33 -0
  42. data/examples/rumale.html +967 -0
  43. data/examples/rumale.md +31 -0
  44. data/examples/table.html +57 -0
  45. data/examples/table.md +7 -0
  46. data/exe/rubydown +114 -0
  47. data/lib/rubydown.rb +59 -0
  48. data/lib/rubydown/version.rb +3 -0
  49. data/rubydown.gemspec +47 -0
  50. data/templates/template.html.erb +26 -0
  51. metadata +207 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 90da523f65d454d4aeb48b78fbfa2e2b35378c565a2823aae1a2e0dc07d1cf3d
4
+ data.tar.gz: 920bb095fd9c9855bd1dbb15c2a6a86d0d2e54e5d73b7d2d71644ec60709f5a2
5
+ SHA512:
6
+ metadata.gz: 62cde3191b98f6dc8500a76722979bf022a88e83d156391f4362d33406bf80158f52da205e05ba4ec5b95efde689296766ae179a21e0a886b7dcc8784d698481
7
+ data.tar.gz: 58b1243ed10666233d24683e0322b3a3b1482452c6bfb1650204df798919bf105a91ac32404261328402183f72d821b2ac8d703dca3e51f2d64cef02a4a8a301
@@ -0,0 +1,35 @@
1
+ # Ruby CircleCI 2.0 configuration file
2
+ #
3
+ # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
+ #
5
+ version: 2
6
+ jobs:
7
+ build:
8
+ docker:
9
+ - image: ruby
10
+
11
+ working_directory: ~/repo
12
+
13
+ steps:
14
+ - checkout
15
+
16
+ - run:
17
+ name: install rubydown
18
+ command: |
19
+ apt-get update
20
+ apt-get install -y gnuplot
21
+ gem build rubydown.gemspec
22
+ gem install rubydown-0.1.0.gem
23
+ gem install bio
24
+
25
+ # run tests!
26
+ - run:
27
+ name: run tests
28
+ command: |
29
+ rubydown -i examples/bio.md -e templates/template.html.erb -o /tmp/bio.html
30
+ rubydown -i examples/table.md -e templates/template.html.erb -o /tmp/table.html
31
+ rubydown -i examples/graph.md -e templates/template.html.erb -o /tmp/graph.html
32
+
33
+ # collect reports
34
+ - store_artifacts:
35
+ path: /tmp
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ vendor/
2
+ pkg/
3
+ .bundle/
data/Dockerfile ADDED
@@ -0,0 +1,9 @@
1
+ FROM ruby
2
+
3
+ USER root
4
+
5
+ RUN apt-get update && apt-get install -y emacs25-nox vim-nox mlocate locales-all tmux gnuplot && gem install numo-gnuplot\
6
+ git config --global alias.co checkout && \
7
+ git config --global alias.br branch && \
8
+ git config --global alias.ci commit && \
9
+ git config --global alias.st status
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in rubydown.gemspec
6
+ gemspec
7
+
8
+ gem "test-unit", "~> 3.2"
data/Gemfile.lock ADDED
@@ -0,0 +1,43 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rubydown (0.1.0)
5
+ daru
6
+ kramdown
7
+ numo-gnuplot
8
+ numo-narray
9
+ pry
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ backports (3.11.4)
15
+ coderay (1.1.2)
16
+ daru (0.2.1)
17
+ backports
18
+ packable (~> 1.3.9)
19
+ kramdown (1.17.0)
20
+ method_source (0.9.2)
21
+ numo-gnuplot (0.2.4)
22
+ numo-narray (0.9.1.3)
23
+ packable (1.3.10)
24
+ backports
25
+ power_assert (1.1.3)
26
+ pry (0.12.2)
27
+ coderay (~> 1.1.0)
28
+ method_source (~> 0.9.0)
29
+ rake (10.5.0)
30
+ test-unit (3.2.9)
31
+ power_assert
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ bundler (~> 1.17)
38
+ rake (~> 10.0)
39
+ rubydown!
40
+ test-unit
41
+
42
+ BUNDLED WITH
43
+ 1.17.3
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Yusuke Sangenya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # rubydown
2
+
3
+ [![CircleCI](https://circleci.com/gh/sciruby-jp/rubydown/tree/master.svg?style=svg)](https://circleci.com/gh/sciruby-jp/rubydown/tree/master)
4
+ [![Build status](https://ci.appveyor.com/api/projects/status/rroa24x9jgdwuka5?svg=true)](https://ci.appveyor.com/project/kozo2/rubydown)
5
+
6
+ *rubydown* is pure-Ruby [R Markdown](https://rmarkdown.rstudio.com/) clone.
7
+ It takes a markdown source file, executes the code chunks, captures the output, and stitches the output into the destination file.
8
+
9
+ Python also has R Markdown like packages.
10
+ If you have interest about making reproducible reports, please also refer to the following projects.
11
+
12
+ https://github.com/jankatins/knitpy
13
+
14
+ https://github.com/pystitch/stitch
15
+
16
+
17
+ ## Install
18
+
19
+ ```
20
+ apt install gnuplot # When you use numo-gnuplot in your workflow markdown
21
+ gem install specific_install
22
+ gem specific_install https://github.com/sciruby-jp/rubydown
23
+ ```
24
+
25
+ ## Usage (example with [rumale](https://github.com/yoshoku/rumale) and [rdatasets](https://github.com/kojix2/rdatasets))
26
+
27
+ ```
28
+ gem install rumale rdatasets
29
+ git clone git://github.com/sciruby-jp/rubydown
30
+ cd rubydown/examples
31
+ rubydown -i rumale.md -o rumale.html
32
+ ```
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/_config.yml ADDED
@@ -0,0 +1 @@
1
+ theme: jekyll-theme-cayman
data/appveyor.yml ADDED
@@ -0,0 +1,25 @@
1
+ # appveyor.yml
2
+ install:
3
+ - set PATH=C:\Ruby25-x64\bin;%PATH%
4
+ - gem build rubydown.gemspec
5
+ - gem install rubydown-0.1.0.gem
6
+
7
+ build: off
8
+
9
+ before_test:
10
+ - ruby -v
11
+ - gem -v
12
+ - bundle -v
13
+ - rubydown --version
14
+ - gem install bio
15
+
16
+ test_script:
17
+ - choco install gnuplot
18
+ - set PATH=C:\Program Files\gnuplot\bin;%PATH%
19
+ - gnuplot --version
20
+ - rubydown -i examples\bio.md -e templates\template.html.erb -o bio.html
21
+ - rubydown -i examples\graph.md -e templates\template.html.erb -o graph.html
22
+ - rubydown -i examples\table.md -e templates\template.html.erb -o table.html
23
+
24
+ artifacts:
25
+ - path: '*.html'
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rubydown"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/docs/_config.yml ADDED
@@ -0,0 +1 @@
1
+ theme: jekyll-theme-cayman
data/docs/index.html ADDED
@@ -0,0 +1,20 @@
1
+ <div style="display: flex;">
2
+ <div>
3
+
4
+ <b>Some Links:</b><br>
5
+ <a href="#">Link 1</a> |
6
+ <a href="#">Link 2</a> |
7
+ <iframe src="https://raw.githubusercontent.com/sciruby-jp/rubydown/master/examples/graph.html"></iframe>
8
+ <br><br>
9
+
10
+ </div>
11
+ <div>
12
+
13
+ <b>Some Links:</b><br>
14
+ <a href="#">Link 1</a> |
15
+ <a href="#">Link 2</a> |
16
+ <iframe src="https://raw.githubusercontent.com/sciruby-jp/rubydown/master/examples/graph.html"></iframe>
17
+ <br><br>
18
+
19
+ </div>
20
+ </div>
@@ -0,0 +1 @@
1
+
data/examples/bio.html ADDED
@@ -0,0 +1,129 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <link href='https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.10.0/github-markdown.min.css' rel='stylesheet' type='text/css' />
6
+ <style>
7
+ article.markdown-body {
8
+ box-sizing: border-box;
9
+ min-width: 200px;
10
+ max-width: 980px;
11
+ margin: 0 auto;
12
+ padding: 45px;
13
+ }
14
+
15
+ span.line-numbers {
16
+ display: none;
17
+ }
18
+ </style>
19
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script>
20
+ </head>
21
+ <body>
22
+ <article class='markdown-body'>
23
+ <h1 id="bioruby-tutorial">BioRuby Tutorial</h1>
24
+
25
+ <h2 id="trying-bioruby">Trying Bioruby</h2>
26
+
27
+ <p>Now test the following:</p>
28
+
29
+ <pre><code class="language-ruby">require 'bio'
30
+ seq = Bio::Sequence::NA.new("atgcatgcaaaa")
31
+ </code></pre>
32
+ <p> <pre><code>=&gt; atgcatgcaaaa
33
+ </code></pre>
34
+ </p>
35
+
36
+ <pre><code class="language-ruby">seq.complement
37
+ </code></pre>
38
+ <p> <pre><code>=&gt; ttttgcatgcat
39
+ </code></pre>
40
+ </p>
41
+
42
+ <h2 id="working-with-nucleic--amino-acid-sequences-biosequence-class">Working with nucleic / amino acid sequences (Bio::Sequence class)</h2>
43
+
44
+ <p>The <code>Bio::Sequence</code> class allows the usual sequence transformations and translations.</p>
45
+
46
+ <p>In the example below the DNA sequence <code>atgcatgcaaaa</code> is converted into the complemental strand and spliced into a subsequence; next, the nucleic acid composition is calculated and the sequence is translated into the amino acid sequence, the molecular weight calculated, and so on. When translating into amino acid sequences, the frame can be specified and optionally the codon table selected (as defined in <a href="https://github.com/bioruby/bioruby/blob/master/lib/bio/data/codontable.rb">codontable.rb</a>).</p>
47
+
48
+ <pre><code class="language-ruby">seq = Bio::Sequence::NA.new("atgcatgcaaaa")
49
+ </code></pre>
50
+ <p> <pre><code>=&gt; atgcatgcaaaa
51
+ </code></pre>
52
+ </p>
53
+
54
+ <pre><code class="language-ruby"># complemental sequence (Bio::Sequence::NA object)
55
+ seq.complement
56
+ </code></pre>
57
+ <p> <pre><code>=&gt; ttttgcatgcat
58
+ </code></pre>
59
+ </p>
60
+
61
+ <pre><code class="language-ruby">seq.subseq(3,8) # gets subsequence of positions 3 to 8 (starting from 1)
62
+ </code></pre>
63
+ <p> <pre><code>=&gt; gcatgc
64
+ </code></pre>
65
+ </p>
66
+
67
+ <pre><code class="language-ruby">seq.gc_percent
68
+ </code></pre>
69
+ <p> <pre><code>=&gt; 33
70
+ </code></pre>
71
+ </p>
72
+
73
+ <pre><code class="language-ruby">seq.composition
74
+ </code></pre>
75
+ <p> <pre><code>=&gt; {"a"=&gt;6, "t"=&gt;2, "g"=&gt;2, "c"=&gt;2}
76
+ </code></pre>
77
+ </p>
78
+
79
+ <pre><code class="language-ruby">seq.translate
80
+ </code></pre>
81
+ <p> <pre><code>=&gt; MHAK
82
+ </code></pre>
83
+ </p>
84
+
85
+ <pre><code class="language-ruby">seq.translate(2)
86
+ </code></pre>
87
+ <p> <pre><code>=&gt; CMQ
88
+ </code></pre>
89
+ </p>
90
+
91
+ <pre><code class="language-ruby">seq.translate(1,11)
92
+ </code></pre>
93
+ <p> <pre><code>=&gt; MHAK
94
+ </code></pre>
95
+ </p>
96
+
97
+ <pre><code class="language-ruby">seq.translate.codes
98
+ </code></pre>
99
+ <p> <pre><code>=&gt; ["Met", "His", "Ala", "Lys"]
100
+ </code></pre>
101
+ </p>
102
+
103
+ <pre><code class="language-ruby">seq.translate.names
104
+ </code></pre>
105
+ <p> <pre><code>=&gt; ["methionine", "histidine", "alanine", "lysine"]
106
+ </code></pre>
107
+ </p>
108
+
109
+ <pre><code class="language-ruby">seq.translate.composition
110
+ </code></pre>
111
+ <p> <pre><code>=&gt; {"M"=&gt;1, "H"=&gt;1, "A"=&gt;1, "K"=&gt;1}
112
+ </code></pre>
113
+ </p>
114
+
115
+ <pre><code class="language-ruby">seq.translate.molecular_weight
116
+ </code></pre>
117
+ <p> <pre><code>=&gt; 485.6050000000001
118
+ </code></pre>
119
+ </p>
120
+
121
+ <pre><code class="language-ruby">seq.complement.translate
122
+ </code></pre>
123
+ <p> <pre><code>=&gt; FCMH
124
+ </code></pre>
125
+ </p>
126
+
127
+ </article>
128
+ </body>
129
+ </html>
data/examples/bio.md ADDED
@@ -0,0 +1,73 @@
1
+ # BioRuby Tutorial
2
+
3
+ ## Trying Bioruby
4
+
5
+ Now test the following:
6
+
7
+ ~~~ruby
8
+ require 'bio'
9
+ seq = Bio::Sequence::NA.new("atgcatgcaaaa")
10
+ ~~~
11
+
12
+ ~~~ruby
13
+ seq.complement
14
+ ~~~
15
+
16
+ ## Working with nucleic / amino acid sequences (Bio::Sequence class)
17
+
18
+ The `Bio::Sequence` class allows the usual sequence transformations and translations.
19
+
20
+ In the example below the DNA sequence `atgcatgcaaaa` is converted into the complemental strand and spliced into a subsequence; next, the nucleic acid composition is calculated and the sequence is translated into the amino acid sequence, the molecular weight calculated, and so on. When translating into amino acid sequences, the frame can be specified and optionally the codon table selected (as defined in [codontable.rb](https://github.com/bioruby/bioruby/blob/master/lib/bio/data/codontable.rb)).
21
+
22
+ ~~~ruby
23
+ seq = Bio::Sequence::NA.new("atgcatgcaaaa")
24
+ ~~~
25
+
26
+ ~~~ruby
27
+ # complemental sequence (Bio::Sequence::NA object)
28
+ seq.complement
29
+ ~~~
30
+
31
+ ~~~ruby
32
+ seq.subseq(3,8) # gets subsequence of positions 3 to 8 (starting from 1)
33
+ ~~~
34
+
35
+ ~~~ruby
36
+ seq.gc_percent
37
+ ~~~
38
+
39
+ ~~~ruby
40
+ seq.composition
41
+ ~~~
42
+
43
+ ~~~ruby
44
+ seq.translate
45
+ ~~~
46
+
47
+ ~~~ruby
48
+ seq.translate(2)
49
+ ~~~
50
+
51
+ ~~~ruby
52
+ seq.translate(1,11)
53
+ ~~~
54
+
55
+ ~~~ruby
56
+ seq.translate.codes
57
+ ~~~
58
+
59
+ ~~~ruby
60
+ seq.translate.names
61
+ ~~~
62
+
63
+ ~~~ruby
64
+ seq.translate.composition
65
+ ~~~
66
+
67
+ ~~~ruby
68
+ seq.translate.molecular_weight
69
+ ~~~
70
+
71
+ ~~~ruby
72
+ seq.complement.translate
73
+ ~~~