Skip to content

Commit

Permalink
fixed the linking between protein and protein sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
tayasherstyukova committed Oct 21, 2024
1 parent a956725 commit ba641d5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions excelutils/excel_sbol_utils/library2.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def proteinSequence(rowobj):
# ONE OBJECT. E.g overwrite in self.obj.sequences = [val] ?
if re.fullmatch(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', val):
# if a url
rowobj.obj.sequences.append(val)
rowobj.obj.sequences = [val]

elif re.match(r'^[ACDEFGHIKLMNPQRSTVWY\s*]+$', val):
# if a sequence string
Expand All @@ -491,8 +491,6 @@ def proteinSequence(rowobj):
val = val.replace('*', '')
val = val.replace(u"\ufeff", "").upper()




# create sequence object
protein_sequence = sbol2.Sequence(f"{rowobj.obj.displayId}_proteinSequence",
Expand All @@ -503,11 +501,11 @@ def proteinSequence(rowobj):
rowobj.doc.add(protein_sequence)

# link sequence object to component definition
rowobj.obj.sequences.append(protein_sequence.identity)
rowobj.obj.sequences = [protein_sequence.identity]

else:
logging.warning(f'The cell value for {rowobj.obj.identity} is not an accepted sequence type, it has been added as a uri and left for post processing. Sequence value provided: {val} (sheet:{rowobj.sheet}, row:{rowobj.sht_row}, col:{col})')
rowobj.obj.sequences.append(val)
rowobj.obj.sequences = [val]
else:
raise TypeError(f"A multicolumn value was unexpectedly given in sequence, {rowobj.col_cell_dict}")

Expand Down

0 comments on commit ba641d5

Please sign in to comment.