bio-polyploid-tools 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/filter_blat_by_target_coverage.rb +1 -1
- data/bin/filter_exonerate_by_identity.rb +38 -0
- data/bin/polymarker.rb +8 -2
- data/bio-polyploid-tools.gemspec +5 -4
- data/lib/bio/db/exonerate.rb +78 -32
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 330ed2e80e9d4bc4146e88f1705633cde7554dc6
|
4
|
+
data.tar.gz: 123b1efc4cb49358be17f1913ed68af241b8232b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5eec1a30cdb7365d1bccae60e0c5b89b4939dbae7b928d0d30d1bc88b4b2f193b710894120d756f252c2b76d93b7c3bcf700e9b729973f15481325978fcf049
|
7
|
+
data.tar.gz: e84c2c06bd35049fd90c7b4a8a7a475a59030e757ee0a7506c68ab9aa4419818c3ddc389a820f9de35b4c839d81b8efd3a25c3ff284f8e4d8940ca11b8de71c9
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.0
|
@@ -43,7 +43,7 @@ options[:identity] = 95
|
|
43
43
|
options[:covered] = 60
|
44
44
|
OptionParser.new do |opts|
|
45
45
|
|
46
|
-
opts.banner = "Usage:
|
46
|
+
opts.banner = "Usage: filter_blat_by_target_coverage.rb [options]"
|
47
47
|
|
48
48
|
opts.on("-p", "--psl FILE", "PSL file") do |o|
|
49
49
|
options[:blat_file] = o.upcase
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'bio'
|
3
|
+
require 'optparse'
|
4
|
+
$: << File.expand_path(File.dirname(__FILE__) + '/../lib')
|
5
|
+
$: << File.expand_path('.')
|
6
|
+
path= File.expand_path(File.dirname(__FILE__) + '/../lib/bioruby-polyploid-tools.rb')
|
7
|
+
require path
|
8
|
+
|
9
|
+
options = {}
|
10
|
+
options[:identity] = 95
|
11
|
+
options[:covered] = 90
|
12
|
+
OptionParser.new do |opts|
|
13
|
+
|
14
|
+
opts.banner = "Usage: filter_exonerate_by_identity.rb [options]"
|
15
|
+
|
16
|
+
opts.on("-e", "--exo FILE", "Exonerate alignment produced by polymarker or with the following ryo: 'RESULT:\\t%S\\t%pi\\t%ql\\t%tl\\t%g\\t%V\\n'") do |o|
|
17
|
+
options[:exo_file] = o.upcase
|
18
|
+
end
|
19
|
+
opts.on("-i", "--identity FLOAT", "Minimum percentage identity") do |o|
|
20
|
+
options[:identity] = o.to_f
|
21
|
+
end
|
22
|
+
opts.on("-c", "--covered FLOAT", "Minimum percentage coverage") do |o|
|
23
|
+
options[:covered] = o.to_f
|
24
|
+
end
|
25
|
+
|
26
|
+
end.parse!
|
27
|
+
|
28
|
+
|
29
|
+
exo_file = options[:exo_file]
|
30
|
+
min_identity = options[:identity];
|
31
|
+
min_coverage = options[:covered]
|
32
|
+
File.foreach(exo_file) do |line|
|
33
|
+
aln = Bio::DB::Exonerate::Alignment.parse_custom(line)
|
34
|
+
if aln.identity > min_identity and aln.query_coverage > min_coverage
|
35
|
+
puts aln.line
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
data/bin/polymarker.rb
CHANGED
@@ -51,6 +51,7 @@ options[:arm_selection] = arm_selection_functions[:arm_selection_embl] ;
|
|
51
51
|
options[:flanking_size] = 150;
|
52
52
|
options[:variation_free_region] = 0
|
53
53
|
options[:extract_found_contigs] = false
|
54
|
+
options[:genomes_count] = 3
|
54
55
|
options[:primer_3_preferences] = {
|
55
56
|
:primer_product_size_range => "50-150" ,
|
56
57
|
:primer_max_size => 25 ,
|
@@ -71,6 +72,10 @@ OptionParser.new do |opts|
|
|
71
72
|
opts.on("-m", "--marker_list FILE", "File with the list of markers to search from") do |o|
|
72
73
|
options[:marker_list] = o
|
73
74
|
end
|
75
|
+
|
76
|
+
opts.on("-g", "--genomes_count INT", "Number of genomes (default 3, for hexaploid)") do |o|
|
77
|
+
options[:genomes_count] = o.to_i
|
78
|
+
end
|
74
79
|
|
75
80
|
opts.on("-s", "--snp_list FILE", "File with the list of snps to search from, requires --reference to get the sequence using a position") do |o|
|
76
81
|
options[:snp_list] = o
|
@@ -124,7 +129,7 @@ if options[:primer_3_preferences][:primer_product_size_range]
|
|
124
129
|
range_arr = range.split("-")
|
125
130
|
min = range_arr[0].to_i
|
126
131
|
max = range_arr[1].to_i
|
127
|
-
raise Bio::DB::Exonerate::ExonerateException.new "
|
132
|
+
raise Bio::DB::Exonerate::ExonerateException.new "Range #{range} is invalid!" unless max > min
|
128
133
|
options[:flanking_size] = max
|
129
134
|
end
|
130
135
|
|
@@ -214,7 +219,8 @@ File.open(test_file) do | f |
|
|
214
219
|
rise Bio::DB::Exonerate::ExonerateException.new "Wrong number of arguments. "
|
215
220
|
end
|
216
221
|
rise Bio::DB::Exonerate::ExonerateException.new "No SNP for line '#{line}'" if snp == nil
|
217
|
-
|
222
|
+
|
223
|
+
snp.genomes_count = options[:genomes_count]
|
218
224
|
snp.snp_in = snp_in
|
219
225
|
snp.original_name = original_name
|
220
226
|
if snp.position
|
data/bio-polyploid-tools.gemspec
CHANGED
@@ -2,19 +2,19 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: bio-polyploid-tools 0.
|
5
|
+
# stub: bio-polyploid-tools 0.7.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "bio-polyploid-tools"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.7.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Ricardo H. Ramirez-Gonzalez"]
|
14
|
-
s.date = "2015-
|
14
|
+
s.date = "2015-05-08"
|
15
15
|
s.description = "Repository of tools developed in TGAC and Crop Genetics in JIC to work with polyploid wheat"
|
16
16
|
s.email = "ricardo.ramirez-gonzalez@tgac.ac.uk"
|
17
|
-
s.executables = ["bfr.rb", "count_variations.rb", "filter_blat_by_target_coverage.rb", "find_best_blat_hit.rb", "find_best_exonerate.rb", "hexaploid_primers.rb", "homokaryot_primers.rb", "map_markers_to_contigs.rb", "markers_in_region.rb", "polymarker.rb", "snp_position_to_polymarker.rb", "snps_between_bams.rb"]
|
17
|
+
s.executables = ["bfr.rb", "count_variations.rb", "filter_blat_by_target_coverage.rb", "filter_exonerate_by_identity.rb", "find_best_blat_hit.rb", "find_best_exonerate.rb", "hexaploid_primers.rb", "homokaryot_primers.rb", "map_markers_to_contigs.rb", "markers_in_region.rb", "polymarker.rb", "snp_position_to_polymarker.rb", "snps_between_bams.rb"]
|
18
18
|
s.extra_rdoc_files = [
|
19
19
|
"README",
|
20
20
|
"README.md"
|
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
"bin/bfr.rb",
|
30
30
|
"bin/count_variations.rb",
|
31
31
|
"bin/filter_blat_by_target_coverage.rb",
|
32
|
+
"bin/filter_exonerate_by_identity.rb",
|
32
33
|
"bin/find_best_blat_hit.rb",
|
33
34
|
"bin/find_best_exonerate.rb",
|
34
35
|
"bin/hexaploid_primers.rb",
|
data/lib/bio/db/exonerate.rb
CHANGED
@@ -18,8 +18,8 @@ module Bio::DB::Exonerate
|
|
18
18
|
query=opts[:query]
|
19
19
|
#
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
cmdline = "exonerate --verbose 0 --showalignment no --bestn #{opts[:bestn]} --showvulgar no --model #{opts[:model]} --ryo '#{opts[:ryo]}' #{query} #{target}"
|
22
|
+
status, stdout, stderr = systemu cmdline
|
23
23
|
#$stderr.puts cmdline
|
24
24
|
if status.exitstatus == 0
|
25
25
|
alns = Array.new unless block_given?
|
@@ -67,45 +67,91 @@ module Bio::DB::Exonerate
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
def
|
71
|
-
|
70
|
+
def query
|
71
|
+
unless @query
|
72
|
+
@query = Bio::DB::Fasta::Region.new()
|
73
|
+
@query.entry = query_id
|
74
|
+
@query.start = query_start + 1
|
75
|
+
@query.end = query_end
|
76
|
+
@query.orientation = query_strand
|
77
|
+
if @query.orientation == :reverse
|
78
|
+
@query.end = query_start
|
79
|
+
@query.start = query_end + 1
|
80
|
+
end
|
81
|
+
@query
|
82
|
+
end
|
83
|
+
@query
|
84
|
+
end
|
85
|
+
|
86
|
+
def target
|
87
|
+
unless @target
|
88
|
+
@target = Bio::DB::Fasta::Region.new()
|
89
|
+
@target.entry = target_id
|
90
|
+
@target.start = target_start + 1
|
91
|
+
@target.end = target_end
|
92
|
+
@target.orientation = target_strand
|
93
|
+
if @target.orientation == :reverse
|
94
|
+
@target.end = target_start
|
95
|
+
@target.start = target_end + 1
|
96
|
+
end
|
72
97
|
end
|
98
|
+
@target
|
99
|
+
end
|
73
100
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
@target_strand = :reverse
|
87
|
-
else
|
88
|
-
raise ExonerateException.new(), "Ivalid target orientation #{@target_strand} for line:\n#{sugar_str}"
|
101
|
+
def identity
|
102
|
+
@pi
|
103
|
+
end
|
104
|
+
def query_length
|
105
|
+
@ql
|
106
|
+
end
|
107
|
+
def query_coverage
|
108
|
+
total_m = 0
|
109
|
+
vulgar_block.each do |v|
|
110
|
+
#p v.label
|
111
|
+
if v.label == :M
|
112
|
+
total_m += v.query_length
|
89
113
|
end
|
114
|
+
end
|
115
|
+
#puts "Total m #{total_m}"
|
116
|
+
#puts "ql #{query_length}"
|
117
|
+
return 100.00 * total_m.to_f / query_length.to_f
|
118
|
+
end
|
90
119
|
|
120
|
+
def parse_sugar(sugar_str)
|
121
|
+
@query_id, @query_start, @query_end, @query_strand, @target_id, @target_start, @target_end, @target_strand, @score = sugar_str.split(/\s+/)
|
91
122
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
raise ExonerateException.new(), "Ivalid query orientation #{@query_strand} for line:\n#{sugar_str}"
|
98
|
-
end
|
123
|
+
@query_start = @query_start.to_i
|
124
|
+
@query_end = @query_end.to_i
|
125
|
+
@target_start = @target_start.to_i
|
126
|
+
@target_end = @target_end.to_i
|
127
|
+
@score = @score.to_f
|
99
128
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
129
|
+
if @target_strand == "+"
|
130
|
+
@target_strand = :forward
|
131
|
+
elsif @target_strand == "-"
|
132
|
+
@target_strand = :reverse
|
133
|
+
else
|
134
|
+
raise ExonerateException.new(), "Ivalid target orientation #{@target_strand} for line:\n#{sugar_str}"
|
135
|
+
end
|
104
136
|
|
105
137
|
|
106
|
-
|
138
|
+
if @query_strand == "+"
|
139
|
+
@query_strand = :forward
|
140
|
+
elsif @query_strand == "-"
|
141
|
+
@query_strand = :reverse
|
142
|
+
else
|
143
|
+
raise ExonerateException.new(), "Ivalid query orientation #{@query_strand} for line:\n#{sugar_str}"
|
107
144
|
end
|
108
145
|
|
146
|
+
raise ExonerateException.new(), "Inconsistent orientation (forward, query)" if @query_strand == :forward and @query_start > @query_end
|
147
|
+
raise ExonerateException.new(), "Inconsistent orientation (reverse, query)" if @query_strand == :reverse and @query_start < @query_end
|
148
|
+
raise ExonerateException.new(), "Inconsistent orientation (forward, target)" if @target_strand == :forward and @target_start > @target_end
|
149
|
+
raise ExonerateException.new(), "Inconsistent orientation (reverse, target)" if @target_strand == :reverse and @target_start < @target_end
|
150
|
+
|
151
|
+
|
152
|
+
self
|
153
|
+
end
|
154
|
+
|
109
155
|
|
110
156
|
#The vulgar has to be parsed AFTER the sugar, otherwise it is impossible to determine the orientations
|
111
157
|
def parse_vulgar(vulgar_str)
|
@@ -199,7 +245,7 @@ module Bio::DB::Exonerate
|
|
199
245
|
reg.start = target_snp_pos - flanking_size
|
200
246
|
reg.end = target_snp_pos + flanking_size
|
201
247
|
raise ExonerateException.new "Target Query out of bounds!" unless position.between?(query_start, query_end)
|
202
|
-
|
248
|
+
|
203
249
|
reg
|
204
250
|
end
|
205
251
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bio-polyploid-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo H. Ramirez-Gonzalez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bio
|
@@ -87,6 +87,7 @@ executables:
|
|
87
87
|
- bfr.rb
|
88
88
|
- count_variations.rb
|
89
89
|
- filter_blat_by_target_coverage.rb
|
90
|
+
- filter_exonerate_by_identity.rb
|
90
91
|
- find_best_blat_hit.rb
|
91
92
|
- find_best_exonerate.rb
|
92
93
|
- hexaploid_primers.rb
|
@@ -110,6 +111,7 @@ files:
|
|
110
111
|
- bin/bfr.rb
|
111
112
|
- bin/count_variations.rb
|
112
113
|
- bin/filter_blat_by_target_coverage.rb
|
114
|
+
- bin/filter_exonerate_by_identity.rb
|
113
115
|
- bin/find_best_blat_hit.rb
|
114
116
|
- bin/find_best_exonerate.rb
|
115
117
|
- bin/hexaploid_primers.rb
|