From 752c4154c4cae296c18e16af32371a7eaf5dc0be Mon Sep 17 00:00:00 2001 From: Katy Brown Date: Tue, 14 May 2024 12:14:59 +0100 Subject: [PATCH] added new consensus identity mini alignment function --- CIAlign/argP.py | 6 ++++++ CIAlign/runCIAlign.py | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/CIAlign/argP.py b/CIAlign/argP.py index 5a1e2e0..1a83747 100755 --- a/CIAlign/argP.py +++ b/CIAlign/argP.py @@ -512,6 +512,12 @@ def getParser(): rows which have been removed by each function marked \ up in corresponding colours. Default: %(default)s") + optional.add("--plot_consensus_identity", dest="plot_consensus_identity", + action="store_true", + help="""Plot a mini alignment showing positions which are \ + identical to or differ from the consensus. \ + Default: %(default)s""") + optional.add("--plot_dpi", dest="plot_dpi", type=int, default=300, metavar="(int)", help="DPI for mini alignments. Default: %(default)s") diff --git a/CIAlign/runCIAlign.py b/CIAlign/runCIAlign.py index c2fb1d8..aeac27e 100755 --- a/CIAlign/runCIAlign.py +++ b/CIAlign/runCIAlign.py @@ -161,6 +161,7 @@ def whichFunctions(args): if any([args.plot_input, args.plot_output, args.plot_markup, + args.plot_consensus_identity, args.visualise, args.all_options]): which_functions.append("mini_alignments") @@ -884,6 +885,20 @@ def runMiniAlignments(args, log, orig_arr, orig_nams, arr, nams, markupdict=markupdict, force_numbers=fn, palette=args.palette) + if args.plot_consensus_identity: + log.info("Plotting identity to consensus") + if not args.silent: + print("Plotting identity to consensus") + outf = "%s_consensus_identity.%s" % (args.outfile_stem, + args.plot_format) + miniAlignments.drawMiniAlignment(arr, nams, log, + outf, typ, + plot_type='boolean', + dpi=args.plot_dpi, + width=args.plot_width, + height=args.plot_height, + force_numbers=fn, + palette=args.palette) def runConsensus(args, log, orig_arr, orig_nams, arr, nams, removed_seqs):