macroape 3.3.0 → 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -41,14 +41,17 @@ Or install it yourself as:
41
41
  require 'macroape'
42
42
  background = [1,1,1,1]
43
43
  discretization = 10
44
- first_pwm_matrix = [[1,2,3,4], [1,2,3,4], [4,1,2,3,], [5,3,2,4], [4,1,2,3], [7,8,9,11]]
45
- pwm_first = PWM::SingleMatrix.new(first_pwm_matrix).with_background(background).discrete(discretization)
46
- pwm_second = PWM::SingleMatrix.load_pat('another_pwm.pat').with_background(background).discrete(discretization)
47
- cmp = PWMCompare::PWMCompare.new(pwm_first, pwm_second)
44
+ pwm_first = Bioinform::PWM.new(File.read('first_pwm.pat')).background(background).discrete(discretization)
45
+ pwm_second = Bioinform::PWM.new(File.read('first_pwm.pat')).background(background).discrete(discretization)
46
+
47
+ cmp = Macroape::PWMCompare.new(pwm_first, pwm_second)
48
48
  first_threshold = pwm_first.threshold(pvalue)
49
49
  second_threshold = pwm_second.threshold(pvalue)
50
+
50
51
  similarity_info = cmp.jaccard(first_threshold, second_threshold)
51
52
  puts "Jaccard similarity: #{similarity_info[:similarity]}"
53
+
54
+ For more details look a source code of utilities in lib/exec/ folder
52
55
 
53
56
  ## Contributing
54
57
 
@@ -10,5 +10,13 @@ module Macroape
10
10
  @pwms[pwm.name] = pwm
11
11
  @infos[pwm.name] = info
12
12
  end
13
+ def ==(other)
14
+ @rough_discretization == other.rough_discretization &&
15
+ @precise_discretization == other.precise_discretization &&
16
+ @background == other.background &&
17
+ @pvalues == other.pvalues &&
18
+ @pwms == other.pwms &&
19
+ @infos == other.infos
20
+ end
13
21
  end
14
22
  end
@@ -28,7 +28,6 @@ Examples:
28
28
 
29
29
  $:.unshift File.join(File.dirname(__FILE__),'./../../')
30
30
  require 'macroape'
31
- require 'bioinform'
32
31
 
33
32
  if ARGV.empty? or ARGV.include? '-h' or ARGV.include? '-help' or ARGV.include? '--help' or ARGV.include? '--h'
34
33
  STDERR.puts help_string
@@ -26,7 +26,6 @@ Examples:
26
26
 
27
27
  $:.unshift File.join(File.dirname(__FILE__),'./../../')
28
28
  require 'macroape'
29
- require 'bioinform'
30
29
 
31
30
  if ARGV.empty? or ARGV.include? '-h' or ARGV.include? '-help' or ARGV.include? '--help' or ARGV.include? '--h'
32
31
  STDERR.puts help_string
@@ -22,7 +22,6 @@ Example:
22
22
 
23
23
  $:.unshift File.join(File.dirname(__FILE__),'./../../')
24
24
  require 'macroape'
25
- require 'bioinform'
26
25
 
27
26
  if ARGV.empty? or ARGV.include? '-h' or ARGV.include? '-help' or ARGV.include? '--help' or ARGV.include? '--h'
28
27
  STDERR.puts help_string
@@ -17,7 +17,6 @@ Example:
17
17
 
18
18
  $:.unshift File.join(File.dirname(__FILE__),'./../../')
19
19
  require 'macroape'
20
- require 'bioinform'
21
20
  require 'yaml'
22
21
 
23
22
  if ARGV.empty? or ARGV.include? '-h' or ARGV.include? '-help' or ARGV.include? '--help' or ARGV.include? '--h'
@@ -25,7 +25,6 @@ Example:
25
25
 
26
26
  $:.unshift File.join(File.dirname(__FILE__),'./../../')
27
27
  require 'macroape'
28
- require 'bioinform'
29
28
  require 'yaml'
30
29
 
31
30
  if ARGV.empty? or ARGV.include? '-h' or ARGV.include? '-help' or ARGV.include? '--help' or ARGV.include? '--h'
@@ -1,3 +1,3 @@
1
1
  module Macroape
2
- VERSION = "3.3.0"
2
+ VERSION = "3.3.1"
3
3
  end
