Skip to content

Commit

Permalink
remove prints or make them debug log only
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachel Norris committed Oct 23, 2018
1 parent 841d149 commit 60433ff
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 36 deletions.
2 changes: 1 addition & 1 deletion include/denovo_discovery/extract_reads.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ std::vector<Interval>
identify_regions(const std::vector<uint32_t> &, const uint32_t &threshold = 0, const uint32_t &min_length = 0);

vector<LocalNodePtr>
find_interval_in_localpath(const Interval &, const vector<LocalNodePtr> &, const unsigned int &);
find_interval_in_localpath(const Interval &, const vector<LocalNodePtr> &, const uint32_t &);

std::set<MinimizerHitPtr, pComp_path> hits_inside_path(const std::set<MinimizerHitPtr, pComp_path> &,
const std::vector<LocalNodePtr> &);
Expand Down
20 changes: 10 additions & 10 deletions src/denovo_discovery/extract_reads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ identify_regions(const vector<uint32_t> &covgs, const uint32_t &threshold, const
}

vector<LocalNodePtr>
find_interval_in_localpath(const Interval &interval, const vector<LocalNodePtr> &lmp,
const unsigned int &buff) {
find_interval_in_localpath(const Interval &interval,
const vector<LocalNodePtr> &lmp,
const uint32_t &buff) {
uint32_t added = 0;
uint16_t start = 0, end = 0;
bool found_end = false;
Expand Down Expand Up @@ -123,12 +124,12 @@ std::set<ReadCoordinate> get_read_overlap_coordinates(const PanNodePtr &pnode,
const std::vector<LocalNodePtr> &local_node_path,
const uint32_t& min_number_hits) {
std::set<ReadCoordinate> read_overlap_coordinates = {};
cout << "read ids " << endl;
BOOST_LOG_TRIVIAL(debug) << "read ids covering pannode to consider " << endl;
for (const auto &r : pnode->reads)
cout << r->id << endl;
BOOST_LOG_TRIVIAL(debug) << r->id << endl;
for (const auto &read_ptr: pnode->reads) {
auto read_hits_inside_path = hits_inside_path(read_ptr->hits.at(pnode->prg_id), local_node_path);
cout << "read_hits_inside_path size " << read_hits_inside_path.size() << endl;
BOOST_LOG_TRIVIAL(debug) << "read_hits_inside_path size " << read_hits_inside_path.size() << endl;
if (read_hits_inside_path.size() < min_number_hits)
continue;

Expand Down Expand Up @@ -161,18 +162,17 @@ void denovo_discovery::add_pnode_coordinate_pairs(
if (intervals.empty())
return;

cout << "there are " << intervals.size() << " intervals" << endl;
BOOST_LOG_TRIVIAL(debug) << "there are " << intervals.size() << " intervals" << endl;
for (const auto &interval: intervals) {
BOOST_LOG_TRIVIAL(debug) << "Looking at interval: " << interval;
BOOST_LOG_TRIVIAL(debug) << "For gene: " << pnode->get_name();

auto sub_local_node_path = find_interval_in_localpath(interval, local_node_path, padding_size);
cout << "sub local node path ";
BOOST_LOG_TRIVIAL(debug) << "sub local node path ";
for (const auto &l : sub_local_node_path)
cout << *l;
cout << endl;
BOOST_LOG_TRIVIAL(debug) << *l;
auto read_overlap_coordinates = get_read_overlap_coordinates(pnode, sub_local_node_path, min_number_hits);
cout << "there are " << read_overlap_coordinates.size() << " read_overlap_coordinates" << endl;
BOOST_LOG_TRIVIAL(debug) << "there are " << read_overlap_coordinates.size() << " read_overlap_coordinates" << endl;

GeneIntervalInfo interval_info{
pnode,
Expand Down
25 changes: 0 additions & 25 deletions test/denovo_discovery/extract_reads_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,6 @@ TEST(ExtractReadsTest, hits_inside_path) {
l3.prg.nodes[6], l3.prg.nodes[7]//, l3.prg.nodes[9]
};
// A G C T CGG TAT
for (const auto &n : lmp) {
cout << n->pos << " ";
}
cout << endl;

set<MinimizerHitPtr, pComp_path> hits, expected_subset;
uint32_t read_id = 0, prg_id = 3, knode_id = 0;
Expand Down Expand Up @@ -925,16 +921,12 @@ TEST(ExtractReadsTest, add_pnode_coordinate_pairs) {
l3.prg.nodes[1], l3.prg.nodes[2], l3.prg.nodes[4],
l3.prg.nodes[6], l3.prg.nodes[7], l3.prg.nodes[9]
};
for (const auto &l : lmp)
cout << *l << endl;

vector<KmerNodePtr> kmp = {l3.kmer_prg.nodes[0],
l3.kmer_prg.nodes[1], l3.kmer_prg.nodes[4], l3.kmer_prg.nodes[8],
l3.kmer_prg.nodes[13], l3.kmer_prg.nodes[15], l3.kmer_prg.nodes[17],
l3.kmer_prg.nodes[19], l3.kmer_prg.nodes[20], l3.kmer_prg.nodes[21]
};
for (const auto &n : kmp)
cout << *n;

PanNodePtr pn = make_shared<pangenome::Node>(pnode_id, prg_id, pnode_name);
pn->kmer_prg = l3.kmer_prg;
Expand All @@ -950,8 +942,6 @@ TEST(ExtractReadsTest, add_pnode_coordinate_pairs) {
pn->kmer_prg.nodes[20]->covg[0] += 10;
pn->kmer_prg.nodes[21]->covg[0] += 10;

//cout << pn->kmer_prg << endl;

PanReadPtr pr = make_shared<pangenome::Read>(read_id);
set<MinimizerHitPtr, pComp> hits;

Expand Down Expand Up @@ -1038,9 +1028,6 @@ TEST(ExtractReadsTest, add_pnode_coordinate_pairs) {
std::set<std::pair<ReadCoordinate, GeneIntervalInfo>> pairs;
denovo_discovery::add_pnode_coordinate_pairs(pairs, pn, lmp, kmp, buff, covg_thresh, min_length, min_num_hits);

for (const auto &p : pairs)
cout << p.first << ", " << p.second << endl;

GeneIntervalInfo interval_info1{pn, Interval(1,3), "AGCT"};
GeneIntervalInfo interval_info2{pn, Interval(6,7), "CGGTAT"};
ReadCoordinate read_coord1{0,2,6,true};
Expand Down Expand Up @@ -1090,16 +1077,12 @@ TEST(ExtractReadsTest, add_pnode_coordinate_pairs_fewer_hits_needed) {
l3.prg.nodes[1], l3.prg.nodes[2], l3.prg.nodes[4],
l3.prg.nodes[6], l3.prg.nodes[7], l3.prg.nodes[9]
};
for (const auto &l : lmp)
cout << *l << endl;

vector<KmerNodePtr> kmp = {l3.kmer_prg.nodes[0],
l3.kmer_prg.nodes[1], l3.kmer_prg.nodes[4], l3.kmer_prg.nodes[8],
l3.kmer_prg.nodes[13], l3.kmer_prg.nodes[15], l3.kmer_prg.nodes[17],
l3.kmer_prg.nodes[19], l3.kmer_prg.nodes[20], l3.kmer_prg.nodes[21]
};
for (const auto &n : kmp)
cout << *n;

PanNodePtr pn = make_shared<pangenome::Node>(pnode_id, prg_id, pnode_name);
pn->kmer_prg = l3.kmer_prg;
Expand All @@ -1115,8 +1098,6 @@ TEST(ExtractReadsTest, add_pnode_coordinate_pairs_fewer_hits_needed) {
pn->kmer_prg.nodes[20]->covg[0] += 10;
pn->kmer_prg.nodes[21]->covg[0] += 10;

//cout << pn->kmer_prg << endl;

set<MinimizerHitPtr, pComp> hits;

// READ 0
Expand Down Expand Up @@ -1205,9 +1186,6 @@ TEST(ExtractReadsTest, add_pnode_coordinate_pairs_fewer_hits_needed) {
std::set<std::pair<ReadCoordinate, GeneIntervalInfo>> pairs;
denovo_discovery::add_pnode_coordinate_pairs(pairs, pn, lmp, kmp, buff, covg_thresh, min_length, min_num_hits);

for (const auto &p : pairs)
cout << p.first << ", " << p.second << endl;

GeneIntervalInfo interval_info1{pn, Interval(1,3), "AGCT"};
GeneIntervalInfo interval_info2{pn, Interval(6,7), "CGGTAT"};

Expand Down Expand Up @@ -1386,11 +1364,8 @@ TEST(ExtractReadsTest, ordering_of_coordinate_pairs) {
EXPECT_EQ(exp_order.size(),pairs.size());
uint count = 0;
for (const auto & p : pairs){
cout << count << endl;
if (exp_order.size() <= count)
break;
cout << p.first << " " << p.second << endl;
cout << insert_order_pairs[exp_order[count]].first << " " << insert_order_pairs[exp_order[count]].second << endl;
EXPECT_EQ(p.first,insert_order_pairs[exp_order[count]].first);
EXPECT_EQ(p.second,insert_order_pairs[exp_order[count]].second);
count++;
Expand Down

0 comments on commit 60433ff

Please sign in to comment.