Skip to content

Commit

Permalink
Bugfix axis swap in comparative static plots
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsweeten committed Sep 17, 2024
1 parent 859ad1e commit dec0a4e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
14 changes: 9 additions & 5 deletions src/moddotplot/moddotplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ def main():
smaller_length = len(smaller_seq)
larger_seq_name = sequences[i][0]
smaller_seq_name = sequences[j][0]
# Houston we have a problem

if larger_length < smaller_length:
smaller_seq = sequences[i][1]
larger_seq = sequences[j][1]
Expand Down Expand Up @@ -1000,15 +1000,17 @@ def main():
seq_list[j],
False,
)
if args.grid:
grid_vals.append(bed)

if not args.no_bed:
# Log saving bed file
if not args.output_dir:
bedfile_output = sequences[i][0] + ".bed"
bedfile_output = smaller_seq_name + "_" + larger_seq_name + "_COMPARE.bed"
else:
bedfile_output = os.path.join(
args.output_dir,
sequences[i][0] + "_" + sequences[j][0] + ".bed",
smaller_seq_name + "_" + larger_seq_name + "_COMPARE.bed",
)
with open(bedfile_output, "w") as bedfile:
for row in bed:
Expand All @@ -1019,8 +1021,8 @@ def main():
create_plots(
sdf=[bed],
directory=args.output_dir if args.output_dir else ".",
name_x=sequences[i][0],
name_y=sequences[j][0],
name_x=smaller_seq_name,
name_y=larger_seq_name,
palette=args.palette,
palette_orientation=args.palette_orientation,
no_hist=args.no_hist,
Expand All @@ -1035,6 +1037,8 @@ def main():
axes_labels=args.axes_ticks,
)

'''if args.grid:
print(grid_vals)'''

if __name__ == "__main__":
main()
8 changes: 4 additions & 4 deletions src/moddotplot/static_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def create_plots(
height=9,
dpi=dpi,
format="pdf",
filename=f"{plot_filename}.pdf",
filename=f"{plot_filename}_COMPARE.pdf",
verbose=False,
)
ggsave(
Expand All @@ -583,11 +583,11 @@ def create_plots(
height=9,
dpi=dpi,
format="png",
filename=f"{plot_filename}.png",
filename=f"{plot_filename}_COMPARE.png",
verbose=False,
)
if no_hist:
print(f"{plot_filename}.pdf and {plot_filename}.png saved sucessfully. \n")
print(f"{plot_filename}_COMPARE.pdf and {plot_filename}_COMPARE.png saved sucessfully. \n")
else:
ggsave(
histy,
Expand All @@ -608,7 +608,7 @@ def create_plots(
verbose=False,
)
print(
f"{plot_filename}.pdf, {plot_filename}.png, {plot_filename}_HIST.pdf and {plot_filename}_HIST.png saved sucessfully. \n"
f"{plot_filename}_COMPARE.pdf, {plot_filename}_COMPARE.png, {plot_filename}_HIST.pdf and {plot_filename}_HIST.png saved sucessfully. \n"
)
# Self-identity plots: Output _TRI, _FULL, and _HIST
else:
Expand Down

0 comments on commit dec0a4e

Please sign in to comment.