Skip to content

Commit

Permalink
Only set the error rate based on read type if it hasn't been set via …
Browse files Browse the repository at this point in the history
…the command line.
  • Loading branch information
brianwalenz committed Dec 13, 2016
1 parent a07ceea commit 7b04cd0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/pipelines/canu.pl
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@
$haveCorrected = 1 if ($type =~ m/corrected/);
$haveRaw = 1 if ($type =~ m/raw/);

setErrorRate(0.015) if ($type =~ m/pacbio/);
setErrorRate(0.015, 0) if ($type =~ m/pacbio/);
setGlobal("corErrorRate", "0.30") if ($type =~ m/pacbio/);

setErrorRate(0.048) if ($type =~ m/nanopore/);
setErrorRate(0.048, 0) if ($type =~ m/nanopore/);
setGlobal("corErrorRate", "0.50") if ($type =~ m/nanopore/);
}

Expand All @@ -251,7 +251,7 @@

# set to the default if we can't find anything
if (!defined($gkpStore)) {
setErrorRate(0.01);
setErrorRate(0.01, 0);
} else {
my $numPacBioRaw = 0;
my $numPacBioCorrected = 0;
Expand All @@ -266,12 +266,12 @@
$numNanoporeCorrected++ if (m/nanopore-corrected/);
}
if ($numPacBioRaw > 0 || $numPacBioCorrected > 0) {
setErrorRate(0.015);
setErrorRate(0.015, 0);
setGlobal("corErrorRate", "0.30");
setGlobal("cnsMaxCoverage", 40);
}
if ($numNanoporeRaw > 0 || $numNanoporeCorrected > 0) {
setErrorRate(0.048);
setErrorRate(0.048, 0);
setGlobal("corErrorRate", "0.50");
setGlobal("cnsMaxCoverage", 40);
}
Expand Down
15 changes: 10 additions & 5 deletions src/pipelines/canu/Defaults.pm
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ sub setGlobal ($$) {
return if ($set > 0);

if ($var eq "errorrate") {
setErrorRate($val);
setErrorRate($val, 1);
return;
}

Expand Down Expand Up @@ -533,11 +533,16 @@ sub showErrorRates ($) {
# trimming errorRate = 0.009 obtOvlErrorRate = 0.06 obtErrorRate = 0.035
# assembly errorRate = 0.009 utgOvlErrorRate = 0.06 bogart 0.035
#
sub setErrorRate ($@) {
sub setErrorRate ($$) {
my $er = shift @_;
my $verbose = shift @_;
my $force = shift @_;

print STDERR "-- Set errorRate to $er (verbose='$verbose')\n" if (defined($verbose));
if (($force == 0) && (defined($global{"errorrate"}))) {
#print STDERR "-- Can't change error rate from ", getGlobal('errorRate'), " to $er - not allowed.\n";
return;
}

#print STDERR "-- Set errorRate to $er\n";

# Can NOT call setGlobal() for this, because it calls setErrorRate()!.
$global{"errorrate"} = $er;
Expand All @@ -551,7 +556,7 @@ sub setErrorRate ($@) {
#setGlobal("corErrorRate", $er * 10); # Erorr rate used for raw sequence alignment/consensus
setGlobal("cnsErrorRate", $er * 3);

showErrorRates("-- ") if (defined($verbose));
#showErrorRates("-- ");
}


Expand Down
2 changes: 1 addition & 1 deletion src/pipelines/canu/ErrorEstimate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ sub estimateCorrectedError ($$$) {
} else {
print STDERR "-- Estimated error rate: " . ($errorRate * 100) . "%.\n";
}
setErrorRate($errorRate);
setErrorRate($errorRate, 1);
showErrorRates("-- ");
print STDERR "-- \n";
}

0 comments on commit 7b04cd0

Please sign in to comment.