diff gff2tabular.R @ 1:639c0edb7e64 draft

planemo upload for repository https://github.com/kavonrtep/galaxy_packages commit 248ffeb6792d5807820b664eae3e88306f3f395e-dirty
author petr-novak
date Mon, 26 Feb 2024 12:59:20 +0000
parents 696e702ebf74
children
line wrap: on
line diff
--- a/gff2tabular.R	Mon May 09 08:26:30 2022 +0000
+++ b/gff2tabular.R	Mon Feb 26 12:59:20 2024 +0000
@@ -2,5 +2,12 @@
 library(rtracklayer)
 gff <- import(commandArgs(T)[1], format='GFF')
 tabular <- as.data.frame(gff)
+head(tabular)
+# some columns are lists, we need to convert them to vectors  before writing to file
+for (i in 1:ncol(tabular)){
+  if (is.list(tabular[[i]])){
+    tabular[[i]] <- sapply(tabular[[i]], function(x) paste(x, collapse = ";"))
+  }
+}
 write.table(tabular, file = commandArgs(T)[2], quote=FALSE, sep="\t", row.names=FALSE)