Skip to content

Commit

Permalink
Rename plot_genes() labels param to gene_labelset everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
leehart committed Nov 28, 2024
1 parent ed16b06 commit f1b1b35
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 32 deletions.
8 changes: 4 additions & 4 deletions malariagen_data/anoph/cnv_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ def plot_cnv_hmm_coverage(
show: gplt_params.show = True,
output_backend: gplt_params.output_backend = gplt_params.output_backend_default,
gene_labels: Optional[gplt_params.gene_labels] = None,
labels: Optional[gplt_params.labels] = None,
gene_labelset: Optional[gplt_params.gene_labelset] = None,
) -> gplt_params.figure:
debug = self._log.debug

Expand Down Expand Up @@ -785,7 +785,7 @@ def plot_cnv_hmm_coverage(
show=False,
output_backend=output_backend,
gene_labels=gene_labels,
labels=labels,
gene_labelset=gene_labelset,
)

debug("combine plots into a single figure")
Expand Down Expand Up @@ -965,7 +965,7 @@ def plot_cnv_hmm_heatmap(
genes_height: gplt_params.genes_height = gplt_params.genes_height_default,
show: gplt_params.show = True,
gene_labels: Optional[gplt_params.gene_labels] = None,
labels: Optional[gplt_params.labels] = None,
gene_labelset: Optional[gplt_params.gene_labelset] = None,
) -> gplt_params.figure:
debug = self._log.debug

Expand Down Expand Up @@ -996,7 +996,7 @@ def plot_cnv_hmm_heatmap(
x_range=fig1.x_range,
show=False,
gene_labels=gene_labels,
labels=labels,
gene_labelset=gene_labelset,
)

