Skip to content

Commit

Permalink
plot full range of completeness - contamination
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandomeyer committed May 23, 2019
1 parent f9b118f commit 089ea20
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
3 changes: 0 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
version: 2
jobs:
build:
branches:
ignore:
- amber20
working_directory: ~/CAMI-challenge/AMBER
parallelism: 1
shell: /bin/bash --login
Expand Down
6 changes: 3 additions & 3 deletions cami_i_hc/index.html

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions src/amber_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,17 +468,19 @@ def create_precision_recall_all_genomes_scatter(pd_genome_bins, tools):


def create_contamination_plot(pd_bins, tools, title, xlabel, ylabel, create_column_function):
pd_bins_copy = pd_bins[[utils_labels.TOOL, 'purity_bp', 'completeness_bp']].copy().dropna(subset=['purity_bp'])
create_column_function(pd_bins_copy)

colors_list = plots.create_colors_list()
bokeh_colors = [matplotlib.colors.to_hex(c) for c in colors_list]

p = figure(title=title, plot_width=580, plot_height=400, y_range=(0, 1), toolbar_location="below")
p = figure(title=title, plot_width=580, plot_height=400, toolbar_location="below")
p.x_range.start = 0
p.y_range.start = pd_bins_copy['newcolumn'].min()
p.y_range.end = 1
legend_it = []
for color, tool in zip(bokeh_colors, tools):
pd_tool_bins = pd_bins[pd_bins[utils_labels.TOOL] == tool]
pd_tool_bins = pd_tool_bins.dropna(subset=['purity_bp'])

create_column_function(pd_tool_bins)
pd_tool_bins = pd_bins_copy[pd_bins_copy[utils_labels.TOOL] == tool]
pd_tool_bins = pd_tool_bins.sort_values(by='newcolumn', ascending=False).reset_index()
pd_tool_bins = pd_tool_bins.drop(['index'], axis=1)

Expand Down
13 changes: 7 additions & 6 deletions src/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,24 +351,25 @@ def plot_contamination(pd_bins, binning_type, title, xlabel, ylabel, create_colu
if len(pd_bins) == 0:
return

pd_bins_copy = pd_bins[[utils_labels.TOOL, 'purity_bp', 'completeness_bp']].copy().dropna(subset=['purity_bp'])
create_column_function(pd_bins_copy)

colors_list = create_colors_list()

fig, axs = plt.subplots(figsize=(6, 5))

tools = pd_bins[utils_labels.TOOL].unique().tolist()
tools = pd_bins_copy[utils_labels.TOOL].unique().tolist()

for color, tool in zip(colors_list, tools):
pd_tool_bins = pd_bins[pd_bins[utils_labels.TOOL] == tool]
pd_tool_bins = pd_tool_bins.dropna(subset=['purity_bp'])

create_column_function(pd_tool_bins)
pd_tool_bins = pd_bins_copy[pd_bins_copy[utils_labels.TOOL] == tool]
pd_tool_bins = pd_tool_bins.sort_values(by='newcolumn', ascending=False).reset_index()
pd_tool_bins = pd_tool_bins.drop(['index'], axis=1)

axs.plot(list(range(1, len(pd_tool_bins) + 1)), pd_tool_bins['newcolumn'], color=color)

axs.set_ylim(0.0, 1.0)
axs.set_ylim(pd_bins_copy['newcolumn'].min(), 1.0)
axs.set_xlim(1, None)
axs.grid(which='major', linestyle='-', linewidth='0.5', color='lightgrey')

# transform plot_labels to percentages
vals = axs.get_yticks()
Expand Down

0 comments on commit 089ea20

Please sign in to comment.