comparison 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
comparison
equal deleted inserted replaced
0:696e702ebf74 1:639c0edb7e64
1 #!/usr/bin/env Rscript 1 #!/usr/bin/env Rscript
2 library(rtracklayer) 2 library(rtracklayer)
3 gff <- import(commandArgs(T)[1], format='GFF') 3 gff <- import(commandArgs(T)[1], format='GFF')
4 tabular <- as.data.frame(gff) 4 tabular <- as.data.frame(gff)
5 head(tabular)
6 # some columns are lists, we need to convert them to vectors before writing to file
7 for (i in 1:ncol(tabular)){
8 if (is.list(tabular[[i]])){
9 tabular[[i]] <- sapply(tabular[[i]], function(x) paste(x, collapse = ";"))
10 }
11 }
5 write.table(tabular, file = commandArgs(T)[2], quote=FALSE, sep="\t", row.names=FALSE) 12 write.table(tabular, file = commandArgs(T)[2], quote=FALSE, sep="\t", row.names=FALSE)
6 13