Hi everyone,

I'm trying to analyze my counts data with DESeq2 and based on the tutorial of GSEA, DESeq2 has an output format that can be used directly in the GSEA ([here][1]). However, I'm reading their [workflow][2] and I don't find how to make this gct output format.
Any help is appreciated.


  [1]: http://software.broadinstitute.org/cancer/software/gsea/wiki/index.php/Using_RNA-seq_Datasets_with_GSEA
  [2]: http://master.bioconductor.org/packages/release/workflows/vignettes/rnaseqGene/inst/doc/rnaseqGene.html#the-deseqdataset-object-sample-information-and-the-design-formula
Hi!

In this case you have to prepare the `gct` file "by hand" for analyze your data with GSEA. Once you have created your DESeq object (`dds`) you are going to retrieve the normalized counts based on the DESeq method:

    norm_counts <- counts(dds, normalized = T)

Then, you must arrange this normalized counts matrix according to the minimum requirements for a [GCT](https://www.genepattern.org/file-formats-guide#GCT) file.
I suggest you to codificate the `norm_counts` as a `data.frame` and add an extra column called description (this column could contain the id's of your genes):

    norm_counts <- as.data.frame(norm_counts)
    norm_counts$description <- norm_counts$your_id_column

Move the "description" column to be the second in the df and save it using the `write.table` command:

    write.table(norm_counts, "path_to_save_file.gct", sep = "\t", quote = F, row.names = F)

Finally, using a plain text editor put all the additional information (following the directions of the link) to have a gct file for GSEA.
For a detailed tutorial about `gct` and `cls` files watch [this video](https://www.youtube.com/watch?v=KY6SS4vRchY&t=2563s) but please follow the directions of the [link](https://www.genepattern.org/file-formats-guide#GCT)

Hope it could help!

Best regards!

Rodo