Skip to content

Commit

Permalink
Add incorrect eligible read marking
Browse files Browse the repository at this point in the history
  • Loading branch information
adamnovak committed Jan 26, 2024
1 parent 40cc426 commit a91e8f5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 10 deletions.
7 changes: 6 additions & 1 deletion scripts/plot-pr.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ require("tidyverse")
require("ggrepel")

# Read in the combined toil-vg stats.tsv, listing:
# correct, mapq, aligner (really graph name), read name, count
# correct, mapq, aligner (really graph name), read name, count, eligible
dat <- read.table(commandArgs(TRUE)[1], header=T)

if (("eligible" %in% names(dat))) {
# If the eligible column is present, remove ineligible reads
dat <- dat[dat$eligible == 1, ]
}

if (! ("count" %in% names(dat))) {
# If the count column is not present, add i
dat$count <- rep(1, nrow(dat))
Expand Down
7 changes: 6 additions & 1 deletion scripts/plot-qq.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ require("tidyverse")
require("ggrepel")

# Read in the combined toil-vg stats.tsv, listing:
# correct, mapq, aligner (really graph name), read name, count
# correct, mapq, aligner (really graph name), read name, count, eligible
dat <- read.table(commandArgs(TRUE)[1], header=T)

if (("eligible" %in% names(dat))) {
# If the eligible column is present, remove ineligible reads
dat <- dat[dat$eligible == 1, ]
}

if (! ("count" %in% names(dat))) {
# If the count column is not present, add i
dat$count <- rep(1, nrow(dat))
Expand Down
9 changes: 7 additions & 2 deletions scripts/plot-roc-log.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ require("tidyverse")
require("ggrepel")

# Read in the combined toil-vg stats.tsv, listing:
# correct, mapq, aligner (really graph name), read name, count
dat <- read.table(commandArgs(TRUE)[1], header=T)
# correct, mapq, aligner (really graph name), read name, count, eligible
dat <- read.table(commandArgs(TRUE)[1], header=T, colClasses=c("aligner"="factor"))

if (("eligible" %in% names(dat))) {
# If the eligible column is present, remove ineligible reads
dat <- dat[dat$eligible == 1, ]
}

if (! ("count" %in% names(dat))) {
# If the count column is not present, add i
Expand Down
9 changes: 7 additions & 2 deletions scripts/plot-roc.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ require("ggrepel")
require("scales") # For squish

# Read in the combined toil-vg stats.tsv, listing:
# correct, mapq, aligner (really graph name), read name, count
dat <- read.table(commandArgs(TRUE)[1], header=T)
# correct, mapq, aligner (really graph name), read name, count, eligible
dat <- read.table(commandArgs(TRUE)[1], header=T, colClasses=c("aligner"="factor"))

if (("eligible" %in% names(dat))) {
# If the eligible column is present, remove ineligible reads
dat <- dat[dat$eligible == 1, ]
}

if (! ("count" %in% names(dat))) {
# If the count column is not present, add i
Expand Down
15 changes: 11 additions & 4 deletions src/subcommand/gamcompare_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ int main_gamcompare(int argc, char** argv) {
// Output TSV to standard out in the format plot-qq.R needs.
if (!header_printed) {
// It needs a header
cout << "correct\tmq\taligner\tread" << endl;
cout << "correct\tmq\taligner\tread\teligible" << endl;
header_printed = true;
}

Expand All @@ -266,7 +266,8 @@ int main_gamcompare(int argc, char** argv) {
cout << (aln.correctly_mapped() ? "1" : "0") << "\t";
cout << aln.mapping_quality() << "\t";
cout << aligner_name << "\t";
cout << aln.name() << endl;
cout << aln.name() << "\t";
cout << (aln.to_correct().name().empty() ? "0" : "1") << endl;
}
text_buffer.clear();
};
Expand Down Expand Up @@ -362,11 +363,17 @@ int main_gamcompare(int argc, char** argv) {
#pragma omp critical
{
if (output_tsv) {
text_buffer.emplace_back(std::move(aln));
if (emitter) {
// Copy the alignment since we need it twice
text_buffer.emplace_back(aln);
} else {
text_buffer.emplace_back(std::move(aln));
}
if (text_buffer.size() > 1000) {
flush_text_buffer();
}
} else {
}
if (emitter) {
emitter->write(std::move(aln));
}
}
Expand Down

0 comments on commit a91e8f5

Please sign in to comment.