obi annotate: now defaults to setting str if expression is not valid
This commit is contained in:
@ -190,58 +190,50 @@ def sequenceTaggerGenerator(config, taxo=None):
|
|||||||
seq['seq_rank']=counter[0]
|
seq['seq_rank']=counter[0]
|
||||||
|
|
||||||
for i,v in toSet:
|
for i,v in toSet:
|
||||||
#try:
|
try:
|
||||||
if taxo is not None:
|
if taxo is not None:
|
||||||
environ = {'taxonomy' : taxo, 'sequence':seq, 'counter':counter[0], 'math':math}
|
environ = {'taxonomy' : taxo, 'sequence':seq, 'counter':counter[0], 'math':math}
|
||||||
else:
|
else:
|
||||||
environ = {'sequence':seq, 'counter':counter[0], 'math':math}
|
environ = {'sequence':seq, 'counter':counter[0], 'math':math}
|
||||||
val = eval(v, environ, seq)
|
val = eval(v, environ, seq)
|
||||||
#except Exception,e: # TODO discuss usefulness of this
|
except Exception: # set string if not a valid expression
|
||||||
# if options.onlyValid:
|
val = v
|
||||||
# raise e
|
|
||||||
# val = v
|
|
||||||
seq[i]=val
|
seq[i]=val
|
||||||
|
|
||||||
if length:
|
if length:
|
||||||
seq['seq_length']=len(seq)
|
seq['seq_length']=len(seq)
|
||||||
|
|
||||||
if newId is not None:
|
if newId is not None:
|
||||||
# try:
|
try:
|
||||||
if taxo is not None:
|
if taxo is not None:
|
||||||
environ = {'taxonomy' : taxo, 'sequence':seq, 'counter':counter[0], 'math':math}
|
environ = {'taxonomy' : taxo, 'sequence':seq, 'counter':counter[0], 'math':math}
|
||||||
else:
|
else:
|
||||||
environ = {'sequence':seq, 'counter':counter[0], 'math':math}
|
environ = {'sequence':seq, 'counter':counter[0], 'math':math}
|
||||||
val = eval(newId, environ, seq)
|
val = eval(newId, environ, seq)
|
||||||
# except Exception,e:
|
except Exception: # set string if not a valid expression
|
||||||
# if options.onlyValid:
|
val = newId
|
||||||
# raise e
|
|
||||||
# val = newId
|
|
||||||
seq.id=val
|
seq.id=val
|
||||||
|
|
||||||
if newDef is not None:
|
if newDef is not None:
|
||||||
# try:
|
try:
|
||||||
if taxo is not None:
|
if taxo is not None:
|
||||||
environ = {'taxonomy' : taxo, 'sequence':seq, 'counter':counter[0], 'math':math}
|
environ = {'taxonomy' : taxo, 'sequence':seq, 'counter':counter[0], 'math':math}
|
||||||
else:
|
else:
|
||||||
environ = {'sequence':seq, 'counter':counter[0], 'math':math}
|
environ = {'sequence':seq, 'counter':counter[0], 'math':math}
|
||||||
val = eval(newDef, environ, seq)
|
val = eval(newDef, environ, seq)
|
||||||
# except Exception,e:
|
except Exception: # set string if not a valid expression
|
||||||
# if options.onlyValid:
|
val = newDef
|
||||||
# raise e
|
|
||||||
# val = newDef
|
|
||||||
seq.definition=val
|
seq.definition=val
|
||||||
#
|
|
||||||
if newSeq is not None:
|
if newSeq is not None:
|
||||||
# try:
|
try:
|
||||||
if taxo is not None:
|
if taxo is not None:
|
||||||
environ = {'taxonomy' : taxo, 'sequence':seq, 'counter':counter[0], 'math':math}
|
environ = {'taxonomy' : taxo, 'sequence':seq, 'counter':counter[0], 'math':math}
|
||||||
else:
|
else:
|
||||||
environ = {'sequence':seq, 'counter':counter[0], 'math':math}
|
environ = {'sequence':seq, 'counter':counter[0], 'math':math}
|
||||||
val = eval(newSeq, environ, seq)
|
val = eval(newSeq, environ, seq)
|
||||||
# except Exception,e:
|
except Exception: # set string if not a valid expression
|
||||||
# if options.onlyValid:
|
val = newSeq
|
||||||
# raise e
|
|
||||||
# val = newSeq
|
|
||||||
seq.seq=val
|
seq.seq=val
|
||||||
if 'seq_length' in seq:
|
if 'seq_length' in seq:
|
||||||
seq['seq_length']=len(seq)
|
seq['seq_length']=len(seq)
|
||||||
@ -251,15 +243,14 @@ def sequenceTaggerGenerator(config, taxo=None):
|
|||||||
seq.view.delete_column(QUALITY_COLUMN)
|
seq.view.delete_column(QUALITY_COLUMN)
|
||||||
|
|
||||||
if run is not None:
|
if run is not None:
|
||||||
# try:
|
try:
|
||||||
if taxo is not None:
|
if taxo is not None:
|
||||||
environ = {'taxonomy' : taxo, 'sequence':seq, 'counter':counter[0], 'math':math}
|
environ = {'taxonomy' : taxo, 'sequence':seq, 'counter':counter[0], 'math':math}
|
||||||
else:
|
else:
|
||||||
environ = {'sequence':seq, 'counter':counter[0], 'math':math}
|
environ = {'sequence':seq, 'counter':counter[0], 'math':math}
|
||||||
eval(run, environ, seq)
|
eval(run, environ, seq)
|
||||||
# except Exception,e:
|
except Exception,e:
|
||||||
# if options.onlyValid:
|
raise e
|
||||||
# raise e
|
|
||||||
|
|
||||||
return sequenceTagger
|
return sequenceTagger
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
major = 3
|
major = 3
|
||||||
minor = 0
|
minor = 0
|
||||||
serial= '0-beta14b'
|
serial= '0-beta1c'
|
||||||
|
|
||||||
version ="%d.%02d.%s" % (major,minor,serial)
|
version ="%d.%02d.%s" % (major,minor,serial)
|
||||||
|
Reference in New Issue
Block a user