Created
August 8, 2019 03:25
-
-
Save pansapiens/5f871b5ab104c0dc75d310cfadc54fee to your computer and use it in GitHub Desktop.
gff2gtf.R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env Rscript | |
# Based on https://www.biostars.org/p/45791/#45804 | |
# | |
# Usage: | |
# ./gff2gtf.R genes.gff genes.gtf | |
# | |
# Dependencies can be easily installed like: | |
# conda create -n gff2gtf bioconductor-rtracklayer | |
# conda activate gff2gtf | |
# Set a working CRAN mirror | |
local({r <- getOption("repos") | |
r["CRAN"] <- "http://cloud.r-project.org" | |
options(repos=r) | |
}) | |
# Install pacman and rtracklayer if not present | |
if (!require("pacman")) { | |
install.packages("pacman") | |
} | |
pacman::p_install(rtracklayer, | |
try.bioconductor=TRUE, | |
force=FALSE, | |
update.bioconductor=TRUE) | |
library(rtracklayer) | |
args = commandArgs(trailingOnly=TRUE) | |
gff_features <- import(args[1]) | |
export(gff_features, args[2], "gtf") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment