obi annotate: fixed a bug with --with-taxon-at-rank option and minor

improvements
This commit is contained in:
Celine Mercier
2018-05-17 14:51:18 +02:00
parent b380368264
commit 8a10072d99

View File

@ -13,10 +13,19 @@ from obitools3.dms.capi.obiview cimport QUALITY_COLUMN
import time import time
import math import math
from obitools3.dms.capi.obiview cimport NUC_SEQUENCE_COLUMN, \
ID_COLUMN, \
DEFINITION_COLUMN, \
QUALITY_COLUMN, \
COUNT_COLUMN
__title__="Annotate views with new tags and edit existing annotations" __title__="Annotate views with new tags and edit existing annotations"
SPECIAL_COLUMNS = [NUC_SEQUENCE_COLUMN, ID_COLUMN, DEFINITION_COLUMN, QUALITY_COLUMN]
def addOptions(parser): def addOptions(parser):
addMinimalInputOption(parser) addMinimalInputOption(parser)
@ -152,7 +161,7 @@ def sequenceTaggerGenerator(config, taxo=None):
toSet[i][j] = tobytes(toSet[i][j]) toSet[i][j] = tobytes(toSet[i][j])
annoteRank=[] annoteRank=[]
if 'taxon_at_rank' in config['annotate']: if config['annotate']['taxon_at_rank']:
if taxo is not None: if taxo is not None:
annoteRank = config['annotate']['taxon_at_rank'] annoteRank = config['annotate']['taxon_at_rank']
else: else:
@ -313,8 +322,9 @@ def run(config):
keep = set(keep) keep = set(keep)
if clear or keep: if clear or keep:
for k in o_view.keys(): keys = [k for k in o_view.keys()]
if k not in keep: for k in keys:
if k not in keep and k not in SPECIAL_COLUMNS:
o_view.delete_column(k) o_view.delete_column(k)
else: else:
for k in toDelete: for k in toDelete: