bio-polyploid-tools 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1cc46774ab2f15eaee35b984c144c44c122802ef
4
- data.tar.gz: 36ab34ac34994a67bd56eb9748a6106bffd3045f
3
+ metadata.gz: e18c33d6f59147dfc491ff461b64d29a8633f1d2
4
+ data.tar.gz: 715a7c85a2543040aac59aa877df1af68fb9eac9
5
5
  SHA512:
6
- metadata.gz: 9d08e9a320ce0994620c3687915f96cb7badf54a59f8ec3fda15bdc7497638d6d2dac815d8eadb2ac9d279b0fb781cc8d4e284dd6542cdc89a0b579b183f804a
7
- data.tar.gz: 24e83bd8221a30a89f0307bfa6079b7876ea9af135192093af89cae9fd29f643022a5b02de5152faa2f9d0846fed9077e1667460674122bb0c4b12be2cfd4c75
6
+ metadata.gz: b1fffb8d0e4a70d30632f9db81a51c5292f7867d3e64f66f468a9875b3336885b3952bb3fbb701ba4470d9e5bab66fd43638565c0f83540d7937f0e1100f5bb7
7
+ data.tar.gz: 4938c8487632b74f53778b695cc896d3bcf542e1a9e92eca24076b2d6b6fbe3744c18df1258bee751a0d5491d7d6cc99120b2429d0c597fe53c7cec387dbf288
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.4.3
@@ -1,15 +1,69 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'bio'
3
+ require 'optparse'
3
4
  $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
4
5
  $: << File.expand_path('.')
5
6
  path= File.expand_path(File.dirname(__FILE__) + '/../lib/bioruby-polyploid-tools.rb')
6
7
  require path
8
+ module Bio
9
+ class Blat
10
+ class StreamedReport < Report
7
11
 
8
- blat_file=ARGV[0]
12
+ def self.each_hit(text = '')
13
+ flag = false
14
+ head = []
9
15
 
10
- blat_aln = Bio::Blat::Report.new(Bio::FlatFile.open(blat_file).to_io)
11
- blat_aln.each_hit() do |hit|
12
- if hit.percentage_covered >= 50
16
+ text.each_line do |line|
17
+ if flag then
18
+ yield Hit.new(line)
19
+ else
20
+ # for headerless data
21
+ if /^\d/ =~ line then
22
+ flag = true
23
+ redo
24
+ end
25
+ line = line.chomp
26
+ if /\A\-+\s*\z/ =~ line
27
+ flag = true
28
+ else
29
+ head << line
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+
39
+ #blat_file=ARGV[0]
40
+
41
+ options = {}
42
+ options[:identity] = 95
43
+ options[:covered] = 60
44
+ OptionParser.new do |opts|
45
+
46
+ opts.banner = "Usage: polymarker.rb [options]"
47
+
48
+ opts.on("-p", "--psl FILE", "PSL file") do |o|
49
+ options[:blat_file] = o.upcase
50
+ end
51
+ opts.on("-i", "--identity FLOAT", "Minimum percentage identity") do |o|
52
+ options[:identity] = o.to_f
53
+ end
54
+ opts.on("-c", "--covered FLOAT", "Minimum percentage coverage") do |o|
55
+ options[:covered] = o.to_f
56
+ end
57
+
58
+ end.parse!
59
+
60
+
61
+ blat_file = options[:blat_file]
62
+
63
+ Bio::Blat::StreamedReport.each_hit(Bio::FlatFile.open(blat_file).to_io) do |hit|
64
+ if hit.percentage_covered >= options[:covered] and hit.percent_identity >= options[:identity]
13
65
  puts hit.data.join("\t")
14
66
  end
15
- end
67
+ end
68
+
69
+
@@ -28,5 +28,6 @@ best_aln = Hash.new
28
28
  load_blat_alignments( blat_file,best_aln)
29
29
  puts "QUERY\tTARGET"
30
30
  best_aln.each do |k, hit|
31
- puts "#{k}\t#{hit.target_id}"
31
+ #puts "#{k}\t#{hit.target_id}"
32
+ puts hit.data.join("\t")
32
33
  end
@@ -2,16 +2,16 @@
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.4.2 ruby lib
5
+ # stub: bio-polyploid-tools 0.4.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "bio-polyploid-tools"
9
- s.version = "0.4.2"
9
+ s.version = "0.4.3"
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 = "2014-09-26"
14
+ s.date = "2014-10-04"
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
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"]
@@ -128,6 +128,7 @@ module Bio::PolyploidTools
128
128
 
129
129
  def print_primer_3_exons (file, target_chromosome , parental )
130
130
  added = 0
131
+
131
132
  @snp_map.each do | gene, snp_array|
132
133
  snp_array.each do |snp|
133
134
  string = ""
@@ -140,7 +141,8 @@ module Bio::PolyploidTools
140
141
  end
141
142
  rescue Exception=>e
142
143
  @missing_exons << snp.to_s
143
- #$stderr.puts e.to_s
144
+
145
+ $stderr.puts e.to_s
144
146
  end
145
147
  end
146
148
  end
@@ -288,7 +288,7 @@ module Bio::PolyploidTools
288
288
  primer_3_propertes = Array.new
289
289
 
290
290
  seq_original = String.new(pr.sequence)
291
- put seq_original.size << "-" << primer_3_min_seq_length
291
+ #puts seq_original.size.to_s << "-" << primer_3_min_seq_length.to_s
292
292
  return primer_3_propertes if seq_original.size < primer_3_min_seq_length
293
293
  seq_original[pr.snp_pos] = self.original
294
294
  seq_original_reverse = reverse_complement_string(seq_original)
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.2
4
+ version: 0.4.3
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: 2014-09-26 00:00:00.000000000 Z
11
+ date: 2014-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bio