text: user9990: Similar to: How to convert data in gmt format to dataframe?
  I have downloaded a GMT file from the GSEA database (https://www.gsea-msigdb.org/gsea/msigdb/download_file.jsp?filePath=/msigdb/release/2022.1.Hs/c2.all.v2022.1.Hs.symbols.gmt)
  I have imported this into R using the GSA.read.gmt tool from GSA as I want to do pathway analysis using GAUSS (https://github.com/diptavo/GAUSS/blob/master/example_gmt.txt).
  GAUSS needs the table to have the genes in a comma separated manner as well as there being headers in the table.
  I have tried using the gsub function on the third column but it doesn't work, I feel this is because a GMT file is not the same as a dataframe.
  Would anyone be able to help me turn this column into a comma separated one please?
  Many thanks
  
  user9990: I used the unite function from tidyr but first I read the gmt file in as a data table using the read.delim function (with header set to False). Then I used unite:
  library(tidyr)
  
  gmt_file <- read.delim("~/path_to_file/file.gmt", header = F)
  gmt_file <- gmt_file %>% unite(genes,3:ncol(gmt_file), sep=",")
  colnames(gmt_file) <- c("pathway", "source", "genes")
  write.table.... 
  
  
original_text: 9990: <p>Similar to: <a href="https://bioinformatics.stackexchange.com/questions/5400/how-to-convert-data-in-gmt-format-to-dataframe">How to convert data in gmt format to dataframe?</a></p>
  <p>I have downloaded a GMT file from the GSEA database (<a href="https://www.gsea-msigdb.org/gsea/msigdb/download_file.jsp?filePath=/msigdb/release/2022.1.Hs/c2.all.v2022.1.Hs.symbols.gmt" rel="nofollow noreferrer">https://www.gsea-msigdb.org/gsea/msigdb/download_file.jsp?filePath=/msigdb/release/2022.1.Hs/c2.all.v2022.1.Hs.symbols.gmt</a>)</p>
  <p>I have imported this into R using the GSA.read.gmt tool from GSA as I want to do pathway analysis using GAUSS (<a href="https://github.com/diptavo/GAUSS/blob/master/example_gmt.txt" rel="nofollow noreferrer">https://github.com/diptavo/GAUSS/blob/master/example_gmt.txt</a>).</p>
  <p>GAUSS needs the table to have the genes in a comma separated manner as well as there being headers in the table.</p>
  <p>I have tried using the gsub function on the third column but it doesn't work, I feel this is because a GMT file is not the same as a dataframe.</p>
  <p>Would anyone be able to help me turn this column into a comma separated one please?</p>
  <p>Many thanks</p>
   9990: <p>I used the unite function from tidyr but first I read the gmt file in as a data table using the read.delim function (with header set to False). Then I used unite:</p>
  <pre><code>library(tidyr)
  
  gmt_file &lt;- read.delim(&quot;~/path_to_file/file.gmt&quot;, header = F)
  gmt_file &lt;- gmt_file %&gt;% unite(genes,3:ncol(gmt_file), sep=&quot;,&quot;)
  colnames(gmt_file) &lt;- c(&quot;pathway&quot;, &quot;source&quot;, &quot;genes&quot;)
  write.table.... 
  </code></pre>
  