Skip to content

Instantly share code, notes, and snippets.

@standage
Created April 11, 2014 16:59
Show Gist options
  • Save standage/10484272 to your computer and use it in GitHub Desktop.
Save standage/10484272 to your computer and use it in GitHub Desktop.
Minimal GeneSeqer to GFF3 converter
#!/usr/bin/env python
import re, sys
# Usage: gsq2gff3 < in.gsq > out.gff3
print "##gff-version 3"
for line in sys.stdin:
line = line.rstrip()
matches = re.search("hqPGS_(.+)[+-]_(.+)([+-])\s\((.+)\)", line)
if not matches:
continue
template = "%s\tGeneSeqer\tEST_match\t%%s\t%%s\t.\t%c\t.\tID=%s" % (matches.group(1), matches.group(3), matches.group(2))
for alignpart in matches.group(4).split(","):
coords = alignpart.split(" ")
print template % (coords[0], coords[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment