bio-polyploid-tools 0.4.0 → 0.4.1

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: 612c7e5e39e8908003387efe2e6ba739b7fb981d
4
- data.tar.gz: eac406e26c6985115884ba53f0c3dadf22bf3e81
3
+ metadata.gz: 8d839159cd2b8aee7e5586e5b04a4fadc1415b90
4
+ data.tar.gz: 30af7856bfe87e382b0e0e8c8890507b743d8057
5
5
  SHA512:
6
- metadata.gz: c9408f36825e70458901b867b3733d878291240b937d120be658c71e5b7d53f22ae2c7023408a9cfb2be385a630ed1fae4e0e321160d6556820baa36a657bc7a
7
- data.tar.gz: 84bf294ab30e62fe758b54274adcca0c1f0f5331a0bc56a2932b2af9d112518c45535b59496f7f33365ef70d10a578946d398b095da473fd5d0af857383f1c10
6
+ metadata.gz: 19893d9fcdf0a5583c1b07d5bf86e8bbc517cd6219bba0d9e0966532756c63be3765f02810758dd4488232cf68edccf55a8d22d9bb07195eb3a94825e7ffba49
7
+ data.tar.gz: 80bdd7c718ab9c05155b8da99cec7ed543e938a942591acd0a53fce8cbe7e797ffb044e48b96734c795a5a9cda8b5cdd269d019766dffa0c5f498207744f9ef9
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
data/bin/polymarker.rb CHANGED
@@ -266,10 +266,10 @@ file = File.open(primer_3_input, "w")
266
266
  #file.puts("PRIMER_THERMODYNAMIC_PARAMETERS_PATH=#{primer_3_config}/")
267
267
 
268
268
  Bio::DB::Primer3.prepare_input_file(file, options[:primer_3_preferences])
269
- container.print_primer_3_exons(file, nil, snp_in)
269
+ added_exons = container.print_primer_3_exons(file, nil, snp_in)
270
270
  file.close
271
271
 
272
- Bio::DB::Primer3.run({:in=>primer_3_input, :out=>primer_3_output})
272
+ Bio::DB::Primer3.run({:in=>primer_3_input, :out=>primer_3_output}) if added_exons > 0
273
273
 
274
274
 
275
275
  #5. Pick the best primer and make the primer3 output
@@ -282,7 +282,7 @@ snps.each do |snp|
282
282
  kasp_container.add_snp(snp)
283
283
  end
284
284
 
285
- kasp_container.add_primers_file(primer_3_output)
285
+ kasp_container.add_primers_file(primer_3_output) if added_exons > 0
286
286
  header = "Marker,SNP,RegionSize,chromosome,total_contigs,contig_regions,SNP_type,#{snp_in},#{original_name},common,primer_type,orientation,#{snp_in}_TM,#{original_name}_TM,common_TM,selected_from,product_size"
287
287
  File.open(output_primers, 'w') { |f| f.write("#{header}\n#{kasp_container.print_primers}") }
288
288
 
@@ -37,7 +37,9 @@ OptionParser.new do |opts|
37
37
  opts.on("-o", "--out CSV", "Output file ") do |o|
38
38
  options[:output] = o
39
39
  end
40
- opts.on()("-f", "--flanking_size INT", "Flanking size around the SNP")
40
+ opts.on("-f", "--flanking_size INT", "Flanking size around the SNP") do |o|
41
+ options[:flanking_size] = o.to_i
42
+ end
41
43
 
42
44
  end.parse!
43
45
  #reference="/Users/ramirezr/Documents/TGAC/references/Triticum_aestivum.IWGSP1.21.dna_rm.genome.fa"
@@ -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.0 ruby lib
5
+ # stub: bio-polyploid-tools 0.4.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "bio-polyploid-tools"
9
- s.version = "0.4.0"
9
+ s.version = "0.4.1"
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-25"
14
+ s.date = "2014-09-26"
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"]
@@ -59,4 +59,6 @@ class Hash
59
59
  def join(keyvaldelim=$,, entrydelim=$,)
