Skip to content

Comments

feat: presets#3653

Draft
flying-sheep wants to merge 55 commits intomainfrom
pa/presets
Draft

feat: presets#3653
flying-sheep wants to merge 55 commits intomainfrom
pa/presets

Conversation

@flying-sheep
Copy link
Member

@flying-sheep flying-sheep commented May 28, 2025

  • Release notes not necessary because:

Self-documenting presets work!

E.g.:

TODO

  • actually add everything to SeuratV5 flavor

@codecov
Copy link

codecov bot commented May 28, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
2294 1 2293 458
View the top 1 failed test(s) by shortest run time
tests/test_highly_variable_genes.py::test_compare_to_upstream[dask_array_sparse-1d_chunked-csr_matrix-seurat-fgd]
Stack Traces | 0.137s run time
#x1B[0m#x1B[37m@pytest#x1B[39;49;00m.mark.parametrize(#x1B[33m"#x1B[39;49;00m#x1B[33mfunc#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, [#x1B[33m"#x1B[39;49;00m#x1B[33mhvg#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, #x1B[33m"#x1B[39;49;00m#x1B[33mfgd#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m])#x1B[90m#x1B[39;49;00m
    #x1B[37m@pytest#x1B[39;49;00m.mark.parametrize(#x1B[90m#x1B[39;49;00m
        (#x1B[33m"#x1B[39;49;00m#x1B[33mflavor#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, #x1B[33m"#x1B[39;49;00m#x1B[33mparams#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, #x1B[33m"#x1B[39;49;00m#x1B[33mref_path#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m),#x1B[90m#x1B[39;49;00m
        [#x1B[90m#x1B[39;49;00m
            pytest.param(#x1B[90m#x1B[39;49;00m
                #x1B[33m"#x1B[39;49;00m#x1B[33mseurat#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, #x1B[96mdict#x1B[39;49;00m(min_mean=#x1B[94m0.0125#x1B[39;49;00m, max_mean=#x1B[94m3#x1B[39;49;00m, min_disp=#x1B[94m0.5#x1B[39;49;00m), FILE, #x1B[96mid#x1B[39;49;00m=#x1B[33m"#x1B[39;49;00m#x1B[33mseurat#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            ),#x1B[90m#x1B[39;49;00m
            pytest.param(#x1B[90m#x1B[39;49;00m
                #x1B[33m"#x1B[39;49;00m#x1B[33mcell_ranger#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, #x1B[96mdict#x1B[39;49;00m(n_top_genes=#x1B[94m100#x1B[39;49;00m), FILE_CELL_RANGER, #x1B[96mid#x1B[39;49;00m=#x1B[33m"#x1B[39;49;00m#x1B[33mcell_ranger#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            ),#x1B[90m#x1B[39;49;00m
        ],#x1B[90m#x1B[39;49;00m
    )#x1B[90m#x1B[39;49;00m
    #x1B[37m@pytest#x1B[39;49;00m.mark.parametrize(#x1B[33m"#x1B[39;49;00m#x1B[33marray_type#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, ARRAY_TYPES)#x1B[90m#x1B[39;49;00m
    #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mtest_compare_to_upstream#x1B[39;49;00m(#x1B[90m#x1B[39;49;00m
        *,#x1B[90m#x1B[39;49;00m
        request: pytest.FixtureRequest,#x1B[90m#x1B[39;49;00m
        func: Literal[#x1B[33m"#x1B[39;49;00m#x1B[33mhvg#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, #x1B[33m"#x1B[39;49;00m#x1B[33mfgd#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m],#x1B[90m#x1B[39;49;00m
        flavor: Literal[#x1B[33m"#x1B[39;49;00m#x1B[33mseurat#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, #x1B[33m"#x1B[39;49;00m#x1B[33mcell_ranger#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m],#x1B[90m#x1B[39;49;00m
        params: #x1B[96mdict#x1B[39;49;00m[#x1B[96mstr#x1B[39;49;00m, #x1B[96mfloat#x1B[39;49;00m | #x1B[96mint#x1B[39;49;00m],#x1B[90m#x1B[39;49;00m
        ref_path: Path,#x1B[90m#x1B[39;49;00m
        array_type: Callable,#x1B[90m#x1B[39;49;00m
    ):#x1B[90m#x1B[39;49;00m
        #x1B[94mif#x1B[39;49;00m func == #x1B[33m"#x1B[39;49;00m#x1B[33mfgd#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m #x1B[95mand#x1B[39;49;00m flavor == #x1B[33m"#x1B[39;49;00m#x1B[33mcell_ranger#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            reason = #x1B[33m"#x1B[39;49;00m#x1B[33mThe deprecated filter_genes_dispersion behaves differently with cell_ranger#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
            request.applymarker(pytest.mark.xfail(reason=reason))#x1B[90m#x1B[39;49;00m
        hvg_info = pd.read_csv(ref_path)#x1B[90m#x1B[39;49;00m
    #x1B[90m#x1B[39;49;00m
        pbmc = pbmc68k_reduced()#x1B[90m#x1B[39;49;00m
        pbmc.X = pbmc.raw.X#x1B[90m#x1B[39;49;00m
        pbmc.X = array_type(pbmc.X)#x1B[90m#x1B[39;49;00m
        pbmc.var_names_make_unique()#x1B[90m#x1B[39;49;00m
        sc.pp.filter_cells(pbmc, min_counts=#x1B[94m1#x1B[39;49;00m)#x1B[90m#x1B[39;49;00m
        sc.pp.normalize_total(pbmc, target_sum=#x1B[94m1e4#x1B[39;49;00m)#x1B[90m#x1B[39;49;00m
    #x1B[90m#x1B[39;49;00m
        #x1B[94mif#x1B[39;49;00m func == #x1B[33m"#x1B[39;49;00m#x1B[33mhvg#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            sc.pp.log1p(pbmc)#x1B[90m#x1B[39;49;00m
            sc.pp.highly_variable_genes(pbmc, flavor=flavor, **params, inplace=#x1B[94mTrue#x1B[39;49;00m)#x1B[90m#x1B[39;49;00m
        #x1B[94melif#x1B[39;49;00m func == #x1B[33m"#x1B[39;49;00m#x1B[33mfgd#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            #x1B[94mwith#x1B[39;49;00m pytest.warns(#x1B[96mFutureWarning#x1B[39;49;00m, match=#x1B[33mr#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33msc#x1B[39;49;00m#x1B[33m\#x1B[39;49;00m#x1B[33m.pp#x1B[39;49;00m#x1B[33m\#x1B[39;49;00m#x1B[33m.highly_variable_genes#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m):  #x1B[90m# noqa: PT031#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
                #x1B[90m# https://github..../pandas/issues/61928#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
                warnings.filterwarnings(#x1B[90m#x1B[39;49;00m
                    #x1B[33m"#x1B[39;49;00m#x1B[33mignore#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, #x1B[33mr#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33minvalid value encountered in cast#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, #x1B[96mRuntimeWarning#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
                )#x1B[90m#x1B[39;49;00m
                sc.pp.filter_genes_dispersion(#x1B[90m#x1B[39;49;00m
                    pbmc, flavor=flavor, **params, log=#x1B[94mTrue#x1B[39;49;00m, subset=#x1B[94mFalse#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
                )#x1B[90m#x1B[39;49;00m
        #x1B[94melse#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            pytest.fail(#x1B[33mf#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[33mUnknown func #x1B[39;49;00m#x1B[33m{#x1B[39;49;00mfunc#x1B[33m}#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m)#x1B[90m#x1B[39;49;00m
    #x1B[90m#x1B[39;49;00m
        np.testing.assert_array_equal(#x1B[90m#x1B[39;49;00m
            hvg_info[#x1B[33m"#x1B[39;49;00m#x1B[33mhighly_variable#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m], pbmc.var[#x1B[33m"#x1B[39;49;00m#x1B[33mhighly_variable#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m]#x1B[90m#x1B[39;49;00m
        )#x1B[90m#x1B[39;49;00m
    #x1B[90m#x1B[39;49;00m
        #x1B[90m# (still) Not equal to tolerance rtol=2e-05, atol=2e-05#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        #x1B[90m# np.testing.assert_allclose(4, 3.9999, rtol=2e-05, atol=2e-05)#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
>       np.testing.assert_allclose(#x1B[90m#x1B[39;49;00m
            hvg_info[#x1B[33m"#x1B[39;49;00m#x1B[33mmeans#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m],#x1B[90m#x1B[39;49;00m
            pbmc.var[#x1B[33m"#x1B[39;49;00m#x1B[33mmeans#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m],#x1B[90m#x1B[39;49;00m
            rtol=#x1B[94m2e-05#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
            atol=#x1B[94m2e-05#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        )#x1B[90m#x1B[39;49;00m

#x1B[1m#x1B[31mtests/test_highly_variable_genes.py#x1B[0m:426: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

args = (<function assert_allclose.<locals>.compare at 0x7f02e46dafc0>, array([1.88077032, 0.86220696, 2.78955474, 3.51562963,...6, 2.32597827, 1.59182085, 3.16090039, 3.48005717,
       2.51568575, 3.51163705, 1.30307758, 2.53377802, 2.18815013]))
kwds = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=2e-05, atol=2e-05', 'strict': False, ...}

    #x1B[0m#x1B[37m@wraps#x1B[39;49;00m(func)#x1B[90m#x1B[39;49;00m
    #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92minner#x1B[39;49;00m(*args, **kwds):#x1B[90m#x1B[39;49;00m
        #x1B[94mwith#x1B[39;49;00m #x1B[96mself#x1B[39;49;00m._recreate_cm():#x1B[90m#x1B[39;49;00m
>           #x1B[94mreturn#x1B[39;49;00m func(*args, **kwds)#x1B[90m#x1B[39;49;00m
                   ^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE           AssertionError: #x1B[0m
#x1B[1m#x1B[31mE           Not equal to tolerance rtol=2e-05, atol=2e-05#x1B[0m
#x1B[1m#x1B[31mE           #x1B[0m
#x1B[1m#x1B[31mE           Mismatched elements: 134 / 765 (17.5%)#x1B[0m
#x1B[1m#x1B[31mE           Max absolute difference among violations: 0.01282391#x1B[0m
#x1B[1m#x1B[31mE           Max relative difference among violations: 0.00696457#x1B[0m
#x1B[1m#x1B[31mE            ACTUAL: array([1.88077 , 0.862207, 2.789555, 3.51563 , 0.779662, 2.495507,#x1B[0m
#x1B[1m#x1B[31mE                  2.051983, 2.200089, 2.121406, 2.272991, 2.340023, 2.030907,#x1B[0m
#x1B[1m#x1B[31mE                  2.267801, 1.565244, 2.465999, 0.676449, 2.246484, 3.938324,...#x1B[0m
#x1B[1m#x1B[31mE            DESIRED: array([1.88077 , 0.862207, 2.789555, 3.515629, 0.779662, 2.495507,#x1B[0m
#x1B[1m#x1B[31mE                  2.051983, 2.200089, 2.121406, 2.272991, 2.340023, 2.030907,#x1B[0m
#x1B[1m#x1B[31mE                  2.267801, 1.565244, 2.465999, 0.676449, 2.246485, 3.938324,...#x1B[0m

#x1B[1m#x1B[.../usr/lib/python3.12/contextlib.py#x1B[0m:81: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@flying-sheep flying-sheep added this to the 1.12.0 milestone Jun 3, 2025
@flying-sheep flying-sheep changed the base branch from main to pa/settings-overhaul June 6, 2025 10:07
Base automatically changed from pa/settings-overhaul to main June 10, 2025 12:23
@flying-sheep flying-sheep modified the milestones: 1.12.0, 1.13.0 Nov 3, 2025
@flying-sheep
Copy link
Member Author

flying-sheep commented Nov 10, 2025

TODO: add jaccard to seurat preset #3828

@flying-sheep flying-sheep changed the title (feat): presets feat: presets Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Seurat compatibility preset

1 participant