Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

PR

Just a small problem.

I can fix it online!

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindsponge.metrics.local_distance_difference_test

View Source On Gitee
mindsponge.metrics.local_distance_difference_test(predicted_points, true_points, true_points_mask, cutoff=15, per_residue=False)[source]

Compute true and predicted distance matrices for Cα. First calculate the distance matrix of true and predicted Cα atoms D=(((x[None,:]x[:,None])2).sum(1))0.5 then compute the rate that difference is smaller than fixed value: lddt=(rate(abs(DtrueDpred)<0.5)+rate(abs(DtrueDpred)<1.0)+rate(abs(DtrueDpred)<2.0)+rate(abs(DtrueDpred)<4.0))/4 Jumper et al. (2021) Suppl. Alg. 29 "predictPerResidueLDDT_Ca".

Parameters
  • predicted_points (Tensor) – The prediction Ca atoms position tensor of shape (1,Nres,3) with Nres the number of residues in protein.

  • true_points (Tensor) – The ground truth Ca atoms position tensor of shape (1,Nres,3)

  • true_points_mask (Tensor) – The binary mask for predicted_points of shape (1,Nres,1)

  • cutoff (float) – The cutoff value for lddt to stop gradient, Default: 15.

  • per_residue (bool) – The indicator if local distance difference is averaged, set True to return local distance difference per residue. Default: False.

Returns

  • score (Tensor) - Local distance difference score, the shape is (1,) if per_residue is set to False, (1,Nres) otherwise.

Supported Platforms:

Ascend GPU

Examples

>>> import numpy as np
>>> np.random.seed(0)
>>> from mindsponge.metrics import local_distance_difference_test
>>> from mindspore import dtype as mstype
>>> from mindspore import Tensor
>>> predicted_points = Tensor(np.random.rand(1, 256, 3)).astype(mstype.float32)
>>> true_points = Tensor(np.random.rand(1, 256, 3)).astype(mstype.float32)
>>> true_points_mask = Tensor(np.random.rand(1, 256, 1)).astype(mstype.float32)
>>> lddt = local_distance_difference_test(predicted_points, true_points, true_points_mask,
...                                       cutoff=15, per_residue=False)
>>> print(lddt)
[0.9554313]