bio 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4962e411aae8be8955dbf62675371e1828caad0e9c465e5935c4198bffd96639
4
- data.tar.gz: 9aa98b72bdb24f80bf2b209f3ddd2abc47aced3b54764c44b27a0dc65eef00ce
3
+ metadata.gz: ee0226eebc0265a4cab075c2aaba3de55d82eff2767d1e00f6889d385c0037bd
4
+ data.tar.gz: ea4940449ac518b918ad0ddefa512b1ba51cb5ff22d9cbfff2ad1c2eca7433ab
5
5
  SHA512:
6
- metadata.gz: 6b93a323e2c9c605987b98602a174b80023de62e2b27d5449866fc9101cfc574e5538f8e13c54cc9cf6f8fdcab10c6714373e1d02d0475f0378525c907c8e558
7
- data.tar.gz: d07903f10960791dc7b73d4b4eca54e83d0b45911604547a7e39e35b4238b1710daf4ffc79cd4f69f76fba35a6fc40c7c73b3fc0bca2e3b44b574e40bc16f30a
6
+ metadata.gz: be1ed472712c090d5de731e801b644356d3d155a7dd3db1c75cb91c2a9580ecdf50b4f58dd972810900dd9cbb1c907c000fdb968e2b18585901396fef3d01dcb
7
+ data.tar.gz: 53fd895fb65c582f1e2ed9abd21e3c8598056db4f408bbf84b527561cafe17976ece11a9b6a29d3fc89d3eb790a0de1611aa4d08a3d4856ff7344efdd718cde6
data/ChangeLog CHANGED
@@ -1,3 +1,188 @@
1
+ commit 21bf51a1ec8c18c9cdf8528ffc3c59c503cef042
2
+ Author: Naohisa Goto <ng@bioruby.org>
3
+ Date: Fri Sep 6 15:45:47 2019 +0900
4
+
5
+ RELEASE_NOTES.rdoc: describe notable changes since 2.0.0
6
+
7
+ RELEASE_NOTES.rdoc | 40 ++++++++++++++++++++++++++++++++++++++++
8
+ 1 file changed, 40 insertions(+)
9
+
10
+ commit 9092a629e0e28b416ee7288d349fb9d73dd2b961
11
+ Author: Naohisa Goto <ng@bioruby.org>
12
+ Date: Fri Sep 6 15:06:11 2019 +0900
13
+
14
+ regenerate bioruby.gemspec with rake regemspec
15
+
16
+ bioruby.gemspec | 11 ++++++++++-
17
+ 1 file changed, 10 insertions(+), 1 deletion(-)
18
+
19
+ commit 59e24b6e55d2c9a8887e8e01a91999d33a008042
20
+ Author: Naohisa Goto <ng@bioruby.org>
21
+ Date: Fri Sep 6 15:04:33 2019 +0900
22
+
23
+ prepare for BioRuby 2.0.1 release
24
+
25
+ lib/bio/version.rb | 2 +-
26
+ 1 file changed, 1 insertion(+), 1 deletion(-)
27
+
28
+ commit 9635a38a158db434fd2b6aff7a2ee75622ddecef
29
+ Author: Naohisa Goto <ng@bioruby.org>
30
+ Date: Fri Sep 6 14:51:23 2019 +0900
31
+
32
+ sample/fastq2html.rb: A html visualization of FASTQ sequences
33
+
34
+ * sample/fastq2html: A html visualization of FASTQ sequences.
35
+ Each sequence is colored with the quality score.
36
+ * sample/fastq2html.cwl: CWL workflow for the above sample script
37
+ * sample/fastq2html.testdata.yaml: Test data for the above workflow
38
+
39
+ sample/fastq2html.cwl | 23 ++++++++++
40
+ sample/fastq2html.rb | 94 +++++++++++++++++++++++++++++++++++++++++
41
+ sample/fastq2html.testdata.yaml | 5 +++
42
+ 3 files changed, 122 insertions(+)
43
+ create mode 100644 sample/fastq2html.cwl
44
+ create mode 100644 sample/fastq2html.rb
45
+ create mode 100644 sample/fastq2html.testdata.yaml
46
+
47
+ commit 6bbcf8b66310c225d686f2c59359680a0bc0b4b6
48
+ Author: Naohisa Goto <ng@bioruby.org>
49
+ Date: Fri Sep 6 14:42:19 2019 +0900
50
+
51
+ sample/rev_comp.rb: Generates reverse-complement sequences
52
+
53
+ * sample/rev_comp.rb: Generates reverse-complement sequences of
54
+ the given nucleotide sequences.
55
+ * sample/rev_comp.cwl: CWL cowkflow for the sample script
56
+ * sample/rev_comp.testdata.yaml: Test data for the above CWL workflow
57
+
58
+ sample/rev_comp.cwl | 23 +++++++++++++++++++++++
59
+ sample/rev_comp.rb | 20 ++++++++++++++++++++
60
+ sample/rev_comp.testdata.yaml | 7 +++++++
61
+ 3 files changed, 50 insertions(+)
62
+ create mode 100644 sample/rev_comp.cwl
63
+ create mode 100644 sample/rev_comp.rb
64
+ create mode 100644 sample/rev_comp.testdata.yaml
65
+
66
+ commit ff0e6c3c6b6f1b56d81b5a4b579a6d0984bfc607
67
+ Author: Naohisa Goto <ng@bioruby.org>
68
+ Date: Fri Sep 6 14:40:45 2019 +0900
69
+
70
+ sample/color_scheme_(na|aa).rb: use String#each_char instead of each_byte
71
+
72
+ sample/color_scheme_aa.rb | 6 +++---
73
+ sample/color_scheme_na.rb | 6 +++---
74
+ 2 files changed, 6 insertions(+), 6 deletions(-)
75
+
76
+ commit 6f7c1be09aa3d6cdb76fd029fc0f84efda31c907
77
+ Author: Naohisa Goto <ng@bioruby.org>
78
+ Date: Thu Sep 5 17:32:07 2019 +0900
79
+
80
+ sample/color_scheme_aa.rb: new sample based on color_scheme_na.rb
81
+
82
+ sample/color_scheme_aa.rb | 82 +++++++++++++++++++++++++++++++++++++++++++++++
83
+ 1 file changed, 82 insertions(+)
84
+ create mode 100644 sample/color_scheme_aa.rb
85
+
86
+ commit 51864c3857178f58133b759f7608b8d6d8991c44
87
+ Author: Naohisa Goto <ng@bioruby.org>
88
+ Date: Thu Sep 5 17:13:20 2019 +0900
89
+
90
+ sample/color_scheme_na.rb: use const_get instead of eval
91
+
92
+ sample/color_scheme_na.rb | 2 +-
93
+ 1 file changed, 1 insertion(+), 1 deletion(-)
94
+
95
+ commit ba0b554971a9a387a54fc04c5002853d91357347
96
+ Author: Naohisa Goto <ng@bioruby.org>
97
+ Date: Thu Sep 5 17:02:20 2019 +0900
98
+
99
+ sample/na2aa.cwl: inputBinding position -1 for the script
100
+
101
+ * sample/na2aa.cwl: inputBinding position -1 is used for the script
102
+ to emphasize that the argument is the first one.
103
+
104
+ sample/na2aa.cwl | 2 +-
105
+ 1 file changed, 1 insertion(+), 1 deletion(-)
106
+
107
+ commit 26a27ec261e2251f3ff3a85007147d33682778d0
108
+ Author: Naohisa Goto <ng@bioruby.org>
109
+ Date: Thu Sep 5 16:56:08 2019 +0900
110
+
111
+ sample/color_scheme_na.rb: Supports more file formats
112
+
113
+ * sample/color_scheme_na.rb: Supports more file formats other than
114
+ fasta format, by using Bio::Flatfile.
115
+
116
+ sample/color_scheme_na.rb | 3 +--
117
+ 1 file changed, 1 insertion(+), 2 deletions(-)
118
+
119
+ commit 5c053a606382bb578a2b6884ee639805154433e5
120
+ Author: Naohisa Goto <ng@bioruby.org>
121
+ Date: Thu Sep 5 12:32:00 2019 +0900
122
+
123
+ sample/na2aa.cwl: use inputBinding
124
+
125
+ sample/na2aa.cwl | 5 ++++-
126
+ 1 file changed, 4 insertions(+), 1 deletion(-)
127
+
128
+ commit 6a3c3e02f08549d47dda00dca92d55bbadfc468f
129
+ Author: Naohisa Goto <ng@bioruby.org>
130
+ Date: Wed Sep 4 22:59:21 2019 +0900
131
+
132
+ Sample CWL workflow to run sample/na2aa.rb
133
+
134
+ * na2aa.cwl: A sample CWL workflow to run na2aa.rb in sample/ dir
135
+ * na2aa.testdata.yaml: Test data for the workflow
136
+
137
+ sample/na2aa.cwl | 20 ++++++++++++++++++++
138
+ sample/na2aa.testdata.yaml | 7 +++++++
139
+ 2 files changed, 27 insertions(+)
140
+ create mode 100644 sample/na2aa.cwl
141
+ create mode 100644 sample/na2aa.testdata.yaml
142
+
143
+ commit 960b885036f549863e3cfe9c693c90f9bef27d3d
144
+ Author: Naohisa Goto <ng@bioruby.org>
145
+ Date: Wed Sep 4 21:00:50 2019 +0900
146
+
147
+ LEGAL: na2aa.rb is now Ruby's License
148
+
149
+ LEGAL | 1 -
150
+ 1 file changed, 1 deletion(-)
151
+
152
+ commit 7af9e81988939007eb36dab6b102a7422e8196d8
153
+ Author: Naohisa Goto <ng@bioruby.org>
154
+ Date: Wed Sep 4 14:34:05 2019 +0900
155
+
156
+ sample/na2aa.rb: Completely rewritten
157
+
158
+ * sample/na2aa.rb: Completely rewritten. License is changed because
159
+ old code is completely wiped out. Note that the old code always
160
+ raises error due to a bug in the code.
161
+ * The old code was trying to replace 'X' (any) to '-' (gap) but
162
+ the new code does not modify translated sequences anymore.
163
+
164
+ sample/na2aa.rb | 36 +++++++++++-------------------------
165
+ 1 file changed, 11 insertions(+), 25 deletions(-)
166
+
167
+ commit cf8cac5e32db42b6683c1a837adc9e1c04994062
168
+ Author: Naohisa Goto <ng@bioruby.org>
169
+ Date: Mon Sep 2 17:11:08 2019 +0900
170
+
171
+ Bug fix: Bio::GFF::GFF2::Record.parse did not return correct object
172
+
173
+ lib/bio/db/gff.rb | 4 +++-
174
+ test/unit/bio/db/test_gff.rb | 5 +++++
175
+ 2 files changed, 8 insertions(+), 1 deletion(-)
176
+
177
+ commit 80b387e7e2bb8570d9204e389b6c5d90c6ea31de
178
+ Author: Naohisa Goto <ng@bioruby.org>
179
+ Date: Fri Jun 14 14:33:19 2019 +0900
180
+
181
+ BioRuby 2.0.0 is released
182
+
183
+ ChangeLog | 1051 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
184
+ 1 file changed, 1043 insertions(+), 8 deletions(-)
185
+
1
186
  commit 2e4046517fd8ee1c105ef53131e69f787d790099
