call_all_variants: Call All Variants

Description Usage Arguments Value Examples

View source: R/call_all_variants.R

Description

Call all variants from the varscan pileup2cns output and the context-specific error models. In the rare case that no model exists for that context (not enough alternate alleles), then this function uses the varscan assigned pvalue

Usage

1
call_all_variants(sample, samp_models)

Arguments

sample

VRanges object of the varscan pileup2cns output annotated with variant context

samp_models

Data.Frame of context specific error models generated from generate_all_models

Value

This function returns a VRanges with the following metadata:

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
## Not run: 
# Get flagged alleles and cosmic mutations
hemeCOSMIC_10 <- load_recurrent_mutations("example_data/COSMIC_heme_freq10.txt", genome = "hg19")
flagged_alleles <- get_flagged_alleles(all_sample_names, all_sample_paths,
    exclude_cosmic_mutations = TRUE, cosmic_mutations = heme_COSMIC, cosmic_mut_frequency = 3)

# Load and annotate sample
samp <- load_as_VRanges(sample_name = "pt123",
    sample_path = "./patient_123_pileup2cns", genome = "hg19", metadata = TRUE)
samp <- sequence_context(samp)
library(MafDb.gnomADex.r2.1.hs37d5)
annotated_samp <- annotate_MAF(varscan_output = variants,
    MAF_database = MafDb.gnomADex.r2.1.hs37d5, genome = "hg19")

# Filter model input
samp_model_input <- filter_model_input(model_input = annotated_samp,
    flagged_alleles = flagged_alleles, recurrent_mutations = hemeCOSMIC_10)

# Generate the error models for this sample
samp_models <- generate_all_models(sample = samp_model_input, plots = FALSE)

# Call variants for the sample based on the previously generated error models
variant_calls <- call_all_variants(annotated_samp, samp_models)

## End(Not run)

andygxzeng/ECSI documentation built on Feb. 6, 2021, 8:53 a.m.