Mercurial > repos > tyty > structurefold
diff structurefold/predict/dot_convert.py @ 113:aedb21527abd draft
Uploaded
author | tyty |
---|---|
date | Tue, 14 Apr 2015 14:09:42 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/structurefold/predict/dot_convert.py Tue Apr 14 14:09:42 2015 -0400 @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import sys + +dot_file = sys.argv[1] +result_file = sys.argv[2] + +h = file(result_file, 'w') +f = open(dot_file) + + + +for aline in f.readlines(): + line = aline.strip() + if line.find('>')!=-1: + id_line = line + idt = id_line.split('>') + ids = idt[1].strip() + else: + if line.find('(')!=-1: + structure_line = line + st = structure_line.split(' ') + structure = st[0].strip() + enert = st[1].strip() + if len(enert)>1: + enertt = enert.split('(') + enertt = enertt[1].strip() + else: + enertt = st[2].strip() + enerttt = enertt.split(')') + ener = enerttt[0].strip() + h.write('>ENERGY = '+ener+' '+ids+'\n') + h.write(seq+'\n') + h.write(structure+'\n') + else: + seq = line + + + + + +f.close() +h.close() +