Commit e9b231e6 authored by Mathieu Giraud's avatar Mathieu Giraud

gb-to-should.py: quick translation of some .gb files into .should-vdj.fa

parent c7a80b6d
'''Rough conversion from .gb to .should-vdj.fa'''
# python gb-to-should.py *.gb
import sys
def parse(stream):
sys.stdout.write(">")
phase = 0
for l in stream:
l = l.strip()
if l.startswith("FEATURES"):
phase = 1
continue
if l == "ORIGIN":
phase = 2
continue
if l == "//":
phase = 3
continue
if not phase in [1, 2]:
continue
if phase == 1 and l.startswith('/label'):
what = l.split('=')[1]
if not 'TR' in what:
continue
sys.stdout.write(what + ' ')
continue
if phase == 2:
seq = ''.join(l.split(' ')[1:])
sys.stdout.write('\n' + seq)
continue
# print "! Not parsed:", l
sys.stdout.write('\n\n')
for f in sys.argv:
sys.stdout.write('#%s\n' % f)
parse(open(f))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment