Hello Biostars,
Can anyone tell me how to prepare input data set for GSEA after Differential Gene Expression Analysis by DESeq2?
How will I rank the genes? Should I rank based on log2FC or Adjusted P value? Is there any way to generate a GSEA ready data directly from DESeq2?. 
I was using topGo for gene ontology enrichment analysis before and recently came across GSEA. Which one is better GO enrichment analysis or GSEA? Even after going through the papers I couldn't find a significant difference between above two.

Thank you
Hi Sreeraj 

Genes can be ranked based on fold change and P value and that can be used in GSEA package.

you can use this R code for this purpose. 

    x <- read.table("DE_genes.txt",sep = "\t",header = T)
    head(x)
    x$fcsign <- sign(x$log2.fold_change.)
    x$logP=-log10(x$p_value)
    x$metric= x$logP/x$fcsign
    y<-x[,c("Gene", "metric")]
    head(y)
    write.table(y,file="DE_genes.rnk",quote=F,sep="\t",row.names=F)