bio-gggenome 0.1.0 → 0.2.0

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.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/bin/gggenome +73 -0
  3. metadata +6 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -0,0 +1,73 @@
1
+ #!/usr/env ruby
2
+ #
3
+ # gggenome command-line tool
4
+ #
5
+ help = "
6
+ gggenome: Command-line tool for GGGenome the Ultrafast DNA search,
7
+ http://gggenome.dbcls.jp/en/
8
+
9
+ Usage:
10
+ gggenome hg19 1 TTCATTGACAACATTA
11
+ gggenome hg19 0 TTCATTGACAACATTA
12
+ gggenome hg19 TTCATTGACAACATTA
13
+ gggenome 1 TTCATTGACAACATTA
14
+ gggenome TTCATTGACAACATTA
15
+
16
+ "
17
+
18
+ require 'rubygems'
19
+ require 'bio-gggenome'
20
+
21
+ case ARGV.size
22
+ when 1
23
+ when 2
24
+ when 3
25
+ else
26
+ puts help
27
+ exit
28
+ end
29
+
30
+ hits = Bio::GGGenome.search(ARGV)
31
+
32
+ puts "database: #{hits['database']}"
33
+ puts "summary: #{hits['summary']}"
34
+ puts "time: #{hits['time']}"
35
+ puts "error: #{hits['error']}"
36
+ puts "results:"
37
+
38
+ chr = ""
39
+ hits['results'].each do |hit|
40
+ if hit['name'] != chr
41
+ chr = hit['name']
42
+ print "\n\t#{chr.rjust(20)} : #{hit['strand']}"
43
+ else
44
+ print hit['strand']
45
+ end
46
+ end
47
+ puts
48
+ puts
49
+
50
+ hits['results'].each do |hit|
51
+ case hit['strand']
52
+ when "+"
53
+ snippet = hit['snippet'].sub(hits['summary'][0]['query'], hits['summary'][0]['query'].downcase)
54
+ when "-"
55
+ snippet = hit['snippet'].sub(hits['summary'][1]['query'], hits['summary'][1]['query'].downcase)
56
+ end
57
+ left = hit['position'] - hit['snippet_pos']
58
+ right = left + hit['position_end'] - hit['position']
59
+ snippet = hit['snippet']
60
+ left_part = snippet[0..(left-1)]
61
+ hit_part = snippet[left..right]
62
+ right_part = snippet[(right+1)..hit['snippet'].size]
63
+ snippet = left_part + hit_part.downcase + right_part
64
+
65
+ puts [hit['name'],
66
+ hit['strand'],
67
+ hit['position'].to_s.rjust(13), " " * (left_part.size-17) + hit['position'].to_s.rjust(13) + " " * 4 + hit_part + " " * 4 + hit['position_end'].to_s].join("\t")
68
+ puts ["",
69
+ hit['strand'],
70
+ hit['snippet_pos'].to_s.rjust(13),
71
+ snippet,
72
+ hit['snippet_end'].to_s.rjust(13)].join("\t")
73
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bio-gggenome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-12 00:00:00.000000000 Z
12
+ date: 2013-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc
@@ -93,7 +93,8 @@ dependencies:
93
93
  version: '3.12'
94
94
  description: A Ruby client for GGGenome the Ultrafast sequence search
95
95
  email: mitsuteru.nakao@gmail.com
96
- executables: []
96
+ executables:
97
+ - gggenome
97
98
  extensions: []
98
99
  extra_rdoc_files:
99
100
  - LICENSE.txt
@@ -108,6 +109,7 @@ files:
108
109
  - README.rdoc
109
110
  - Rakefile
110
111
  - VERSION
112
+ - bin/gggenome
111
113
  - lib/bio-gggenome.rb
112
114
  - lib/bio-gggenome/gggenome.rb
113
115
  - test/helper.rb
@@ -127,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
129
  version: '0'
128
130
  segments:
129
131
  - 0
130
- hash: 1277551901848741236
132
+ hash: -804717082175376756
131
133
  required_rubygems_version: !ruby/object:Gem::Requirement
132
134
  none: false
133
135
  requirements: