view gff2tabular.R @ 3:1069776f7ae2 draft default tip

planemo upload for repository https://github.com/kavonrtep/galaxy_packages commit 3b9f93ed06cc32dbfa271789739e7a1e8fac528c
author petr-novak
date Tue, 30 Apr 2024 08:27:27 +0000
parents 639c0edb7e64
children
line wrap: on
line source

#!/usr/bin/env Rscript
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)