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

New argument for panfeed-plots to allow users to generate plots within a specified directory #31

Merged
merged 2 commits into from
Jun 3, 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: 1 addition & 1 deletion panfeed/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.6.0'
__version__ = '1.6.1'
12 changes: 8 additions & 4 deletions panfeed/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ def get_options():
default='png',
help='Output format for plots (default %(default)s)')

parser.add_argument('--output-directory',
default='.',
help='Output directory for the plots (default %(default)s)')

parser.add_argument('--dpi',
type=int,
default=300,
Expand Down Expand Up @@ -337,7 +341,7 @@ def handle_paralogs_text(x):
cax = divider.append_axes("right", size="2.5%", pad=0.05)
coba = plt.colorbar(im, cax=cax)
coba.set_label("-log10 p-value")
plt.savefig(f'significance_{gene}.{args.format}', dpi=args.dpi, bbox_inches="tight")
plt.savefig(f'{args.output_directory}/significance_{gene}.{args.format}', dpi=args.dpi, bbox_inches="tight")
logger.info(f'saved plot significance_{gene}.{args.format}')
plt.close()

Expand All @@ -360,7 +364,7 @@ def handle_paralogs_text(x):
ax.set_title(f"nucleotide sequence {gene}")
ax.set_xlabel("position relative to gene start")
ax.set_ylabel(f"{g.shape[0]} samples")
plt.savefig(f'sequence_{gene}.{args.format}', dpi=args.dpi, bbox_inches="tight")
plt.savefig(f'{args.output_directory}/sequence_{gene}.{args.format}', dpi=args.dpi, bbox_inches="tight")
logger.info(f'saved plot sequence_{gene}.{args.format}')
plt.close()

Expand Down Expand Up @@ -389,7 +393,7 @@ def handle_paralogs_text(x):
ax.set_title(f"significant k-mers {gene}")
ax.set_xlabel("position relative to gene start")
ax.set_ylabel(f"{g.shape[0]} samples")
plt.savefig(f'hybrid_{gene}.{args.format}', dpi=args.dpi, bbox_inches="tight")
plt.savefig(f'{args.output_directory}/hybrid_{gene}.{args.format}', dpi=args.dpi, bbox_inches="tight")
logger.info(f'saved plot hybrid_{gene}.{args.format}')
plt.close()

Expand All @@ -406,7 +410,7 @@ def handle_paralogs_text(x):
xticklabels=False,
square=True)

plt.savefig(f'sequence_legend.{args.format}', dpi=args.dpi, bbox_inches="tight")
plt.savefig(f'{args.output_directory}/sequence_legend.{args.format}', dpi=args.dpi, bbox_inches="tight")
logger.info(f"Saved nucleotide color key at sequence_legend.{args.format}")
plt.close()

Expand Down
Loading