format_query_res: Format perturbation query result like web app.

View source: R/format_query_table.R

format_query_resR Documentation

Format perturbation query result like web app.

Description

Used to get unfiltered query table from downloaded perturbation query result. A condensed top-hits is shown in the web app for performance reasons.

Usage

format_query_res(
  query_res,
  drug_study,
  sort_by = c("avg_cor", "min_cor"),
  direction = c("opposing", "similar", "both"),
  sort_abs = FALSE,
  show_clinical = TRUE,
  min_signatures = 3,
  cells = NULL
)

Arguments

query_res

Numeric vector of correlation values with names as HGNC symbols

drug_study

Queried database giving rise to query_res. One of 'CMAP02','L1000 Genetic', or 'L1000 Drugs'.

sort_by

Metric to sort by. Either 'avg_cor' (default) or 'min_cor'.

direction

Direction of correlation to sort results by. One of 'both', 'similar', or 'opposing' (default).

sort_abs

Should results be sorted based on absolute correlation? Default is FALSE.

show_clinical

Should result only contain drugs with clinical phase annotation? Default is TRUE.

min_signatures

Number of independent perturbagen signatures below which a perturbation is excluded. Default is 3.

cells

Character vector of cell types to include. Default (NULL) includes all cell types.

Value

data.frame with annotated, filtered, and sorted query result.

Examples


# generate fake result
annot <-  dseqr:::get_drugs_table('L1000_drugs')
query_res <- rnorm(nrow(annot), 0, 0.25)
names(query_res) <- annot$title
formatted <- dseqr:::format_query_res(query_res, 'L1000 Drugs', sort_by = 'min_cor')


hms-dbmi/drugseqr documentation built on Feb. 15, 2024, 10:38 p.m.