Skip to content

Commit

Permalink
Merge branch 'v2.7' into 'master'
Browse files Browse the repository at this point in the history
v2.7.1

See merge request stat/graphtyper-github!2
  • Loading branch information
hannespetur committed Mar 31, 2021
2 parents b1a69e8 + 63a3b38 commit ffb1ab2
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include(ExternalProject)
# The version number
set (graphtyper_VERSION_MAJOR 2)
set (graphtyper_VERSION_MINOR 7)
set (graphtyper_VERSION_PATCH 0)
set (graphtyper_VERSION_PATCH 1)
set(STATIC_DIR "" CACHE STRING "If set, GraphTyper will be built as a static binary using libraries from the given STATIC_DIR.")

# Get the current working branch
Expand Down
2 changes: 1 addition & 1 deletion include/graphtyper/utilities/options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Options
bool is_csi{false};
bool force_align_both_orientations{false};
int sam_flag_filter{3840};
long max_files_open{576}; // Maximum amount of SAM/BAM/CRAM files can be opened at the same time
long max_files_open{864}; // Maximum amount of SAM/BAM/CRAM files can be opened at the same time
long soft_cap_of_variants_in_100_bp_window{22};
bool get_sample_names_from_filename{false};
bool output_all_variants{false};
Expand Down
2 changes: 1 addition & 1 deletion src/graph/constructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,7 @@ add_var_record(std::vector<VarRecord> & var_records,
assert(key == "GT_HAPLOTYPE");
auto const val_ul = std::stoul(val_str);
ref.anti_events.insert(val_ul);
alt.anti_events.insert(-val_ul);
//alt.anti_events.insert(-val_ul);
}
} // for (auto const & val : values)
} // for (auto const & info : infos)
Expand Down
31 changes: 16 additions & 15 deletions src/typer/caller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ namespace

#ifndef NDEBUG
std::string const debug_read_name = "HISEQ1:33:H9YY4ADXX:1:2110:2792:58362/2";
long debug_event_pos{699214};
char debug_event_type{'D'};
std::size_t debug_event_size{3};
long debug_event_pos{15001};
char debug_event_type{'X'};
std::size_t debug_event_size{1};
#endif // NDEBUG


