Skip to content

Commit

Permalink
Updating tests as quicksort (default) is not stable for columns with …
Browse files Browse the repository at this point in the history
…same values
  • Loading branch information
shachafl committed Oct 11, 2024
1 parent 49557b7 commit 71c5a8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions starfish/test/full_pipelines/api/test_dartfish.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,16 @@ def test_dartfish_pipeline_cropped_data(tmpdir):
cnts_starfish.rename(columns={'target': 'gene', 'area': 'cnt_starfish'}, inplace=True)

# get top 5 genes and verify they are correct
high_expression_genes = cnts_starfish.sort_values('cnt_starfish', ascending=False).head(5)
high_expression_genes = cnts_starfish.sort_values('cnt_starfish', ascending=False,
kind='stable').head(5)

assert np.array_equal(
high_expression_genes['cnt_starfish'].values,
[7, 3, 2, 2, 2]
)
assert np.array_equal(
high_expression_genes['gene'].values,
['MBP', 'MOBP', 'ADCY8', 'TRIM66', 'SYT6']
['MBP', 'MOBP', 'ADCY8', 'SYT6', 'TRIM66']
)

# verify correlation is accurate for this subset of the image
Expand Down
2 changes: 1 addition & 1 deletion starfish/test/full_pipelines/api/test_merfish.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def test_merfish_pipeline_cropped_data():
spot_intensities[Features.PASSES_THRESHOLDS], drop=True
)
genes, counts = np.unique(spot_intensities_passing_filters[Features.TARGET], return_counts=True)
result_counts = pd.Series(counts, index=genes).sort_values(ascending=False)[:5]
result_counts = pd.Series(counts, index=genes).sort_values(ascending=False, kind='stable')[:5]

# assert that number of high-expression detected genes are correct
expected_counts = pd.Series(
Expand Down

0 comments on commit 71c5a8b

Please sign in to comment.