opts_chunk$set(echo = F,
               warning = F,
               message = F)
# decorate data, or return as given
if (params$decorate){
  document_data <- See_GEM_formatter(GEMINI_data)
} else{
  document_data <- GEMINI_data}

r params$sample_name {.tabset}

GEMINI Variation

DT::datatable(document_data$GEMINI_data, 
              width = params$table_width, 
              escape = FALSE,
              rownames = F, 
              class='compact', 
              filter='bottom',
              extensions = c('Buttons','FixedHeader', 'ColReorder'),
              options = list(columnDefs=list(list(targets=document_data$neg_core_index-1, visible = FALSE)),
                             pageLength = 15,
                             scrollX = TRUE,
                             fixedHeader = TRUE,
                             colReorder = TRUE,
                             lengthMenu = list(c(5, 15, 30, 60, 100, -1), list('5', '15', '30', '60', '100', 'All')),
                             dom = 'Bfrtip',
                             buttons = list(list(extend = 'pageLength'),
                                            list(extend = 'colvis', collectionLayout='four-column'),
                                            list(extend = 'colvisGroup', text='Core Fields', 
                                                 hide = paste(document_data$neg_core_index-1, collapse = ','), 
                                                 show = paste(document_data$core_index-1, collapse = ',')),
                                            list(extend = 'colvisGroup', text='Family Genotypes', 
                                                 hide = paste(document_data$neg_genotypes-1, collapse = ','), 
                                                 show = paste(document_data$genotypes-1, collapse = ',')),
                                            list(extend = 'colvisGroup', text='In Silico Fields', 
                                                 hide = paste(document_data$neg_in_silico_index-1, collapse = ','), 
                                                 show = paste(document_data$in_silico_index-1, collapse = ',')),
                                            list(extend='colvisGroup', text='Show All', show = ':hidden' )))) %>% 
  DT::formatStyle(columns = c('Color'), target = 'row', backgroundColor = DT::styleEqual(c(0, 1, 2), c('#ffffff', '#fff0dd', '#ffdddd'))) 

peddy QC

A small selection of outputs from the peddy tool.

For the plots, gray are all of the samples available in the vcf that peddy was run on. The colored points are samples in the family analyzed in this document.

# load peddy data
ped_check <- fread(paste0(params$peddy_path_prefix, ".ped_check.csv"))
het_check <- fread(paste0(params$peddy_path_prefix, ".het_check.csv"))
sex_check <- fread(paste0(params$peddy_path_prefix, ".sex_check.csv"))
peddy_id <- params$peddy_id

het_processor <- function(df, stat_to_filter){
  df %>% gather(stat, value, -c(sample_id)) %>% 
    filter(stat == stat_to_filter) %>% 
    mutate(value=as.numeric(value))
}
het_data <- het_processor(het_check, 'het_ratio')
median_data <- het_processor(het_check, 'median_depth')
idr_baf_data <- het_processor(het_check, 'idr_baf')

peddy Heterozygousity Check

het_ratio <- het_data %>% 
  ggplot(aes(x=stat, y=value)) + 
  geom_quasirandom(color = 'gray', alpha=0.7) + 
  geom_quasirandom(data = het_data %>% filter(sample_id %in% peddy_id), 
                   aes(x=stat,y=value, colour=sample_id)) +
  theme_minimal() + 
  xlab('') + ylab('') + ggtitle('Het Ratio') + theme( axis.text.x=element_blank(), axis.ticks.x=element_blank())

median_depth <- median_data %>% 
  ggplot(aes(x=stat, y=value)) +
  geom_quasirandom(color = 'gray', alpha=0.7) + 
  geom_quasirandom(data = median_data %>% filter(sample_id %in% peddy_id), 
                   aes(x=stat,y=value, colour=sample_id)) +
  theme_minimal() +
  xlab('') + ylab('') + ggtitle('Median Read Depth') + theme( axis.text.x=element_blank(), axis.ticks.x=element_blank())

idr_baf <- idr_baf_data %>% 
  ggplot(aes(x=stat, y=value)) + 
  geom_quasirandom(color = 'gray', alpha=0.7) + 
  geom_quasirandom(data = idr_baf_data %>% filter(sample_id %in% peddy_id), 
                   aes(x=stat,y=value, colour=sample_id)) +
  theme_minimal() + 
  xlab('') + ylab('') + ggtitle('IDR BAF') + theme( axis.text.x=element_blank(), axis.ticks.x=element_blank())

legend <- get_legend(idr_baf+ theme(legend.position="right"))
plot_grid(median_depth + theme(legend.position="none"),
          NULL,
          het_ratio + theme(legend.position="none"), 
          NULL,
          idr_baf + theme(legend.position="none"), 
          NULL,
          legend,
          rel_widths = c(1,0.1,1,0.1,1,0.1,0.4),
          scale=0.9,
          nrow=1) 

peddy Sex Check

sex_check %>% 
  filter(sample_id %in% peddy_id) %>% 
  select('Sample ID' = sample_id, 'Pedigree Sex' = ped_sex, 'Predicted Sex' = predicted_sex, 'Error' = error) %>% 
  DT::datatable(rownames = F, 
                width = 800,
                class='compact',  
                extensions = c('Buttons'),
                options = list(dom = 'Bfrtip',
                               buttons = list(list(extend='pageLength'))))

peddy Pedigree Check

ped_check %>% 
  filter(sample_a %in% peddy_id, sample_b %in% peddy_id) %>% 
  select('Sample 1' = sample_a,
         'Sample 2' = sample_b, 
         'Relatedness' = rel,
         ibs0,
         ibs2,
         'Pedigree Parents' = pedigree_parents,
         'Predicted Parents' = predicted_parents,
         'Parent Error' = parent_error) %>% 
  DT::datatable(rownames = F, 
                width = 800,
                class='compact',  
                extensions = c('Buttons'),
                options = list(dom = 'Bfrtip',
                               buttons = list(list(extend='pageLength'))))
ped_check %>% 
  ggplot(aes(x=ibs0, y=ibs2)) + 
  geom_point(aes(x=ibs0, y=ibs2), color='gray', alpha=0.7) + 
  geom_jitter(data = ped_check %>% 
                filter(sample_a %in% peddy_id, sample_b %in% peddy_id) %>% 
                mutate('Sample - Sample' = paste0(sample_a, ' - ', sample_b)),
              aes(x=ibs0, y=ibs2, colour = `Sample - Sample`)) +
  geom_text_repel(data = ped_check %>% 
                    filter(sample_a %in% peddy_id, sample_b %in% peddy_id) %>% 
                    mutate('Sample - Sample' = paste0(sample_a, ' - ', sample_b)),
                  aes(x=ibs0, y=ibs2, label = `Sample - Sample`, colour = `Sample - Sample`),
                  box.padding = 1) + 
  theme_minimal() + 
  theme(legend.position="none")

Info

This report is auto-generated with the See GEM R package on r strftime(Sys.time(), format = "%B %d, %Y")

The analyst for this report populated the information in this dynamic documents with a variety of GEMINI queries.

FAQ:

WARNINGS/LIMITATIONS



davemcg/SeeGEM documentation built on May 5, 2019, 1:34 a.m.