This function calls the callFilters() function on each element of a list of CollapsedVCF objects and generates in output a list of lists. Each list corresponds to one input element, and consists in four elements: an object containg variants which passed the filter, a character string describing the applied filter (if any), an object containing the sequencing design and a character string with the name of the sample.

applyFilters(
  vcfs,
  assembly,
  design,
  vaf.cutoff = 0,
  remove.nonexonic = TRUE,
  remove.cancer = FALSE,
  tsList = NULL,
  variantType = c()
)

Arguments

vcfs

a list of one or more CollapsedVCF object(s)

assembly

human genome assembly: hg19 or hg38

design

a GRanges object containing WES or panel design

vaf.cutoff

minimum value of variant allele frequency accepted

remove.nonexonic

logical value 'TRUE' or 'FALSE' indicating whether or not SNV mapped ouside of exons are to be removed. Default is True

remove.cancer

logical value 'TRUE' or 'FALSE' indicating whether or not to remove cancer variants (variants described in COSMIC and truncating mutations in tumor suppressors)

tsList

path to file containing list of tumor suppressors. If not provided a list of 1217 tumor suppressors from the TSgene2 database (<http://bioinfo.mc.vanderbilt.edu/TSGene/>) is used by default.

variantType

type of variant to remove. Possible values: synonymous, nonsynonymous, frameshift, nonsense, not translated or a combination of them specified in a character vector

Value

Returns a list of lists. Each list include the following elements: a GRanges, CollapsedVCF, data.frame object containing variants passing the filter, a charcater string describing applied filter (if any), a GRanges or character vector with the sequencing design, a character string with the name of the sample.

Author

Laura Fancello

Examples

## Read vcf vcf_files <- list(Horizon5="Horizon5_ExamplePanel.vcf", HorizonFFPEmild="HorizonFFPEmild_ExamplePanel.vcf") vcf_files <- lapply(vcf_files , function(x) system.file("extdata", x, package = "TMBleR", mustWork = TRUE)) vcfs <- readVcfFiles(vcfFiles = vcf_files, assembly = "hg19")
#> Validate VCF input:
#> $Horizon5 #> $Horizon5$warnings #> [1] "line 141: The VCF file contains 2 samples. Only the first (1_20170317_01_i01_0_horizon_5) will be used" #> [2] "line 142: AF is described both in FORMAT and in INFO of this and possibly other variants. FORMAT's AF will be used" #> #> $Horizon5$errors #> NULL #> #> #> $HorizonFFPEmild #> $HorizonFFPEmild$warnings #> [1] "line 141: The VCF file contains 2 samples. Only the first (2_20170317_01_i01_0_horizon_ffpe_mild) will be used" #> [2] "line 142: AF is described both in FORMAT and in INFO of this and possibly other variants. FORMAT's AF will be used" #> #> $HorizonFFPEmild$errors #> NULL #> #>
#> Warnings and Errors exported to 'validator_check' variable
#> Warning: replacing previous import ‘vctrs::data_frame’ by ‘tibble::data_frame’ when loading ‘dplyr’
## Read design design <- readDesign(system.file("extdata" , "ExamplePanel_GeneIDs.txt" , package = "TMBleR" , mustWork = TRUE) , assembly = "hg19" , ids = "entrezgene_id")
#> Warning: `select_()` is deprecated as of dplyr 0.7.0. #> Please use `select()` instead. #> This warning is displayed once every 8 hours. #> Call `lifecycle::last_warnings()` to see where this warning was generated.
#> Warning: `filter_()` is deprecated as of dplyr 0.7.0. #> Please use `filter()` instead. #> See vignette('programming') for more help #> This warning is displayed once every 8 hours. #> Call `lifecycle::last_warnings()` to see where this warning was generated.
#> Cache found
## Apply filter to remove known cancer variants using the default tumor ## suppressors list vcfs_NoCancer <- applyFilters(vcfs = vcfs , assembly = "hg19" , design = design , remove.cancer = TRUE , tsList = NULL , variantType = NULL)
#> Warning: data object COSMIC_hg19 was not found. Loading a COSMIC demo dataset. Please do not use this for TMB analysis but only for demoing TMBleR
#> Warning: data object COSMIC_hg19 was not found. Loading a COSMIC demo dataset. Please do not use this for TMB analysis but only for demoing TMBleR
## Apply filter to remove synonymous mutations vcfs_filtered <- applyFilters(vcfs = vcfs, assembly = "hg19", design = design, remove.cancer = FALSE, tsList = NULL, variantType = "synonymous")