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

Issues visualizing CNV posterior in tSNE embedding using pagoda #116

Closed
bobbyshih opened this issue Apr 27, 2023 · 2 comments
Closed

Issues visualizing CNV posterior in tSNE embedding using pagoda #116

bobbyshih opened this issue Apr 27, 2023 · 2 comments

Comments

@bobbyshih
Copy link

bobbyshih commented Apr 27, 2023

Ran numbat successfully and following the published guide for interpreting the results.

I am attempting to visualize CNV posterior in tSNE embedding as below:

pagoda <- readRDS(url('http://pklab.med.harvard.edu/teng/data/con_TNBC1.rds'))
plist = list()
muts  <-  nb$joint_post %>% distinct(seg)
muts <- muts$seg
cnv_type = nb$joint_post %>% distinct(seg, cnv_state) %>% {setNames(.$cnv_state, .$seg)}
for (mut in muts) {
    plist[[mut]] = pagoda$plotEmbedding(
        alpha=0.8,
        size=1, 
        plot.na = F, 
        colors = nb$joint_post %>%
            filter(seg == mut) %>%
            {setNames(.$p_cnv, .$cell)},
        show.legend = T,
        mark.groups = F,
        plot.theme = theme_bw(),
        title = paste0(mut, '(', cnv_type[muts], ')')
    ) +
    scale_color_gradient2(low = 'royalblue', mid = 'white', high = 'red3', midpoint = 0.5, limits = c(0,1), name = 'Posterior')
}
wrap_plots(plist, guides = 'collect')

However I get the following error

Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf

I have run this using the provided example numbat results:

nb_TNBC1= readRDS(url("http://pklab.med.harvard.edu/teng/data/nb_TNBC1.rds"))
plist = list()
muts = c('1a', '3b', '22b')
cnv_type = nb_TNBC1$joint_post %>% distinct(seg, cnv_state) %>% {setNames(.$cnv_state, .$seg)}
for (mut in muts) {
    
    plist[[mut]] = pagoda$plotEmbedding(
        alpha=0.8,
        size=1, 
        plot.na = F, 
        colors = nb_TNBC1$joint_post %>%
            filter(seg == mut) %>%
            {setNames(.$p_cnv, .$cell)},
        show.legend = T,
        mark.groups = F,
        plot.theme = theme_bw(),
        title = paste0(mut, '(', cnv_type[muts], ')')
    ) +
    scale_color_gradient2(low = 'royalblue', mid = 'white', high = 'red3', midpoint = 0.5, limits = c(0,1), name = 'Posterior')
}
wrap_plots(plist, guides = 'collect')

This generates the exact same plots as shown in the guide.

Using my data, if I remove the colors argument the following plot is generated.

pagoda$plotEmbedding(
        alpha=0.8,
        size=1, 
        plot.na = F, 
        show.legend = T,
        mark.groups = F,
        plot.theme = theme_bw()
    )

image

I have compared the input to colors using both the provided example numbat results as well as mine and can see no difference, so I do not understand why I am getting this error only when using my results.

If it helps I will gladly send over my numbat results, please let me know.

@bobbyshih
Copy link
Author

Did not realize I needed to generate my own pagoda object. Fixed itself!

@christophechu
Copy link

@bobbyshih How to generate own pagoda object?

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