lib/bio/db/primer3.rb in bio-polyploid-tools-0.10.1 vs lib/bio/db/primer3.rb in bio-polyploid-tools-1.0.0

- old
+ new

@@ -127,16 +127,16 @@ @values << regions.size @values << regions.join("|") @values << snp_type if primer3_line_1 and primer3_line_2 #Block that searches both if both pairs have a TM - primer_2 = primer3_line_2.left_primer_with_coordinates(primer3_line_1.left_coordinates, primer3_line_1.orientation) - primer_2_tm = find_left_primer_temp(primer_2) - primer_1 = primer3_line_1.left_primer_with_coordinates(primer3_line_2.left_coordinates, primer3_line_2.orientation) + primer_1 = primer3_line_1.left_primer_with_coordinates(primer3_line_2.left_coordinates, primer3_line_2.orientation) primer_1_tm = find_left_primer_temp(primer_1) - # $stderr.puts primer_1 - # $stderr.puts primer_2 + + primer_2 = primer3_line_2.left_primer_with_coordinates(primer3_line_1.left_coordinates, primer3_line_1.orientation) + primer_2_tm = find_left_primer_temp(primer_2) + if primer3_line_1 < primer3_line_2 and primer_2_tm != "NA" @values << primer3_line_1.left_primer @values << primer_2 @values << primer3_line_1.right_primer @values << primer3_line_1.type.to_s @@ -157,11 +157,11 @@ @values << primer3_line_2.best_pair.right.tm @values << "second" @values << primer3_line_2.best_pair.product_size else - first_candidate = find_primer_pair_first + first_candidate = find_primer_pair_first second_candidate = find_primer_pair_second if first_candidate primer_2 = primer3_line_2.left_primer_with_coordinates(first_candidate.left_coordinates, first_candidate.orientation) primer_2_tm = find_left_primer_temp(primer_2) @@ -181,11 +181,11 @@ @values << first_candidate.type.to_s @values << first_candidate.orientation.to_s @values << first_candidate.best_pair.left.tm @values << primer_2_tm @values << first_candidate.best_pair.right.tm - @values << "first" + @values << "first-" @values << first_candidate.best_pair.product_size elsif second_candidate #puts "B" @values << primer_1 @values << second_candidate.left_primer @@ -193,11 +193,11 @@ @values << second_candidate.type.to_s @values << second_candidate.orientation.to_s @values << primer_1_tm @values << second_candidate.best_pair.left.tm @values << second_candidate.best_pair.right.tm - @values << "second" + @values << "second-" @values << second_candidate.best_pair.product_size elsif first_candidate #puts "C" @values << first_candidate.left_primer @values << primer_2 @@ -205,11 +205,11 @@ @values << first_candidate.type.to_s @values << first_candidate.orientation.to_s @values << primer_2_tm @values << first_candidate.best_pair.left.tm @values << first_candidate.best_pair.right.tm - @values << "first" + @values << "first/" @values << first_candidate.best_pair.product_size end end elsif primer3_line_1 @@ -275,11 +275,10 @@ return self.values[16].to_i if self.values[16]&& self.values[16] != nil return 0 end def orientation - puts "insideOrientation: #{self.values[11]}" return self.values[11] if self.values[11]&& self.values[11] != nil return 'unknown' end @@ -383,11 +382,11 @@ primers_line_1 << primer3record #puts primer3record.inspect @primer3_line_1 = primer3record if not @primer3_line_1 or @primer3_line_1 > primer3record when primer3record.line == @line_2 primers_line_2 << primer3record - @primer3_line_2 = primer3record if not @primer3_line_2 or @primer3_line_2 > primer3record + @primer3_line_2 = primer3record if not @primer3_line_2 or @primer3_line_2 > primer3record else raise Primer3Exception.new "#{primer3record.line} is not recognized (#{line_1}, #{line_2})" end else primer3_errors << "#{primer3record.line}(#{primer3record.orientation}):#{primer3record.primer_left_explain.gsub!(',',';')}" @@ -506,13 +505,11 @@ end def left_primer_with_coordinates(coordinates, other_orientation) seq = self.sequence_template - #puts "Left coordinates: #{seq}" - seq = Primer3Record.reverse_complement_string(seq) if self.orientation != other_orientation - + seq = Primer3Record.reverse_complement_string(seq) if self.orientation != other_orientation seq[coordinates[0],coordinates[1]] end def self.reverse_complement_string(sequenc_str) complement = sequenc_str.tr('atgcrymkdhvbswnATGCRYMKDHVBSWN', 'tacgyrkmhdbvswnTACGYRKMHDBVSWN') @@ -805,12 +802,12 @@ def print_primers_with_tails(tail_a: "GAAGGTCGGAGTCAACGGATT", tail_b: "GAAGGTGACCAAGTTCATGCT") str = "" snp_hash.each do |k, snp| if snp.found_primers? - str << snp.gene << snp.original << "\t" << tail_a << snp.first_primer << "\n" - str << snp.gene << snp.snp << "\t" << tail_b << snp.second_primer << "\n" - str << snp.gene << "\t" << snp.common_primer << "\n" + str << snp.gene << snp.original << "_1st\t" << tail_a << snp.first_primer << "\n" + str << snp.gene << snp.snp << "_2nd\t" << tail_b << snp.second_primer << "\n" + str << snp.gene << "_common\t" << snp.common_primer << "\n" end end return str end