Skip to content

Commit

Permalink
fix #22
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacques Dainat committed Oct 15, 2018
1 parent 2b592c5 commit 735231b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions EMBLmyGFF3/modules/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,14 @@ def add_qualifier(self, gff_qualifier, value):
for val in value:
if val not in self.qualifiers[qualifier].value:
self.qualifiers[qualifier].add_value(val)
else:
logging.debug('val %s alredy exist (list case)' % val)
# Scalar case
else:
if value not in self.qualifiers[qualifier].value:
self.qualifiers[qualifier].add_value(value)
else:
logging.debug('val %s alredy exist (scalar case)' % val)

def combine(self, other):
"""
Expand Down
11 changes: 5 additions & 6 deletions EMBLmyGFF3/modules/qualifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ def _by_value_format(self, value):
elif self.value_format.startswith("\"<database:identifier>\""): # Handle dbxref's
self._load_legal_dbxref( LEGAL_DBXREF_FILE )
value = value if type(value) == type([]) else [value]
new_value=[]

for val in value:
if val.split(':')[0].lower() in [v.lower() for v in self.legal_dbxref]:
new_value.append(val)
new_value = val
else:
msg = "Unknown db_xref '%s' - removing." % (val.split(':')[0])
if msg not in Qualifier.PREVIOUS_ERRORS:
Expand Down Expand Up @@ -153,11 +153,10 @@ def add_value(self, value):
Qualifier wihtout value is possible. e.g environmental_sample
"""
self.value = [self.value] if type(self.value) != type([]) else self.value
value = [value] if type(value) != type([]) else value

new_values = [self._by_value_format(v) for v in value]
logging.debug("%s - Changing value: '%s' to '%s'" % (self.name, value, new_values))
self.value += new_values
new_value = self._by_value_format(value)
logging.debug("%s - Changing value: '%s' to '%s'" % (self.name, value, new_value))
self.value.append(new_value)
logging.debug("%s - Current value: '%s'" % (self.name, self.value))

def set_value(self, value):
Expand Down

0 comments on commit 735231b

Please sign in to comment.