icbi-lab / infercnvpy

Infer copy number variation (CNV) from scRNA-seq data. Plays nicely with Scanpy.
https://infercnvpy.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
122 stars 27 forks source link

Per gene copy number signal. #128

Closed sohrabsa closed 1 week ago

sohrabsa commented 3 months ago

Description of feature

I've noticed that on occasions, after running cnv.tl.infercnv the shape of adata.obsm['X_cnv'].shape is not equal to the size of adata.X.shape. It is possible to please get gene specific copy number values? or otherwise, a mapping for genes to the segments that comprise the columns of X_cnv?

grst commented 3 months ago

Hi, this is currently not possible. Since infercnvpy aggregates gene expression of several genes in a sliding window the information about individual genes is lost.

In principle, it would be possible to store a mapping in which "bins" a certain gene is located - There's a PR open for that #58, but it has gone stale.

sohrabsa commented 3 months ago

Okay, got it thanks. Could you confirm that the columns of X_cnv are bins of size window_size please?

grst commented 3 months ago

That's correct, but note that the bins overlap, i.e. each gene occurs in multiple bins. It's described here in more detail: https://infercnvpy.readthedocs.io/en/latest/infercnv.html

knadia07 commented 1 month ago

Hi is there a way to pull out group of genes within selected chrm coordinates that have high cnv values? We want to know what are the most probable gene sets that are likely altered

grantn5 commented 3 weeks ago

Hi I am working on PR and adding to #58 that will allow you to extract the per gene copy number by averaging across all the bins a given gene appears in, I will hopefully have something ready in the next 2 weeks!

Additionally, in my refactoring I have noticed that the current implementation uses the default np.convolve method full, this means that the pyramid array is fully moved over the gene array, which does not match with the documentation for the function I have therefore updated method to valid which does match what the documentation suggests. Is this the correct interpretation?

Edit: PR is here #132