Mercurial > repos > ieguinoa > data_manager_fetch_tx2gene
view data_manager/get_tx2gene_table.R @ 5:c380b7da5b65 draft default tip
Uploaded
author | ieguinoa |
---|---|
date | Mon, 07 Jun 2021 16:33:53 +0000 |
parents | d71f65b854de |
children |
line wrap: on
line source
library(getopt) # we read the options from the default: commandArgs(TRUE). spec <- matrix(c( "input_type", "t", 1, "character", "outfile", "o", 1, "character", "gtfFile", "x", 1, "character"), byrow=TRUE, ncol=4) opt <- getopt(spec) suppressPackageStartupMessages({library("GenomicFeatures")}) txdb <- makeTxDbFromGFF(opt$gtfFile, format=opt$input_type) k <- keys(txdb, keytype = "GENEID") df <- select(txdb, keys = k, keytype = "GENEID", columns = "TXNAME") tx2gene <- df[, 2:1] # tx ID, then gene ID write.table(tx2gene,file = opt$outfile, quote = FALSE, sep = " ",row.names = FALSE,col.names = FALSE)