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.between_residue_bond

View Source On Gitee
mindsponge.metrics.between_residue_bond(pred_atom_positions, pred_atom_mask, residue_index, aatype, tolerance_factor_soft=12.0, tolerance_factor_hard=12.0)[source]

Flat-bottom loss to penalize structural violations between residues. This is a loss penalizing any violation of the geometry around the peptide bond between consecutive amino acids.

Parameters
  • pred_atom_positions (Tensor) – Atom positions in atom37/14 representation, shape (Nres,37,3). or shape (Nres,14,3) .

  • pred_atom_mask (Tensor) – Atom mask in atom37/14 representation. shape (Nres,37) or shape (Nres,14) .

  • residue_index (Tensor) – Residue index for given amino acid, this is assumed to be monotonically increasing. Range from 1 to Nres. shape (Nres,) .

  • aatype (Tensor) – amino acid types. Range is [0,20]. shape (Nres,) .

  • tolerance_factor_soft (float) – soft tolerance factor measured in standard deviations of pdb distributions. Default: 12.0 .

  • tolerance_factor_hard (float) – hard tolerance factor measured in standard deviations of pdb distributions. Default: 12.0 .

Returns

  • Tensor, c_n_loss_mean, loss for peptide bond length violations. shape is () .

  • Tensor, ca_c_n_loss_mean, loss for violations of bond angle around C spanned by CA, C, N. shape is () .

  • Tensor, c_n_ca_loss_mean, loss for violations of bond angle around N spanned by C, N, CA. shape is () .

  • Tensor, per_residue_loss_sum, sum of all losses of each residue. shape is (Nres,) .

  • Tensor, per_residue_violation_mask, mask denoting all residues with violation present. shape is (Nres,) .

Symbol:

Nres, number of amino acids.

Supported Platforms:

Ascend GPU

Examples

>>> import mindspore as ms
>>> from mindspore import Tensor
>>> import numpy as np
>>> from mindsponge.metrics import between_residue_bond
>>> np.random.seed(1)
>>> pred_atom_positions = Tensor(np.random.random(size=(50,37,3)), ms.float32)
>>> pred_atom_mask = Tensor(np.random.randint(2,size=(50,37)), ms.int32)
>>> residue_index = Tensor(np.array(range(50)), ms.int32)
>>> aatype = Tensor(np.random.randint(20, size=(50,)), ms.int32)
>>> tolerance_factor_soft = 12.0
>>> tolerance_factor_hard = 12.0
>>> result = between_residue_bond(pred_atom_positions, pred_atom_mask, residue_index, aatype,
>>>                              tolerance_factor_soft, tolerance_factor_hard)
>>> for x in result:
>>>    print(x)
0.52967054
0.6045412
0.39251995
[0.62809587 1.6770853  1.7221183  1.0325309  1.3417522  1.79882
 1.7718308  1.5092779  1.5653987  1.9564128  1.6804926  1.6051245
 1.5033073  1.5895741  2.1686926  2.126039   1.3837843  1.2554975
 1.8135165  2.1593785  1.9408598  1.7281027  1.8666006  1.9623451
 1.8177024  1.7543832  1.5969353  1.2150483  0.9833115  1.219868
 1.7008476  1.6968286  1.7648234  1.5584714  1.370602   1.8525059
 1.7938454  1.5313196  1.6940074  1.8512855  1.8222975  1.6600168
 1.9163743  1.7201058  1.6288358  1.6055745  1.521946   1.6553445
 1.6175683  0.894606 ]
 [1. 1. 0. 1. 1. 0. 0. 1. 1. 1. 1. 0. 0. 0. 0. 1. 1. 1. 1. 1. 0. 1. 1. 0.
  0. 1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 1. 1. 1. 0.
  1. 1.]