60
60
  map {|e| e.join(keyvaldelim) }.join(entrydelim)
61
61
  end
62
- end
62
+ end
63
+
64
+
@@ -5,7 +5,7 @@ module Bio::PolyploidTools
5
5
  attr_reader :parental_1_name, :parental_2_name, :gene_models_db
6
6
  attr_reader :chromosomes, :snp_map
7
7
  attr_reader :parents
8
- attr_accessor :flanking_size
8
+ attr_accessor :flanking_size , :primer_3_min_seq_length
9
9
 
10
10
  BASES = [:A, :C, :G, :T]
11
11
  #Sets the reference file for the gene models
@@ -14,6 +14,7 @@ module Bio::PolyploidTools
14
14
  @parents=Hash.new
15
15
  @snp_map = Hash.new
16
16
  @snp_contigs
17
+ @primer_3_min_seq_length = 50
17
18
  end
18
19
 
19
20
  def gene_models(path)
@@ -126,17 +127,24 @@ module Bio::PolyploidTools
126
127
  end
127
128
 
128
129
  def print_primer_3_exons (file, target_chromosome , parental )
130
+ added = 0
129
131
  @snp_map.each do | gene, snp_array|
130
132
  snp_array.each do |snp|
133
+ string = ""
131
134
  begin
132
- string = snp.primer_3_string( snp.chromosome, parental )
133
- file.puts string if string.size > 0
135
+ primer_3_min_seq_length
136
+ string = snp.primer_3_string( snp.chromosome, parental )
137
+ if string.size > 0
138
+ file.puts string
139
+ added += 1
140
+ end
134
141
  rescue Exception=>e
135
142
  @missing_exons << snp.to_s
136
143
  #$stderr.puts e.to_s
137
144
  end
138
145
  end
139
146
  end
147
+ return added
140
148
  end
141
149
 
142
150
  def add_alignments(opts=Hash.new)
@@ -12,7 +12,7 @@ module Bio::PolyploidTools
12
12
  attr_accessor :template_sequence
13
13
  attr_accessor :use_reference
14
14
  attr_accessor :genomes_count
15
-
15
+ attr_accessor :primer_3_min_seq_length
16
16
  attr_accessor :chromosome
17
17
 
18
18
  #Format:
@@ -35,13 +35,18 @@ module Bio::PolyploidTools
35
35
  end
36
36
 
37
37
  def initialize
38
- @genomes_count = 3 #TODO: if we want to use this with other polyploids, me need to set this as a variable in the main script.
38
+ @genomes_count = 3 #TODO: if we want to use this with other polyploids, me need to set this as a variable in the main script.
39
+ @primer_3_min_seq_length = 50
39
40
  end
40
41
 
41
- def to_polymarker_sequence
42
+ def to_polymarker_sequence(flanking_size)
42
43
  out = template_sequence.clone
43
44
  out[position-1] = "[#{original}/#{snp}]"
44
- out
45
+
46
+ start = position - flanking_size - 1
47
+ start = 0 if start < 0
48
+ total = flanking_size * 2 + 6
49
+ out[start , total ]
45
50
  end
46
51
 
47
52
  def snp_id_in_seq
@@ -283,6 +288,8 @@ module Bio::PolyploidTools
283
288
  primer_3_propertes = Array.new
284
289
 
285
290
  seq_original = String.new(pr.sequence)
291
+ put seq_original.size << "-" << primer_3_min_seq_length
292
+ return primer_3_propertes if seq_original.size < primer_3_min_seq_length
286
293
  seq_original[pr.snp_pos] = self.original
287
294
  seq_original_reverse = reverse_complement_string(seq_original)
288
295
 
@@ -407,16 +414,10 @@ module Bio::PolyploidTools
407
414
  seq[local_pos_in_gene] = self.original
408
415
  end
409
416
  end
