Skip to content

Commit

Permalink
DAOTHER-8817: Reconciled fix with the previous commit (2mse)
Browse files Browse the repository at this point in the history
  • Loading branch information
yokochi47 committed Apr 3, 2024
1 parent 0bf8be6 commit d3e6bd5
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 13 deletions.
4 changes: 2 additions & 2 deletions wwpdb/utils/nmr/AlignUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ def alignPolymerSequence(pA, polySeqModel, polySeqRst, conservative=True, resolv

_matched, unmapped, conflict, offset_1, offset_2 = getScoreOfSeqAlign(myAlign)

if length == unmapped + conflict or _matched <= conflict + 1:
if length == unmapped + conflict or _matched <= conflict + (1 if length > 1 else 0):
inhibitList.append({chain_id, chain_id2})
continue

Expand Down Expand Up @@ -1297,7 +1297,7 @@ def alignPolymerSequenceWithConflicts(pA, polySeqModel, polySeqRst, conflictTh=1

_matched, unmapped, conflict, offset_1, offset_2 = getScoreOfSeqAlign(myAlign)

if length == unmapped + conflict or _matched <= conflict + 1 - conflictTh:
if length == unmapped + conflict or _matched <= conflict + (1 if length > 1 else 0) - conflictTh:
continue

if not_decided_s2_comp_id: # AMBER/GROMACS topology
Expand Down
64 changes: 53 additions & 11 deletions wwpdb/utils/nmr/NmrDpUtility.py
Original file line number Diff line number Diff line change
Expand Up @@ -17653,9 +17653,10 @@ def __appendPolymerSequenceAlignment(self):

alt_chain = False

if length == unmapped + conflict or _matched <= conflict + 1 or (len(polymer_sequence) > 1 and _matched < 4 and offset_1 > 0):
if length == unmapped + conflict or _matched <= conflict + (1 if length > 1 else 0)\
or (len(polymer_sequence) > 1 and _matched < 4 and offset_1 > 0):

if self.__tolerant_seq_align and _matched <= conflict + 1 and len(polymer_sequence) > 1:
if self.__tolerant_seq_align and _matched <= conflict + (1 if length > 1 else 0) and len(polymer_sequence) > 1:

__length = length
__matched = _matched
Expand Down Expand Up @@ -17689,7 +17690,7 @@ def __appendPolymerSequenceAlignment(self):

_matched, unmapped, conflict, offset_1, offset_2 = getScoreOfSeqAlign(myAlign)

if length == unmapped + conflict or _matched <= conflict + 1:
if length == unmapped + conflict or _matched <= conflict + (1 if length > 1 else 0):
continue

if _matched - conflict < __matched - __conflict or unmapped + conflict > __unmapped + __conflict:
Expand Down Expand Up @@ -17975,9 +17976,10 @@ def __appendPolymerSequenceAlignment(self):

alt_chain = False

if length == unmapped + conflict or _matched <= conflict + 1 or (len(polymer_sequence) > 1 and _matched < 4 and offset_1 > 0):
if length == unmapped + conflict or _matched <= conflict + (1 if length > 1 else 0)\
or (len(polymer_sequence) > 1 and _matched < 4 and offset_1 > 0):

if self.__tolerant_seq_align and _matched <= conflict + 1 and len(polymer_sequence) > 1:
if self.__tolerant_seq_align and _matched <= conflict + (1 if length > 1 else 0) and len(polymer_sequence) > 1:

__length = length
__matched = _matched
Expand Down Expand Up @@ -18011,7 +18013,7 @@ def __appendPolymerSequenceAlignment(self):

_matched, unmapped, conflict, offset_1, offset_2 = getScoreOfSeqAlign(myAlign)

if length == unmapped + conflict or _matched <= conflict + 1:
if length == unmapped + conflict or _matched <= conflict + (1 if length > 1 else 0):
continue

if _matched - conflict < __matched - __conflict or (unmapped + conflict > __unmapped + __conflict and __matched > 0):
Expand Down Expand Up @@ -18230,7 +18232,7 @@ def __appendPolymerSequenceAlignment(self):

_matched, unmapped, conflict, offset_1, offset_2 = getScoreOfSeqAlign(myAlign)

if length == unmapped + conflict or _matched <= conflict + 1:
if length == unmapped + conflict or _matched <= conflict + (1 if length > 1 else 0):
break

cross = True
Expand Down Expand Up @@ -18267,7 +18269,7 @@ def __appendPolymerSequenceAlignment(self):

_matched, unmapped, conflict, offset_1, offset_2 = getScoreOfSeqAlign(myAlign)

if length == unmapped + conflict or _matched <= conflict + 1:
if length == unmapped + conflict or _matched <= conflict + (1 if length > 1 else 0):
continue

_s1 = s1 if offset_1 == 0 else fillBlankCompIdWithOffset(s1, offset_1)
Expand Down Expand Up @@ -41163,6 +41165,16 @@ def __extractCoordPolymerSequence(self):

key_items = self.key_items[file_type][content_subtype]

if self.__cR.hasItem(lp_category, 'pdb_mon_id'):
_key_items = copy.copy(key_items)
_key_items.append({'name': 'pdb_mon_id', 'type': 'str', 'alt_name': 'auth_comp_id', 'default-from': 'mon_id'})
key_items = _key_items

if self.__cR.hasItem(lp_category, 'auth_mon_id'):
_key_items = copy.copy(key_items)
_key_items.append({'name': 'auth_mon_id', 'type': 'str', 'alt_name': 'alt_comp_id', 'default-from': 'mon_id'})
key_items = _key_items

try:
branched_seq = self.__cR.getPolymerSequence(lp_category, key_items,
withStructConf=False, withRmsd=False, alias=False,
Expand All @@ -41174,6 +41186,36 @@ def __extractCoordPolymerSequence(self):
except Exception:
pass

content_subtype = 'non_poly'

lp_category = self.lp_categories[file_type][content_subtype]

if self.__cR.hasCategory(lp_category):

key_items = self.key_items[file_type][content_subtype]

if self.__cR.hasItem(lp_category, 'pdb_mon_id'):
_key_items = copy.copy(key_items)
_key_items.append({'name': 'pdb_mon_id', 'type': 'str', 'alt_name': 'auth_comp_id', 'default-from': 'mon_id'})
key_items = _key_items

if self.__cR.hasItem(lp_category, 'auth_mon_id'):
_key_items = copy.copy(key_items)
_key_items.append({'name': 'auth_mon_id', 'type': 'str', 'alt_name': 'alt_comp_id', 'default-from': 'mon_id'})
key_items = _key_items

try:
non_poly = self.__cR.getPolymerSequence(lp_category, key_items,
withStructConf=False, withRmsd=False, alias=False,
totalModels=self.__total_models,
effModelIds=self.__eff_model_ids,
repAltId=self.__representative_alt_id)

if len(non_poly) > 0:
poly_seq.extend(non_poly)
except Exception:
pass

if len(poly_seq) > 0 and poly_seq_cache_path is not None:
write_as_pickle(poly_seq, poly_seq_cache_path)

Expand Down Expand Up @@ -41960,7 +42002,7 @@ def __appendCoordPolymerSequenceAlignment(self):

_matched, unmapped, conflict, offset_1, offset_2 = getScoreOfSeqAlign(myAlign)

if length == unmapped + conflict or _matched <= conflict + 1:
if length == unmapped + conflict or _matched <= conflict + (1 if length > 1 else 0):
continue

_s1 = s1 if offset_1 == 0 else fillBlankCompIdWithOffset(s1, offset_1)
Expand Down Expand Up @@ -42058,7 +42100,7 @@ def __appendCoordPolymerSequenceAlignment(self):
_s1 = __s1
_s2 = __s2

if _matched <= conflict + 1:
if _matched <= conflict + (1 if length > 1 else 0):
continue

# if conflict > 0:
Expand Down Expand Up @@ -42197,7 +42239,7 @@ def __appendCoordPolymerSequenceAlignment(self):
_s1 = __s1
_s2 = __s2

if _matched <= conflict + 1:
if _matched <= conflict + (1 if length > 1 else 0):
continue

# if conflict > 0:
Expand Down

0 comments on commit d3e6bd5

Please sign in to comment.