"lib/bindings/python/vscode:/vscode.git/clone" did not exist on "ecf53ce2b38971dc9b5dde6f70d74cfc5b870c35"
Commit 6b4f1678 authored by rostro36's avatar rostro36
Browse files

Added alignment method.

parent 295d0d56
...@@ -962,7 +962,7 @@ def get_custom_template_features( ...@@ -962,7 +962,7 @@ def get_custom_template_features(
else: else:
logging.error("Custom template path %s does not exist", mmcif_path) logging.error("Custom template path %s does not exist", mmcif_path)
raise ValueError(f"Custom template path {mmcif_path} does not exist") raise ValueError(f"Custom template path {mmcif_path} does not exist")
warnings = [] warnings = []
template_features = dict() template_features = dict()
for template_path in template_paths: for template_path in template_paths:
...@@ -974,26 +974,35 @@ def get_custom_template_features( ...@@ -974,26 +974,35 @@ def get_custom_template_features(
mmcif_parse_result = mmcif_parsing.parse( mmcif_parse_result = mmcif_parsing.parse(
file_id=pdb_id, mmcif_string=cif_string file_id=pdb_id, mmcif_string=cif_string
) )
template_sequence = mmcif_parse_result.mmcif_object.chain_to_seqres[chain_id] # mapping skipping "-"
mapping = {x: x for x, _ in enumerate(template_sequence)} mapping = {
x: x for x, curr_char in enumerate(query_sequence) if curr_char.isalnum()
}
realigned_sequence, realigned_mapping = _realign_pdb_template_to_query(
old_template_sequence=query_sequence,
template_chain_id=chain_id,
mmcif_object=mmcif_parse_result.mmcif_object,
old_mapping=mapping,
kalign_binary_path=kalign_binary_path,
)
curr_features, curr_warnings = _extract_template_features( curr_features, curr_warnings = _extract_template_features(
mmcif_object=mmcif_parse_result.mmcif_object, mmcif_object=mmcif_parse_result.mmcif_object,
pdb_id=pdb_id, pdb_id=pdb_id,
mapping=mapping, mapping=realigned_mapping,
template_sequence=template_sequence, template_sequence=realigned_sequence,
query_sequence=query_sequence, query_sequence=query_sequence,
template_chain_id=chain_id, template_chain_id=chain_id,
kalign_binary_path=kalign_binary_path, kalign_binary_path=kalign_binary_path,
_zero_center_positions=True, _zero_center_positions=True,
) )
curr_features["template_sum_probs"] = [1.0] curr_features["template_sum_probs"] = [
1.0
] # template given by user, 100% confident
template_features = { template_features = {
curr_name: template_features.get(curr_name, []) + [curr_item] curr_name: template_features.get(curr_name, []) + [curr_item]
for curr_name, curr_item in curr_features.items() for curr_name, curr_item in curr_features.items()
} }
warnings.append(curr_warnings) warnings.append(curr_warnings)
template_features = { template_features = {
template_feature_name: np.stack( template_feature_name: np.stack(
template_features[template_feature_name], axis=0 template_features[template_feature_name], axis=0
...@@ -1004,8 +1013,6 @@ def get_custom_template_features( ...@@ -1004,8 +1013,6 @@ def get_custom_template_features(
features=template_features, errors=None, warnings=warnings features=template_features, errors=None, warnings=warnings
) )
@dataclasses.dataclass(frozen=True) @dataclasses.dataclass(frozen=True)
class TemplateSearchResult: class TemplateSearchResult:
features: Mapping[str, Any] features: Mapping[str, Any]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment