Skip to content

Commit 8b6f4f0

Browse files
authored
Merge branch 'master' into master
2 parents edd123a + 71c0b23 commit 8b6f4f0

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

malariagen_data/anoph/genome_features.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,5 +552,5 @@ def _transcript_to_parent_name(self, transcript):
552552
return self._gene_name_overrides[parent_id]
553553
except KeyError:
554554
rec_parent = df_genome_features.loc[parent_id]
555-
# Try to access "Name" attribute, fall back to "ID" if not present.
556-
return rec_parent.get("Name", parent_id)
555+
# Try to access gene name attribute, fall back to "ID" if not present.
556+
return rec_parent.get(self._gff_gene_name_attribute, parent_id)

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)