Skip to contents

Assign average sample values to their corresponding subjects

Usage

assignValuePerSubject(
  data,
  match,
  clinical = NULL,
  patients = NULL,
  samples = NULL
)

Arguments

data

One-row data frame/matrix or vector: values per sample for a single gene

match

Matrix: match between samples and subjects

clinical

Data frame or matrix: clinical dataset (only required if the subjects argument is not handed)

patients

Character: subject identifiers (only required if the clinical argument is not handed)

samples

Character: samples to use when assigning values per subject (if NULL, all samples will be used)

Value

Values per subject

Examples

# Calculate PSI for skipped exon (SE) and mutually exclusive (MXE) events
annot <- readFile("ex_splicing_annotation.RDS")
junctionQuant <- readFile("ex_junctionQuant.RDS")

psi <- quantifySplicing(annot, junctionQuant, eventType=c("SE", "MXE"))
#> Using 3 of 3 events (100%) whose junctions are present in junction quantification data...
#>   |                                        |   0% 
  |========                                |  20% 
  |================                        |  40% 
  |========================                |  60% 
  |================================        |  80% 
  |========================================| 100% 

#> Using 3 of 3 events (100%) whose junctions are present in junction quantification data...
#>   |                                        |   0% 
  |========                                |  20% 
  |================                        |  40% 
  |========================                |  60% 
  |================================        |  80% 
  |========================================| 100% 


# Match between subjects and samples
match <- rep(paste("Subject", 1:3), 2)
names(match) <- colnames(psi)

# Assign PSI values to each subject based on the PSI of their samples
assignValuePerSubject(psi[3, ], match)
#> Subject 1 Subject 2 Subject 3 
#> 0.4336962 0.4815878 0.3925439