2
187
  Author: Naohisa Goto <ng@bioruby.org>
3
188
  Date: Fri Jun 14 14:23:19 2019 +0900
data/LEGAL CHANGED
@@ -59,7 +59,6 @@ sample/vs-genes.rb:
59
59
 
60
60
  sample/fastagrep.rb:
61
61
  sample/fastasort.rb:
62
- sample/na2aa.rb:
63
62
 
64
63
  Copyright (C) 2008 KATAYAMA Toshiaki <k@bioruby.org> & Pjotr Prins
65
64
 
@@ -1,3 +1,43 @@
1
+ = BioRuby 2.0.1 RELEASE NOTES
2
+
3
+ Some bug fixes and improvements have been made to the BioRuby 2.0.1 after
4
+ the version 2.0.0 is released.
5
+
6
+ == Bug fixes
7
+
8
+ * Bio::GFF::GFF2::Record.parse did not return correct object.
9
+
10
+ == Improvement of sample scripts
11
+
12
+ The following scripts in the sample/ directiry are newly added.
13
+
14
+ * color_scheme_aa.rb: Example of Bio::ColorScheme for an amino acid sequence.
15
+ * fastq2html.rb: Visualization of FASTQ sequences, colored by quality scores.
16
+ * rev_comp.rb: Shows reverse-complement sequences of the given sequences.
17
+
18
+ The floowing scripts are modified to fix bug and/or to improve features.
19
+
20
+ * na2aa.rb: Completely rewritten to fix bug. Shows translated sequences.
21
+ * color_scheme_na.rb: Added support for various sequence formats.
22
+
23
+ === CWL (Common Workflow Language) workflow files are added
24
+
25
+ CWL (Common Workflow Language) workflow files are added for some sample
26
+ scripts. The usage of each sample script will be clarified with the CWL
27
+ workflow files.
28
+
29
+ Two type of files are prepared for CWL workflow engine. *.cwl is a workflow
30
+ definition file for each sample script. *.testdata.yaml describes sample
31
+ input data for each CWL workflow.
32
+
33
+ In this version, cwl files for the 3 sample scripts are added.
34
+
35
+ * fastq2html.rb: fastq2html.cwl with fastq2html.testdata.yaml
36
+ * na2aa.rb: na2aa.cwl with na2aa.testdata.yaml
37
+ * rev_comp.rb: rev_comp.cwl with rev_comp.testdata.yaml
38
+
39
+
40
+
1
41
  = BioRuby 2.0.0 RELEASE NOTES
