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

copykat with mouse data #91

Closed muntajihad closed 1 year ago

muntajihad commented 1 year ago

Description of feature

Hi there, when applying cnv.tl.copykat on mouse data I got this error : RRuntimeError: Error in copykat(rawmat = expr_r, id.type = gene_ids, ngene.chr = min_gene_chr, : all cells are filtered

Which is normal as it expect Human gene names.

While, in the original copykat R package it can be use with mouse data by adding the option genome = 'mm10' . it would be nice, if you add that too. Thanks

abyssum commented 1 year ago

@grst do you think such feature is needed? I can look into it when I have some time.

@muntajihad thanks for pointing this out.

grst commented 1 year ago

Why not... should be a straightforward change. PR welcome!

abyssum commented 1 year ago

Added the mouse functionality for copyKAT, but it needs testing... Since I don't have any mice scRNAseq data at the ready, @muntajihad can you pull the copykat_mice branch in icbi-lab/infercnvpy and test it on your data?

edit: make sure to issue the organism = "mouse" parameter in your cnv.tl.copykat call

muntajihad commented 1 year ago

Hi @abyssum , It worked perfectly. Many thanks

abyssum commented 1 year ago

@muntajihad Great! Thank you for testing it.

@grst I am firing up a PR right away (take a look when you have some time, I am closing this issue).

muntajihad commented 1 year ago

Hi, sorry for the late feedback. But I realized that copykat R package outputs copykat_results has different columns when choosing mouse (mm10):

while in human it only has :

so when its mouse that part of your code : new_cpkat = copyKAT_result.drop(["chrom", "chrompos", "abspos"], axis=1)

should be : new_cpkat = copyKAT_result.drop(["start_position", "chromosome_name", "abspos","end_position","ensembl_gene_id","mgi_symbol","band"], axis=1)

Best,

muntajihad commented 1 year ago

Also (I think)

chrom_pos = { "chr_pos": { f"chr{chrom}": int(pos) for pos, chrom in copyKAT_result.loc[:, ["chrom"]].drop_duplicates().itertuples() } }

should be : chrom_pos = { "chr_pos": { f"chr{chrom}": int(pos) for pos, chrom in copyKAT_result.loc[:, ["chromosome_name"]].drop_duplicates().itertuples() } }

abyssum commented 1 year ago

hello @muntajihad , thank you for the feedback! I just pushed the hotfix branch with your suggestions but haven't tested it tbh. Could you please clone the copykat_mice branch once again locally and give it a try? Let me know if you encounter any issues.

Thanks for your help!