Skip to content

Commit

Permalink
Add mapq filter in caller
Browse files Browse the repository at this point in the history
  • Loading branch information
ldenti committed Nov 27, 2023
1 parent b539e8f commit ef12b20
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions clusterer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ bool Clusterer::load_batch(int p) {
spdlog::warn("Non primary alignment.. Is bam file smoothed?");
continue;
}
if (aln->core.qual < config->min_mapq)
continue;
char *qname = bam_get_qname(aln);
if (SFSs->find(qname) == SFSs->end())
continue;
Expand Down Expand Up @@ -527,6 +529,8 @@ void Clusterer::fill_clusters() {
if (aln->core.flag & BAM_FUNMAP || aln->core.flag & BAM_FSUPPLEMENTARY ||
aln->core.flag & BAM_FSECONDARY)
continue;
if (aln->core.qual < config->min_mapq)
continue;
int hp_t = bam_aux_get(aln, "HP") != NULL
? bam_aux2i(bam_aux_get(aln, "HP"))
: 0;
Expand Down
3 changes: 3 additions & 0 deletions config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Configuration::Configuration()
("bsize", "", cxxopts::value<int>())
("omax", "", cxxopts::value<int>())
("min-sv-length", "", cxxopts::value<int>())
("min-mapq", "", cxxopts::value<int>())
("min-cluster-weight", "", cxxopts::value<int>())
("clipped", "", cxxopts::value<bool>()->default_value("false"))
("noref", "", cxxopts::value<bool>()->default_value("false"))
Expand Down Expand Up @@ -84,6 +85,8 @@ void Configuration::parse(int argc, char **argv) {
min_sv_length = max(25, results["min-sv-length"].as<int>());
if (results.count("min-cluster-weight"))
min_cluster_weight = results["min-cluster-weight"].as<int>();
if (results.count("min-mapq"))
min_mapq = results["min-mapq"].as<int>();
if (results.count("l"))
min_ratio = results["l"].as<float>();
if (results.count("acc"))
Expand Down
2 changes: 2 additions & 0 deletions config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static const char CALL_USAGE_MESSAGE[] =
" --min-cluster-weight <INT> minimum number of supporting superstrings for a call to be reported (default: 2)\n"
" --min-sv-length <INT> minimum length of reported SVs (default: 25)\n"
" --noref do not report 0/0 calls\n"
" --min-mapq minimum mapping quality (default: 20)\n"
" --clipped calls SVs from clipped SFS (EXPERIMENTAL)\n"
" --threads <INT> number of threads to use (default: 4)\n"
" --help print help message\n";
Expand Down Expand Up @@ -79,6 +80,7 @@ class Configuration {
uint flank = 100;
uint ksize = 7;
uint min_sv_length = 25;
uint min_mapq = 20;
int min_indel_length = 20;
uint min_cluster_weight = 2;
float min_ratio = 0.97; // FIXME: change name
Expand Down

0 comments on commit ef12b20

Please sign in to comment.