2
42
 
3
43
  A lot of changes have been made to the BioRuby 2.0.0 after the version 1.5.x
@@ -3,7 +3,7 @@
3
3
  #
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'bio'
6
- s.version = "2.0.0"
6
+ s.version = "2.0.1"
7
7
 
8
8
  s.author = "BioRuby project"
9
9
  s.email = "staff@bioruby.org"
@@ -258,6 +258,7 @@ Gem::Specification.new do |s|
258
258
  "sample/any2fasta.rb",
259
259
  "sample/benchmark_clustalw_report.rb",
260
260
  "sample/biofetch.rb",
261
+ "sample/color_scheme_aa.rb",
261
262
  "sample/color_scheme_na.rb",
262
263
  "sample/demo_aaindex.rb",
263
264
  "sample/demo_aminoacid.rb",
@@ -296,6 +297,9 @@ Gem::Specification.new do |s|
296
297
  "sample/fasta2tab.rb",
297
298
  "sample/fastagrep.rb",
298
299
  "sample/fastasort.rb",
300
+ "sample/fastq2html.cwl",
301
+ "sample/fastq2html.rb",
302
+ "sample/fastq2html.testdata.yaml",
299
303
  "sample/fsplit.rb",
300
304
  "sample/gb2fasta.rb",
301
305
  "sample/gb2tab.rb",
