Commit 7b69c877 authored by Haowen Zhang's avatar Haowen Zhang Committed by Li Song
Browse files

Separate header for Candidate.

parent 8ebe012e
Loading
Loading
Loading
Loading

src/candidate.h

0 → 100644
+21 −0
Original line number Diff line number Diff line
#ifndef CANDIDATE_H_
#define CANDIDATE_H_

namespace chromap {

struct Candidate {
  uint64_t position;
  uint8_t count;

  bool operator<(const Candidate &c) const {
    if (count != c.count) {
      return count > c.count;
    }

    return position < c.position;
  }
};

}  // namespace chromap

#endif  // CANDIDATE_H_
+12 −12
Original line number Diff line number Diff line
@@ -1321,14 +1321,14 @@ void Chromap<MappingRecord>::MapPairedEndReads() {

  read_batch1.SetSeqEffectiveRange(read1_format_[0], read1_format_[1], 1);
  read_batch2.SetSeqEffectiveRange(read2_format_[0], read2_format_[1], 1);
  barcode_batch.SetSeqEffectiveRange(barcode_format_[0], barcode_format_[1], barcode_format_[2]);
  barcode_batch.SetSeqEffectiveRange(barcode_format_[0], barcode_format_[1],
                                     barcode_format_[2]);
  read_batch1_for_loading.SetSeqEffectiveRange(read1_format_[0],
                                               read1_format_[1], 1);
  read_batch2_for_loading.SetSeqEffectiveRange(read2_format_[0],
                                               read2_format_[1], 1);
  barcode_batch_for_loading.SetSeqEffectiveRange(barcode_format_[0],
                                                 barcode_format_[1],
                                                 barcode_format_[2]);
  barcode_batch_for_loading.SetSeqEffectiveRange(
      barcode_format_[0], barcode_format_[1], barcode_format_[2]);

  // Initialize cache
  mm_cache mm_to_candidates_cache(2000003);
@@ -2756,10 +2756,10 @@ void Chromap<MappingRecord>::MapSingleEndReads() {
  read_batch.SetSeqEffectiveRange(read1_format_[0], read1_format_[1], 1);
  read_batch_for_loading.SetSeqEffectiveRange(read1_format_[0],
                                              read1_format_[1], 1);
  barcode_batch.SetSeqEffectiveRange(barcode_format_[0], barcode_format_[1], barcode_format_[2]);
  barcode_batch_for_loading.SetSeqEffectiveRange(barcode_format_[0],
                                                 barcode_format_[1],
  barcode_batch.SetSeqEffectiveRange(barcode_format_[0], barcode_format_[1],
                                     barcode_format_[2]);
  barcode_batch_for_loading.SetSeqEffectiveRange(
      barcode_format_[0], barcode_format_[1], barcode_format_[2]);

  mappings_on_diff_ref_seqs_.reserve(num_reference_sequences);
  deduped_mappings_on_diff_ref_seqs_.reserve(num_reference_sequences);
+2 −11
Original line number Diff line number Diff line
@@ -5,18 +5,9 @@
#include <utility>
#include <vector>

namespace chromap {
#include "candidate.h"

struct Candidate {
  uint64_t position;
  uint8_t count;
  bool operator<(const Candidate &c) const {
    if (count != c.count)
      return count > c.count;
    else
      return position < c.position;
  }
};
namespace chromap {

class mm_cache;
class Index;
+5 −4
Original line number Diff line number Diff line
@@ -212,7 +212,8 @@ class SequenceBatch {
  static constexpr char uint8_to_char_table_[8] = {'A', 'C', 'G', 'T',
                                                   'N', 'N', 'N', 'N'};
  void ReplaceByEffectiveRange(kstring_t &seq) {
    if (effective_range_[0] == 0 && effective_range_[1] == -1 && effective_range_[2] == 1) {
    if (effective_range_[0] == 0 && effective_range_[1] == -1 &&
        effective_range_[2] == 1) {
      return;
    }
    int i, j;