Class: Qu::Pcr::Primer3Parser
- Inherits:
-
Object
- Object
- Qu::Pcr::Primer3Parser
- Defined in:
- lib/qu/pcr/primer3.rb
Overview
Amplicon
Instance Method Summary collapse
-
#initialize(p3_out) ⇒ Primer3Parser
constructor
A new instance of Primer3Parser.
- #records ⇒ Object
Constructor Details
#initialize(p3_out) ⇒ Primer3Parser
102 103 104 105 106 107 |
# File 'lib/qu/pcr/primer3.rb', line 102 def initialize(p3_out) if p3_out.class != String $stderr.puts "\tNeed primer3 output file content (not file name) for parsing." end @p3_out = p3_out end |
Instance Method Details
#records ⇒ Object
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 |
# File 'lib/qu/pcr/primer3.rb', line 129 def records p3_hash = {} p3_record = parse p3_record.each do |record| seq_id = record['SEQUENCE_ID'] if record.has_key?('PRIMER_ERROR') $stderr.puts "\t#{record['PRIMER_ERROR']}" return p3_hash end pp_num = record['PRIMER_PAIR_NUM_RETURNED'].to_i if pp_num < 1 $stderr.puts "\tFailed design for %s" % [seq_id] $stderr.puts "\tLeft: #{record['PRIMER_LEFT_EXPLAIN']}" $stderr.puts "\tRight: #{record['PRIMER_RIGHT_EXPLAIN']}" $stderr.puts "\INTERNAL: #{record['PRIMER_INTERNAL_EXPLAIN']}" if record.has_key?("PRIMER_INTERNAL_EXPLAIN") $stderr.puts "\tPair: #{record['PRIMER_PAIR_EXPLAIN']}" end p3_hash[seq_id] = [] (0...pp_num).each do |i| p3_hash[seq_id] << Amplicon.new(record, i, type='primer3') end end return p3_hash end |