Expand Down Expand Up @@ -1017,13 +1017,13 @@ run_first_pass(bam1_t * hts_rec,
}
else
{
//#ifndef NDEBUG
// if (debug_event_type == 'X' && snp.pos == debug_event_pos)
// {
// BOOST_LOG_TRIVIAL(info) << __HERE__ << " debug snp has bad support " << snp.to_string() << " "
// << info.to_string() << " file_i=" << file_i;
// }
//#endif // DEBUG
#ifndef NDEBUG
if (debug_event_type == 'X' && snp.pos == debug_event_pos)
{
BOOST_LOG_TRIVIAL(info) << __HERE__ << " debug snp has bad support " << snp.to_string() << " "
<< info.to_string() << " file_i=" << file_i;
}
#endif // DEBUG

snp_it = bucket.events.erase(snp_it);
}
Expand Down Expand Up @@ -1233,9 +1233,10 @@ run_first_pass(bam1_t * hts_rec,
if (support_ratio < 0.3)
support_ratio = 0.3;

// 0 low coverage or ambigous
// 0 low coverage
// 1 support
// 2 anti support
// 3 ambigous
auto is_good_support =
[&cov_down, &region_begin, &support_ratio]
(long local_cov,
Expand Down Expand Up @@ -1285,7 +1286,7 @@ run_first_pass(bam1_t * hts_rec,
return IS_ANY_HAP_SUPPORT;
}

return 0;
return IS_ANY_ANTI_HAP_SUPPORT | IS_ANY_HAP_SUPPORT;
};

// check this bucket
Expand Down Expand Up @@ -2179,9 +2180,9 @@ realign_to_indels(std::vector<Tindel_events::iterator> const & realignment_indel

double const count = correction * (indel_info.hq_count + indel_info.lq_count);

bool const is_good_count = (indel_info.hq_count >= 5 && count >= 8.0) ||
(indel_info.span >= 9 && indel_info.hq_count >= 5 && count >= 7.0) ||
(indel_info.span >= 18 && indel_info.hq_count >= 4 && count >= 6.0);
bool const is_good_count = (indel_info.hq_count >= 5 && count >= 5.5) ||
(indel_info.span >= 5 && indel_info.hq_count >= 4 && count >= 5.0) ||
(indel_info.span >= 15 && indel_info.hq_count >= 3 && count >= 4.5);

#ifndef NDEBUG
if (debug_event_type == indel.type &&
Expand Down
4 changes: 2 additions & 2 deletions src/typer/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@ EventSupport::is_good_indel(uint32_t eps) const
assert(sequence_reversed <= depth);
long const qual = 3 * get_log_qual(hq_count + lq_count, anti_count, eps);

if (qual < 60)
if (qual < 50)
return false;

double const qd = static_cast<double>(qual) / static_cast<double>(depth);
return qd >= 4.0;
return qd >= 3.5;
}


Expand Down
20 changes: 10 additions & 10 deletions src/typer/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,8 +898,8 @@ Variant::generate_infos()

if (per_al.total_depth > 0 &&
qd > 0.1 &&
per_al.maximum_alt_support >= 3 &&
per_al.maximum_alt_support_ratio >= 0.175)
per_al.maximum_alt_support >= 2 &&
per_al.maximum_alt_support_ratio >= 0.15)
{
double const alt_seq_depth = per_al.total_depth;
double const _sb = 2.0 * ((static_cast<double>(sb_alt[s]) / alt_seq_depth) - 0.5);
Expand Down Expand Up @@ -1009,14 +1009,14 @@ Variant::generate_infos()
#ifndef NDEBUG
if (is_good_alt[a] == 0)
{
BOOST_LOG_TRIVIAL(debug) << __HERE__ << " In variant=" << to_string(true) // skip calls
<< " bad alt="
<< std::string(seqs[a + 1].begin(), seqs[a + 1].end())
<< " MaxAAS=" << per_al.maximum_alt_support
<< " MaxAASR=" << per_al.maximum_alt_support_ratio
<< " AAScore=" << aa_score[a]
<< " ABHom=" << info_abhom
<< " QDAlt=" << qd_alt[a];
BOOST_LOG_TRIVIAL(info) << __HERE__ << " In variant=" << to_string(true) // skip calls
<< " bad alt="
<< std::string(seqs[a + 1].begin(), seqs[a + 1].end())
<< " MaxAAS=" << per_al.maximum_alt_support
<< " MaxAASR=" << per_al.maximum_alt_support_ratio
<< " AAScore=" << aa_score[a]
<< " ABHom=" << info_abhom
<< " QDAlt=" << qd_alt[a];
}
#endif // NDEBUG
}
Expand Down
3 changes: 3 additions & 0 deletions test/data/reference/index_test.fa
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ GGGGGGGGG
>chr10
GGGGGGGGGGGTGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
GGGGGGGGG
>chr11
AAGGGCGGGGGTGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
GGGGGGGGG
1 change: 1 addition & 0 deletions test/data/reference/index_test.fa.fai
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ chr7 280 878 70 71
chr8 79 1168 70 71
chr9 79 1255 70 71
chr10 79 1343 70 71
chr11 79 1431 70 71
4 changes: 4 additions & 0 deletions test/data/reference/index_test.vcf
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ chr9 5 . G A 0 . GT_ANTI_HAPLOTYPE=2;GT_ID=1
chr9 10 . G GA 0 . GT_ID=2
chr10 5 . G A 0 . GT_HAPLOTYPE=2;GT_ID=1
chr10 10 . G GA 0 . GT_ID=2
chr11 2 . AGGGC A 0 . GT_ANTI_HAPLOTYPE=2,3,4;GT_ID=1
chr11 4 . G T 0 . GT_ANTI_HAPLOTYPE=4;GT_HAPLOTYPE=3;GT_ID=2
chr11 5 . G T 0 . GT_ANTI_HAPLOTYPE=4;GT_ID=3
chr11 6 . C T 0 . GT_ID=4
Binary file modified test/data/reference/index_test.vcf.gz
Binary file not shown.
Binary file modified test/data/reference/index_test.vcf.gz.tbi
Binary file not shown.
23 changes: 21 additions & 2 deletions test/graph/test_constructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,30 @@ TEST_CASE("Construct test graph with anti events (chr10)")
{
REQUIRE(var_nodes[0].anti_events.size() == 1);
REQUIRE(var_nodes[0].anti_events.count(2) == 1);
REQUIRE(var_nodes[1].anti_events.size() == 1);
REQUIRE(var_nodes[1].anti_events.count(-2) == 1);
REQUIRE(var_nodes[1].anti_events.size() == 0);
REQUIRE(var_nodes[2].anti_events.size() == 0);
REQUIRE(var_nodes[3].anti_events.size() == 0);
}

Options::instance()->add_all_variants = false;
}


TEST_CASE("Construct test graph with anti events (chr11)")
{
using namespace gyper;
Options::instance()->add_all_variants = true;

BOOST_LOG_TRIVIAL(debug) << __HERE__ << " TEST CASE: Construct test graph (chr11).";
create_test_graph("/test/data/reference/index_test.fa", "/test/data/reference/index_test.vcf.gz", "chr11", true);

std::vector<gyper::RefNode> const & ref_nodes = graph.ref_nodes;
std::vector<gyper::VarNode> const & var_nodes = graph.var_nodes;

{
REQUIRE(ref_nodes.size() == 2);
REQUIRE(var_nodes.size() == 6);
}

Options::instance()->add_all_variants = false;
}
2 changes: 1 addition & 1 deletion test/index/test_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ TEST_CASE("Test index chr10 with parity event")
REQUIRE(labels[0].variant_id != labels[1].variant_id);

labels = ph_index.get(gyper::to_uint64("AGGGGGGTGGGGGGGGGGGGGGGGGGGGGGGG", 0));
REQUIRE(labels.size() == 0);
REQUIRE(labels.size() == 2);

labels = ph_index.get(gyper::to_uint64("AGGGGGAGTGGGGGGGGGGGGGGGGGGGGGGG", 0));

Expand Down

0 comments on commit ffb1ab2

Please sign in to comment.