Skip to content

Commit

Permalink
optimised add_mmcif_res_full with Series.str methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartmac committed Sep 27, 2017
1 parent 2b4890f commit 31acb1c
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions prointvar/pdbx.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,21 +558,9 @@ def add_mmcif_res_full(data):
table = data
# adds both 'label' and 'auth' entries
if 'label_seq_id' in table:
seqs_full = []
for ix in table.index:
seq = "{}{}".format(table.loc[ix, 'label_seq_id'],
table.loc[ix, 'pdbx_PDB_ins_code']).replace('?', '')
seqs_full.append(seq)
assert len(seqs_full) == len(table)
table['label_seq_id_full'] = seqs_full
table['label_seq_id_full'] = table['label_seq_id'] + table['pdbx_PDB_ins_code'].str.replace('?', '')
if 'auth_seq_id' in table:
seqs_full = []
for ix in table.index:
seq = "{}{}".format(table.loc[ix, 'auth_seq_id'],
table.loc[ix, 'pdbx_PDB_ins_code']).replace('?', '')
seqs_full.append(seq)
assert len(seqs_full) == len(table)
table['auth_seq_id_full'] = seqs_full
table['auth_seq_id_full'] = table['auth_seq_id'] + table['pdbx_PDB_ins_code'].str.replace('?', '')

return table

Expand Down

0 comments on commit 31acb1c

Please sign in to comment.