6 Summary
We ouput the results of the analysis to an Excel workbook with seperate sheets for de novo, homozygous, unphased compound hetorygous and phased compound heterozygous variants. We highlight variants in the same transcript with a single colour for ease of viewing.
library(openxlsx)
<- c("de_novo", "de_novo_gq>=30","homozygote","unphased_compound_heterozygote","phased_compound_heterozygote","chrX","ukpanelapp_green","aupanelapp","all_variants")
names <- c("prob_novo","prob_novo_high_qual","prob_hom","prob_2plus_het2","prob_comp_het2","prob_X","refseq_green","refseq_au","refseq5")
tables <- data_frame(names,tables)
sheets
<- createWorkbook()
wb <- createStyle(fontColour = "#215967", bgFill = "#B7DEE8")
negStyle <- createStyle(fontColour = "#006100", bgFill = "#C6EFCE")
posStyle
for (i in 1:nrow(sheets)) {
<- get(sheets$tables[i])
table $Group <- cumsum(c(TRUE, head(table$Feature, -1) != tail(table$Feature, -1)))
table<- int2col(ncol(table))
e_col <- int2col(ncol(table)+1)
e_col1 <- int2col(ncol(table)+2)
e_col2 $helper1 <- paste("=SUBTOTAL(103,",e_col,2:(nrow(table)+1),")", sep = "")
table$helper2 <- paste("=IF(",e_col1,2:(nrow(table)+1),"=1,IFERROR(MAX($",e_col2,"$1:",e_col2,1:nrow(table),")+(COUNTIFS($",e_col,"$1:",e_col,1:nrow(table),",",e_col,2:(nrow(table)+1),",","$",e_col1,"$1:",e_col1,1:nrow(table),",1)=0),1),\"\")", sep = "")
tableclass(table$helper1) <- c(class(table$helper1), "formula")
class(table$helper2) <- c(class(table$helper2), "formula")
addWorksheet(wb, sheets$names[i])
writeDataTable(wb,sheets$names[i], x = table, tableStyle = "None")
<- paste("ISODD($", e_col2, "1)", sep = "", collapse = "")
rule_odd <- paste("ISEVEN($", e_col2, "1)", sep = "", collapse = "")
rule_even conditionalFormatting(wb, sheets$names[i], cols = 1:ncol(table), rows = 1:(nrow(table)+1), rule = rule_odd, style = negStyle)
conditionalFormatting(wb, sheets$names[i], cols = 1:ncol(table), rows = 1:(nrow(table)+1), rule = rule_even, style = posStyle)
}
saveWorkbook(wb, "result/AJ_pedigree_results_05_14_24.xlsx", overwrite = TRUE)