Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bl0b/scriptsforb
Browse files Browse the repository at this point in the history
  • Loading branch information
bl0b committed Jul 20, 2013
2 parents 56459d9 + 1e34830 commit 0e9adaa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions convert_exonerate_to_fasta.py
Expand Up @@ -15,18 +15,22 @@
if args[0] == '-s':
args = args[1:]
pred_a = lambda x: x != '#'
ts_remove = set(['.', 'a', 'c', 't', 'g', '{', '}'])
pred_ts = lambda x: x not in ts_remove
suffix = '_STRIPPED'
else:
pred_a = lambda x: True
suffix = ''


for filename in args:
e = Exonerate(filename)
out = open(filename + '.fas', 'w')
out = open(filename + suffix + '.fas', 'w')
for q in e.queries:
tseq = ''.join(ts
for qp, tp, ts, a
in q.iterate(pred_a=pred_a))
in q.iterate(pred_a=pred_a, pred_ts=pred_ts))
s = Sequence(q.Query.split(' ')[0] + '_' + q.Target
+ ('#' in q.alignment and '_STRIPPED' or ''),
+ ('#' in q.alignment and suffix or ''),
tseq.replace('-', 'N'))
print >> out, s
4 changes: 2 additions & 2 deletions parse_exonerate.py
Expand Up @@ -151,12 +151,12 @@ def _rd_q(self, l):

def _rd_al(self, l):
#print "read alignment", l.strip()
self.alignment += l[8:]
self.alignment += l[8:-1]
return True

def _rd_tgt(self, l):
#print "read target", l.strip()
self.target_prot += l[8:]
self.target_prot += l[8:-1]
return True

def _rd_dna(self, l):
Expand Down

0 comments on commit 0e9adaa

Please sign in to comment.