From 67b9bd48775d923934e41e47eaa75f495055f471 Mon Sep 17 00:00:00 2001 From: cmdoret Date: Mon, 3 Aug 2020 16:08:57 +0200 Subject: [PATCH] add `--extreme_ploidies` flag --- exec/smudgeplot.py | 3 +++ exec/smudgeplot_plot.R | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/exec/smudgeplot.py b/exec/smudgeplot.py index 749a8b3..efd4de9 100755 --- a/exec/smudgeplot.py +++ b/exec/smudgeplot.py @@ -69,6 +69,7 @@ def plot(self): argparser.add_argument('-L', help='The lower boundary used when dumping kmers (default min(total_pair_cov) / 2).', type=int, default=0) argparser.add_argument('-n', help='The expected haploid coverage (default estimated from data).', type=float, default=0) argparser.add_argument('-t', '--title', help='name printed at the top of the smudgeplot (default none).', default='') + argparser.add_argument('-e', '--extreme_ploidies', help='Allow very high ploidies, at the cost of speed.', action='store_true') # argparser.add_argument('-m', '-method', help='The algorithm for annotation of smudges (default \'local_aggregation\')', default='local_aggregation') argparser.add_argument('-nbins', help='The number of nbins used for smudgeplot matrix (nbins x nbins) (default autodetection).', type=int, default=0) argparser.add_argument('-k', help='The length of the kmer.', default=21) @@ -337,6 +338,8 @@ def main(): plot_args += " -n " + str(args.n) if args.title: plot_args += " -t \"" + args.title + "\"" + if args.extreme_ploidies: + plot_args += " -e " if args.nbins != 0: plot_args += " -nbins " + str(args.nbins) if args.homozygous: diff --git a/exec/smudgeplot_plot.R b/exec/smudgeplot_plot.R index da92659..882d528 100755 --- a/exec/smudgeplot_plot.R +++ b/exec/smudgeplot_plot.R @@ -27,6 +27,7 @@ parser$add_argument("-nbins", type = "integer", help="the number of nbins used for smudgeplot matrix (nbins x nbins) [default autodetection]") parser$add_argument("-k", "--kmer_size", type = "integer", default = 21, help="The kmer size used to calculate kmer spectra [default 21]") +parser$add_argument("-e", "--extreme_ploidies", action="store_true", help="Expect extremely high ploidies at the cost of speed.") args <- parser$parse_args() @@ -68,7 +69,7 @@ smudge_summary$n_subset_est <- round(estimate_1n_coverage_1d_subsets(total_pair_ draft_n <- ifelse(length(args$n_cov) == 0, smudge_summary$n_subset_est, args$n_cov) -ymax <- min(10*draft_n, max(total_pair_cov)) +ymax <- ifelse(args$extreme_ploidies, max(total_pair_cov), min(10*draft_n, max(total_pair_cov))) ymin <- min(total_pair_cov) - 1 smudge_warn(args$output, "\n#############")