Skip to content

Commit

Permalink
goldrush-path: ensure reads only have atcg (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwcodee authored Jun 17, 2024
1 parent 9117e09 commit eb9e28f
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions goldrush_path/goldrush_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ fill_bit_vector(const std::string& input_file,
size_t num_reads_skipped_by_phred = 0;
size_t num_reads_skipped_by_delta = 0;
size_t num_reads_skipped_by_length = 0;
size_t num_reads_skipped_by_invalid_bases = 0;
#pragma omp parallel
for (const auto record : reader) {
#pragma omp atomic
Expand Down Expand Up @@ -187,6 +188,16 @@ fill_bit_vector(const std::string& input_file,
}
continue;
}
if (record.seq.find_first_not_of("ACGTacgt") != std::string::npos) {
#pragma omp atomic
++num_reads_skipped_by_invalid_bases;
#pragma omp critical
{
filter_out_reads.insert(record.id);
}
continue;

}
#pragma omp atomic
++num_passed_reads;
multiLensfrHashIterator itr(record.seq, spaced_seeds);
Expand All @@ -207,10 +218,13 @@ fill_bit_vector(const std::string& input_file,
<< num_reads_skipped_by_delta << "\n"
<< "num_reads_skipped_by_length: "
<< num_reads_skipped_by_length << "\n"
<< "num_reads_skipped_by_invalid_bases: "
<< num_reads_skipped_by_invalid_bases << "\n"
<< "Total reads skipped: "
<< num_reads_skipped_by_phred +
num_reads_skipped_by_delta +
num_reads_skipped_by_length
num_reads_skipped_by_length +
num_reads_skipped_by_invalid_bases
<< std::endl;
}

Expand Down Expand Up @@ -815,7 +829,7 @@ process_read(const btllib::SeqReader::Record& record,
if (!filter_out_reads.empty()) {
if (filter_out_reads.find(record.id) != filter_out_reads.end()) {
if (opt::debug) {
std::cerr << "hairpin or quality too low" << std::endl;
std::cerr << "hairpin or quality too low or invalid bases" << std::endl;
std::cerr << "skipping: " << record.id << std::endl;
}

Expand Down

0 comments on commit eb9e28f

Please sign in to comment.