@@ -307,9 +311,14 @@ Gem::Specification.new do |s|
307
311
  "sample/genome2tab.rb",
308
312
  "sample/goslim.rb",
309
313
  "sample/gt2fasta.rb",
314
+ "sample/na2aa.cwl",
310
315
  "sample/na2aa.rb",
316
+ "sample/na2aa.testdata.yaml",
311
317
  "sample/pmfetch.rb",
312
318
  "sample/pmsearch.rb",
319
+ "sample/rev_comp.cwl",
320
+ "sample/rev_comp.rb",
321
+ "sample/rev_comp.testdata.yaml",
313
322
  "sample/seqdatabase.ini",
314
323
  "sample/ssearch2tab.rb",
315
324
  "sample/tdiary.rb",
@@ -359,7 +359,9 @@ module Bio
359
359
  # Parses a GFF2-formatted line and returns a new
360
360
  # Bio::GFF::GFF2::Record object.
361
361
  def self.parse(str)
362
- self.new.parse(str)
362
+ ret = self.new
363
+ ret.parse(str)
364
+ ret
363
365
  end
364
366
 
365
367
  # Creates a Bio::GFF::GFF2::Record object.
@@ -10,7 +10,7 @@
10
10
  module Bio
11
11
 
12
12
  # BioRuby version (Array containing Integer)
