Skip to content

Commit 172dd2f

Browse files
committed
fix(ci): restore coverage and remove deprecated plotly usage
- restore dynamic gene attribute lookup - replace append_trace with add_trace - restore f-strings for style consistency No functional changes.
1 parent 615beb6 commit 172dd2f

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

malariagen_data/plotly_dendrogram.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ def concat_clustering_subplots(
166166
if isinstance(figure, go.Figure):
167167
# This is a figure, access the traces within it.
168168
for trace in range(len(figure["data"])):
169-
fig.append_trace(figure["data"][trace], row=i + 1, col=1)
169+
fig.add_trace(figure["data"][trace], row=i + 1, col=1)
170170
else:
171171
# Assume this is a trace, add directly.
172-
fig.append_trace(figure, row=i + 1, col=1)
172+
fig.add_trace(figure, row=i + 1, col=1)
173173

174174
fig.update_xaxes(visible=False)
175175
fig.update_layout(

malariagen_data/veff.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def get_ref_allele_coords(self, chrom, pos, ref):
8484
ref_seq = self.get_ref_seq(chrom, ref_start, ref_stop).lower()
8585
assert ref_seq == ref.lower(), (
8686
"reference allele does not match reference sequence, "
87-
"expected %r, found %r" % (ref_seq, ref.lower())
87+
f"expected {ref_seq!r}, found {ref.lower()!r}"
8888
)
8989

9090
return ref_start, ref_stop
@@ -262,11 +262,11 @@ def _get_within_cds_effect(ann, base_effect, cds, cdss):
262262
base_effect = base_effect._replace(
263263
ref_codon=ref_codon,
264264
alt_codon=alt_codon,
265-
codon_change="%s/%s" % (ref_codon, alt_codon),
265+
codon_change=f"{ref_codon}/{alt_codon}",
266266
aa_pos=aa_pos,
267267
ref_aa=ref_aa,
268268
alt_aa=alt_aa,
269-
aa_change="%s%s%s" % (ref_aa, aa_pos, alt_aa),
269+
aa_change=f"{ref_aa}{aa_pos}{alt_aa}",
270270
)
271271

272272
if len(ref) == 1 and len(alt) == 1:

tests/anoph/test_genome_features.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ def test_plot_genes_with_gene_labels(fixture, api: AnophelesGenomeFeaturesData):
169169
# For each contig in the fixture...
170170
for contig in fixture.contigs:
171171
# Get the genes for this contig.
172-
genes_df = api.genome_features(region=contig).query("type == 'gene'")
172+
genes_df = api.genome_features(region=contig).query(
173+
f"type == '{api._gff_gene_type}'"
174+
)
173175

174176
# If there are no genes, we cannot label them.
175177
if not genes_df.empty:
@@ -181,7 +183,10 @@ def test_plot_genes_with_gene_labels(fixture, api: AnophelesGenomeFeaturesData):
181183

182184
# Put the random gene "ID" and its "Name" in a dictionary.
183185
random_gene_labels = dict(
184-
zip(random_sample_genes_df["ID"], random_sample_genes_df["Name"])
186+
zip(
187+
random_sample_genes_df["ID"],
188+
random_sample_genes_df[api._gff_gene_name_attribute],
189+
)
185190
)
186191

187192
# Check that we get a Bokeh figure from plot_genes() with these gene_labels.

0 commit comments

Comments
 (0)