Skip to content

Commit

Permalink
Rename two funcs to supplement candidates.
Browse files Browse the repository at this point in the history
  • Loading branch information
haowenz authored and swiftgenomics committed Nov 13, 2022
1 parent e5377e7 commit 157e5b1
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 31 deletions.
38 changes: 20 additions & 18 deletions src/candidate_processor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,18 @@ int CandidateProcessor::SupplementCandidates(
int negative_rescue_result = 0;
if (mate_positive_candidates->size() > 0) {
positive_rescue_result =
GenerateCandidatesFromRepetitiveReadWithMateInfo(
error_threshold, index, *minimizers, *repetitive_seed_length,
*negative_hits, *augment_negative_candidates,
*mate_positive_candidates, kNegative, search_range);
GenerateCandidatesFromRepetitiveReadWithMateInfoOnOneStrand(
kNegative, search_range, error_threshold, index, *minimizers,
*mate_positive_candidates, *repetitive_seed_length,
*negative_hits, *augment_negative_candidates);
}

if (mate_negative_candidates->size() > 0) {
negative_rescue_result =
GenerateCandidatesFromRepetitiveReadWithMateInfo(
error_threshold, index, *minimizers, *repetitive_seed_length,
*positive_hits, *augment_positive_candidates,
*mate_negative_candidates, kPositive, search_range);
GenerateCandidatesFromRepetitiveReadWithMateInfoOnOneStrand(
kPositive, search_range, error_threshold, index, *minimizers,
*mate_negative_candidates, *repetitive_seed_length,
*positive_hits, *augment_positive_candidates);
}

// If one of the strand did not supplement due to too many best candidate,
Expand Down Expand Up @@ -262,16 +262,18 @@ void CandidateProcessor::ReduceCandidatesForPairedEndRead(
filtered_negative_candidates1, filtered_positive_candidates2);
}

int CandidateProcessor::GenerateCandidatesFromRepetitiveReadWithMateInfo(
int error_threshold, const Index &index,
const std::vector<Minimizer> &minimizers, uint32_t &repetitive_seed_length,
std::vector<uint64_t> &hits, std::vector<Candidate> &candidates,
const std::vector<Candidate> &mate_candidates, const Strand strand,
uint32_t search_range) const {
int max_seed_count = index.CollectSeedHitsFromRepetitiveReadWithMateInfo(
error_threshold, minimizers, repetitive_seed_length, hits,
mate_candidates, strand, search_range,
min_num_seeds_required_for_mapping_, max_seed_frequencies_[0]);
int CandidateProcessor::
GenerateCandidatesFromRepetitiveReadWithMateInfoOnOneStrand(
const Strand strand, uint32_t search_range, int error_threshold,
const Index &index, const std::vector<Minimizer> &minimizers,
const std::vector<Candidate> &mate_candidates,
uint32_t &repetitive_seed_length, std::vector<uint64_t> &hits,
std::vector<Candidate> &candidates) const {
int max_seed_count =
index.GenerateCandidatePositionsFromRepetitiveReadWithMateInfo(
error_threshold, minimizers, repetitive_seed_length, hits,
mate_candidates, strand, search_range,
min_num_seeds_required_for_mapping_, max_seed_frequencies_[0]);

GenerateCandidatesOnOneStrand(error_threshold, /*num_seeds_required=*/1,
minimizers.size(), hits, candidates);
Expand Down
11 changes: 5 additions & 6 deletions src/candidate_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,12 @@ class CandidateProcessor {
std::vector<uint64_t> &hits,
std::vector<Candidate> &candidates) const;

int GenerateCandidatesFromRepetitiveReadWithMateInfo(
int error_threshold, const Index &index,
const std::vector<Minimizer> &minimizers,
int GenerateCandidatesFromRepetitiveReadWithMateInfoOnOneStrand(
const Strand strand, uint32_t search_range, int error_threshold,
const Index &index, const std::vector<Minimizer> &minimizers,
const std::vector<Candidate> &mate_candidates,
uint32_t &repetitive_seed_length, std::vector<uint64_t> &hits,
std::vector<Candidate> &candidates,
const std::vector<Candidate> &mate_candidates, const Strand strand,
uint32_t search_range) const;
std::vector<Candidate> &candidates) const;

void MergeCandidates(int error_threshold, std::vector<Candidate> &c1,
std::vector<Candidate> &c2,
Expand Down
2 changes: 1 addition & 1 deletion src/chromap.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "temp_mapping.h"
#include "utils.h"

#define CHROMAP_VERSION "0.2.3-r435"
#define CHROMAP_VERSION "0.2.3-r436"

namespace chromap {

Expand Down
2 changes: 1 addition & 1 deletion src/index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ int Index::GenerateCandidatePositions(
return repetitive_seed_count;
}

int Index::CollectSeedHitsFromRepetitiveReadWithMateInfo(
int Index::GenerateCandidatePositionsFromRepetitiveReadWithMateInfo(
int error_threshold, const std::vector<Minimizer> &minimizers,
uint32_t &repetitive_seed_length, std::vector<uint64_t> &hits,
const std::vector<Candidate> &mate_candidates, const Strand strand,
Expand Down
10 changes: 5 additions & 5 deletions src/index.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ class Index {
const CandidatePositionGeneratingConfig &generating_config,
MappingMetadata &mapping_metadata) const;

// Input a search range, for each best mate candidate, serach for minimizer
// hits. Return the minimizer count of the best candidate if it finishes
// normally. Or return a negative value if it stops early due to too many
// candidates with low minimizer count.
int CollectSeedHitsFromRepetitiveReadWithMateInfo(
// Input a search range, for each best mate candidate, serach for candidate
// positions for the read. Return the minimizer count of the best candidate if
// it finishes normally. Or return a negative value if it stops early due to
// too many candidates with low minimizer count.
int GenerateCandidatePositionsFromRepetitiveReadWithMateInfo(
int error_threshold, const std::vector<Minimizer> &minimizers,
uint32_t &repetitive_seed_length, std::vector<uint64_t> &hits,
const std::vector<Candidate> &mate_candidates, const Strand strand,
Expand Down

0 comments on commit 157e5b1

Please sign in to comment.