Writes a GMT (Gene Matrix Transposed) file from a data frame.
writeGMT(df, outfile)
df | Data frame with columns ordered as Identifiers, optional Name columns and Genes. Identifiers must be first and Genes must be last. |
---|---|
outfile | Path to output GMT file |
None
The input data frame must include at least two columns: Identifiers (first column) and Genes (last column). The Identifiers will be duplicated to fill the Name column in the output GMT file. If one or more Name columns are provided in the data frame, #' then they will be concatenated with separators.
Adapted from the GMT writer in MAGeCKFlute, https://github.com/WubingZhang/MAGeCKFlute/blob/master/R/readGMT.R
readPathwayGMT
# \donttest{ my.df <- data.frame(id=c("WP1000","WP1000","WP1000","WP1001","WP1001"), name=c("cancer","cancer","cancer","diabetes","diabetes"), gene=c("574413","2167","4690","5781","11184")) writeGMT(my.df, "myGmtFile.gmt") # }