13
- BIORUBY_VERSION = [2, 0, 0].extend(Comparable).freeze
13
+ BIORUBY_VERSION = [2, 0, 1].extend(Comparable).freeze
14
14
 
15
15
  # Extra version specifier (String or nil).
16
16
  # Existance of the value indicates development version.
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # color_scheme_aa.rb - A Bio::ColorScheme demo script for Amino Acid sequences.
4
+ #
5
+ # Usage:
6
+ #
7
+ # % ruby color_scheme_aa.rb > cs-seq-faa.html
8
+ #
9
+ # % cat seq.faa
10
+ # >AA_sequence
11
+ # MKRISTTITTTITITTGNGAG
12
+ # % ruby color_scheme_aa.rb seq.faa > colored-seq-faa.html
13
+ #
14
+ #
15
+ # Copyright:: Copyright (C) 2005
16
+ # Mitsuteru C. Nakao <n@bioruby.org>
17
+ # License:: The Ruby License
18
+ #
19
+
20
+ require 'bio'
21
+
22
+
23
+ # returns folded sequence with <br>.
24
+ def br(i, width = 80)
25
+ return "<br\n>" if i % width == 0
26
+ ""
27
+ end
28
+
29
+
30
+ # returns sequence html doc
31
+ def display(seq, cs)
32
+ html = '<p style="font-family: monospace">'
33
+ postfix = '</span>'
34
+ i = 0
35
+ seq.each_char do |c|
36
+ color = cs[c]
37
+ prefix = %Q(<span style="background:\##{color};">)
38
+ html += prefix + c + postfix
39
+ html += br(i += 1)
40
+ end
41
+ html + '</p>'
42
+ end
43
+
44
+
45
+ # returns scheme wise html doc
46
+ def display_scheme(scheme, aaseq)
47
+ html = ''
48
+ cs = Bio::ColorScheme.const_get(scheme.intern)
49
+ [aaseq].each do |seq|
50
+ html += display(seq, cs)
51
+ end
52
+ return ['<div>', "<h3>#{cs}</h3>", html, '</div>']
53
+ end
54
+
55
+
56
+
57
+ if fna = ARGV.shift
58
+ aaseq = Bio::FlatFile.open(fna) { |ff| ff.next_entry.aaseq }
59
+ else
60
+ aaseq = Bio::Sequence::AA.new('ARNDCQEGHILKMFPSTWYV' * 20).randomize
61
+ end
62
+
63
+ title = 'Bio::ColorScheme for amino acid sequences'
64
+ doc = ['<html>',
65
+ '<header>', '<title>', title, '</title>', '</header>',
66
+ '<body>', '<h1>', title, '</h1>']
67
+
68
+ doc << ['<div>', '<h2>', 'Simple colors', '</h2>']
69
+
70
+ ['Zappo', 'Taylor' ].each do |scheme|
71
+ doc << display_scheme(scheme, aaseq)
72
+ end
73
+ doc << ['</div>']
74
+
75
+
76
+ doc << ['<div>', '<h2>', 'Score colors', '</h2>']
77
+ ['Buried', 'Helix', 'Hydropathy', 'Strand', 'Turn'].each do |score|
78
+ doc << display_scheme(score, aaseq)
79
+ end
80
+ doc << ['</div>']
81
+
82
+ puts doc + ['</body>','</html>']
@@ -17,7 +17,6 @@
17
17
  # Mitsuteru C. Nakao <n@bioruby.org>
18
18
  # License:: The Ruby License
19
19
  #
20
- # $Id: color_scheme_na.rb,v 1.3 2007/04/05 23:35:42 trevor Exp $
21
20
  #
22
21
 
23
22
  require 'bio'
@@ -35,10 +34,10 @@ def display(seq, cs)
35
34
  html = '<p style="font-family: monospace">'
