Skip to content

Commit

Permalink
add DPI option as parameter for plot_coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkinsc committed Jul 14, 2016
1 parent bfdcccc commit 0f47ccc
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,13 @@ def parser_plot_coverage_common(parser=argparse.ArgumentParser()): # parser n
type=int,
help="Width of the plot in pixels (default: %(default)s)"
)
parser.add_argument(
'--plotDPI',
dest="plot_dpi",
default=plt.gcf().get_dpi(),
type=int,
help="dots per inch for rendered output, more useful for vector modes (default: %(default)s)"
)
parser.add_argument(
'--plotTitle',
dest="plot_title",
Expand Down Expand Up @@ -472,6 +479,7 @@ def plot_coverage(
plot_style,
plot_width,
plot_height,
plot_dpi,
plot_title,
base_q_threshold,
mapping_q_threshold,
Expand Down Expand Up @@ -534,12 +542,11 @@ def plot_coverage(

domain_max = 0
with plt.style.context(plot_style):

fig = plt.gcf()
DPI = fig.get_dpi()
DPI = plot_dpi or fig.get_dpi()
fig.set_size_inches(float(plot_width) / float(DPI), float(plot_height) / float(DPI))

font_size = math.sqrt((plot_width**2) + (plot_height**2)) / float(DPI) * 1.25
font_size = (2.5 * plot_height) / float(DPI)

ax = plt.subplot() # Defines ax variable by creating an empty plot

Expand Down Expand Up @@ -607,6 +614,7 @@ def align_and_plot_coverage(
plot_style,
plot_width,
plot_height,
plot_dpi,
plot_title,
base_q_threshold,
mapping_q_threshold,
Expand Down Expand Up @@ -662,7 +670,7 @@ def align_and_plot_coverage(

# -- call plot function --
plot_coverage(
bam_aligned, out_plot_file, plot_format, plot_data_style, plot_style, plot_width, plot_height, plot_title,
bam_aligned, out_plot_file, plot_format, plot_data_style, plot_style, plot_width, plot_height, plot_dpi, plot_title,
base_q_threshold, mapping_q_threshold, max_coverage_depth, read_length_threshold, out_summary
)

Expand Down

0 comments on commit 0f47ccc

Please sign in to comment.