data/macroape.gemspec CHANGED
@@ -1,19 +1,19 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/macroape/version', __FILE__)
3
-
4
- Gem::Specification.new do |gem|
5
- gem.authors = ["Ilya Vorontsov"]
6
- gem.email = ["prijutme4ty@gmail.com"]
7
- gem.description = %q{Macroape is an abbreviation for MAtrix CompaRisOn by Approximate P-value Estimation. It's a bioinformatic tool for evaluating similarity measure and best alignment between a pair of Position Weight Matrices(PWM), finding thresholds by P-values and inside out and even searching a collection of motifs for the most similar ones. Used approach and application described in manual at https://docs.google.com/document/pub?id=1_jsxhMNzMzy4d2d_byAd3n6Szg5gEcqG_Sf7w9tEqWw}
8
- gem.summary = %q{PWM comparison tool using MACROAPE approach}
9
- gem.homepage = "http://autosome.ru/macroape/"
10
-
11
- gem.files = `git ls-files`.split($\)
12
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
- gem.name = "macroape"
15
- gem.require_paths = ["lib"]
16
- gem.version = Macroape::VERSION
17
-
18
- gem.add_dependency('bioinform', '~> 0.1.0')
19
- end
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/macroape/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Ilya Vorontsov"]
6
+ gem.email = ["prijutme4ty@gmail.com"]
7
+ gem.description = %q{Macroape is an abbreviation for MAtrix CompaRisOn by Approximate P-value Estimation. It's a bioinformatic tool for evaluating similarity measure and best alignment between a pair of Position Weight Matrices(PWM), finding thresholds by P-values and inside out and even searching a collection of motifs for the most similar ones. Used approach and application described in manual at https://docs.google.com/document/pub?id=1_jsxhMNzMzy4d2d_byAd3n6Szg5gEcqG_Sf7w9tEqWw}
8
+ gem.summary = %q{PWM comparison tool using MACROAPE approach}
9
+ gem.homepage = "http://autosome.ru/macroape/"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "macroape"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Macroape::VERSION
17
+
18
+ gem.add_dependency('bioinform', '>= 0.1.1')
19
+ end
@@ -1,9 +1,11 @@
1
1
  require 'test_helper'
2
+ require 'yaml'
3
+ require 'macroape'
2
4
 
3
5
  class TestPreprocessCollection < Test::Unit::TestCase
4
6
  def test_multipvalue_preproceessing
5
- system(Helpers.exec_cmd('preprocess_collection','./test/data/test_collection -o test/data/test_collection.yaml.tmp -p 0.0005 0.0001 0.00005 --silent'))
6
- assert_equal File.read('test/data/test_collection.yaml'), File.read('test/data/test_collection.yaml.tmp')
7
+ system(Helpers.exec_cmd('preprocess_collection','test/data/test_collection -o test/data/test_collection.yaml.tmp -p 0.0005 0.0001 0.00005 --silent'))
8
+ assert_equal YAML.load_file('test/data/test_collection.yaml'), YAML.load_file('test/data/test_collection.yaml.tmp')
7
9
  File.delete 'test/data/test_collection.yaml.tmp'
8
10
  end
9
11
  end
@@ -2,16 +2,16 @@ require 'test_helper'
2
2
 
3
3
  class TestScanCollection < Test::Unit::TestCase
4
4
  def test_scan_default_cutoff
5
- assert_equal File.read('test/data/KLF4_f2_scan_results_default_cutoff.txt'),
6
- IO.popen(Helpers.exec_cmd('scan_collection','test/data/KLF4_f2.pat test/data/test_collection.yaml --silent'), &:read)
5
+ assert_equal File.read('test/data/KLF4_f2_scan_results_default_cutoff.txt').gsub("\r\n", "\n"),
6
+ IO.popen(Helpers.exec_cmd('scan_collection','test/data/KLF4_f2.pat test/data/test_collection.yaml --silent'), &:read).gsub("\r\n","\n")
7
7
  end
8
8
  def test_scan_and_output_all_results
9
- assert_equal File.read('test/data/KLF4_f2_scan_results_all.txt'),
10
- IO.popen(Helpers.exec_cmd('scan_collection','test/data/KLF4_f2.pat test/data/test_collection.yaml --all --silent'), &:read)
9
+ assert_equal File.read('test/data/KLF4_f2_scan_results_all.txt').gsub("\r\n", "\n"),
10
+ IO.popen(Helpers.exec_cmd('scan_collection','test/data/KLF4_f2.pat test/data/test_collection.yaml --all --silent'), &:read).gsub("\r\n","\n")
11
11
 
12
12
  end
13
13
  def test_scan_precise_mode
14
- assert_equal File.read('test/data/KLF4_f2_scan_results_precise_mode.txt'),
15
- IO.popen(Helpers.exec_cmd('scan_collection','test/data/KLF4_f2.pat test/data/test_collection.yaml --precise --all --silent'), &:read)
14
+ assert_equal File.read('test/data/KLF4_f2_scan_results_precise_mode.txt').gsub("\r\n","\n"),
15
+ IO.popen(Helpers.exec_cmd('scan_collection','test/data/KLF4_f2.pat test/data/test_collection.yaml --precise --all --silent'), &:read).gsub("\r\n", "\n")
16
16
  end
17
17
  end
data/test/test_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
2
+ $LOAD_PATH.unshift File.dirname(__FILE__)
1
3
  require 'test/unit'
2
4
 
3
5
  module Helpers
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: macroape
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-20 00:00:00.000000000 Z
12
+ date: 2012-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bioinform
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.1.0
21
+ version: 0.1.1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ~>
27
+ - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.1.0
29
+ version: 0.1.1
30
30
  description: Macroape is an abbreviation for MAtrix CompaRisOn by Approximate P-value
31
31
  Estimation. It's a bioinformatic tool for evaluating similarity measure and best
32
32
  alignment between a pair of Position Weight Matrices(PWM), finding thresholds by