Created
April 11, 2014 16:59
-
-
Save standage/10484272 to your computer and use it in GitHub Desktop.
Minimal GeneSeqer to GFF3 converter
This file contains 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 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