Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions malariagen_data/anoph/sample_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,8 @@ def plot_samples_interactive_map(
fill_value=0,
)

taxa = df_pivot.columns.dropna().sort_values().unique()

# Append aggregations to pivot.
df_location_aggs = df_samples.groupby(location_composite_key).agg(
{
Expand Down Expand Up @@ -1015,7 +1017,6 @@ def plot_samples_interactive_map(
samples_map.layout.width = width

# Add markers.
count_factors = df_samples[count_by].dropna().sort_values().unique()
for _, row in df_pivot.reset_index().iterrows():
title = (
f"Location: {row.location} ({row.latitude:.3f}, {row.longitude:.3f})"
Expand All @@ -1028,13 +1029,13 @@ def plot_samples_interactive_map(
title += f"\nContributors: {row.contributor}"
title += "\nNo. specimens: "
all_n = 0
for factor in count_factors:
for taxon in taxa:
# Get the number of samples in this taxon
n = row[factor]
n = int(row[taxon])
# Count the number of samples in all taxa
all_n += n
if n > 0:
title += f"{n} {factor}; "
title += f"{n} {taxon}; "
# Only show a marker when there are enough samples
if all_n >= min_samples:
marker = ipyleaflet.Marker(
Expand Down
Loading