mismatches = options[:mismatches]
Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
- aux_hash = {}
-
input.each_record do |record|
if record.has_key? :SEQ
found_tag = nil
end
if mismatches > 0 and found_tag.nil?
- if aux_hash.has_key? tag10
- found_tag = tag10
- elsif aux_hash.has_key? tag11
- found_tag = tag11
- end
-
if found_tag.nil?
gsmid_hash.each_pair do |mid, mid_name|
hamming_dist = tag10.to_s.hamming_distance(mid.to_s)
if hamming_dist <= mismatches
found_tag = mid
- aux_hash[tag10] = mid_name
-
break
end
end
if hamming_dist <= mismatches
found_tag = mid
- aux_hash[tag11] = mid_name
-
break
end
end
SEQ_NAME: test_RL12_2_mismatches_repeat
SEQ: gtgactgact
SEQ_LEN: 10
-MID: ACTCACCTCGT
-MID_NAME:
+MID: ACTCGCGTCGT
+MID_NAME: RL12
MID_POS: 4
MID_LEN: 11
-MID_MISMATCHES: 0
+MID_MISMATCHES: 2
---
SEQ_NAME: test_GS99_0_mismatches
SEQ: gtagtagtagt
SEQ_NAME: test_GS99_2_mismatches_repeat
SEQ: gtagtagtagt
SEQ_LEN: 11
-MID: CTGTTCAGAC
-MID_NAME:
+MID: CTGTACATAC
+MID_NAME: MID99
MID_POS: 4
MID_LEN: 10
-MID_MISMATCHES: 0
+MID_MISMATCHES: 2
---