create_mutation_catalogue_from_VR: Create a Mutational Catalogue from a VRanges Object

Description Usage Arguments Value See Also Examples

View source: R/complex_functions.R

Description

This function creates a mutational catalogue from a VRanges Object by first calling mutationContext to establish the motif context of the variants in the input VRanges and then calling motifMatrix to build the mutational catalogue V.

Usage

1
2
3
4
5
6
7
8
9
create_mutation_catalogue_from_VR(
  in_vr,
  in_refGenome,
  in_wordLength,
  in_PID.field = "PID",
  in_verbose = 0,
  in_rownames = c(),
  adapt_rownames = 1
)

Arguments

in_vr

A VRanges object constructed from a vcf-like file of a whole cohort. The first columns are those of a standard vcf file, followed by an arbitrary number of custom or used defined columns. One of these can carry a PID (patient or sample identifyier) and one can carry subgroup information.

in_refGenome

The reference genome handed over to mutationContext and used to extract the motif context of the variants in in_vr.

in_wordLength

The size of the motifs to be extracted by mutationContext

in_PID.field

Indicates the name of the column in which the PID (patient or sample identifier) is encoded

in_verbose

Verbose if in_verbose=1

in_rownames

Optional parameter to specify rownames of the mutational catalogue V i.e. the names of the features.

adapt_rownames

Rownames of the output matrix will be adapted if adapt_rownames=1

Value

A list with entries matrix, frame,

See Also

mutationContext

motifMatrix

Examples

 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
28
 library(BSgenome.Hsapiens.UCSC.hg19)
 data(lymphoma_test)
 data(sigs)
 word_length <- 3
 temp_vr <- makeVRangesFromDataFrame(
   lymphoma_test_df,in_seqnames.field="CHROM",
   in_subgroup.field="SUBGROUP",verbose_flag=1)
 temp_list <- create_mutation_catalogue_from_VR(
   temp_vr,in_refGenome=BSgenome.Hsapiens.UCSC.hg19,
   in_wordLength=word_length,in_PID.field="PID",
   in_verbose=1)
 dim(temp_list$matrix)
 head(temp_list$matrix)
 test_list <- split(lymphoma_test_df,f=lymphoma_test_df$PID)
 other_list <- list()
 for(i in seq_len(length(test_list))){
   other_list[[i]] <- test_list[[i]][c(1:80),]
 }
 other_df <- do.call(rbind,other_list)
 other_vr <- makeVRangesFromDataFrame(
   other_df,in_seqnames.field="CHROM",
   in_subgroup.field="SUBGROUP",verbose_flag=1)
 other_list <- create_mutation_catalogue_from_VR(
   other_vr,in_refGenome=BSgenome.Hsapiens.UCSC.hg19,
   in_wordLength=word_length,in_PID.field="PID",
   in_verbose=1,in_rownames=rownames(AlexCosmicValid_sig_df))
 dim(other_list$matrix)
 head(other_list$matrix)

YAPSA documentation built on Nov. 8, 2020, 4:59 p.m.