Closed amkhasawneh closed 9 months ago
Often that error is associated with specifying the wrong analysis type in the enrichment input window for the enrichment analysis results file. Are you trying to run a GSEA or a generic analysis?
Thank you.
I'm trying to run a GSEA analysis, which I did with the fgsea R package. I have divided the output file into two--one with positive and one with negative NESs.
Are you just giving Enrichment map the file that fGSEA generates? Unfortunately EM is not configured to recognize the fgsea files directly.
Sorry not pretty and specific to my current analysis but I have a function like this in R to create GSEA like results from fGSEA outputs.
write_patient_fgsea_results<- function(current_fgsea_results, current_results_dir,
current_patient){
current_patient <- substring(current_patient,1,12)
current_patient_directory_fullpath <- file.path(current_results_dir,
current_patient)
if(!dir.exists(current_patient_directory_fullpath)){
dir.create(current_patient_directory_fullpath)
}
#calculate the rank at max
#fgsea returns the leading edge. Just need to extract the highest rank from
# set to get the rank at max
calculated_rank_at_max <- apply(current_fgsea_results,1,
FUN=function(x){
max(which(names(current_ranks)
%in% unlist(x[8])))})
enr_current_patient <- cbind(current_fgsea_results$pathway,
current_fgsea_results$pathway,
"Details",
current_fgsea_results$size,
current_fgsea_results$ES,
current_fgsea_results$NES,
current_fgsea_results$pval,
current_fgsea_results$padj,
0,
calculated_rank_at_max,
apply(current_fgsea_results,1,
FUN=function(x){paste(unlist(x[8]),collapse=",")}))
colnames(enr_current_patient) <- c("name","description",
"GS details","SIZE","ES",
"NES","pval","padj","FWER",
"Rank at Max","leading edge genes")
enr_filename_positive <- paste0(current_patient, "fgsea_enr_results_pos.txt",sep="")
enr_filename_docker_positive <- file.path(current_patient_directory_fullpath,
enr_filename_positive)
write.table(enr_current_patient[which(enr_current_patient[,"NES"]>=0),] ,
enr_filename_docker_positive,
col.name=TRUE,sep="\t",row.names=FALSE,quote=FALSE,fileEncoding="latin1")
enr_filename_negative <- paste0(current_patient, "fgsea_enr_results_neg.txt",sep="")
enr_filename_docker_negative <- file.path(current_patient_directory_fullpath,
enr_filename_negative)
write.table(enr_current_patient[which(enr_current_patient[,"NES"]<0),] ,
enr_filename_docker_negative,
col.name=TRUE,sep="\t",row.names=FALSE,quote=FALSE,fileEncoding="latin1")
#create a expression file - just the ranks file as expression file
exp <- data.frame(name = names(current_ranks),
description = names(current_ranks),current_ranks)
exp_filename <- paste0(current_patient,"expression.txt",sep="")
exp_name_docker <- file.path( current_patient_directory_fullpath,exp_filename)
write.table(exp,
exp_name_docker,
col.name=TRUE,sep="\t",row.names=FALSE,
quote=FALSE,fileEncoding="")
#create a rank expression file
rnk <- data.frame(name = names(current_ranks),
current_ranks)
rnk_filename <- paste0(current_patient,"ranks.rnk",sep="")
rnk_name_docker <- file.path( current_patient_directory_fullpath,rnk_filename)
write.table(rnk,
rnk_name_docker,
col.name=TRUE,sep="\t",row.names=FALSE,
quote=FALSE,
fileEncoding="")
}
Thanks a lot for taking the time, and I'm sorry for the late response (it's because of the time difference).
I have been adding ranks to my fGSEA results, but I'm not sure about the other modifications. I will adapt the function to my data, and try it again with EnrichmentMap.
Thanks again.
It works perfectly.
Thank you very much.
Hello.
Thanks a lot for all your efforts.
Whenever I try to build an enrichment map, I get a strange error:
How should I go about this?
Thanks a lot. Abdullah