36
35
  postfix = '</span>'
37
36
  i = 0
38
- seq.each_byte do |c|
39
- color = cs[c.chr]
37
+ seq.each_char do |c|
38
+ color = cs[c]
40
39
  prefix = %Q(<span style="background:\##{color};">)
41
- html += prefix + c.chr + postfix
40
+ html += prefix + c + postfix
42
41
  html += br(i += 1)
43
42
  end
44
43
  html + '</p>'
@@ -48,7 +47,7 @@ end
48
47
  # returns scheme wise html doc
49
48
  def display_scheme(scheme, naseq, aaseq)
50
49
  html = ''
51
- cs = eval("Bio::ColorScheme::#{scheme}")
50
+ cs = Bio::ColorScheme.const_get(scheme.intern)
52
51
  [naseq, aaseq].each do |seq|
53
52
  html += display(seq, cs)
54
53
  end
@@ -58,7 +57,7 @@ end
58
57
 
59
58
 
60
59
  if fna = ARGV.shift
61
- naseq = Bio::FastaFormat.new(File.open(fna, 'r').read).naseq
60
+ naseq = Bio::FlatFile.open(fna) { |ff| ff.next_entry.naseq }
62
61
  aaseq = naseq.translate
63
62
  else
64
63
  naseq = Bio::Sequence::NA.new('acgtu' * 20).randomize
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env cwl-runner
2
+
3
+ cwlVersion: v1.0
4
+ class: CommandLineTool
5
+ baseCommand: [ruby]
6
+
7
+ inputs:
8
+ - id: script
9
+ type: File
10
+ default:
11
+ class: File
12
+ location: fastq2html.rb
13
+ inputBinding:
14
+ position: -1
15
+ - id: fastq
16
+ type: File[]
17
+ inputBinding:
18
+ position: 1
19
+
20
+ outputs:
21
+ - id: out
22
+ type: stdout
23
+ stdout: $(inputs.script.nameroot)-$(inputs.fastq[0].nameroot).html
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # fastq2html.rb - HTML visualization of FASTQ sequences
4
+ #
5
+ # Usage:
6
+ #
7
+ # % ruby fastq2html.rb seq00.fastq > seq00.html
8
+ #
9
+ #
10
+ # Copyright:: Copyright (C) 2019 BioRuby Project
11
+ # Copyright (C) 2005 Mitsuteru C. Nakao <n@bioruby.org>
12
+ # License:: The Ruby License
13
+ #
14
+ #
15
+
16
+ require 'bio'
17
+
18
+ # thickness to color
19
+ def thickness2color(t)
20
+ c = "%02X" % ((t * 255.0).to_i)
21
+ c * 3
22
+ end
23
+
24
+ # Creates
25
+ def create_score2color_hashes
26
+ h_bg = {}
27
+ h_char = {}
28
+ cutoff_low = 0
29
+ cutoff_high = 50
30
+ range = cutoff_high - cutoff_low
31
+ sc_min = -5
32
+ sc_max = 100
33
+ (sc_min..sc_max).each do |i|
34
+ t = if i <= cutoff_low then
35
+ 0.0
36
+ elsif i >= cutoff_high then
37
+ 1.0
38
+ else
39
+ (i - cutoff_low).to_f / range
40
+ end
41
+ h_bg[i] = thickness2color(t)
42
+ h_char[i] = thickness2color((t > 0.3) ? 0.0 : 0.55)
43
+ end
44
+ h_bg.default = h_bg[cutoff_low]
45
+ h_char.default = h_char[cutoff_low]
46
+ [h_bg, h_char]
47
+ end
48
+
49
+ # Color code from quality score
50
+ SCORE2COLOR_BG, SCORE2COLOR_CHAR = create_score2color_hashes
51
+
52
+ # returns folded sequence with <br>.
53
+ def br(i, width = 80)
54
+ return "<br\n>" if i % width == 0
55
+ ""
56
+ end
57
+
58
+ # returns sequence html doc
59
+ def display(naseq, scores)
60
+ html = '<p style="font-family: monospace">'
61
+ postfix = '</span>'
62
+ i = 0
63
+ naseq.each_char.with_index do |c, i|
64
+ sc = scores[i]
65
+ bgcol = SCORE2COLOR_BG[sc]
66
+ col = SCORE2COLOR_CHAR[sc]
67
+ prefix = %Q(<span style="color:\##{col}; background:\##{bgcol};">)
68
+ html += prefix + c + postfix
69
+ html += br(i += 1)
70
+ end
71
+ html + '</p>'
72
+ end
73
+
74
+ # returns colorized html doc
75
+ def fastq2html(definition, naseq, scores)
76
+ html = display(naseq, scores)
77
+ return ['<div>', "<div>&gt;#{CGI.escapeHTML(definition)}</div>", html, '</div>']
78
+ end
79
+
80
+ title = 'Sequences with quality scores'
81
+ puts ['<html>',
82
+ '<header>', '<title>', title, '</title>', '</header>',
83
+ '<body>', '<h1>', title, '</h1>']
84
+
85
+ #main loop
86
+ ARGV.each do |filename|
87
+ Bio::FlatFile.open(filename) do |ff|
88
+ ff.each do |e|
89
+ puts fastq2html(e.definition, e.naseq, e.quality_scores)
90
+ end
91
+ end
92
+ end
93
+
94
+ puts ['</body>','</html>']
@@ -0,0 +1,5 @@
1
+ fastq:
2
+ - class: File
3
+ location: ../test/data/fastq/longreads_as_sanger.fastq
4
+ - class: File
5
+ location: ../test/data/fastq/sanger_full_range_original_sanger.fastq
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env cwl-runner
2
+
3
+ cwlVersion: v1.0
4
+ class: CommandLineTool
5
+ baseCommand: [ruby]
6
+
7
+ inputs:
8
+ - id: script
9
+ type: File
10
+ default:
11
+ class: File
12
+ location: na2aa.rb
13
+ inputBinding:
14
+ position: -1
15
+ - id: seqFile
16
+ type: File[]
17
+ inputBinding:
18
+ position: 1
19
+
20
+ outputs:
21
+ - id: out
22
+ type: stdout
23
+ stdout: $(inputs.script.nameroot)-$(inputs.seqFile[0].nameroot).fst
@@ -1,34 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # translate.rb - translate any NA input into AA FASTA format
3
+ # na2aa.rb - translate any NA input into AA FASTA format
4
4
  #
