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

Adjust pc.range in IKAP for SCTransform()-processed Seurat objects? #10

Open
denvercal1234GitHub opened this issue Feb 21, 2021 · 6 comments

Comments

@denvercal1234GitHub
Copy link

denvercal1234GitHub commented Feb 21, 2021

Dear @NHLBI-BCB and @xizhihui

Thank you for developing the package!

I have processed my data using SCTransform() (which replaces NormalizeData(), ScaleData() and FindVariableFeatures()) and have performed RunPCA, RunUMAP, FindNeighbors() and FindClusters().

SCTransform() allows using 30 PCs, should I adjust pc.range = 30 or just use the default value of 20 and let the IKAP() decides? I am confused because even if the IKAP Package info says pc.range = 20 as default, I still see the Iteration running for nPC = more than 20.

Also, would you mind advising me how to obtain the resolution of a recommended (PC,k) combination at the end?

Thank you very much for your help!

@denvercal1234GitHub denvercal1234GitHub changed the title Where to start IKAP for SCTransform()-processed Seurat objects? Re-scale in IKAP for SCTransform()-processed Seurat objects? Feb 21, 2021
@denvercal1234GitHub denvercal1234GitHub changed the title Re-scale in IKAP for SCTransform()-processed Seurat objects? Adjust pc.range in IKAP for SCTransform()-processed Seurat objects? Feb 21, 2021
@xizhihui
Copy link

Hi, I think you can have a look at the README and the source code of function "IKAP". It seems that pc.range is used to get the final pcs computed in "Seurat::RunPCA" if you provide no pcs in IKAP. For example, IKAP(..., pcs = 50, pc.range = 20) may result in a heatmap(PC_K.pdf) with 30-50(not exactly) pcs and their clusters, in that heatmap, box labeled "B" means best (PC,k), "X" means candidate (PC, k).

@denvercal1234GitHub
Copy link
Author

denvercal1234GitHub commented Feb 22, 2021

Thank you for your response, @xizhihui! But actually when I set pc.range = 30, pcs=20, the function will test various k values but only with a single value of number of PC (20 PCs)

Also, how do we obtain the resolution of a recommended (PC,k) combination at the end?

@xizhihui
Copy link

if you have read the source code in IKAP, you would find these lines, it shows that when "pcs" is provided, pc.range is ignored and resolution is used as the "r.kmax.est" parameter.

@xizhihui
Copy link

if you have read the source code in IKAP, you would find these lines, it shows that when "pcs" is provided, pc.range is ignored and resolution is used as the "r.kmax.est" parameter.

oops, it shows in the doc @param r.kmax.est, by the way, it seems k.max and r.kmax.est are not compatible.

@denvercal1234GitHub
Copy link
Author

denvercal1234GitHub commented Feb 22, 2021

Hi @xizhihui - Thanks for your response!

Though, r.kmax.est is only the max resolution parameter to use to determine the k max. Once the codes are finished, we get recommended (PC, k).

In #9, you suggested that "if you wanna to generate the tsne or umap, just use RunTSNE or RunUMAP on the Seurat object with the first 18 pcs" (i.e. running RunUMAP on the "new" Seurat object with the recommended Best PC. But, FindClusters() function still needs to set the argument resolution. This resolution might not be the r.kmax.est we input.

Do you know how we get the resolution associated with the Best (PC, k) used to generate the UMAP and clusters in the IKAP output PC_K?

I looked over the code for Seurat v3, but cannot seem to find it.

@xizhihui
Copy link

Hi @denvercal1234GitHub in the lines from BottomUpMerge, you can add a message line to print the informations like:

# after FindClusters
# PC, resolution, K
message(npc, ",",  clust.r, ", ", length(unique(sobj@active.ident)))

Then you can find the clust.r for Best (PC, K) from the log.

As you mentioned in #9 , it is not necessary to know the resolution because we can get the Best(PC,K) cluster result from meta.data and UMAP/tSNE does nothing with resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants