#!/usr/bin/env python

# Convert a GFF file to a GTF file using gffread from the 
# cufflinks package. Assumes that the string after the rightmost
# dot (.) is the file extension. The rest of the filename can contain
# dots eg. if the input file is GCF_000005005.2_B73_RefGen_v4_genomic.gff
# the output will be written GCF_000005005.2_B73_RefGen_v4_genomic.gtf

import os.path
import subprocess
import sys

#Convert arguments to variables
INFILE = sys.argv[1]
NAME   = os.path.splitext(INFILE)[0]
OUTFILE = NAME + '.gtf'

p = subprocess.Popen(['gffread', INFILE, '-T', '-o', OUTFILE])
p.wait()