5
- # Copyright (C) 2008 KATAYAMA Toshiaki <k@bioruby.org> & Pjotr Prins
6
- #
7
- # This program is free software; you can redistribute it and/or modify
8
- # it under the terms of the GNU General Public License as published by
9
- # the Free Software Foundation; either version 2 of the License, or
10
- # (at your option) any later version.
11
- #
12
- # This program is distributed in the hope that it will be useful,
13
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- # GNU General Public License for more details.
16
- #
17
- # $Id: na2aa.rb,v 1.1 2008/02/06 16:25:53 pjotr Exp $
5
+ # Copyright:: Copyright (C) 2019 BioRuby Project
6
+ # License:: The Ruby License
18
7
  #
19
8
 
20
9
  require 'bio'
21
- require 'pp'
22
10
 
23
- include Bio
24
-
25
- ARGV.each do | fn |
26
- Bio::FlatFile.auto(fn).each do | item |
27
- seq = Sequence::NA.new(item.data)
28
- aa = seq.translate
29
- aa.gsub!(/X/,'-')
30
- rec = Bio::FastaFormat.new('> '+item.definition+"\n"+aa)
31
- print rec
11
+ ARGV.each do |fn|
12
+ Bio::FlatFile.open(fn) do |ff|
13
+ ff.each do |entry|
14
+ next if /\A\s*\z/ =~ ff.entry_raw.to_s
15
+ na = entry.naseq
16
+ aa = na.translate
17
+ print aa.to_fasta(entry.definition, 70)
18
+ end
32
19
  end
33
20
  end
