Skip to content

Commit

Permalink
fix style according to PEP8
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Zalevsky authored and benmwebb committed May 20, 2022
1 parent 2afe53d commit c3b01ca
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions master/pyext/src/validation/get_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import numpy as np
from bokeh.io import output_file, curdoc, export_png, export_svgs, show
from bokeh.models import (ColumnDataSource, Legend, LegendItem, FactorRange,
Div, BasicTickFormatter)
Div, BasicTickFormatter)
from bokeh.palettes import viridis, Reds256, linear_palette
from bokeh.plotting import figure, save
from bokeh.models.widgets import Tabs, Panel
Expand Down Expand Up @@ -75,15 +75,15 @@ def plot_quality_at_glance(self, molprobity_data: dict, exv_data: dict,
x_range=(0, upper),
plot_height=120,
plot_width=700
)
)

p.hbar(y=source.data['y'][i * 3: (i + 1) * 3],
right=source.data['counts'][i * 3: (i + 1) * 3],
width=0.9, line_color="white",
fill_color=factor_cmap('y', palette=viridis(len(Scores)),
factors=Scores,
start=1, end=2)
)
right=source.data['counts'][i * 3: (i + 1) * 3],
width=0.9, line_color="white",
fill_color=factor_cmap('y', palette=viridis(len(Scores)),
factors=Scores,
start=1, end=2)
)
# set labels and fonts
p.xaxis.major_label_text_font_size = "12pt"
p.yaxis.major_label_text_font_size = "12pt"
Expand All @@ -97,20 +97,20 @@ def plot_quality_at_glance(self, molprobity_data: dict, exv_data: dict,
plots.append(p)

export_svgs(p, filename=self.filename+'/' +
self.ID+'_' + str(i) + "_quality_at_glance_MQ.svg")
self.ID+'_' + str(i) + "_quality_at_glance_MQ.svg")

grid = gridplot(plots, ncols=1,
merge_tools=True,
toolbar_location='right')
merge_tools=True,
toolbar_location='right')
grid.children[1].css_classes = ['scrollable']
grid.children[1].sizing_mode = 'fixed'
grid.children[1].height = 450
grid.children[1].width = 800

title = Div(text="<p>Model Quality: Molprobity Analysis</p>",
style={"font-size": "1.5em", "font-weight": "bold",
"text-align": "center", "width": '100%'}, width=800
)
style={"font-size": "1.5em", "font-weight": "bold",
"text-align": "center", "width": '100%'}, width=800
)

fullplot = column(title, grid)

Expand All @@ -133,7 +133,6 @@ def plot_quality_at_glance(self, molprobity_data: dict, exv_data: dict,
source = ColumnDataSource(
data=dict(Scores=Scores, counts=counts, legends=legends, color=viridis(n)))


# build plots
plots = []

Expand All @@ -142,16 +141,16 @@ def plot_quality_at_glance(self, molprobity_data: dict, exv_data: dict,

for i, name_ in enumerate(model):
p = figure(y_range=source.data['Scores'][i: i + 1], x_range=(lower, upper), plot_height=100,
plot_width=700) # , title='Model Quality: Excluded Volume Analysis')
plot_width=700) # , title='Model Quality: Excluded Volume Analysis')
# p.xaxis.formatter = BasicTickFormatter(use_scientific=True, power_limit_high=3)
p.xaxis.ticker.desired_num_ticks = 3

r = p.hbar(y=source.data['Scores'][i:i + 1], right=source.data['counts'][i: i + 1], color=source.data['color'][i:i + 1], height=0.5,
alpha=0.8, line_color='black')
p.xaxis.axis_label = 'Number of violations'
legend = Legend(items=[LegendItem(label=legends[i:i + 1][j], renderers=[
r], index=j) for j in range(len(legends[i:i + 1]))], location='center',
label_text_font_size='12px', orientation='vertical')
r], index=j) for j in range(len(legends[i:i + 1]))], location='center',
label_text_font_size='12px', orientation='vertical')
p.add_layout(legend, 'right')
p.xaxis.major_label_text_font_size = "12pt"
p.yaxis.major_label_text_font_size = "12pt"
Expand All @@ -161,20 +160,20 @@ def plot_quality_at_glance(self, molprobity_data: dict, exv_data: dict,
plots.append(p)

export_svgs(p, filename=self.filename+'/' +
self.ID+'_' + str(i) + "_quality_at_glance_MQ.svg")
self.ID+'_' + str(i) + "_quality_at_glance_MQ.svg")

grid = gridplot(plots, ncols=1,
merge_tools=True,
toolbar_location='right')
merge_tools=True,
toolbar_location='right')
grid.children[1].css_classes = ['scrollable']
grid.children[1].sizing_mode = 'fixed'
grid.children[1].height = 450
grid.children[1].width = 800

title = Div(text='<p>Model Quality: Excluded Volume Analysis</p>',
style={"font-size": "1.5em", "font-weight": "bold",
"text-align": "center", "width": '100%'}, width=800
)
style={"font-size": "1.5em", "font-weight": "bold",
"text-align": "center", "width": '100%'}, width=800
)

fullplot = column(title, grid)

Expand Down Expand Up @@ -204,8 +203,9 @@ def plot_quality_at_glance(self, molprobity_data: dict, exv_data: dict,
export_svgs(fullplot, filename=self.filename+'/' +
self.ID+"quality_at_glance_MQ.svg")
export_png(fullplot, filename=self.filename+'/' +
self.ID+"quality_at_glance_MQ.png")
save(fullplot, filename=self.filename+'/'+self.ID+"quality_at_glance_MQ.html")
self.ID+"quality_at_glance_MQ.png")
save(fullplot, filename=self.filename+'/' +
self.ID+"quality_at_glance_MQ.html")
# DATA QUALITY
# check for sas data, if exists, plot
# this section will be updated with more data assessments, as and when it is complete
Expand Down

0 comments on commit c3b01ca

Please sign in to comment.