410
- #puts "local_pos_in_gene #{local_pos_in_gene}"
411
- #puts "'#{name}' compared to '#{self.snp_in}'"
412
- #puts seq
413
417
  seq[local_pos_in_gene] = seq[local_pos_in_gene].upcase
414
418
  seq[local_pos_in_gene] = self.snp if name == self.snp_in
415
- #puts seq
416
- #puts "__"
417
419
  @surrounding_parental_sequences [name] = cut_and_pad_sequence_to_primer_region(seq)
418
420
  end
419
- # puts "&&&&\n#{surrounding_parental_sequences['A']}\n#{surrounding_parental_sequences['B']}\n&&&&"
420
421
  @surrounding_parental_sequences
421
422
  end
422
423
 
@@ -430,7 +431,6 @@ module Bio::PolyploidTools
430
431
  end
431
432
 
432
433
  def cut_and_pad_sequence_to_primer_region(sequence)
433
- # p "cut_and_pad_sequence_to_primer_region #{local_position} #{flanking_size}"
434
434
  ideal_min = self.local_position - flanking_size
435
435
  ideal_max = self.local_position + flanking_size
436
436
  left_pad = 0
@@ -448,10 +448,7 @@ module Bio::PolyploidTools
448
448
  end
449
449
 
450
450
  def sequences_to_align
451
- p @sequences_to_align.inspect
452
451
  @sequences_to_align = surrounding_parental_sequences.merge(surrounding_exon_sequences) unless @sequences_to_align
453
- # p "sequences_to_align"
454
-
455
452
  @sequences_to_align
456
453
  end
457
454
 
@@ -44,6 +44,7 @@ module Bio::PolyploidTools
44
44
  @position = Regexp.last_match(:pre).size + 1
45
45
  @original = Regexp.last_match(:org)
46
46
  @snp = Regexp.last_match(:snp)
47
+
47
48
  amb_base = Bio::NucleicAcid.to_IUAPC("#{@original}#{@snp}")
48
49
 
49
50
  @template_sequence = "#{Regexp.last_match(:pre)}#{amb_base}#{Regexp.last_match(:pos)}"
@@ -199,9 +199,7 @@ module Bio::DB::Exonerate
199
199
  reg.start = target_snp_pos - flanking_size
200
200
  reg.end = target_snp_pos + flanking_size
201
201
  raise ExonerateException.new "Target Query out of bounds!" unless position.between?(query_start, query_end)
202
- #puts "Flanking region for #{position} in exon between ( #{query_id}:#{query_start}-#{query_end}), the target in #{target_snp_pos} ( #{target_id}:#{target_start}-#{target_end}) "
203
-
204
-
202
+
205
203
  reg
206
204
  end
207
205
 
@@ -226,7 +224,6 @@ module Bio::DB::Exonerate
226
224
  end
227
225
  #THis is in case the position is on a gap.
228
226
  if @target_length == 0 and label == :G
229
- #puts "Returning nil"
230
227
  @snp_in_gap = true
231
228
  ret = target_start
232
229
  end
@@ -17,12 +17,6 @@ module Bio::DB::Primer3
17
17
  end
18
18
 
19
19
  def self.prepare_input_file(file, opts2={})
20
- #file.puts("PRIMER_PRODUCT_SIZE_RANGE=50-150")
21
- #file.puts("PRIMER_MAX_SIZE=25")
22
- #file.puts("PRIMER_LIB_AMBIGUITY_CODES_CONSENSUS=1")
23
- #file.puts("PRIMER_LIBERAL_BASE=1")
24
- #file.puts("PRIMER_NUM_RETURN=5")
25
- #file.puts("PRIMER_THERMODYNAMIC_PARAMETERS_PATH=#{primer_3_config}/")
26
20
  opts = {
27
21
  :primer_product_size_range => "50-150" ,
28
22
  :primer_max_size => 25 ,
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.0
4
+ version: 0.4.1
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-25 00:00:00.000000000 Z
11
+ date: 2014-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bio