Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding no text option #39

Merged
merged 4 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions snipit/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,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 @@ -120,6 +121,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
12 changes: 8 additions & 4 deletions snipit/scripts/snp_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ def make_graph(num_seqs,
height,
size_option,
solid_background,
ambig_mode,
remove_site_text,
flip_vertical=False,
included_positions=None,
excluded_positions=None,
Expand Down Expand Up @@ -552,7 +554,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 @@ -576,11 +579,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
Loading