bio-polyploid-tools 0.4.4 → 0.4.5
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/bio-polyploid-tools.gemspec +2 -2
- data/lib/bio/PolyploidTools/SNP.rb +2 -1
- data/lib/bio/db/primer3.rb +68 -78
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e11509fcfcbe8aa33caccd377dd0eca756713ef
|
4
|
+
data.tar.gz: ee00b6ac0ca58b233e3154caf2cc3e00b909a869
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50afb04d54bd58599d730cfe44bcf7f8e51ec2aea62af870ebca9af0e685fc7a68e06da8a82b82973f1f8dcd6cb3f3414b1b93753dd64e37b19d12473b46adc1
|
7
|
+
data.tar.gz: 3b2313544ce3954ca7e6f0c6ca4e4de32255329468511a662ea15abb87e5cbcc038328371d93d3213c6daba56b453bb2f0bac5660e3009010414f4284fdac2a9
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.5
|
data/bio-polyploid-tools.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
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.
|
5
|
+
# stub: bio-polyploid-tools 0.4.5 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "bio-polyploid-tools"
|
9
|
-
s.version = "0.4.
|
9
|
+
s.version = "0.4.5"
|
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"]
|
@@ -265,7 +265,7 @@ module Bio::PolyploidTools
|
|
265
265
|
str << "=\n"
|
266
266
|
|
267
267
|
|
268
|
-
#In case that we don't have a right primer,
|
268
|
+
#In case that we don't have a right primer, we do both orientations
|
269
269
|
unless opts[:right_pos]
|
270
270
|
sequence = opts[:sequence]
|
271
271
|
left = sequence.size - left - 1
|
@@ -290,6 +290,7 @@ module Bio::PolyploidTools
|
|
290
290
|
seq_original = String.new(pr.sequence)
|
291
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
294
|
seq_original[pr.snp_pos] = self.original
|
294
295
|
seq_original_reverse = reverse_complement_string(seq_original)
|
295
296
|
|
data/lib/bio/db/primer3.rb
CHANGED
@@ -141,11 +141,11 @@ module Bio::DB::Primer3
|
|
141
141
|
values << primer3_line_1.right_primer
|
142
142
|
values << primer3_line_1.type.to_s
|
143
143
|
values << primer3_line_1.orientation.to_s
|
144
|
-
values << primer3_line_1.
|
144
|
+
values << primer3_line_1.best_pair.left.tm
|
145
145
|
values << primer_2_tm
|
146
|
-
values << primer3_line_1.
|
146
|
+
values << primer3_line_1.best_pair.right.tm
|
147
147
|
values << "first"
|
148
|
-
values << primer3_line_1.
|
148
|
+
values << primer3_line_1.best_pair.product_size
|
149
149
|
elsif primer_1_tm != "NA"
|
150
150
|
values << primer_1
|
151
151
|
values << primer3_line_2.left_primer
|
@@ -153,60 +153,62 @@ module Bio::DB::Primer3
|
|
153
153
|
values << primer3_line_2.type.to_s
|
154
154
|
values << primer3_line_2.orientation.to_s
|
155
155
|
values << primer_1_tm
|
156
|
-
values << primer3_line_2.
|
157
|
-
values << primer3_line_2.
|
156
|
+
values << primer3_line_2.best_pair.left.tm
|
157
|
+
values << primer3_line_2.best_pair.right.tm
|
158
158
|
values << "second"
|
159
|
-
values << primer3_line_2.
|
159
|
+
values << primer3_line_2.best_pair.product_size
|
160
160
|
else
|
161
161
|
|
162
162
|
first_candidate = find_primer_pair_first
|
163
163
|
second_candidate = find_primer_pair_second
|
164
164
|
|
165
165
|
if first_candidate
|
166
|
-
|
167
|
-
#puts "input to search #{first_candidate.left_coordinates}"
|
168
166
|
primer_2 = primer3_line_2.left_primer_with_coordinates(first_candidate.left_coordinates, first_candidate.orientation)
|
169
167
|
primer_2_tm = find_left_primer_temp(primer_2)
|
170
|
-
#puts "In the funky if #{primer_2}"
|
171
168
|
end
|
172
169
|
if second_candidate
|
170
|
+
#puts "input to search #{first_candidate.left_coordinates}"
|
173
171
|
primer_1 = primer3_line_1.left_primer_with_coordinates(second_candidate.left_coordinates, second_candidate.orientation)
|
174
172
|
primer_1_tm = find_left_primer_temp(primer_1)
|
173
|
+
#puts "In the other funky if #{primer_2}"
|
175
174
|
end
|
176
175
|
|
177
176
|
if first_candidate and second_candidate and first_candidate < second_candidate
|
177
|
+
#puts "A"
|
178
178
|
values << first_candidate.left_primer
|
179
179
|
values << primer_2
|
180
180
|
values << first_candidate.right_primer
|
181
181
|
values << first_candidate.type.to_s
|
182
182
|
values << first_candidate.orientation.to_s
|
183
|
-
values << first_candidate.
|
183
|
+
values << first_candidate.best_pair.left.tm
|
184
184
|
values << primer_2_tm
|
185
|
-
values << first_candidate.
|
185
|
+
values << first_candidate.best_pair.right.tm
|
186
186
|
values << "first"
|
187
|
-
values << first_candidate.
|
187
|
+
values << first_candidate.best_pair.product_size
|
188
188
|
elsif second_candidate
|
189
|
+
#puts "B"
|
189
190
|
values << primer_1
|
190
191
|
values << second_candidate.left_primer
|
191
192
|
values << second_candidate.right_primer
|
192
193
|
values << second_candidate.type.to_s
|
193
194
|
values << second_candidate.orientation.to_s
|
194
195
|
values << primer_1_tm
|
195
|
-
values << second_candidate.
|
196
|
-
values << second_candidate.
|
196
|
+
values << second_candidate.best_pair.left.tm
|
197
|
+
values << second_candidate.best_pair.right.tm
|
197
198
|
values << "second"
|
198
|
-
values << second_candidate.
|
199
|
+
values << second_candidate.best_pair.product_size
|
199
200
|
elsif first_candidate
|
200
|
-
|
201
|
+
#puts "C"
|
201
202
|
values << first_candidate.left_primer
|
203
|
+
values << primer_2
|
202
204
|
values << first_candidate.right_primer
|
203
205
|
values << first_candidate.type.to_s
|
204
206
|
values << first_candidate.orientation.to_s
|
205
207
|
values << primer_2_tm
|
206
|
-
values << first_candidate.
|
207
|
-
values << first_candidate.
|
208
|
+
values << first_candidate.best_pair.left.tm
|
209
|
+
values << first_candidate.best_pair.right.tm
|
208
210
|
values << "first"
|
209
|
-
values << first_candidate.
|
211
|
+
values << first_candidate.best_pair.product_size
|
210
212
|
# else
|
211
213
|
# values << ""
|
212
214
|
end
|
@@ -220,12 +222,12 @@ module Bio::DB::Primer3
|
|
220
222
|
values << primer3_line_1.right_primer
|
221
223
|
values << primer3_line_1.type.to_s
|
222
224
|
values << primer3_line_1.orientation.to_s
|
223
|
-
values << primer3_line_1.
|
225
|
+
values << primer3_line_1.best_pair.left.tm
|
224
226
|
values << "NA"
|
225
|
-
values << primer3_line_1.
|
227
|
+
values << primer3_line_1.best_pair.right.tm
|
226
228
|
|
227
229
|
values << "first+"
|
228
|
-
values << primer3_line_1.
|
230
|
+
values << primer3_line_1.best_pair.product_size
|
229
231
|
elsif primer3_line_2
|
230
232
|
values << primer3_line_2.polymorphism
|
231
233
|
values << primer3_line_2.left_primer_snp(self)
|
@@ -234,10 +236,10 @@ module Bio::DB::Primer3
|
|
234
236
|
values << primer3_line_2.type.to_s
|
235
237
|
values << primer3_line_2.orientation.to_s
|
236
238
|
values << "NA"
|
237
|
-
values << primer3_line_2.
|
238
|
-
values << primer3_line_2.
|
239
|
+
values << primer3_line_2.best_pair.left.tm
|
240
|
+
values << primer3_line_2.best_pair.right.tm
|
239
241
|
values << "second+"
|
240
|
-
values << primer3_line_2.
|
242
|
+
values << primer3_line_2.best_pair.product_size
|
241
243
|
|
242
244
|
end
|
243
245
|
values.join(",")
|
@@ -274,7 +276,9 @@ module Bio::DB::Primer3
|
|
274
276
|
end
|
275
277
|
case
|
276
278
|
when primer3record.line == @line_1
|
279
|
+
|
277
280
|
@line_1_template = primer3record.sequence_template
|
281
|
+
|
278
282
|
when primer3record.line == @line_2
|
279
283
|
@line_2_template = primer3record.sequence_template
|
280
284
|
else
|
@@ -283,10 +287,11 @@ module Bio::DB::Primer3
|
|
283
287
|
|
284
288
|
if primer3record.primer_left_num_returned.to_i > 0
|
285
289
|
case
|
286
|
-
when primer3record.line == @
|
290
|
+
when primer3record.line == @line_2
|
287
291
|
primers_line_1 << primer3record
|
292
|
+
#puts primer3record.inspect
|
288
293
|
@primer3_line_1 = primer3record if not @primer3_line_1 or @primer3_line_1 > primer3record
|
289
|
-
when primer3record.line == @
|
294
|
+
when primer3record.line == @line_1
|
290
295
|
primers_line_2 << primer3record
|
291
296
|
@primer3_line_2 = primer3record if not @primer3_line_2 or @primer3_line_2 > primer3record
|
292
297
|
else
|
@@ -299,15 +304,18 @@ module Bio::DB::Primer3
|
|
299
304
|
class Primer3Record
|
300
305
|
include Comparable
|
301
306
|
attr_accessor :properties, :polymorphism
|
307
|
+
attr_accessor :socres
|
302
308
|
|
303
|
-
|
304
|
-
|
305
|
-
@
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
309
|
+
|
310
|
+
def best_pair
|
311
|
+
return @best_pair if @best_pair
|
312
|
+
#@best_pair = nil
|
313
|
+
#@primerPairs.each do | primer |
|
314
|
+
# @best_pair = primer if @best_pair == nil
|
315
|
+
# @best_pair = primer if primer.size < @best_pair.size
|
316
|
+
#end
|
317
|
+
@best_pair = @primerPairs.first
|
318
|
+
@best_pair
|
311
319
|
end
|
312
320
|
|
313
321
|
def primer_error
|
@@ -335,44 +343,16 @@ module Bio::DB::Primer3
|
|
335
343
|
return nil
|
336
344
|
end
|
337
345
|
|
338
|
-
def
|
339
|
-
ret =
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
if anOther.type != :chromosome_specific
|
346
|
-
return -1
|
347
|
-
end
|
348
|
-
elsif type == :chromosome_semispecific
|
349
|
-
if anOther.type == :chromosome_specific
|
350
|
-
return 1
|
351
|
-
else anOther.type == :chromosome_nonspecific
|
352
|
-
return -1
|
353
|
-
end
|
354
|
-
elsif type == :chromosome_nonspecific
|
355
|
-
if anOther.type != :chromosome_nonspecific
|
356
|
-
return 1
|
357
|
-
end
|
358
|
-
end
|
359
|
-
|
360
|
-
#Sorting if it is in intron or not This will give priority
|
361
|
-
#to the cases when we know for sure the sequence from the line
|
362
|
-
#and reduce the chances of getting messed with a short indel
|
363
|
-
if self.exon?
|
364
|
-
unless anOther.exon?
|
365
|
-
return -1
|
366
|
-
end
|
367
|
-
else
|
368
|
-
if anOther.exon?
|
369
|
-
return 1
|
370
|
-
end
|
371
|
-
end
|
372
|
-
|
373
|
-
#Sorting for how long the product is, the shorter, the better
|
374
|
-
return product_length <=> anOther.product_length
|
346
|
+
def score
|
347
|
+
ret = 0
|
348
|
+
ret += @scores[type]
|
349
|
+
ret += @scores[:exon] if exon?
|
350
|
+
ret -= product_length
|
351
|
+
ret
|
352
|
+
end
|
375
353
|
|
354
|
+
def <=>(anOther)
|
355
|
+
return anOther.score <=> score
|
376
356
|
end
|
377
357
|
|
378
358
|
def parse_coordinates(str)
|
@@ -385,13 +365,13 @@ module Bio::DB::Primer3
|
|
385
365
|
|
386
366
|
def left_coordinates
|
387
367
|
#@left_coordinates = parse_coordinates(self.primer_left_0) unless @left_coordinates
|
388
|
-
@left_coordinates =
|
368
|
+
@left_coordinates = best_pair.left.coordinates
|
389
369
|
@left_coordinates
|
390
370
|
end
|
391
371
|
|
392
372
|
def right_coordinates
|
393
373
|
unless @right_coordinates
|
394
|
-
@right_coordinates =
|
374
|
+
@right_coordinates = best_pair.right.coordinates
|
395
375
|
@right_coordinates[0] = @right_coordinates[0] - @right_coordinates[1] + 1
|
396
376
|
end
|
397
377
|
@right_coordinates
|
@@ -399,7 +379,7 @@ module Bio::DB::Primer3
|
|
399
379
|
|
400
380
|
def left_primer
|
401
381
|
#@left_primer = self.sequence_template[left_coordinates[0],left_coordinates[1]] unless @left_primer
|
402
|
-
@left_primer =
|
382
|
+
@left_primer = best_pair.left.sequence
|
403
383
|
@left_primer
|
404
384
|
end
|
405
385
|
|
@@ -448,15 +428,21 @@ module Bio::DB::Primer3
|
|
448
428
|
end
|
449
429
|
|
450
430
|
def right_primer
|
451
|
-
return
|
431
|
+
return best_pair.right.sequence
|
452
432
|
end
|
453
433
|
|
454
434
|
def product_length
|
455
|
-
return
|
435
|
+
return best_pair.size
|
456
436
|
end
|
457
437
|
|
458
438
|
def initialize
|
459
439
|
@properties = Hash.new
|
440
|
+
@scores = Hash.new
|
441
|
+
@scores[:chromosome_specific] = 1000
|
442
|
+
@scores[:chromosome_semispecific] = 100
|
443
|
+
@scores[:chromosome_nonspecific] = 0
|
444
|
+
@scores[:exon] = 50
|
445
|
+
|
460
446
|
end
|
461
447
|
|
462
448
|
def snp
|
@@ -587,7 +573,7 @@ module Bio::DB::Primer3
|
|
587
573
|
end
|
588
574
|
|
589
575
|
class PrimerPair
|
590
|
-
|
576
|
+
include Comparable
|
591
577
|
attr_reader :record
|
592
578
|
attr_reader :left, :right
|
593
579
|
|
@@ -602,6 +588,10 @@ module Bio::DB::Primer3
|
|
602
588
|
return product_size.to_i
|
603
589
|
end
|
604
590
|
|
591
|
+
def <=>(anOther)
|
592
|
+
penalty.to_f <=> anOther.penalty.to_f
|
593
|
+
end
|
594
|
+
|
605
595
|
def initialize(record, index)
|
606
596
|
raise Primer3Exception.new(), "Index #{index} is greater than the number of records" unless index < record.size
|
607
597
|
@record = record
|