Class: Bio::DB::Primer3::SNP
- Inherits:
-
Object
- Object
- Bio::DB::Primer3::SNP
- Defined in:
- lib/bio/db/primer3.rb
Instance Attribute Summary collapse
-
#chromosome ⇒ Object
Returns the value of attribute chromosome.
-
#gene ⇒ Object
Returns the value of attribute gene.
-
#line_1 ⇒ Object
Returns the value of attribute line_1.
-
#line_2 ⇒ Object
Returns the value of attribute line_2.
-
#original ⇒ Object
Returns the value of attribute original.
-
#position ⇒ Object
Returns the value of attribute position.
-
#primer3_errors ⇒ Object
Returns the value of attribute primer3_errors.
-
#primer3_line_1 ⇒ Object
Returns the value of attribute primer3_line_1.
-
#primer3_line_2 ⇒ Object
Returns the value of attribute primer3_line_2.
-
#primers_line_1 ⇒ Object
Returns the value of attribute primers_line_1.
-
#primers_line_2 ⇒ Object
Returns the value of attribute primers_line_2.
-
#regions ⇒ Object
Returns the value of attribute regions.
-
#snp ⇒ Object
Returns the value of attribute snp.
-
#snp_from ⇒ Object
Returns the value of attribute snp_from.
-
#template_length ⇒ Object
Returns the value of attribute template_length.
-
#used_contigs ⇒ Object
Returns the value of attribute used_contigs.
Class Method Summary collapse
Instance Method Summary collapse
- #add_record(primer3record) ⇒ Object
- #find_left_primer_temp(primer) ⇒ Object
- #find_primer_pair_first ⇒ Object
- #find_primer_pair_second ⇒ Object
-
#initialize ⇒ SNP
constructor
A new instance of SNP.
- #line_1_name ⇒ Object
- #line_2_name ⇒ Object
- #print_primers ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ SNP
Returns a new instance of SNP.
67 68 69 70 71 |
# File 'lib/bio/db/primer3.rb', line 67 def initialize @primers_line_1 = SortedSet.new @primers_line_2 = SortedSet.new @reguibs = SortedSet.new end |
Instance Attribute Details
#chromosome ⇒ Object
Returns the value of attribute chromosome.
55 56 57 |
# File 'lib/bio/db/primer3.rb', line 55 def chromosome @chromosome end |
#gene ⇒ Object
Returns the value of attribute gene.
55 56 57 |
# File 'lib/bio/db/primer3.rb', line 55 def gene @gene end |
#line_1 ⇒ Object
Returns the value of attribute line_1.
55 56 57 |
# File 'lib/bio/db/primer3.rb', line 55 def line_1 @line_1 end |
#line_2 ⇒ Object
Returns the value of attribute line_2.
55 56 57 |
# File 'lib/bio/db/primer3.rb', line 55 def line_2 @line_2 end |
#original ⇒ Object
Returns the value of attribute original.
55 56 57 |
# File 'lib/bio/db/primer3.rb', line 55 def original @original end |
#position ⇒ Object
Returns the value of attribute position.
55 56 57 |
# File 'lib/bio/db/primer3.rb', line 55 def position @position end |
#primer3_errors ⇒ Object
Returns the value of attribute primer3_errors.
61 62 63 |
# File 'lib/bio/db/primer3.rb', line 61 def primer3_errors @primer3_errors end |
#primer3_line_1 ⇒ Object
Returns the value of attribute primer3_line_1.
56 57 58 |
# File 'lib/bio/db/primer3.rb', line 56 def primer3_line_1 @primer3_line_1 end |
#primer3_line_2 ⇒ Object
Returns the value of attribute primer3_line_2.
56 57 58 |
# File 'lib/bio/db/primer3.rb', line 56 def primer3_line_2 @primer3_line_2 end |
#primers_line_1 ⇒ Object
Returns the value of attribute primers_line_1.
57 58 59 |
# File 'lib/bio/db/primer3.rb', line 57 def primers_line_1 @primers_line_1 end |
#primers_line_2 ⇒ Object
Returns the value of attribute primers_line_2.
57 58 59 |
# File 'lib/bio/db/primer3.rb', line 57 def primers_line_2 @primers_line_2 end |
#regions ⇒ Object
Returns the value of attribute regions.
60 61 62 |
# File 'lib/bio/db/primer3.rb', line 60 def regions @regions end |
#snp ⇒ Object
Returns the value of attribute snp.
55 56 57 |
# File 'lib/bio/db/primer3.rb', line 55 def snp @snp end |
#snp_from ⇒ Object
Returns the value of attribute snp_from.
59 60 61 |
# File 'lib/bio/db/primer3.rb', line 59 def snp_from @snp_from end |
#template_length ⇒ Object
Returns the value of attribute template_length.
56 57 58 |
# File 'lib/bio/db/primer3.rb', line 56 def template_length @template_length end |
#used_contigs ⇒ Object
Returns the value of attribute used_contigs.
58 59 60 |
# File 'lib/bio/db/primer3.rb', line 58 def used_contigs @used_contigs end |
Class Method Details
Instance Method Details
#add_record(primer3record) ⇒ Object
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
# File 'lib/bio/db/primer3.rb', line 270 def add_record(primer3record) @primer3_errors = Array.new unless @primer3_errors @template_length = primer3record.sequence_template.size if primer3record.primer_error != nil primer3_errors << primer3record return end case when primer3record.line == @line_1 @line_1_template = primer3record.sequence_template when primer3record.line == @line_2 @line_2_template = primer3record.sequence_template else raise Primer3Exception.new "#{primer3record.line} is not recognized (#{line_1}, #{line_2})" end if primer3record.primer_left_num_returned.to_i > 0 case when primer3record.line == @line_1 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 else raise Primer3Exception.new "#{primer3record.line} is not recognized (#{line_1}, #{line_2})" end end end |
#find_left_primer_temp(primer) ⇒ Object
81 82 83 84 85 86 87 88 89 |
# File 'lib/bio/db/primer3.rb', line 81 def find_left_primer_temp(primer) primers_line_1.each do |pr| return pr.find_left_tm(primer) if pr.find_left_tm(primer) end primers_line_2.each do |pr| return pr.find_left_tm(primer) if pr.find_left_tm(primer) end return "NA" end |
#find_primer_pair_first ⇒ Object
92 93 94 95 96 97 98 |
# File 'lib/bio/db/primer3.rb', line 92 def find_primer_pair_first primers_line_1.each do |pr| primer = pr.left_primer_snp(self) return pr if find_left_primer_temp(primer) != "NA" end nil end |
#find_primer_pair_second ⇒ Object
100 101 102 103 104 105 106 |
# File 'lib/bio/db/primer3.rb', line 100 def find_primer_pair_second primers_line_2.each do |pr| primer = pr.left_primer_snp(self) return pr if find_left_primer_temp(primer) != "NA" end nil end |
#line_1_name ⇒ Object
63 64 65 |
# File 'lib/bio/db/primer3.rb', line 63 def line_1_name "#{gene}:#{position}#{original}>#{snp} #{line_1}}" end |
#line_2_name ⇒ Object
73 74 75 |
# File 'lib/bio/db/primer3.rb', line 73 def line_2_name "#{gene}:#{position}#{original}>#{snp} #{line_2}}" end |
#print_primers ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/bio/db/primer3.rb', line 109 def print_primers #TODO: Retrieve error messages left_start = 0 left_end = 0 right_start = 0 right_end = 0 # exons = snp_from.exon_list.values # puts "Exons: #{exon_list.size}" # puts "It has the following exons: #{snp_in.exon_list.to_s}" values = Array.new #values << "#{gene},,#{template_length}," values << gene values << "#{original}#{position}#{snp}" values << template_length values << snp_from.chromosome values << regions.size values << regions.join("|") if primer3_line_1 and primer3_line_2 values << primer3_line_1.polymorphism #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_tm = find_left_primer_temp(primer_1) # $stderr.puts primer_1 # $stderr.puts 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 values << primer3_line_1.orientation.to_s values << primer3_line_1.best_pair.left.tm values << primer_2_tm values << primer3_line_1.best_pair.right.tm values << "first" values << primer3_line_1.best_pair.product_size elsif primer_1_tm != "NA" values << primer_1 values << primer3_line_2.left_primer values << primer3_line_2.right_primer values << primer3_line_2.type.to_s values << primer3_line_2.orientation.to_s values << primer_1_tm values << primer3_line_2.best_pair.left.tm 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 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) end if second_candidate #puts "input to search #{first_candidate.left_coordinates}" primer_1 = primer3_line_1.left_primer_with_coordinates(second_candidate.left_coordinates, second_candidate.orientation) primer_1_tm = find_left_primer_temp(primer_1) #puts "In the other funky if #{primer_2}" end if first_candidate and second_candidate and first_candidate < second_candidate #puts "A" values << first_candidate.left_primer values << primer_2 values << first_candidate.right_primer 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_candidate.best_pair.product_size elsif second_candidate #puts "B" values << primer_1 values << second_candidate.left_primer values << second_candidate.right_primer 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_candidate.best_pair.product_size elsif first_candidate #puts "C" values << first_candidate.left_primer values << primer_2 values << first_candidate.right_primer 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_candidate.best_pair.product_size # else # values << "" end end elsif primer3_line_1 values << primer3_line_1.polymorphism values << primer3_line_1.left_primer values << primer3_line_1.left_primer_snp(self) values << primer3_line_1.right_primer values << primer3_line_1.type.to_s values << primer3_line_1.orientation.to_s values << primer3_line_1.best_pair.left.tm values << "NA" values << primer3_line_1.best_pair.right.tm values << "first+" values << primer3_line_1.best_pair.product_size elsif primer3_line_2 values << primer3_line_2.polymorphism values << primer3_line_2.left_primer_snp(self) values << primer3_line_2.left_primer values << primer3_line_2.right_primer values << primer3_line_2.type.to_s values << primer3_line_2.orientation.to_s values << "NA" values << primer3_line_2.best_pair.left.tm values << primer3_line_2.best_pair.right.tm values << "second+" values << primer3_line_2.best_pair.product_size end values.join(",") end |
#to_s ⇒ Object
77 78 79 |
# File 'lib/bio/db/primer3.rb', line 77 def to_s "#{gene}:#{original}#{position}#{snp}:#{snp_from.chromosome}" end |