debug("combine plots into a single figure")
Expand Down
4 changes: 2 additions & 2 deletions malariagen_data/anoph/fst.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def plot_fst_gwss(
output_backend: gplt_params.output_backend = gplt_params.output_backend_default,
clip_min: fst_params.clip_min = 0.0,
gene_labels: Optional[gplt_params.gene_labels] = None,
labels: Optional[gplt_params.labels] = None,
gene_labelset: Optional[gplt_params.gene_labelset] = None,
) -> gplt_params.figure:
# gwss track
fig1 = self.plot_fst_gwss_track(
Expand Down Expand Up @@ -330,7 +330,7 @@ def plot_fst_gwss(
show=False,
output_backend=output_backend,
gene_labels=gene_labels,
labels=labels,
gene_labelset=gene_labelset,
)

# combine plots into a single figure
Expand Down
4 changes: 2 additions & 2 deletions malariagen_data/anoph/g123.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def plot_g123_gwss(
inline_array: base_params.inline_array = base_params.inline_array_default,
chunks: base_params.chunks = base_params.native_chunks,
gene_labels: Optional[gplt_params.gene_labels] = None,
labels: Optional[gplt_params.labels] = None,
gene_labelset: Optional[gplt_params.gene_labelset] = None,
) -> gplt_params.figure:
# gwss track
fig1 = self.plot_g123_gwss_track(
Expand Down Expand Up @@ -475,7 +475,7 @@ def plot_g123_gwss(
show=False,
output_backend=output_backend,
gene_labels=gene_labels,
labels=labels,
gene_labelset=gene_labelset,
)

# combine plots into a single figure
Expand Down
6 changes: 3 additions & 3 deletions malariagen_data/anoph/genome_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def plot_genes(
title: Optional[gplt_params.title] = None,
output_backend: gplt_params.output_backend = gplt_params.output_backend_default,
gene_labels: Optional[gplt_params.gene_labels] = None,
labels: Optional[gplt_params.labels] = None,
gene_labelset: Optional[gplt_params.gene_labelset] = None,
) -> gplt_params.figure:
debug = self._log.debug

Expand Down Expand Up @@ -502,8 +502,8 @@ def plot_genes(
fig.add_layout(gene_pointers_ls)
fig.add_layout(gene_labels_ls)

if labels:
fig.add_layout(labels)
if gene_labelset:
fig.add_layout(gene_labelset)

debug("tidy up the plot")
fig.ygrid.visible = False
Expand Down
2 changes: 1 addition & 1 deletion malariagen_data/anoph/gplt_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"A mapping of gene identifiers to custom labels, which will appear in the plot.",
]

labels: TypeAlias = Annotated[
gene_labelset: TypeAlias = Annotated[
bokeh.models.LabelSet,
"A LabelSet to use in the plot.",
]
12 changes: 6 additions & 6 deletions malariagen_data/anoph/h12.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def plot_h12_gwss(
chunks: base_params.chunks = base_params.native_chunks,
inline_array: base_params.inline_array = base_params.inline_array_default,
gene_labels: Optional[gplt_params.gene_labels] = None,
labels: Optional[gplt_params.labels] = None,
gene_labelset: Optional[gplt_params.gene_labelset] = None,
) -> gplt_params.figure:
# Plot GWSS track.
fig1 = self.plot_h12_gwss_track(
Expand Down Expand Up @@ -511,7 +511,7 @@ def plot_h12_gwss(
show=False,
output_backend=output_backend,
gene_labels=gene_labels,
labels=labels,
gene_labelset=gene_labelset,
)

# Combine plots into a single figure.
Expand Down Expand Up @@ -679,7 +679,7 @@ def plot_h12_gwss_multi_overlay(
show: gplt_params.show = True,
output_backend: gplt_params.output_backend = gplt_params.output_backend_default,
gene_labels: Optional[gplt_params.gene_labels] = None,
labels: Optional[gplt_params.labels] = None,
gene_labelset: Optional[gplt_params.gene_labelset] = None,
) -> gplt_params.figure:
# Plot GWSS track.
fig1 = self.plot_h12_gwss_multi_overlay_track(
Expand Down Expand Up @@ -717,7 +717,7 @@ def plot_h12_gwss_multi_overlay(
show=False,
output_backend=output_backend,
gene_labels=gene_labels,
labels=labels,
gene_labelset=gene_labelset,
)

# Combine plots into a single figure.
Expand Down Expand Up @@ -764,7 +764,7 @@ def plot_h12_gwss_multi_panel(
show: gplt_params.show = True,
output_backend: gplt_params.output_backend = gplt_params.output_backend_default,
gene_labels: Optional[gplt_params.gene_labels] = None,
labels: Optional[gplt_params.labels] = None,
gene_labelset: Optional[gplt_params.gene_labelset] = None,
) -> gplt_params.figure:
cohort_queries = self._setup_cohort_queries(
cohorts=cohorts,
Expand Down Expand Up @@ -818,7 +818,7 @@ def plot_h12_gwss_multi_panel(
show=False,
output_backend=output_backend,
gene_labels=gene_labels,
labels=labels,
gene_labelset=gene_labelset,
)

figs.append(fig2)
Expand Down
4 changes: 2 additions & 2 deletions malariagen_data/anoph/h1x.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def plot_h1x_gwss(
chunks: base_params.chunks = base_params.native_chunks,
inline_array: base_params.inline_array = base_params.inline_array_default,
gene_labels: Optional[gplt_params.gene_labels] = None,
labels: Optional[gplt_params.labels] = None,
gene_labelset: Optional[gplt_params.gene_labelset] = None,
) -> gplt_params.figure:
# Plot GWSS track.
fig1 = self.plot_h1x_gwss_track(
Expand Down Expand Up @@ -344,7 +344,7 @@ def plot_h1x_gwss(
show=False,
output_backend=output_backend,
gene_labels=gene_labels,
labels=labels,
gene_labelset=gene_labelset,
)

# Combine plots into a single figure.
Expand Down
4 changes: 2 additions & 2 deletions malariagen_data/anoph/snp_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ def plot_snps(
max_snps: int = 200_000,
show: gplt_params.show = True,
gene_labels: Optional[gplt_params.gene_labels] = None,
labels: Optional[gplt_params.labels] = None,
gene_labelset: Optional[gplt_params.gene_labelset] = None,
) -> gplt_params.figure:
# Plot SNPs track.
fig1 = self.plot_snps_track(
Expand All @@ -1333,7 +1333,7 @@ def plot_snps(
x_range=fig1.x_range,
show=False,
gene_labels=gene_labels,
labels=labels,
gene_labelset=gene_labelset,
)

# Layout tracks in a grid.
Expand Down
16 changes: 8 additions & 8 deletions malariagen_data/anopheles.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def plot_heterozygosity(
chunks: base_params.chunks = base_params.native_chunks,
inline_array: base_params.inline_array = base_params.inline_array_default,
gene_labels: Optional[gplt_params.gene_labels] = None,
labels: Optional[gplt_params.labels] = None,
gene_labelset: Optional[gplt_params.gene_labelset] = None,
) -> gplt_params.figure:
debug = self._log.debug

Expand Down Expand Up @@ -492,7 +492,7 @@ def plot_heterozygosity(
show=False,
output_backend=output_backend,
gene_labels=gene_labels,
labels=labels,
gene_labelset=gene_labelset,
)
figs.append(fig_genes)

Expand Down Expand Up @@ -729,7 +729,7 @@ def plot_roh(
chunks: base_params.chunks = base_params.native_chunks,
inline_array: base_params.inline_array = base_params.inline_array_default,
gene_labels: Optional[gplt_params.gene_labels] = None,
labels: Optional[gplt_params.labels] = None,
gene_labelset: Optional[gplt_params.gene_labelset] = None,
) -> gplt_params.figure:
debug = self._log.debug

Expand Down Expand Up @@ -803,7 +803,7 @@ def plot_roh(
show=False,
output_backend=output_backend,
gene_labels=gene_labels,
labels=labels,
gene_labelset=gene_labelset,
)
figs.append(fig_genes)

Expand Down Expand Up @@ -2297,7 +2297,7 @@ def plot_xpehh_gwss(
chunks: base_params.chunks = base_params.native_chunks,
inline_array: base_params.inline_array = base_params.inline_array_default,
gene_labels: Optional[gplt_params.gene_labels] = None,
labels: Optional[gplt_params.labels] = None,
gene_labelset: Optional[gplt_params.gene_labelset] = None,
) -> gplt_params.figure:
# gwss track
fig1 = self.plot_xpehh_gwss_track(
Expand Down Expand Up @@ -2343,7 +2343,7 @@ def plot_xpehh_gwss(
show=False,
output_backend=output_backend,
gene_labels=gene_labels,
labels=labels,
gene_labelset=gene_labelset,
)

# combine plots into a single figure
Expand Down Expand Up @@ -2402,7 +2402,7 @@ def plot_ihs_gwss(
chunks: base_params.chunks = base_params.native_chunks,
inline_array: base_params.inline_array = base_params.inline_array_default,
gene_labels: Optional[gplt_params.gene_labels] = None,
labels: Optional[gplt_params.labels] = None,
gene_labelset: Optional[gplt_params.gene_labelset] = None,
) -> gplt_params.figure:
# gwss track
fig1 = self.plot_ihs_gwss_track(
Expand Down Expand Up @@ -2450,7 +2450,7 @@ def plot_ihs_gwss(
show=False,
output_backend=output_backend,
gene_labels=gene_labels,
labels=labels,
gene_labelset=gene_labelset,
)

# combine plots into a single figure
Expand Down
4 changes: 2 additions & 2 deletions notebooks/plot_genes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
" ]\n",
")\n",
"data_as_cds = bokeh.models.ColumnDataSource(data)\n",
"labels = bokeh.models.LabelSet(\n",
"gene_labelset = bokeh.models.LabelSet(\n",
" source=data_as_cds,\n",
" x='pos',\n",
" y='y',\n",
Expand All @@ -285,7 +285,7 @@
"\n",
"ag3.plot_genes(\n",
" region=\"2R\",\n",
" labels=labels,\n",
" gene_labelset=gene_labelset,\n",
" height=200,\n",
")"
]
Expand Down

0 comments on commit f1b1b35

Please sign in to comment.