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

Finding normal cells and tumor cells in BAF module #16

Open
Rongtingting opened this issue Aug 23, 2024 · 7 comments
Open

Finding normal cells and tumor cells in BAF module #16

Rongtingting opened this issue Aug 23, 2024 · 7 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Rongtingting
Copy link
Collaborator

          Hi @faridrashidi,

I am sorry for the late reply.
I have added functions for finding normal and tumor cells in XClone BAF module (latest version via github installation).
And XClone works well in Python 3.9 environment now.

Example

import xclone
import scanpy as sc

data_dir = "xxxxxx/BCH869_scRNA_trials/"
baf_final_file = data_dir + "data/BAF_merge_Xdata_KNN_HMM_post.h5ad"

adata = sc.read(baf_final_file)

## explore the clusters numbers by UMAP visualization
xclone.al.exploreClustering(adata, ref_anno_key = "spot_anno", Xlayer = "posterior_mtx", max_clusters = 5)


## explore the BAF clustering by specify 2 clusters
adata_anno = xclone.al.OnestopBAFClustering(adata, Xlayer = "posterior_mtx", 
                         n_clusters = 2, ref_anno_key = "spot_anno", clone_anno_key = "clone(2)", 
                         plot_title = "xxxx (XClone)",
                         file_save_path = "xxxx/analysis/", file_save_name =  "xxx_2clones", complex_plot = True)

## Similarly, explore the BAF clustering by specify 3 clusters
adata_anno = xclone.al.OnestopBAFClustering(adata, Xlayer = "posterior_mtx", 
                         n_clusters = 3, ref_anno_key = "spot_anno", clone_anno_key = "clone(3)", 
                         plot_title = "xxxx (XClone)",
                         file_save_path = "xxxx/analysis/", file_save_name =  "xxx_3clones", complex_plot = True)

Bests,
Rongting

Originally posted by @Rongtingting in #5 (comment)

@Rongtingting
Copy link
Collaborator Author

#8 #8 (comment)
BAF module without specifying reference cells

@Rongtingting Rongtingting added enhancement New feature or request good first issue Good for newcomers labels Aug 23, 2024
@Mashuaiii
Copy link

Hi, Rongting @Rongtingting

Thank you for your prompt answer last time. Sorry to bother you again. I wonder if the normal and tumor cells identified by this BAF module can be used as the result of the final comboine? Can I cluster with the results after the combine module? Will there be any difference between the combine and BAF results? In addition, does xclone have the ability to identify subclones? I am looking forward to hearing from you and I would appreciate it very much.

Best regards!

@Rongtingting
Copy link
Collaborator Author

Hi @ShuaiManMan,

Thank you for your questions.
Yes, you should cluster the results after the Combine module.

Here, BAF module clustering just provides an option for finding reference/normal cells.

If there are LOH events (similar expression level as reference populations but loss allele), only Combine module can detect.

Yes, XClone can detect subclones based on the Combine module's output.

You may find the following codes helpful

import xclone
import scanpy as sc

data_dir = "xxxxxx/BCH869_scRNA_trials/"
combine_final_file = data_dir + "data/combined_final.h5ad"

adata = sc.read(combine_final_file)

## explore the clusters numbers by UMAP visualization
xclone.al.exploreClustering(adata, ref_anno_key = "spot_anno", Xlayer = "prob1_merge", max_clusters = 5)


## explore the clustering by specify 2 clusters
adata_anno = xclone.al.OnestopBAFClustering(adata, Xlayer = "prob1_merge", 
                         n_clusters = 2, ref_anno_key = "spot_anno", clone_anno_key = "clone(2)", 
                         plot_title = "xxxx (XClone)",
                         file_save_path = "xxxx/analysis/", file_save_name =  "xxx_2clones", complex_plot = True)

## Similarly, explore the clustering by specify 3 clusters
adata_anno = xclone.al.OnestopBAFClustering(adata, Xlayer = "prob1_merge", 
                         n_clusters = 3, ref_anno_key = "spot_anno", clone_anno_key = "clone(3)", 
                         plot_title = "xxxx (XClone)",
                         file_save_path = "xxxx/analysis/", file_save_name =  "xxx_3clones", complex_plot = True)

Bests,
Rongting

@Mashuaiii
Copy link

Hi Rongting,
Thank you very much for your timely reply, and your answer is very detailed, I really appreciate it! ^-^

@Mashuaiii
Copy link

Hi @Rongtingting ,

I have some questions about the results of clustering after the Combine module. I ran the following code.

import xclone
import scanpy as sc

data_dir = "xxxxxx/BCH869_scRNA_trials/"
combine_final_file = data_dir + "data/combined_final.h5ad"

adata = sc.read(combine_final_file)

## explore the clusters numbers by UMAP visualization
xclone.al.exploreClustering(adata, ref_anno_key = "spot_anno", Xlayer = "prob1_merge", max_clusters = 5)


## explore the clustering by specify 2 clusters
adata_anno = xclone.al.OnestopBAFClustering(adata, Xlayer = "prob1_merge", 
                         n_clusters = 2, ref_anno_key = "spot_anno", clone_anno_key = "clone(2)", 
                         plot_title = "xxxx (XClone)",
                         file_save_path = "xxxx/analysis/", file_save_name =  "xxx_2clones", complex_plot = True)

the results as follow:
image
I want to know what the coordinates on the right mean. And how do I know which of the two clones is normal and tumor? Run the results of the combine again and label the results with this clone?I am looking forward to hearing from you and I would appreciate it very much.

Bests,
Mashuai

@Rongtingting
Copy link
Collaborator Author

Hi @Mashuaiii,

Thank you for your updates.

Here, you have 2 clone labels; you can use that label to plot a combined module-derived heatmap to check the patterns of the 2 clones.

Bests,
Rongting

@Mashuaiii
Copy link

Ok,Thank you ~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants