campbio/musicatk

Calculate signature probability for each individual variant

Closed this issue · 1 comments

Here is some example code for a result object with SBS96 schema:


# Get mutation types and variants from result object
f <- result@musica@count_tables$SBS96@features
v <- result@musica@variants
vs <- subset(v, Variant_Type == "SBS")

# check to make sure they have the same number of rows
nrow(f) == nrow(vs)

# Get mutation type probability per sample
expo <- exposures(result)
expo <- prop.table(expo, margin=2)
sig <- signatures(result)

# Calculate probability per mutation
mut.prop <- sig[f[,1],] * t(expo[,vs$sample])
final <- cbind(vs, Motif=f[,1], mut.prop)

Doesn't seem that useful/important for now. It'll be more meaningful with later models. Closing.