Skip to content

Commit

Permalink
adding no text option
Browse files Browse the repository at this point in the history
  • Loading branch information
aineniamh committed Apr 12, 2024
1 parent b04f51e commit f6f6142
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions snipit/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 7 additions & 4 deletions snipit/scripts/snp_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -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]
Expand Down

0 comments on commit f6f6142

Please sign in to comment.