From f6f61421382fc7c448c9351d26c2a32865c130f6 Mon Sep 17 00:00:00 2001 From: aineniamh Date: Fri, 12 Apr 2024 14:55:10 +0100 Subject: [PATCH 1/3] adding no text option --- snipit/command.py | 2 ++ snipit/scripts/snp_functions.py | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/snipit/command.py b/snipit/command.py index af8c3c8..5dbac07 100644 --- a/snipit/command.py +++ b/snipit/command.py @@ -62,6 +62,7 @@ def main(sysargs = sys.argv[1:]): f_group.add_argument("--high-to-low", action='store_false', help="If sorted by mutation number is selected, show the sequences with the fewest SNPs closest to the reference. Default: False", dest="high_to_low") + f_group.add_argument("--remove-site-text",action='store_true',help="Do not annotate text on the individual columns in the figure.",dest="remove_site_text") s_group = parser.add_argument_group('SNP options') s_group.add_argument("--show-indels",action='store_true',help="Include insertion and deletion mutations in snipit plot.",dest="show_indels") @@ -128,6 +129,7 @@ def main(sysargs = sys.argv[1:]): args.height, args.size_option, args.solid_background, + args.remove_site_text, args.flip_vertical, args.included_positions, args.excluded_positions, diff --git a/snipit/scripts/snp_functions.py b/snipit/scripts/snp_functions.py index bc8eef0..d31b148 100644 --- a/snipit/scripts/snp_functions.py +++ b/snipit/scripts/snp_functions.py @@ -377,6 +377,7 @@ def make_graph(num_seqs, size_option, solid_background, ambig_mode, + remove_site_text, flip_vertical=False, included_positions=None, excluded_positions=None, @@ -570,7 +571,8 @@ def make_graph(num_seqs, # write text adjacent to the SNPs shown with the numeric position # the text alignment is toggled right/left (top/bottom considering 90-deg rotation) if the plot is flipped - ax.text(position, y_level+(0.55*y_inc), snp, size=9, ha="center", va="bottom" if not flip_vertical else "top", rotation=90) + if not remove_site_text: + ax.text(position, y_level+(0.55*y_inc), snp, size=9, ha="center", va="bottom" if not flip_vertical else "top", rotation=90) # snp position labels left_of_box = position-(0.4*spacing) @@ -594,11 +596,12 @@ def make_graph(num_seqs, ax.add_patch(rect) # sequence variant text - ax.text(position, y_pos*y_inc, var, size=9, ha="center", va="center") + if not remove_site_text: + ax.text(position, y_pos*y_inc, var, size=9, ha="center", va="center") # reference variant text - - ax.text(position, y_inc * -0.2, ref, size=9, ha="center", va="center") + if not remove_site_text: + ax.text(position, y_inc * -0.2, ref, size=9, ha="center", va="center") #polygon showing mapping from genome to spaced out snps x = [snp-0.5,snp+0.5,right_of_box,left_of_box,snp-0.5] From 38f4eafc959489810a9a393859c7e17154a7293f Mon Sep 17 00:00:00 2001 From: aineniamh Date: Fri, 12 Apr 2024 14:59:08 +0100 Subject: [PATCH 2/3] remove st --- snipit/command.py | 1 - 1 file changed, 1 deletion(-) diff --git a/snipit/command.py b/snipit/command.py index 5dbac07..d66e553 100644 --- a/snipit/command.py +++ b/snipit/command.py @@ -28,7 +28,6 @@ def main(sysargs = sys.argv[1:]): i_group = parser.add_argument_group('Input options') i_group.add_argument('alignment',help="Input alignment fasta file") - i_group.add_argument("-t","--sequence-type", choices=['nt','aa'], action="store",help="Input sequence type: aa or nt", default="nt", dest="sequence_type") i_group.add_argument("-r","--reference", action="store",help="Indicates which sequence in the alignment is\nthe reference (by sequence ID).\nDefault: first sequence in alignment", dest="reference") i_group.add_argument("-l","--labels", action="store",help="Optional csv file of labels to show in output snipit plot. Default: sequence names", dest="labels") i_group.add_argument("--l-header", action="store",help="Comma separated string of column headers in label csv. First field indicates sequence name column, second the label column. Default: 'name,label'", dest="label_headers",default="name,label") From 20006e1dad6e8cd7bff755d9cf49ae2f7dda6292 Mon Sep 17 00:00:00 2001 From: aineniamh Date: Fri, 12 Apr 2024 14:59:36 +0100 Subject: [PATCH 3/3] add back in (not merging properly for some reason ) --- snipit/command.py | 1 + 1 file changed, 1 insertion(+) diff --git a/snipit/command.py b/snipit/command.py index d66e553..5dbac07 100644 --- a/snipit/command.py +++ b/snipit/command.py @@ -28,6 +28,7 @@ def main(sysargs = sys.argv[1:]): i_group = parser.add_argument_group('Input options') i_group.add_argument('alignment',help="Input alignment fasta file") + i_group.add_argument("-t","--sequence-type", choices=['nt','aa'], action="store",help="Input sequence type: aa or nt", default="nt", dest="sequence_type") i_group.add_argument("-r","--reference", action="store",help="Indicates which sequence in the alignment is\nthe reference (by sequence ID).\nDefault: first sequence in alignment", dest="reference") i_group.add_argument("-l","--labels", action="store",help="Optional csv file of labels to show in output snipit plot. Default: sequence names", dest="labels") i_group.add_argument("--l-header", action="store",help="Comma separated string of column headers in label csv. First field indicates sequence name column, second the label column. Default: 'name,label'", dest="label_headers",default="name,label")