#' Given a data frame of variants including their pass
#' or fail codes as generated by MuTect2 or Oncotator
#' return a data frame filtered to contain only those variants
#' that failed ONLY because the log odds were too low.
#' TODO: parameters
filter_oncotated_variants <- function(var_fr){
var_fr <- var_fr %>% dplyr::filter(!stringr::str_detect(Variant_Classification,'RNA')) %>% # Remove RNA calls
mutate(all_filters=ifelse(germline_risk=="PASS" & t_lod_fstar=="PASS" & homologous_mapping_event=="PASS" &
alt_allele_in_normal=="PASS" & triallelic_site=="PASS" & clustered_events=="PASS" &
multi_event_alt_allele_in_normal=="PASS" & str_contraction=="PASS","PASS","FAIL")) %>%
mutate(tlod_only=ifelse(germline_risk=="PASS" & t_lod_fstar=="FAIL" & homologous_mapping_event=="PASS" &
alt_allele_in_normal=="PASS" & triallelic_site=="PASS" & clustered_events=="PASS" &
multi_event_alt_allele_in_normal=="PASS" & str_contraction=="PASS","PASS","FAIL")) %>%
mutate('start'=Start_position,
'end'=Start_position,
'chr'=Chromosome,
'ref'=Reference_Allele,
'alt'=Tumor_Seq_Allele2,
'tlod'=t_lod_fstar__INFO__,
'alt_depth'=t_alt_count,
'ref_depth'=t_ref_count) %>%
dplyr::select(chr,start,end,ref,alt,tlod,Hugo_Symbol,Variant_Classification,Codon_Change,Protein_Change,all_filters,tlod_only,tumor_f,
alt_depth,ref_depth,germline_risk)
var_fr
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.