chipgps 0.1.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/.document +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +18 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +7 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/chipgps.gemspec +58 -0
- data/lib/chipgps.rb +79 -0
- data/sample/Demo_2_GPS_significant.txt +11 -0
- data/sample/gps2bet.rb +29 -0
- data/test/helper.rb +17 -0
- data/test/test_chipgps.rb +177 -0
- metadata +102 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "bundler", "~> 1.0.0"
|
10
|
+
gem "jeweler", "~> 1.6.4"
|
11
|
+
gem "rcov", ">= 0"
|
12
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
git (1.2.5)
|
5
|
+
jeweler (1.6.4)
|
6
|
+
bundler (~> 1.0)
|
7
|
+
git (>= 1.2.5)
|
8
|
+
rake
|
9
|
+
rake (0.9.2)
|
10
|
+
rcov (0.9.11)
|
11
|
+
|
12
|
+
PLATFORMS
|
13
|
+
ruby
|
14
|
+
|
15
|
+
DEPENDENCIES
|
16
|
+
bundler (~> 1.0.0)
|
17
|
+
jeweler (~> 1.6.4)
|
18
|
+
rcov
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Itoshi NIKAIDO
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
= chipgps
|
2
|
+
|
3
|
+
ChIPgps is an open source Ruby library for parsing result files of the Genome Positioning System which is a software tool to study protein-DNA interaction using ChIP-Seq data.
|
4
|
+
|
5
|
+
== Copyright
|
6
|
+
|
7
|
+
Copyright (c) 2011 Itoshi NIKAIDO <dritoshi@gmail.com>. See LICENSE.txt for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "chipgps"
|
18
|
+
gem.homepage = "http://github.com/dritoshi/chipgps"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Parser for the Genome Positioning System}
|
21
|
+
gem.description = %Q{ChIPgps is an open source Ruby library for parsing result files of the Genome Positioning System which is a software tool to study protein-DNA interaction using ChIP-Seq data.}
|
22
|
+
gem.email = "dritoshi@gmail.com"
|
23
|
+
gem.authors = ["Itoshi NIKAIDO"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
require 'rcov/rcovtask'
|
36
|
+
Rcov::RcovTask.new do |test|
|
37
|
+
test.libs << 'test'
|
38
|
+
test.pattern = 'test/**/test_*.rb'
|
39
|
+
test.verbose = true
|
40
|
+
test.rcov_opts << '--exclude "gems/*"'
|
41
|
+
end
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "chipgps #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.1
|
data/chipgps.gemspec
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "chipgps"
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Itoshi NIKAIDO"]
|
12
|
+
s.date = "2011-10-20"
|
13
|
+
s.description = "ChIPgps is an open source Ruby library for parsing result files of the Genome Positioning System which is a software tool to study protein-DNA interaction using ChIP-Seq data."
|
14
|
+
s.email = "dritoshi@gmail.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"chipgps.gemspec",
|
28
|
+
"lib/chipgps.rb",
|
29
|
+
"sample/Demo_2_GPS_significant.txt",
|
30
|
+
"sample/gps2bet.rb",
|
31
|
+
"test/helper.rb",
|
32
|
+
"test/test_chipgps.rb"
|
33
|
+
]
|
34
|
+
s.homepage = "http://github.com/dritoshi/chipgps"
|
35
|
+
s.licenses = ["MIT"]
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.rubygems_version = "1.8.11"
|
38
|
+
s.summary = "Parser for the Genome Positioning System"
|
39
|
+
|
40
|
+
if s.respond_to? :specification_version then
|
41
|
+
s.specification_version = 3
|
42
|
+
|
43
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
45
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
46
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
47
|
+
else
|
48
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
49
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
50
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
51
|
+
end
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
54
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
55
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
data/lib/chipgps.rb
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
class Chipgps
|
2
|
+
|
3
|
+
class Event
|
4
|
+
def initialize(line)
|
5
|
+
@line = line
|
6
|
+
end
|
7
|
+
attr_reader :line
|
8
|
+
attr_accessor :chr, :bp, :ip
|
9
|
+
attr_accessor :ip_binding_present, :ip_binding_strength, :control_binding_strength,
|
10
|
+
:fold_enrichment, :mlog10_qvalue, :mlog10_pvalue, :ipvsEMP_KLD, :ipvsCTR_KLD
|
11
|
+
|
12
|
+
end # End of Event class
|
13
|
+
|
14
|
+
class Search < Event
|
15
|
+
def initialize(line, options = {})
|
16
|
+
@line = line
|
17
|
+
@event_number = options[:event]
|
18
|
+
@condition_number = options[:condition]
|
19
|
+
|
20
|
+
parse
|
21
|
+
end
|
22
|
+
|
23
|
+
def cleanup(line)
|
24
|
+
new_line = line.strip
|
25
|
+
new_line.chomp!
|
26
|
+
new_line.gsub!(/ +/, "")
|
27
|
+
return new_line
|
28
|
+
end
|
29
|
+
|
30
|
+
def parse
|
31
|
+
# condition_number start from 0.
|
32
|
+
|
33
|
+
line = cleanup(@line)
|
34
|
+
f = line.split(/\t/)
|
35
|
+
|
36
|
+
@chr = f[0].split(/:/)[0]
|
37
|
+
@bp = f[0].split(/:/)[1].to_i
|
38
|
+
@ip = f[1].to_f
|
39
|
+
|
40
|
+
@ip_binding_present = f[(@condition_number * 9 + 2) + 0].to_i
|
41
|
+
@ip_binding_strength = f[(@condition_number * 9 + 2) + 1].to_f
|
42
|
+
@control_binding_strength = f[(@condition_number * 9 + 2) + 2].to_f
|
43
|
+
@fold_enrichment = f[(@condition_number * 9 + 2) + 3].to_f
|
44
|
+
@mlog10_qvalue = f[(@condition_number * 9 + 2) + 4].to_f
|
45
|
+
@mlog10_pvalue = f[(@condition_number * 9 + 2) + 5].to_f
|
46
|
+
@ipvsEMP_KLD = f[(@condition_number * 9 + 2) + 6].to_f
|
47
|
+
@ipvsCTR_KLD = f[(@condition_number * 9 + 2) + 7].to_f
|
48
|
+
end
|
49
|
+
|
50
|
+
end # End of Search class
|
51
|
+
|
52
|
+
def initialize(file)
|
53
|
+
@gps_out_file = file
|
54
|
+
@lines = File.open(@gps_out_file).readlines
|
55
|
+
@header = @lines.shift
|
56
|
+
|
57
|
+
@num_of_conditions = num_of_conditions
|
58
|
+
@num_of_events = num_of_events
|
59
|
+
end
|
60
|
+
attr_reader :header
|
61
|
+
|
62
|
+
def num_of_conditions
|
63
|
+
f = @lines[0].split(/\t/)
|
64
|
+
num_of_conditions = (f.size - 2) / 9 # each condition has 9 cols
|
65
|
+
# pp f.size
|
66
|
+
return num_of_conditions
|
67
|
+
end
|
68
|
+
|
69
|
+
def num_of_events
|
70
|
+
return @lines.size
|
71
|
+
end
|
72
|
+
|
73
|
+
def each_by_condition(condition_id) # condition_id starts from 0
|
74
|
+
@lines.each_with_index do |line, idx|
|
75
|
+
yield Chipgps::Search.new(line, {:condition => condition_id, :event => idx})
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Position IP Demo_Day0_Present Demo_Day0_IP Demo_Day0_Control Demo_Day0_ Fold Demo_Day0_Q_-lg10 Demo_Day0_P_-lg10 IPvsEMP Demo_Day0_IPvsCTR Demo_Day1_Present Demo_Day1_IP Demo_Day1_Control Demo_Day1_ Fold Demo_Day1_Q_-lg10 Demo_Day1_P_-lg10 IPvsEMP Demo_Day1_IPvsCTR Demo_Day2_Present Demo_Day2_IP Demo_Day2_Control Demo_Day2_ Fold Demo_Day2_Q_-lg10 Demo_Day2_P_-lg10 IPvsEMP Demo_Day2_IPvsCTR Demo_Day3_Present Demo_Day3_IP Demo_Day3_Control Demo_Day3_ Fold Demo_Day3_Q_-lg10 Demo_Day3_P_-lg10 IPvsEMP Demo_Day3_IPvsCTR Demo_Day4_Present Demo_Day4_IP Demo_Day4_Control Demo_Day4_ Fold Demo_Day4_Q_-lg10 Demo_Day4_P_-lg10 IPvsEMP Demo_Day4_IPvsCTR
|
2
|
+
1:3390040 19.0 0 1.0 1.4 0.7 -0.07 999.00 -4.00 0.00 1 10.0 1.6 6.3 2.78 999.00 -1.07 0.00 0 2.0 2.1 1.0 -0.06 999.00 -3.59 0.00 0 5.0 2.7 1.8 0.17 999.00 -0.84 0.00 0 1.0 2.1 0.5 -0.06 999.00 -4.00 0.00
|
3
|
+
1:3667860 16.2 0 2.0 1.4 1.4 -0.02 999.00 -0.71 0.00 0 2.0 1.6 1.3 -0.02 999.00 -2.45 0.00 0 2.0 1.3 1.6 -0.01 999.00 -3.21 0.00 1 9.2 1.9 4.8 2.21 999.00 -0.91 0.00 0 1.0 2.2 0.4 -0.05 999.00 -4.00 0.00
|
4
|
+
1:3722075 33.0 0 7.0 1.4 4.8 1.37 999.00 -0.94 0.00 1 9.0 1.5 6.2 2.40 999.00 -0.83 0.00 0 7.0 1.3 5.5 1.39 999.00 -0.93 0.00 0 5.0 2.1 2.4 0.33 999.00 -0.82 0.00 0 5.0 1.8 2.8 0.44 999.00 -1.60 0.00
|
5
|
+
1:3985092 26.0 0 2.0 1.4 1.4 -0.02 999.00 -2.98 0.00 0 5.0 1.6 3.1 0.52 999.00 -0.70 0.00 1 9.0 1.5 6.1 2.17 999.00 -1.42 0.00 0 5.0 1.6 3.1 0.53 999.00 -0.81 0.00 0 5.0 1.4 3.5 0.61 999.00 -0.84 0.00
|
6
|
+
1:4005442 24.0 0 6.0 1.4 4.2 0.96 999.00 -0.72 0.00 0 4.0 2.1 1.9 0.13 999.00 -0.92 0.00 0 2.0 1.6 1.3 -0.03 999.00 -0.72 0.00 0 2.0 2.1 0.9 -0.04 999.00 -0.83 0.00 1 10.0 1.4 7.0 3.03 999.00 -0.77 0.00
|
7
|
+
1:4083105 39.6 0 10.0 2.7 3.6 1.46 999.00 -1.16 0.00 1 12.8 2.2 5.8 3.64 999.00 -0.97 0.00 0 4.0 3.0 1.3 -0.02 999.00 -1.52 0.00 0 5.9 3.5 1.7 0.17 999.00 -1.34 0.00 0 6.9 2.1 3.3 0.85 999.00 -0.79 0.00
|
8
|
+
1:4367903 19.0 1 9.0 1.4 6.2 2.49 999.00 -1.17 0.00 0 4.0 1.5 2.8 0.32 999.00 -0.79 0.00 0 1.0 1.3 0.8 -0.07 999.00 -4.00 0.00 0 4.0 1.5 2.6 0.30 999.00 -1.07 0.00 0 1.0 1.4 0.7 -0.07 999.00 -4.00 0.00
|
9
|
+
1:4373820 30.0 0 7.0 1.4 4.8 1.37 999.00 -0.80 0.00 0 5.0 1.5 3.4 0.58 999.00 -0.96 0.00 0 4.0 1.3 3.1 0.34 999.00 -0.86 0.00 0 5.0 1.5 3.3 0.56 999.00 -1.06 0.00 1 9.0 1.4 6.3 2.40 999.00 -1.18 0.00
|
10
|
+
1:4443835 31.0 0 6.0 2.1 2.9 0.57 999.00 -0.86 0.00 0 1.0 1.8 0.6 -0.05 999.00 -4.00 0.00 0 8.0 1.4 5.7 1.73 999.00 -0.75 0.00 1 10.0 1.9 5.2 2.21 999.00 -0.90 0.00 0 6.0 1.4 4.2 0.95 999.00 -1.23 0.00
|
11
|
+
1:4527690 22.0 0 3.9 5.4 0.7 -0.06 999.00 -0.71 0.00 0 2.0 2.7 0.8 -0.06 999.00 -2.07 0.00 0 3.7 2.1 1.8 0.12 999.00 -0.99 0.00 1 10.6 2.2 4.7 2.31 999.00 -1.17 0.00 0 1.8 3.7 0.5 -0.06 999.00 -1.32 0.00
|
data/sample/gps2bet.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.push("../lib")
|
4
|
+
|
5
|
+
require 'pp'
|
6
|
+
require 'chipgps'
|
7
|
+
|
8
|
+
#gps_out_file = ARGV.shift
|
9
|
+
gps_out_file = "Demo_2_GPS_significant.txt"
|
10
|
+
gps = Chipgps.new(gps_out_file)
|
11
|
+
|
12
|
+
for condition_id in 0..(gps.num_of_conditions-1)
|
13
|
+
|
14
|
+
exp_name = "Demo_Day" + condition_id.to_s
|
15
|
+
header = "track name=#{exp_name} description=\"GPS: #{exp_name}\" useScore=0"
|
16
|
+
puts header
|
17
|
+
gps.each_by_condition(condition_id) do |event|
|
18
|
+
|
19
|
+
# output (bed format)
|
20
|
+
puts [
|
21
|
+
"chr" + event.chr, # chr
|
22
|
+
event.bp, # start
|
23
|
+
event.bp + 1, # end
|
24
|
+
[exp_name, event.chr, event.bp.to_s].join(":"), # name
|
25
|
+
event.fold_enrichment # score
|
26
|
+
].join("\t")
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
|
12
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
require 'chipgps'
|
15
|
+
|
16
|
+
class Test::Unit::TestCase
|
17
|
+
end
|
@@ -0,0 +1,177 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class Test_Chipgps < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@gps_out_file = Dir.pwd + "/sample/Demo_2_GPS_significant.txt"
|
7
|
+
@gps = Chipgps.new(@gps_out_file)
|
8
|
+
|
9
|
+
@event_c0_e0 = nil
|
10
|
+
@gps.each_by_condition(0) do |event|
|
11
|
+
@event_c0_e0 = event
|
12
|
+
break
|
13
|
+
end
|
14
|
+
|
15
|
+
@event_c2_e0 = nil
|
16
|
+
@gps.each_by_condition(2) do |event|
|
17
|
+
@event_c2_e0 = event
|
18
|
+
break
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_open_gps_out_file
|
23
|
+
assert(FileTest.exist?(@gps_out_file))
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_gps_num_of_conditions
|
27
|
+
assert_equal(5, @gps.num_of_conditions)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_gps_num_of_events
|
31
|
+
assert_equal(11-1, @gps.num_of_events)
|
32
|
+
end
|
33
|
+
|
34
|
+
# event = 0, condition = 0
|
35
|
+
def test_gps_each_by_condition_with_c0_e0
|
36
|
+
assert_equal("1", @event_c0_e0.chr)
|
37
|
+
assert_equal(3390040, @event_c0_e0.bp)
|
38
|
+
assert_equal(19.0, @event_c0_e0.ip)
|
39
|
+
assert_equal(0, @event_c0_e0.ip_binding_present)
|
40
|
+
assert_equal(1.0, @event_c0_e0.ip_binding_strength)
|
41
|
+
assert_equal(1.4, @event_c0_e0.control_binding_strength)
|
42
|
+
assert_equal(0.7, @event_c0_e0.fold_enrichment)
|
43
|
+
assert_equal(-0.07, @event_c0_e0.mlog10_qvalue)
|
44
|
+
assert_equal(999.00, @event_c0_e0.mlog10_pvalue)
|
45
|
+
assert_equal(-4.00, @event_c0_e0.ipvsEMP_KLD)
|
46
|
+
assert_equal(0.00, @event_c0_e0.ipvsCTR_KLD)
|
47
|
+
end
|
48
|
+
|
49
|
+
# event = 0, condition = 2
|
50
|
+
def test_gps_each_by_condition_with_c2_e0
|
51
|
+
assert_equal("1", @event_c2_e0.chr)
|
52
|
+
assert_equal(3390040, @event_c2_e0.bp)
|
53
|
+
assert_equal(19.0, @event_c2_e0.ip)
|
54
|
+
assert_equal(0, @event_c2_e0.ip_binding_present)
|
55
|
+
assert_equal(2.0, @event_c2_e0.ip_binding_strength)
|
56
|
+
assert_equal(2.1, @event_c2_e0.control_binding_strength)
|
57
|
+
assert_equal(1.0, @event_c2_e0.fold_enrichment)
|
58
|
+
assert_equal(-0.06, @event_c2_e0.mlog10_qvalue)
|
59
|
+
assert_equal(999.00, @event_c2_e0.mlog10_pvalue)
|
60
|
+
assert_equal(-3.59, @event_c2_e0.ipvsEMP_KLD)
|
61
|
+
assert_equal(0.00, @event_c2_e0.ipvsCTR_KLD)
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
class Test_Chipgps::Event < Test::Unit::TestCase
|
67
|
+
def setup
|
68
|
+
@gps_out_file = Dir.pwd + "/sample/Demo_2_GPS_significant.txt"
|
69
|
+
@line = File.open(@gps_out_file).readlines[1]
|
70
|
+
@event = Chipgps::Event.new(@line)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
class Test_Chipgps::Search < Test::Unit::TestCase
|
75
|
+
def setup
|
76
|
+
@gps_out_file = Dir.pwd + "/sample/Demo_2_GPS_significant.txt"
|
77
|
+
@line = File.open(@gps_out_file).readlines[1]
|
78
|
+
|
79
|
+
event_number = 0
|
80
|
+
condition_number = 0
|
81
|
+
@event = Chipgps::Search.new(@line, {:event => event_number, :condition => condition_number})
|
82
|
+
|
83
|
+
event_number = 0
|
84
|
+
condition_number = 2
|
85
|
+
@event_0_2 = Chipgps::Search.new(@line, {:event => event_number, :condition => condition_number})
|
86
|
+
end
|
87
|
+
|
88
|
+
# start: event = 0, condition = 0
|
89
|
+
def test_gps_search_search_chr
|
90
|
+
assert_equal("1", @event.chr)
|
91
|
+
end
|
92
|
+
def test_gps_search_search_bp
|
93
|
+
assert_equal(3390040, @event.bp)
|
94
|
+
end
|
95
|
+
def test_gps_search_search_ip
|
96
|
+
assert_equal(19.0, @event.ip)
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_gps_search_search_ip_binding_present
|
100
|
+
assert_equal(0, @event.ip_binding_present)
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_gps_search_search_ip_binding_strength
|
104
|
+
assert_equal(1.0, @event.ip_binding_strength)
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_gps_search_search_control_binding_strength
|
108
|
+
assert_equal(1.4, @event.control_binding_strength)
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_gps_search_search_fold_enrichment
|
112
|
+
assert_equal(0.7, @event.fold_enrichment)
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_gps_search_search_mlog10_qvalue
|
116
|
+
assert_equal(-0.07, @event.mlog10_qvalue)
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_gps_search_search_mlog10_pvalue
|
120
|
+
assert_equal(999.00, @event.mlog10_pvalue)
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_gps_search_search_ipvsEMP_KLD
|
124
|
+
assert_equal(-4.00, @event.ipvsEMP_KLD)
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_gps_search_search_ipvsCTR_KLD
|
128
|
+
assert_equal(0.00, @event.ipvsCTR_KLD)
|
129
|
+
end
|
130
|
+
# end: event = 0, condition = 0
|
131
|
+
|
132
|
+
|
133
|
+
# start: event = 0, condition = 2
|
134
|
+
def test_gps_search_search_chr_by_evnet_0_2
|
135
|
+
assert_equal("1", @event_0_2.chr)
|
136
|
+
end
|
137
|
+
def test_gps_search_search_bp_by_evnet_0_2
|
138
|
+
assert_equal(3390040, @event_0_2.bp)
|
139
|
+
end
|
140
|
+
def test_gps_search_search_ip_by_evnet_0_2
|
141
|
+
assert_equal(19.0, @event_0_2.ip)
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_gps_search_search_ip_binding_present_by_evnet_0_2
|
145
|
+
assert_equal(0, @event_0_2.ip_binding_present)
|
146
|
+
end
|
147
|
+
|
148
|
+
def test_gps_search_search_ip_binding_strength_by_evnet_0_2
|
149
|
+
assert_equal(2.0, @event_0_2.ip_binding_strength)
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_gps_search_search_control_binding_strength_by_evnet_0_2
|
153
|
+
assert_equal(2.1, @event_0_2.control_binding_strength)
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_gps_search_search_fold_enrichment_by_evnet_0_2
|
157
|
+
assert_equal(1.0, @event_0_2.fold_enrichment)
|
158
|
+
end
|
159
|
+
|
160
|
+
def test_gps_search_search_mlog10_qvalue_by_evnet_0_2
|
161
|
+
assert_equal(-0.06, @event_0_2.mlog10_qvalue)
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_gps_search_search_mlog10_pvalue_by_evnet_0_2
|
165
|
+
assert_equal(999.00, @event_0_2.mlog10_pvalue)
|
166
|
+
end
|
167
|
+
|
168
|
+
def test_gps_search_search_ipvsEMP_KLD_by_evnet_0_2
|
169
|
+
assert_equal(-3.59, @event_0_2.ipvsEMP_KLD)
|
170
|
+
end
|
171
|
+
|
172
|
+
def test_gps_search_search_ipvsCTR_KLD_by_evnet_0_2
|
173
|
+
assert_equal(0.00, @event_0_2.ipvsCTR_KLD)
|
174
|
+
end
|
175
|
+
# end: event = 0, condition = 2
|
176
|
+
|
177
|
+
end
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chipgps
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Itoshi NIKAIDO
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-10-20 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bundler
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.0.0
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: jeweler
|
28
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.6.4
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rcov
|
39
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "0"
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *id003
|
48
|
+
description: ChIPgps is an open source Ruby library for parsing result files of the Genome Positioning System which is a software tool to study protein-DNA interaction using ChIP-Seq data.
|
49
|
+
email: dritoshi@gmail.com
|
50
|
+
executables: []
|
51
|
+
|
52
|
+
extensions: []
|
53
|
+
|
54
|
+
extra_rdoc_files:
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.rdoc
|
57
|
+
files:
|
58
|
+
- .document
|
59
|
+
- Gemfile
|
60
|
+
- Gemfile.lock
|
61
|
+
- LICENSE.txt
|
62
|
+
- README.rdoc
|
63
|
+
- Rakefile
|
64
|
+
- VERSION
|
65
|
+
- chipgps.gemspec
|
66
|
+
- lib/chipgps.rb
|
67
|
+
- sample/Demo_2_GPS_significant.txt
|
68
|
+
- sample/gps2bet.rb
|
69
|
+
- test/helper.rb
|
70
|
+
- test/test_chipgps.rb
|
71
|
+
homepage: http://github.com/dritoshi/chipgps
|
72
|
+
licenses:
|
73
|
+
- MIT
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 1295371598341010762
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: "0"
|
94
|
+
requirements: []
|
95
|
+
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 1.8.11
|
98
|
+
signing_key:
|
99
|
+
specification_version: 3
|
100
|
+
summary: Parser for the Genome Positioning System
|
101
|
+
test_files: []
|
102
|
+
|