Package 'koinar'

Title: KoinaR - Remote machine learning inference using Koina
Description: A client to simplify fetching predictions from the Koina web service. Koina is a model repository enabling the remote execution of models. Predictions are generated as a response to HTTP/S requests, the standard protocol used for nearly all web traffic.
Authors: Ludwig Lautenbacher [aut, cre] , Christian Panse [aut]
Maintainer: Ludwig Lautenbacher <[email protected]>
License: Apache License 2.0
Version: 1.1.0
Built: 2024-10-30 08:35:43 UTC
Source: https://github.com/bioc/koinar

Help Index


Koina client class

Description

Koina client class

Value

an instance of the Koina class

Fields

model_name

character, e.g., "Prosit_2019_intensity". See https://koina.wilhelmlab.org/docs for all available models.

url

url, default is set to "koina.wilhelmlab.org".

ssl

logical.

disable_progress_bar

logical.

Methods

predict( input_data, pred_as_df = TRUE, filters = list(intensities = c(1e-04, 1)) )

Predict using the defined model.

Arguments:

- input_data: Either a dataframe or a list of arrays. 'names' must correspond to the inputs for the chosen model.

- pred_as_df: Logical, indicating if the results should be returned as a dataframe (TRUE) or in the original format (FALSE).

- filters: A list of vectors which is used to filter predictions. The key needs to equal the name of the predicted property, the first value is used as minimum the second as maximum. Ignored when 'pred_as_df' == FALSE.

Returns:

Depending on 'pred_as_df', returns either a dataframe or a list/array of predictions, applying 'min_intensity' filtering if applicable.

Author(s)

Ludwig Lautenbacher, 2024

See Also

https://koina.wilhelmlab.org

Examples

library(koinar)
prosit2019 <- koinar::Koina(
  model_name = "Prosit_2019_intensity",
  server_url = "koina.wilhelmlab.org"
)

input <- data.frame(
  peptide_sequences = c("LGGNEQVTR", "GAGSSEPVTGLDAK"),
  collision_energies = c(25, 25),
  precursor_charges = c(1, 2)
)

# Fetch the predictions by calling `$predict` of the model you want to use
prediction_results <- prosit2019$predict(input)

Predict Results Using a Koina Model

Description

The 'predictWithKoinaModel' function leverages the 'predict' method of a 'Koina' class instance to obtain model predictions based on the input data provided.

Usage

predictWithKoinaModel(koina_model, input)

Arguments

koina_model

An instance of the 'Koina' class. This object encapsulates the model that will be used to make predictions.

input

A data frame or list of arrays containing the inputs required for the model:

Value

The function returns the prediction results from the 'koina_model' object. The structure of the output depends on the specific model used and the format expected by the underlying Koina prediction API.

See Also

https://koina.wilhelmlab.org

Examples

# Load the koinar package
library(koinar)

# Create an instance of the Koina class with a specific model
prosit2019 <- koinar::Koina(
  model_name = "Prosit_2019_intensity",
  server_url = "koina.wilhelmlab.org"
)

# Prepare the input data
input <- data.frame(
  peptide_sequences = c("LGGNEQVTR", "GAGSSEPVTGLDAK"),
  collision_energies = c(25, 25),
  precursor_charges = c(1, 2)
)

# Fetch the predictions by calling the predictWithKoinaModel function
prediction_results <- predictWithKoinaModel(prosit2019, input)