icbi-lab / infercnvpy

Infer copy number variation (CNV) from scRNA-seq data. Plays nicely with Scanpy.

Home Page:https://infercnvpy.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

copykat with mouse data

muntajihad opened this issue · comments

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

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

@muntajihad thanks for pointing this out.

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

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

Hi @abyssum ,
It worked perfectly. Many thanks

@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).

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

  • abspos
  • chromosome_name
  • start_position
  • end_position
  • ensembl_gene_id
  • mgi_symbol
  • band

while in human it only has :

  • chrom
  • chromos
  • abspos

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,

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() } }

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!