semin-ulla 0.9.9 → 0.9.9.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.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.9.9.1 26/08/2009
2
+
3
+ * Removed dependency on the Ruby Facets library
4
+
1
5
  == 0.9.9 09/08/2009
2
6
 
3
7
  * Changed default value for --classdef option from 'classdef.dat' to nil
data/Manifest.txt CHANGED
@@ -6,6 +6,7 @@ Rakefile
6
6
  bin/ulla
7
7
  config/website.yml
8
8
  config/website.yml.sample
9
+ lib/array_extensions.rb
9
10
  lib/math_extensions.rb
10
11
  lib/narray_extensions.rb
11
12
  lib/nmatrix_extensions.rb
data/README.rdoc CHANGED
@@ -24,8 +24,8 @@ http://www-cryst.bioc.cam.ac.uk/ulla
24
24
  Following RubyGems will be automatically installed if you have rubygems installed on your machine
25
25
 
26
26
  * narray (http://narray.rubyforge.org)
27
- * facets (http://facets.rubyforge.org)
28
27
  * bio (http://bioruby.open-bio.org)
28
+ * Active Support (http://as.rubyonrails.org)
29
29
  * RMagick (http://rmagick.rubyforge.org)
30
30
 
31
31
 
data/Rakefile CHANGED
@@ -14,10 +14,9 @@ $hoe = Hoe.spec 'ulla' do
14
14
  self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
15
15
  self.rubyforge_name = self.name # TODO this is default value
16
16
  self.extra_deps = [
17
- ['narray', '>= 0.5.9.5'],
18
- ['bio', '>= 1.2.1'],
19
- ['facets', '>= 2.4.5'],
20
- ['rmagick', '>= 2.9.1'],
17
+ ['narray', '>= 0.5.9.5'],
18
+ ['bio', '>= 1.2.1'],
19
+ ['rmagick', '>= 2.9.1'],
21
20
  ]
22
21
  end
23
22
 
@@ -0,0 +1,16 @@
1
+ module ArrayExtensions
2
+
3
+ # from Active Support library
4
+ def sum(identity = 0, &block)
5
+ return identity unless size > 0
6
+
7
+ if block_given?
8
+ map(&block).sum
9
+ else
10
+ inject { |sum, element| sum + element }
11
+ end
12
+ end
13
+
14
+ end
15
+
16
+ Array.send :include, ArrayExtensions
@@ -1,7 +1,9 @@
1
1
  module MathExtensions
2
+
2
3
  def log2(val)
3
4
  log(val) / log(2)
4
5
  end
6
+
5
7
  end
6
8
 
7
9
  Math.extend(MathExtensions)
@@ -1,6 +1,5 @@
1
1
  require 'rubygems'
2
2
  require 'narray'
3
- require 'facets'
4
3
 
5
4
  module NArrayExtensions
6
5
 
@@ -1,6 +1,5 @@
1
1
  require 'rubygems'
2
2
  require 'narray'
3
- require 'facets'
4
3
 
5
4
  begin
6
5
  require 'rvg/rvg'
@@ -19,7 +18,7 @@ module NMatrixExtensions
19
18
 
20
19
  ("%-3s" % "#") + opts[:col_header].inject("") { |s, a|
21
20
  s + ("%#{opts[:col_size]}s" % a)
22
- } + "\n" + self.to_a.map_with_index { |a, i|
21
+ } + "\n" + self.to_a.each_with_index.map { |a, i|
23
22
  ("%-3s" % opts[:row_header][i]) + a.inject("") { |s, v|
24
23
  if v.is_a? Float
25
24
  s + ("%#{opts[:col_size]}.2f" % v)
@@ -1,5 +1,19 @@
1
1
  module StringExtensions
2
2
 
3
+ unless method_defined?(:blank?)
4
+ # from Active Support library
5
+ def blank?
6
+ self !~ /\S/
7
+ end
8
+ end
9
+
10
+ unless method_defined?(:start_with?)
11
+ # from Ruby Facets library
12
+ def start_with?(prefix)
13
+ self.index(prefix) == 0
14
+ end
15
+ end
16
+
3
17
  def remove_internal_spaces
4
18
  gsub(/[\n|\r|\s]+/, '')
5
19
  end
@@ -14,4 +28,3 @@ module StringExtensions
14
28
  end
15
29
 
16
30
  String.send :include, StringExtensions
17
-
data/lib/ulla.rb CHANGED
@@ -2,5 +2,5 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module Ulla
5
- VERSION = '0.9.9'
5
+ VERSION = '0.9.9.1'
6
6
  end
data/lib/ulla/cli.rb CHANGED
@@ -4,7 +4,6 @@ require 'logger'
4
4
  require 'narray'
5
5
  require 'bio'
6
6
  require 'set'
7
- require 'facets'
8
7
 
9
8
  # This is a module for an actual command line interpreter for Ulla
10
9
  # ---
@@ -368,6 +367,7 @@ Options:
368
367
  end
369
368
 
370
369
  require 'math_extensions'
370
+ require 'array_extensions'
371
371
  require 'string_extensions'
372
372
  require 'narray_extensions'
373
373
  require 'nmatrix_extensions'
@@ -535,7 +535,7 @@ Options:
535
535
  ff.rewind
536
536
  ff.each_entry do |pir|
537
537
  if (pir.entry_id == key) && (pir.definition == ec.name)
538
- labels = pir.data.remove_internal_spaces.split('').map_with_index do |sym, pos|
538
+ labels = pir.data.remove_internal_spaces.split('').each_with_index.map do |sym, pos|
539
539
  if sym == '-'
540
540
  '-'
541
541
  elsif sym == 'X' || sym == 'x'
@@ -562,13 +562,13 @@ Options:
562
562
  if $noweight
563
563
  ali.each_pair do |id1, seq1|
564
564
  if $environment == 1
565
- seq1 = seq1.split('').map_with_index { |aa, pos| aa == $gap ? $ext_gap : env_labels[id1][pos] }.join
565
+ seq1 = seq1.split('').each_with_index.map { |aa, pos| aa == $gap ? $ext_gap : env_labels[id1][pos] }.join
566
566
  end
567
567
 
568
568
  ali.each_pair do |id2, seq2|
569
569
  if id1 != id2
570
570
  if $environment == 1
571
- seq2 = seq2.split('').map_with_index { |aa, pos| aa == $gap ? $ext_gap : env_labels[id2][pos] }.join
571
+ seq2 = seq2.split('').each_with_index.map { |aa, pos| aa == $gap ? $ext_gap : env_labels[id2][pos] }.join
572
572
  end
573
573
 
574
574
  pid = calculate_pid(seq1, seq2, $col_size)
@@ -639,7 +639,7 @@ Options:
639
639
  ali.each_pair do |key, seq|
640
640
  clusters << [key]
641
641
  if $environment == 1
642
- ext_seq = seq.split('').map_with_index { |aa, pos| aa == $gap ? $ext_gap : env_labels[key][pos] }.join
642
+ ext_seq = seq.split('').each_with_index.map { |aa, pos| aa == $gap ? $ext_gap : env_labels[key][pos] }.join
643
643
  ext_ali.add_seq(ext_seq, key)
644
644
  end
645
645
  end
@@ -1197,10 +1197,10 @@ HEADER
1197
1197
  #
1198
1198
  # p2 and above
1199
1199
  #
1200
- env_labels = $env_features.map_with_index { |ef, ei| ef.labels.map { |l| "#{ei}#{l}" } }
1200
+ env_labels = $env_features.each_with_index.map { |ef, ei| ef.labels.map { |l| "#{ei}#{l}" } }
1201
1201
 
1202
1202
  if $environment == 1
1203
- env_labels += $env_features[1..-1].map_with_index { |ef, ei| ef.labels.map { |l| "#{ei + $env_features.size}#{l}" } }
1203
+ env_labels += $env_features[1..-1].each_with_index.map { |ef, ei| ef.labels.map { |l| "#{ei + $env_features.size}#{l}" } }
1204
1204
  end
1205
1205
 
1206
1206
  if $smooth == :partial
@@ -1337,7 +1337,7 @@ HEADER
1337
1337
  entropies = priors.map { |prior| -1.0 * prior.to_a.inject(0.0) { |s, p| p == 0 ? s : s + p * Math::log(p) } }
1338
1338
  mod_entropies = entropies.map { |entropy| (entropy_max - entropy) / entropy_max }
1339
1339
  weights = mod_entropies.map { |mod_entropy| mod_entropy / mod_entropies.sum }
1340
- weighted_priors = priors.map_with_index { |prior, i| prior * weights[i] }.sum
1340
+ weighted_priors = priors.each_with_index.map { |prior, i| prior * weights[i] }.sum
1341
1341
 
1342
1342
  # actual smoothing step
1343
1343
  smooth_prob_arr = NArray.float($amino_acids.size)
@@ -1432,9 +1432,9 @@ HEADER
1432
1432
  # entropy based weighting priors step
1433
1433
  entropy_max = NMath::log($amino_acids.size)
1434
1434
  entropies = priors.map { |prior| -1.0 * prior.to_a.inject(0.0) { |s, p| p == 0 ? s : s + p * Math::log(p) } }
1435
- mod_entropies = entropies.map_with_index { |entropy, i| (entropy_max - entropies[i]) / entropy_max }
1435
+ mod_entropies = entropies.each_with_index.map { |entropy, i| (entropy_max - entropies[i]) / entropy_max }
1436
1436
  weights = mod_entropies.map { |mod_entropy| mod_entropy / mod_entropies.sum }
1437
- weighted_priors = priors.map_with_index { |prior, i| prior * weights[i] }.sum
1437
+ weighted_priors = priors.each_with_index.map { |prior, i| prior * weights[i] }.sum
1438
1438
 
1439
1439
  # smoothing step
1440
1440
  smooth_prob_arr = NArray.float($amino_acids.size)
@@ -25,9 +25,9 @@ module Ulla
25
25
 
26
26
  def label_set
27
27
  if $direction == 0
28
- label.split("").map_with_index { |l, i| "#{i}#{l}" }.to_set
28
+ label.split("").each_with_index.map { |l, i| "#{i}#{l}" }.to_set
29
29
  else
30
- label.gsub('-', '').split("").map_with_index { |l, i| "#{i}#{l}" }.to_set
30
+ label.gsub('-', '').split("").each_with_index.map { |l, i| "#{i}#{l}" }.to_set
31
31
  end
32
32
  end
33
33
 
@@ -7,7 +7,7 @@ module Ulla
7
7
 
8
8
  def groups_sorted_by_residue_labels
9
9
  group_by_non_residue_labels.to_a.sort_by { |env_group|
10
- env_group[0].gsub('-', '').split('').map_with_index { |l, i|
10
+ env_group[0].gsub('-', '').split('').each_with_index.map { |l, i|
11
11
  if i < ($env_features.size - 1)
12
12
  $env_features[i + 1].labels.index(l)
13
13
  else
@@ -1,5 +1,4 @@
1
1
  require 'rubygems'
2
- require 'facets'
3
2
 
4
3
  begin
5
4
  require 'RMagick'
data/ulla.gemspec CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ulla}
5
- s.version = "0.9.9"
5
+ s.version = "0.9.9.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Semin Lee"]
9
- s.date = %q{2009-08-09}
9
+ s.date = %q{2009-08-26}
10
10
  s.default_executable = %q{ulla}
11
11
  s.description = %q{'ulla' is a program for calculating environment-specific substitution tables from user providing environmental class definitions and sequence alignments with the annotations of the environment classes.}
12
12
  s.email = ["seminlee@gmail.com"]
13
13
  s.executables = ["ulla"]
14
14
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "website/index.txt"]
15
- s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/ulla", "config/website.yml", "config/website.yml.sample", "lib/math_extensions.rb", "lib/narray_extensions.rb", "lib/nmatrix_extensions.rb", "lib/string_extensions.rb", "lib/ulla.rb", "lib/ulla/cli.rb", "lib/ulla/environment.rb", "lib/ulla/environment_class_hash.rb", "lib/ulla/environment_feature.rb", "lib/ulla/environment_feature_array.rb", "lib/ulla/heatmap_array.rb", "script/console", "script/destroy", "script/generate", "script/txt2html", "test/test_helper.rb", "test/test_math_extensions.rb", "test/test_narray_extensions.rb", "test/test_nmatrix_extensions.rb", "test/test_string_extensions.rb", "test/test_ulla.rb", "test/ulla/test_cli.rb", "test/ulla/test_environment_class_hash.rb", "test/ulla/test_environment_feature.rb", "ulla.gemspec", "website/index.html", "website/index.txt", "website/javascripts/rounded_corners_lite.inc.js", "website/stylesheets/screen.css", "website/template.html.erb"]
15
+ s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "bin/ulla", "config/website.yml", "config/website.yml.sample", "lib/array_extensions.rb", "lib/math_extensions.rb", "lib/narray_extensions.rb", "lib/nmatrix_extensions.rb", "lib/string_extensions.rb", "lib/ulla.rb", "lib/ulla/cli.rb", "lib/ulla/environment.rb", "lib/ulla/environment_class_hash.rb", "lib/ulla/environment_feature.rb", "lib/ulla/environment_feature_array.rb", "lib/ulla/heatmap_array.rb", "script/console", "script/destroy", "script/generate", "script/txt2html", "test/test_helper.rb", "test/test_math_extensions.rb", "test/test_narray_extensions.rb", "test/test_nmatrix_extensions.rb", "test/test_string_extensions.rb", "test/test_ulla.rb", "test/ulla/test_cli.rb", "test/ulla/test_environment_class_hash.rb", "test/ulla/test_environment_feature.rb", "ulla.gemspec", "website/index.html", "website/index.txt", "website/javascripts/rounded_corners_lite.inc.js", "website/stylesheets/screen.css", "website/template.html.erb"]
16
16
  s.homepage = %q{http://www-cryst.bioc.cam.ac.uk/ulla}
17
17
  s.post_install_message = %q{PostInstall.txt}
18
18
  s.rdoc_options = ["--main", "README.rdoc"]
@@ -29,20 +29,17 @@ Gem::Specification.new do |s|
29
29
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
30
30
  s.add_runtime_dependency(%q<narray>, [">= 0.5.9.5"])
31
31
  s.add_runtime_dependency(%q<bio>, [">= 1.2.1"])
32
- s.add_runtime_dependency(%q<facets>, [">= 2.4.5"])
33
32
  s.add_runtime_dependency(%q<rmagick>, [">= 2.9.1"])
34
33
  s.add_development_dependency(%q<hoe>, [">= 2.3.3"])
35
34
  else
36
35
  s.add_dependency(%q<narray>, [">= 0.5.9.5"])
37
36
  s.add_dependency(%q<bio>, [">= 1.2.1"])
38
- s.add_dependency(%q<facets>, [">= 2.4.5"])
39
37
  s.add_dependency(%q<rmagick>, [">= 2.9.1"])
40
38
  s.add_dependency(%q<hoe>, [">= 2.3.3"])
41
39
  end
42
40
  else
43
41
  s.add_dependency(%q<narray>, [">= 0.5.9.5"])
44
42
  s.add_dependency(%q<bio>, [">= 1.2.1"])
45
- s.add_dependency(%q<facets>, [">= 2.4.5"])
46
43
  s.add_dependency(%q<rmagick>, [">= 2.9.1"])
47
44
  s.add_dependency(%q<hoe>, [">= 2.3.3"])
48
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semin-ulla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9
4
+ version: 0.9.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Semin Lee
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-09 00:00:00 -07:00
12
+ date: 2009-08-26 00:00:00 -07:00
13
13
  default_executable: ulla
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,16 +32,6 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.2.1
34
34
  version:
35
- - !ruby/object:Gem::Dependency
36
- name: facets
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: 2.4.5
44
- version:
45
35
  - !ruby/object:Gem::Dependency
46
36
  name: rmagick
47
37
  type: :runtime
@@ -83,6 +73,7 @@ files:
83
73
  - bin/ulla
84
74
  - config/website.yml
85
75
  - config/website.yml.sample
76
+ - lib/array_extensions.rb
86
77
  - lib/math_extensions.rb
87
78
  - lib/narray_extensions.rb
88
79
  - lib/nmatrix_extensions.rb