dscript.commands

dscript.commands.predict

See Prediction for full usage details.

Make new predictions with a pre-trained model. One of –seqs or –embeddings is required.

dscript.commands.embed

See Embedding for full usage details.

Generate new embeddings using pre-trained language model.

dscript.commands.train

See Training for full usage details.

Train a new model.

dscript.commands.train.interaction_eval(model, test_iterator, tensors, use_cuda)[source]

Evaluate test data set performance.

Parameters
  • model (dscript.models.interaction.ModelInteraction) – Model to be trained

  • test_iterator (torch.utils.data.DataLoader) – Test data iterator

  • tensors (dict[str, torch.Tensor]) – Dictionary of protein names to embeddings

  • use_cuda (bool) – Whether to use GPU

Returns

(Loss, number correct, mean square error, precision, recall, F1 Score, AUPR)

Return type

(torch.Tensor, int, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor)

dscript.commands.train.interaction_grad(model, n0, n1, y, tensors, use_cuda, weight=0.35)[source]

Compute gradient and backpropagate loss for a batch.

Parameters
  • model (dscript.models.interaction.ModelInteraction) – Model to be trained

  • n0 (list[str]) – First protein names

  • n1 (list[str]) – Second protein names

  • y (torch.Tensor) – Interaction labels

  • tensors (dict[str, torch.Tensor]) – Dictionary of protein names to embeddings

  • use_cuda (bool) – Whether to use GPU

  • weight (float) – Weight on the contact map magnitude objective. BCE loss is \(1 - \text{weight}\).

Returns

(Loss, number correct, mean square error, batch size)

Return type

(torch.Tensor, int, torch.Tensor, int)

dscript.commands.train.predict_cmap_interaction(model, n0, n1, tensors, use_cuda)[source]

Predict whether a list of protein pairs will interact, as well as their contact map.

Parameters
  • model (dscript.models.interaction.ModelInteraction) – Model to be trained

  • n0 (list[str]) – First protein names

  • n1 (list[str]) – Second protein names

  • tensors (dict[str, torch.Tensor]) – Dictionary of protein names to embeddings

  • use_cuda (bool) – Whether to use GPU

dscript.commands.train.predict_interaction(model, n0, n1, tensors, use_cuda)[source]

Predict whether a list of protein pairs will interact.

Parameters
  • model (dscript.models.interaction.ModelInteraction) – Model to be trained

  • n0 (list[str]) – First protein names

  • n1 (list[str]) – Second protein names

  • tensors (dict[str, torch.Tensor]) – Dictionary of protein names to embeddings

  • use_cuda (bool) – Whether to use GPU

dscript.commands.eval

See Evaluation for full usage details.

Evaluate a trained model.

dscript.commands.eval.plot_eval_predictions(labels, predictions, path='figure')[source]

Plot histogram of positive and negative predictions, precision-recall curve, and receiver operating characteristic curve.

Parameters
  • y (np.ndarray) – Labels

  • phat (np.ndarray) – Predicted probabilities

  • path (str) – File prefix for plots to be saved to [default: figure]