download_proteins {GCModeller} R Documentation

Fetch Protein Data from UniProt via REST API

Description

Queries the UniProt database for protein information based on a search term and an optional taxonomy ID. This function acts as a wrapper around the UniProt REST API, allowing for the retrieval of either raw query results or formatted protein sequences in FASTA format.

Usage

download_proteins(q,
    tax.id = NULL,
    as.fasta = TRUE);

Arguments

q

Character. The query term used to search UniProt. This can be a protein name, gene name, UniProt accession, or any valid UniProt query string (e.g., "insulin", "P12345").

tax.id

Character or Integer. An optional NCBI taxonomy identifier to restrict the search to a specific organism (e.g., 9606 for humans). If NULL (default), the search is performed across all organisms.

as.fasta

Logical. Determines the format of the output. \itemize{ \item If \code{TRUE} (default), the function extracts and returns protein sequences in FASTA format. \item If \code{FALSE}, the raw result object from the REST query is returned. }

Details

Authors

xieguigang

Value

The return value depends on the \code{as_fasta} argument: \itemize{ \item If \code{as_fasta = TRUE}: Returns the protein sequences in FASTA format (typically as a character vector or raw text). \item If \code{as_fasta = FALSE}: Returns the raw response object from \code{UniProt::rest_query}. }

Examples

#\dontrun{

# Search for insulin protein sequences in humans (TaxID: 9606)
fasta_seqs <- download_proteins(q = "insulin", tax_id = 9606)
# Search for a specific accession and get the raw result object
raw_data <- download_proteins(q = "P69905", as_fasta = FALSE)

#}

[Package GCModeller version 1.1.0-beta Index]