Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing to specify 'span' parameter in the Preprocessor #196

Open
Szym29 opened this issue May 7, 2024 · 1 comment
Open

Allowing to specify 'span' parameter in the Preprocessor #196

Szym29 opened this issue May 7, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Szym29
Copy link

Szym29 commented May 7, 2024

Hi,

I tried to fine tune the model on my data for integration. However, the sparsity of my data is higher than the common scRNA-seq dataset. And when I used the scgpt.preprocess.Preprocessor to subset the highly variable genes, an error occurred.

ValueError: b'There are other near singularities as well. . 0.090619

I found this relevant issue . I manually set the span as 0.5 in the Preprocessor class, and it worked fine then.

        # step 5: subset hvg
        if self.subset_hvg:
            logger.info("Subsetting highly variable genes ...")
            if batch_key is None:
                logger.warning(
                    "No batch_key is provided, will use all cells for HVG selection."
                )
            sc.pp.highly_variable_genes(
                adata,
                layer=self.hvg_use_key,
                n_top_genes=self.subset_hvg
                if isinstance(self.subset_hvg, int)
                else None,
                batch_key=batch_key,
                flavor=self.hvg_flavor,
                span=0.5,
                subset=True,
            )

So I would suggest allowing users to specify the 'span' when they initialize the Preprocessor and pass it to sc.pp.highly_variable_genes. It would be better if all scanpy parameters could be specified in the preprocessor to improve the robustness of the method.

Thanks,
Yumin

@subercui
Copy link
Member

subercui commented May 8, 2024

Thank you for the suggestion! I will try to add these features soon, probably by additional kwargs.

@subercui subercui added the enhancement New feature or request label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants