Code Monkey home page Code Monkey logo

Comments (8)

flying-sheep avatar flying-sheep commented on June 11, 2024

Hi, I don’t see any errors in your example. Can you please specify what you expected to happen and how what happened differs from that?

Also please provide code as text (in a Markdown code block), not as images.

from scanpy.

HelloWorldLTY avatar HelloWorldLTY commented on June 11, 2024

Hi, I intend to have 13634 hvgs, but it gave me 13652 genes. I am curious about the difference. Is it a bug?

Code:

adata_atac.X = (adata_atac.X > 0)*1
sc.pp.highly_variable_genes(adata_atac, n_top_genes=13634)
adata_atac = adata_atac[:,adata_atac.var['highly_variable']]

from scanpy.

flying-sheep avatar flying-sheep commented on June 11, 2024

Could have all kinds of reasons. Genes sharing the same score, duplicate gene names.

We won’t be able to tell without a reproducible example.

from scanpy.

HelloWorldLTY avatar HelloWorldLTY commented on June 11, 2024

If it is caused by the same score, how to ensure the uniquenss? Thanks. I did not receive the var.unique.name error thus I think it was not caused by duplicate gene names

It is neurips 2021 single cell competition dataset.

from scanpy.

flying-sheep avatar flying-sheep commented on June 11, 2024

I’ll take a look if you update your issue with a code block that I can copy, that will download the dataset and then reproduce the error without me having to go to any website and download anything manually.

from scanpy.

HelloWorldLTY avatar HelloWorldLTY commented on June 11, 2024

Thanks. The dataset is here:

https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE194122

Sicne it is from GSE, I think it is easy to download and it is formed into h5ad format (the multiome part).
GSE194122_openproblems_neurips2021_multiome_BMMC_processed.h5ad.gz

Code:

adata_atac.X = (adata_atac.X > 0)*1
sc.pp.highly_variable_genes(adata_atac, n_top_genes=13634)
adata_atac = adata_atac[:,adata_atac.var['highly_variable']]

from scanpy.

flying-sheep avatar flying-sheep commented on June 11, 2024

So this would be a reproducible example:

import gzip
import shutil
from urllib.request import urlopen
from pathlib import Path

from tqdm.notebook import tqdm
import scanpy as sc

url = "https://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE194122&format=file&file=GSE194122%5Fopenproblems%5Fneurips2021%5Fmultiome%5FBMMC%5Fprocessed%2Eh5ad%2Egz"

path = Path("data/GSE194122_openproblems_neurips2021_multiome_BMMC_processed.h5ad")
if not path.is_file():
    with (
        urlopen(url) as raw,
        tqdm.wrapattr(raw, "read", total=int(raw.headers["Content-Length"])) as wrapped,
        gzip.open(wrapped, 'rb') as f_in,
        path.open('wb') as f_out,
    ):
        shutil.copyfileobj(f_in, f_out)

adata_atac = sc.read(path)
adata_atac.X = (adata_atac.X > 0)*1
sc.pp.highly_variable_genes(adata_atac, n_top_genes=13634)
adata_atac = adata_atac[:,adata_atac.var['highly_variable']]

from scanpy.

flying-sheep avatar flying-sheep commented on June 11, 2024

Problem seems to be fixed in the newest scanpy:

grafik

from scanpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.