Commit 9b016207 authored by mourisl's avatar mourisl Committed by Li Song
Browse files

Fix an issue of MD string, where 0 is inserted between adjacent mismatches and...

Fix an issue of MD string, where 0 is inserted between adjacent mismatches and the end of the MD string
parent 4673c364
Loading
Loading
Loading
Loading
+7 −11
Original line number Diff line number Diff line
@@ -110,10 +110,9 @@ void GenerateNMAndMDTag(const char *pattern, const char *text,
        } else {
          // a mismatch
          ++mapping_in_memory.NM;
          if (num_matches != 0) {
          
          mapping_in_memory.MD_tag.append(std::to_string(num_matches));
          num_matches = 0;
          }
          mapping_in_memory.MD_tag.push_back(reference[reference_position]);
        }
        ++reference_position;
@@ -124,10 +123,9 @@ void GenerateNMAndMDTag(const char *pattern, const char *text,
      read_position += num_cigar_operations;
    } else if (cigar_operation == BAM_CDEL) {
      mapping_in_memory.NM += num_cigar_operations;
      if (num_matches != 0) {
      
      mapping_in_memory.MD_tag.append(std::to_string(num_matches));
      num_matches = 0;
      }
      mapping_in_memory.MD_tag.push_back('^');
      for (int opi = 0; opi < num_cigar_operations; ++opi) {
        mapping_in_memory.MD_tag.push_back(reference[reference_position]);
@@ -137,10 +135,8 @@ void GenerateNMAndMDTag(const char *pattern, const char *text,
      std::cerr << "Unexpected cigar op: " << (int)cigar_operation << "\n";
    }
  }
  if (num_matches != 0) {
  mapping_in_memory.MD_tag.append(std::to_string(num_matches));
}
}

int BandedAlignPatternToText(int error_threshold, const char *pattern,
                             const char *text, const int read_length,
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@
#include "temp_mapping.h"
#include "utils.h"

#define CHROMAP_VERSION "0.2.7-r493"
#define CHROMAP_VERSION "0.2.7-r494"

namespace chromap {