Class: Bio::DB::Primer3::KASPContainer
- Inherits:
-
Object
- Object
- Bio::DB::Primer3::KASPContainer
- Defined in:
- lib/bio/db/primer3.rb
Instance Attribute Summary collapse
-
#line_1 ⇒ Object
Returns the value of attribute line_1.
-
#line_2 ⇒ Object
Returns the value of attribute line_2.
-
#scores ⇒ Object
Returns the value of attribute scores.
-
#snp_hash ⇒ Object
Returns the value of attribute snp_hash.
Instance Method Summary collapse
- #add_primers_file(filename) ⇒ Object
- #add_snp(snp_in) ⇒ Object
- #add_snp_file(filename) ⇒ Object
- #print_primers ⇒ Object
- #print_primers_with_tails(tail_a: "GAAGGTCGGAGTCAACGGATT", tail_b: "GAAGGTGACCAAGTTCATGCT") ⇒ Object
Instance Attribute Details
#line_1 ⇒ Object
Returns the value of attribute line_1.
753 754 755 |
# File 'lib/bio/db/primer3.rb', line 753 def line_1 @line_1 end |
#line_2 ⇒ Object
Returns the value of attribute line_2.
753 754 755 |
# File 'lib/bio/db/primer3.rb', line 753 def line_2 @line_2 end |
#scores ⇒ Object
Returns the value of attribute scores.
755 756 757 |
# File 'lib/bio/db/primer3.rb', line 755 def scores @scores end |
#snp_hash ⇒ Object
Returns the value of attribute snp_hash.
754 755 756 |
# File 'lib/bio/db/primer3.rb', line 754 def snp_hash @snp_hash end |
Instance Method Details
#add_primers_file(filename) ⇒ Object
787 788 789 790 791 792 793 |
# File 'lib/bio/db/primer3.rb', line 787 def add_primers_file(filename) #primer3record.scores = @scores if @scores Primer3Record.parse_file(filename, scores: @scores) do | primer3record | current_snp = @snp_hash["#{primer3record.snp.to_s}:#{primer3record.chromosome}"] current_snp.add_record(primer3record) end end |
#add_snp(snp_in) ⇒ Object
766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 |
# File 'lib/bio/db/primer3.rb', line 766 def add_snp(snp_in) #TODO: Here we need to also copy the errors that will be printed. @snp_hash=Hash.new unless @snp_hash snp = SNP.new snp.gene = snp_in.gene snp.original = snp_in.original snp.primer3_errors = Set.new snp_in.errors snp.position = snp_in.position snp.snp = snp_in.snp snp.repetitive = snp_in.repetitive #puts snp_in.inspect snp.hit_count = snp_in.hit_count snp.snp_type = snp_in.snp_type snp.line_1 = @line_1 snp.line_2 = @line_2 snp.snp_from = snp_in snp.regions = snp_in.exon_list.values.collect { |x| x.collect {|y| y.target_region.to_s }} @snp_hash[snp.to_s] = snp snp end |
#add_snp_file(filename) ⇒ Object
757 758 759 760 761 762 763 764 |
# File 'lib/bio/db/primer3.rb', line 757 def add_snp_file(filename) @snp_hash=Hash.new unless @snp_hash SNP.parse_file(filename) do |snp| @snp_hash[snp.to_s] = snp snp.line_1 = @line_1 snp.line_2 = @line_2 end end |
#print_primers ⇒ Object
795 796 797 798 799 800 801 |
# File 'lib/bio/db/primer3.rb', line 795 def print_primers str = "" snp_hash.each do |k, snp| str << snp.print_primers << "\n" end return str end |
#print_primers_with_tails(tail_a: "GAAGGTCGGAGTCAACGGATT", tail_b: "GAAGGTGACCAAGTTCATGCT") ⇒ Object
803 804 805 806 807 808 809 810 811 812 813 |
# File 'lib/bio/db/primer3.rb', line 803 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 << "_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 |