34
-
@@ -0,0 +1,7 @@
1
+ seqFile:
2
+ - class: File
3
+ location: ../test/data/fasta/example1.txt
4
+ - class: File
5
+ location: ../test/data/fasta/example2.txt
6
+ - class: File
7
+ location: ../test/data/genbank/SCU49845.gb
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env cwl-runner
2
+
3
+ cwlVersion: v1.0
4
+ class: CommandLineTool
5
+ baseCommand: [ruby]
6
+
7
+ inputs:
8
+ - id: script
9
+ type: File
10
+ default:
11
+ class: File
12
+ location: rev_comp.rb
13
+ inputBinding:
14
+ position: -1
15
+ - id: seqFile
16
+ type: File[]
17
+ inputBinding:
18
+ position: 1
19
+
20
+ outputs:
21
+ - id: out
22
+ type: stdout
23
+ stdout: $(inputs.script.nameroot)-$(inputs.seqFile[0].nameroot).fst
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # rev_comp.rb - Reverse complement DNA sequences
4
+ #
5
+ # Copyright:: Copyright (C) 2019 BioRuby Project
6
+ # License:: The Ruby License
7
+ #
8
+
9
+ require 'bio'
10
+
11
+ ARGV.each do |fn|
12
+ Bio::FlatFile.open(fn) do |ff|
13
+ ff.each do |entry|
14
+ next if /\A\s*\z/ =~ ff.entry_raw.to_s
15
+ na = entry.naseq
16
+ revcomp = na.reverse_complement
17
+ print revcomp.to_fasta("complement(#{entry.entry_id}) " + entry.definition, 70)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,7 @@
1
+ seqFile:
2
+ - class: File
3
+ location: ../test/data/fasta/example2.txt
4
+ - class: File
5
+ location: ../test/data/fasta/example1.txt
6
+ - class: File
7
+ location: ../test/data/genbank/SCU49845.gb
@@ -182,6 +182,11 @@ END_OF_DATA
182
182
  assert_equal(str, @obj.to_s)
183
183
  end
184
184
 
185
+ def test_self_parse
186
+ obj2 = Bio::GFF::GFF2::Record.parse(@obj.to_s)
187
+ assert_equal(@obj, obj2)
188
+ end
189
+
185
190
  def test_eqeq
186
191
  obj2 = Bio::GFF::GFF2::Record.new(@obj.to_s)
187
192
  assert_equal(true, @obj == obj2)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bio
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - BioRuby project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-14 00:00:00.000000000 Z
11
+ date: 2019-09-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: BioRuby is a library for bioinformatics (biology + information science).
14
14
  email: staff@bioruby.org
@@ -269,6 +269,7 @@ files:
269
269
  - sample/any2fasta.rb
270
270
  - sample/benchmark_clustalw_report.rb
271
271
  - sample/biofetch.rb
272
+ - sample/color_scheme_aa.rb
272
273
  - sample/color_scheme_na.rb
273
274
  - sample/demo_aaindex.rb
274
275
  - sample/demo_aminoacid.rb
@@ -307,6 +308,9 @@ files:
307
308
  - sample/fasta2tab.rb
308
309
  - sample/fastagrep.rb
309
310
  - sample/fastasort.rb
311
+ - sample/fastq2html.cwl
312
+ - sample/fastq2html.rb
313
+ - sample/fastq2html.testdata.yaml
310
314
  - sample/fsplit.rb
311
315
  - sample/gb2fasta.rb
312
316
  - sample/gb2tab.rb
@@ -318,9 +322,14 @@ files:
318
322
  - sample/genome2tab.rb
319
323
  - sample/goslim.rb
320
324
  - sample/gt2fasta.rb
325
+ - sample/na2aa.cwl
321
326
  - sample/na2aa.rb
327
+ - sample/na2aa.testdata.yaml
322
328
  - sample/pmfetch.rb
323
329
  - sample/pmsearch.rb
330
+ - sample/rev_comp.cwl
331
+ - sample/rev_comp.rb
332
+ - sample/rev_comp.testdata.yaml
324
333
  - sample/seqdatabase.ini
325
334
  - sample/ssearch2tab.rb
326
335
  - sample/tdiary.rb