Skip to content

Commit

Permalink
Expose different style, transform Nan to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Apr 7, 2020
1 parent 5825ef6 commit 9a6e3f2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
25 changes: 24 additions & 1 deletion galaxy/plot_coverage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plot_coverage
#set identifier = re.sub('[^\w\-_\.\,]', '_', str( $r.input.element_identifier))
--file '$r.input' '$identifier' $r.total_reads
#end for
output.pdf --cores \${GALAXY_SLOTS:-4} --regions '$regions' --plot_kind $plot_kind
output.pdf --cores \${GALAXY_SLOTS:-4} --regions '$regions' --plot_kind $plot_kind --style $style
]]></command>
<inputs>
<repeat name="input_files" title="Add input files to coverage plot" min="1">
Expand All @@ -31,6 +31,29 @@ output.pdf --cores \${GALAXY_SLOTS:-4} --regions '$regions' --plot_kind $plot_ki
<option value="area">Area plot</option>
<option value="line">Line plot</option>
</param>
<param name="style" type="select" label="Select a plotting style">
<option value="ggplot">ggplot</option>
<option value="classic">classic</option>
<option value="greyscale">greyscale</option>
<option value="dark_background">dark_background</option>
<option value="seaborn">seaborn</option>
<option value="seaborn-bright">seaborn-bright</option>
<option value="seaborn-colorblind">seaborn-colorblind</option>
<option value="seaborn-dark">seaborn-dark</option>
<option value="seaborn-dark-palette">seaborn-dark-palette</option>
<option value="seaborn-darkgrid">seaborn-darkgrid</option>
<option value="seaborn-deep">seaborn-deep</option>
<option value="seaborn-muted">seaborn-muted</option>
<option value="seaborn-notebook">seaborn-notebook</option>
<option value="seaborn-paper">seaborn-paper</option>
<option value="seaborn-pastel">seaborn-pastel</option>
<option value="seaborn-poster">seaborn-poster</option>
<option value="seaborn-talk">seaborn-talk</option>
<option value="seaborn-ticks">seaborn-ticks</option>
<option value="seaborn-white">seaborn-white</option>
<option value="seaborn-whitegrid">seaborn-whitegrid</option>
<option value="tableau-colorblind10">tableau-colorblind10</option>
</param>
</inputs>
<outputs>
<data name="output" format="pdf" label="Coverage plot on $on_string" from_work_dir="output.pdf"/>
Expand Down
5 changes: 5 additions & 0 deletions readtagger/cli/plot_coverage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import click

from matplotlib.style import available
from readtagger.plot_coverage import plot_coverage_in_regions
from readtagger import VERSION

Expand All @@ -23,6 +24,10 @@
default='area',
type=click.Choice(['area', 'line']),
help='Kind of plot.')
@click.option('-s',
'--style',
type=click.Choice(available),
default='ggplot')
@click.version_option(version=VERSION)
def plot_coverage(**kwargs):
"""Plot coverage differences between file1 and file2."""
Expand Down
4 changes: 3 additions & 1 deletion readtagger/plot_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ def plot_coverage(contigs_coverage, style='ggplot', plot_kind='area', nrows=8):
figs.append(fig)
i += 1
nrow = i - (int(i / nrows) * nrows)
ax = pd.DataFrame.from_dict(data).reset_index().plot(
df = pd.DataFrame.from_dict(data).reset_index()
df = df.sort_values('index').fillna(0)
ax = df.plot(
x='index',
kind=plot_kind,
title=title,
Expand Down

0 comments on commit 9a6e3f2

Please sign in to comment.