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

BoxPlot.metabolism issue, obj not in function code #2

Open
msalaciak opened this issue Jul 28, 2021 · 5 comments
Open

BoxPlot.metabolism issue, obj not in function code #2

msalaciak opened this issue Jul 28, 2021 · 5 comments

Comments

@msalaciak
Copy link

msalaciak commented Jul 28, 2021

I noticed BoxPlot wasn't working, couldn't find countexp.Seurat

Turns out in the function, the Countexp.Seurat was not replaced by parameter = obj

BoxPlot.metabolism <- function(obj, pathway, phenotype, ncol = 1){
input.pathway<-pathway
input.parameter<-phenotype
metadata<-countexp.Seurat@meta.data
metabolism.matrix <- countexp.Seurat@assays$METABOLISM$score

@wu-yc
Copy link
Owner

wu-yc commented Jul 28, 2021

Hi Salaciak,

Thanks for your comment. We are now working on it and will revise the code ASAP

@xutongran
Copy link

Hi Wu yc !
I had a similar problem, when i run this command "DotPlot.metabolism(obj = countexp.Seurat, pathway = input.pathway, phenotype = "ident", norm = "y")", Error in [.data.frame(metadata, , input.parameter) : 选择了未定义的列, I want to request you: how to fix this kind of error

@kake1998
Copy link

Why can't you install this package?

@sergio-rutella
Copy link

The boxplot issue has not been resolved yet. I am working with this package now and I keep getting the same error!

@msalaciak
Copy link
Author

@sergio-rutella What I did to fix it is I just copied the entire function from here and just changed all instances of Seurat to the parameter obj and it works!

BoxPlot.metabolism <- function(obj, pathway, phenotype, ncol = 1){
input.pathway<-pathway
input.parameter<-phenotype
metadata<-countexp.Seurat@meta.data
metabolism.matrix <- countexp.Seurat@assays$METABOLISM$score
metadata[,input.parameter]<-as.character(metadata[,input.parameter])
metabolism.matrix_sub<-t(metabolism.matrix[input.pathway,])
#arrange large table
gg_table<-c()
for (i in 1:length(input.pathway)){
gg_table<-rbind(gg_table, cbind(metadata[,input.parameter], input.pathway[i], metabolism.matrix_sub[,i]))
}
gg_table<-data.frame(gg_table)
gg_table[,3]<-as.numeric(as.character(gg_table[,3]))
library(wesanderson)
pal <- wes_palette("Zissou1", 100, type = "continuous")
ggplot(data=gg_table, aes(x=gg_table[,1], y=gg_table[,3], fill = gg_table[,1])) +
geom_boxplot(outlier.shape=NA)+
ylab("Metabolic Pathway")+
xlab(input.parameter)+
theme_bw()+theme(axis.text.x = element_text(angle = 45, hjust = 1), #aspect.ratio=1,
panel.grid.minor = element_blank(), panel.grid.major = element_blank()) +
#scale_color_gradientn(colours = pal) +
facet_wrap(~gg_table[,2], ncol = ncol, scales = "free") +
labs(fill = input.parameter) +
#theme_bw()+theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
NULL
}

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

5 participants