codon_table_parser 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,7 +6,7 @@ The output can be easily customized and used to update the respective constants
6
6
  ## Installation
7
7
 
8
8
  ``` bash
9
- gem install codon_table_parser
9
+ $ gem install codon_table_parser
10
10
 
11
11
  ```
12
12
 
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
- # Parses the NCBI genetic code table, generating separate hash maps of each species' name, start & stop codons and codon table.
3
+ # Parses the NCBI genetic code table, generating separate hash maps of each species' name, start & stop codons and codon table.
4
4
  #
5
- # to return definitions, start & stop codons as well as codon tables that can be used
5
+ # to return definitions, start & stop codons as well as codon tables that can be used
6
6
  class CodonTableParser
7
7
 
8
8
  attr_reader :address
@@ -46,9 +46,8 @@ class CodonTableParser
46
46
  arr
47
47
  end
48
48
 
49
- def parse data
50
- del = /.*?\s/.source # .+ does not work as the regex is greedy.
51
- # del = /.*?(?=[a-z])/.source # Using non-greedy search + pos. lookahead also works
49
+ def parse data
50
+ del = /.*?/.source
52
51
  l_name = /name "(.*?)"#{del}/.source
53
52
  s_name = /(|name ".*?"#{del})/.source # Either nothing 'line does not exists' or the short name.
54
53
  id = /id (\d+)#{del}/.source
@@ -56,7 +55,7 @@ class CodonTableParser
56
55
  sncbieaa = /sncbieaa "(.*?)"/.source
57
56
 
58
57
  # flag 'o':
59
- # Perform inline substitutions (#{variable}) only once on creation.
58
+ # Perform inline substitutions (#{variable}) only once on creation.
60
59
  # Normally, the variable is inserted on every evaluation.
61
60
  result = data.scan(/#{l_name}#{s_name}#{id}#{ncbieaa}#{sncbieaa}/mo).
62
61
  inject([]) do |res, (l_name, s_name, id, ncbieaa, sncbieaa)|
@@ -64,7 +63,7 @@ class CodonTableParser
64
63
  short = s_name.match(/[A-Z]{3}\d/)[0] unless s_name.empty?
65
64
  l_name = l_name.gsub(/\n/,'')
66
65
 
67
- res << {:id => id.to_i,
66
+ res << {:id => id.to_i,
68
67
  :long_name => l_name,
69
68
  :short_name => short,
70
69
  :ncbieaa => ncbieaa,
@@ -88,7 +87,7 @@ class CodonTableParser
88
87
  end
89
88
 
90
89
  def starts options = {}
91
- Hash[@parsed_data.map do |species|
90
+ Hash[@parsed_data.map do |species|
92
91
  codons = []
93
92
  species[:sncbieaa].split(//).each_with_index do |pos, i|
94
93
  if pos == 'M'
@@ -167,7 +166,7 @@ class CodonTableParser
167
166
 
168
167
  def custom_codons options, codons
169
168
  opt = options
170
- if opt
169
+ if opt
171
170
  codons = codons | opt[:add] if opt[:add]
172
171
  codons = codons.delete_if {|codon| opt[:remove].include?(codon)} if opt[:remove]
173
172
  end
@@ -1,3 +1,3 @@
1
1
  class CodonTableParser
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codon_table_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-03 00:00:00.000000000Z
12
+ date: 2012-01-18 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &13232540 !ruby/object:Gem::Requirement
16
+ requirement: &12020420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *13232540
24
+ version_requirements: *12020420
25
25
  description: ! ' Parses the NCBI genetic code table, generating hash maps of each
26
26
  species'' name, start codons, stop codons and codon table. The output of CodonTableParser
27
27
  can be customized easily and used to update the respective constants of BioRuby''s
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  version: '0'
59
59
  requirements: []
60
60
  rubyforge_project: codon_table_parser
61
- rubygems_version: 1.8.10
61
+ rubygems_version: 1.8.11
62
62
  signing_key:
63
63
  specification_version: 3
64
64
  summary: Parses the NCBI genetic code table, generating hash maps of each species'