Description Usage Arguments Value See Also Examples
LCD
performs a mutational signatures decomposition of a given
mutational catalogue V
with known signatures W
by
solving the minimization problem min(||W*H - V||)
with additional constraints of non-negativity on H where W and V
are known
1 | LCD(in_mutation_catalogue_df, in_signatures_df, in_per_sample_cutoff = 0)
|
in_mutation_catalogue_df |
A numeric data frame |
in_signatures_df |
A numeric data frame |
in_per_sample_cutoff |
A numeric value less than 1. Signatures from within |
The exposures H
, a numeric data frame with l
rows and
m
columns, l
being the number of signatures and
m
being the number of samples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## define raw data
W_prim <- matrix(c(1,2,3,4,5,6),ncol=2)
W_prim_df <- as.data.frame(W_prim)
W_df <- YAPSA:::normalize_df_per_dim(W_prim_df,2) # corresponds to the sigs
W <- as.matrix(W_df)
## 1. Simple case: non-negativity already in raw data
H <- matrix(c(2,5,3,6,1,9,1,2),ncol=4)
H_df <- as.data.frame(H) # corresponds to the exposures
V <- W %*% H # matrix multiplication
V_df <- as.data.frame(V) # corresponds to the mutational catalogue
exposures_df <- YAPSA:::LCD(V_df,W_df)
## 2. more complicated: raw data already contains negative elements
## define indices where sign is going to be swapped
sign_ind <- c(5,7)
## now compute the indices of the other fields in the columns affected
## by the sign change
row_ind <- sign_ind %% dim(H)[1]
temp_ind <- 2*row_ind -1
other_ind <- sign_ind + temp_ind
## alter the matrix H to yield a new mutational catalogue
H_compl <- H
H_compl[sign_ind] <- (-1)*H[sign_ind]
H_compl_df <- as.data.frame(H_compl) # corresponds to the exposures
V_compl <- W %*% H_compl # matrix multiplication
V_compl_df <- as.data.frame(V_compl) # corresponds to the mutational catalog
exposures_df <- YAPSA:::LCD(V_compl_df,W_df)
exposures <- as.matrix(exposures_df)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.