tested dm_om_data function with alr gene to make sure valid dfs are being returned
This commit is contained in:
parent
5779b3fe87
commit
ef1fb96b88
2 changed files with 52 additions and 413 deletions
|
@ -1,416 +1,62 @@
|
||||||
#!/usr/bin/env Rscript
|
#!/usr/bin/env Rscript
|
||||||
#########################################################
|
#########################################################
|
||||||
# TASK: Script to format data for dm om plots:
|
# TASK: Script to format data for dm om plots:
|
||||||
# generating LF data
|
# generating WF LF data
|
||||||
# sourced by get_plotting_dfs.R
|
# sourced by get_plotting_dfs.R
|
||||||
|
# calls my function: dm_om_wf_lf_data()
|
||||||
#########################################################
|
#########################################################
|
||||||
##========================================================================
|
#geneL_normal = c("pnca")
|
||||||
# cols to select:
|
#geneL_na_dy = c("gid")
|
||||||
# THINK: whu
|
geneL_na = c("gid", "rpob")
|
||||||
|
geneL_dy = c("gid")
|
||||||
|
geneL_ppi2 = c("alr", "embb", "katg", "rpob")
|
||||||
|
|
||||||
|
all_dm_om_df = dm_om_wf_lf_data(df = merged_df3, gene_name = gene)
|
||||||
|
|
||||||
comb_df <- merged_df3[, c("mutationinformation", "mutation"
|
wf_duet = all_dm_om_df[['wf_duet']]
|
||||||
, "mutation_info","mutation_info_labels"
|
lf_duet = all_dm_om_df[['lf_duet']]
|
||||||
, "position"
|
|
||||||
, LigDist_colname
|
|
||||||
, "duet_stability_change", "duet_scaled", "duet_outcome"
|
|
||||||
, "ligand_affinity_change", "affinity_scaled", "ligand_outcome"
|
|
||||||
, "ddg_foldx", "foldx_scaled", "foldx_outcome"
|
|
||||||
, "deepddg", "deepddg_scaled", "deepddg_outcome"
|
|
||||||
, "asa", "rsa"
|
|
||||||
, "rd_values", "kd_values"
|
|
||||||
, "log10_or_mychisq", "neglog_pval_fisher", "af"
|
|
||||||
, "mcsm_na_affinity", "mcsm_na_scaled", "mcsm_na_outcome"
|
|
||||||
, "ddg_dynamut", "ddg_dynamut_scaled","ddg_dynamut_outcome"
|
|
||||||
, "ddg_encom", "ddg_encom_scaled", "ddg_encom_outcome"
|
|
||||||
, "dds_encom", "dds_encom_scaled", "dds_encom_outcome"
|
|
||||||
, "ddg_mcsm", "ddg_mcsm_scaled", "ddg_mcsm_outcome"
|
|
||||||
, "ddg_sdm", "ddg_sdm_scaled", "ddg_sdm_outcome"
|
|
||||||
, "ddg_duet", "ddg_duet_scaled", "ddg_duet_outcome"
|
|
||||||
, "ddg_dynamut2","ddg_dynamut2_scaled", "ddg_dynamut2_outcome")]
|
|
||||||
|
|
||||||
|
|
||||||
comb_df_s = arrange(comb_df, position)
|
wf_mcsm_lig = all_dm_om_df[['wf_mcsm_lig']]
|
||||||
|
lf_mcsm_lig = all_dm_om_df[['lf_mcsm_lig']]
|
||||||
#=======================================================================
|
|
||||||
fact_cols = colnames(comb_df_s)[grepl( "_outcome|_info", colnames(comb_df_s) )]
|
|
||||||
fact_cols
|
|
||||||
lapply(comb_df_s[, fact_cols], class)
|
|
||||||
comb_df_s[, fact_cols] <- lapply(comb_df_s[, fact_cols], as.factor)
|
|
||||||
|
|
||||||
if (any(lapply(comb_df_s[, fact_cols], class) == "character")){
|
wf_foldx = all_dm_om_df[['wf_foldx']]
|
||||||
cat("\nChanging cols to factor")
|
lf_foldx = all_dm_om_df[['lf_foldx']]
|
||||||
comb_df_s[, fact_cols] <- lapply(comb_df_s[, fact_cols],as.factor)
|
|
||||||
if (all(lapply(comb_df_s[, fact_cols], class) == "factor")){
|
|
||||||
cat("\nSuccessful: cols changed to factor")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lapply(comb_df_s[, fact_cols], class)
|
|
||||||
|
|
||||||
#=======================================================================
|
wf_deepddg = all_dm_om_df[['wf_deepddg']]
|
||||||
table(comb_df_s$mutation_info)
|
lf_deepddg = all_dm_om_df[['lf_deepddg']]
|
||||||
|
|
||||||
# further checks to make sure dr and other muts are indeed unique
|
wf_dynamut2 = all_dm_om_df[['wf_dynamut2']]
|
||||||
dr_muts = comb_df_s[comb_df_s$mutation_info == dr_muts_col,]
|
lf_dynamut2 = all_dm_om_df[['lf_dynamut2']]
|
||||||
dr_muts_names = unique(dr_muts$mutation)
|
|
||||||
|
|
||||||
other_muts = comb_df_s[comb_df_s$mutation_info == other_muts_col,]
|
wf_consurf = all_dm_om_df[['wf_consurf']]
|
||||||
other_muts_names = unique(other_muts$mutation)
|
lf_consurf = all_dm_om_df[['lf_consurf']]
|
||||||
|
|
||||||
if ( table(dr_muts_names%in%other_muts_names)[[1]] == length(dr_muts_names) &&
|
wf_snap2 = all_dm_om_df[['wf_snap2']]
|
||||||
table(other_muts_names%in%dr_muts_names)[[1]] == length(other_muts_names) ){
|
lf_snap2 = all_dm_om_df[['lf_snap2']]
|
||||||
cat("PASS: dr and other muts are indeed unique")
|
|
||||||
}else{
|
if (tolower(gene)%in%geneL_na){
|
||||||
cat("FAIL: dr and others muts are NOT unique!")
|
wf_mcsm_na = all_dm_om_df[['wf_mcsm_na']]
|
||||||
quit()
|
lf_mcsm_na = all_dm_om_df[['lf_mcsm_na']]
|
||||||
}
|
}
|
||||||
|
|
||||||
# pretty display names i.e. labels to reduce major code duplication later
|
if (tolower(gene)%in%geneL_ppi2){
|
||||||
foo_cnames = data.frame(colnames(comb_df_s))
|
wf_mcsm_ppi2 = all_dm_om_df[['wf_mcsm_ppi2']]
|
||||||
names(foo_cnames) <- "old_name"
|
lf_mcsm_ppi2 = all_dm_om_df[['lf_mcsm_ppi2']]
|
||||||
|
|
||||||
stability_suffix <- paste0(delta_symbol, delta_symbol, "G")
|
|
||||||
flexibility_suffix <- paste0(delta_symbol, delta_symbol, "S")
|
|
||||||
|
|
||||||
lig_dn = paste0("Ligand distance (", angstroms_symbol, ")"); lig_dn
|
|
||||||
duet_dn = paste0("DUET ", stability_suffix); duet_dn
|
|
||||||
foldx_dn = paste0("FoldX ", stability_suffix); foldx_dn
|
|
||||||
deepddg_dn = paste0("Deepddg " , stability_suffix); deepddg_dn
|
|
||||||
mcsm_na_dn = paste0("mCSM-NA affinity ", stability_suffix); mcsm_na_dn
|
|
||||||
dynamut_dn = paste0("Dynamut ", stability_suffix); dynamut_dn
|
|
||||||
dynamut2_dn = paste0("Dynamut2 " , stability_suffix); dynamut2_dn
|
|
||||||
encom_ddg_dn = paste0("EnCOM " , stability_suffix); encom_ddg_dn
|
|
||||||
encom_dds_dn = paste0("EnCOM " , flexibility_suffix ); encom_dds_dn
|
|
||||||
sdm_dn = paste0("SDM " , stability_suffix); sdm_dn
|
|
||||||
mcsm_dn = paste0("mCSM " , stability_suffix ); mcsm_dn
|
|
||||||
|
|
||||||
# Change colnames of some columns using datatable
|
|
||||||
comb_df_sl = comb_df_s
|
|
||||||
names(comb_df_sl)
|
|
||||||
|
|
||||||
setnames(comb_df_sl
|
|
||||||
, old = c("asa", "rsa", "rd_values", "kd_values"
|
|
||||||
, "log10_or_mychisq", "neglog_pval_fisher", "af"
|
|
||||||
, LigDist_colname
|
|
||||||
, "duet_scaled"
|
|
||||||
, "foldx_scaled"
|
|
||||||
, "deepddg_scaled"
|
|
||||||
, "mcsm_na_scaled"
|
|
||||||
, "ddg_dynamut_scaled"
|
|
||||||
, "ddg_dynamut2_scaled"
|
|
||||||
, "ddg_encom_scaled"
|
|
||||||
, "dds_encom_scaled"
|
|
||||||
, "ddg_sdm"
|
|
||||||
, "ddg_mcsm")
|
|
||||||
|
|
||||||
, new = c("ASA", "RSA", "RD", "KD"
|
|
||||||
, "Log10 (OR)", "-Log (P)", "MAF"
|
|
||||||
, lig_dn
|
|
||||||
, duet_dn
|
|
||||||
, foldx_dn
|
|
||||||
, deepddg_dn
|
|
||||||
, mcsm_na_dn
|
|
||||||
, dynamut_dn
|
|
||||||
, dynamut2_dn
|
|
||||||
, encom_ddg_dn
|
|
||||||
, encom_dds_dn
|
|
||||||
, sdm_dn
|
|
||||||
, mcsm_dn)
|
|
||||||
)
|
|
||||||
|
|
||||||
foo_cnames <- cbind(foo_cnames, colnames(comb_df_sl))
|
|
||||||
|
|
||||||
# some more pretty labels
|
|
||||||
table(comb_df_sl$mutation_info)
|
|
||||||
|
|
||||||
levels(comb_df_sl$mutation_info)[levels(comb_df_sl$mutation_info)==dr_muts_col] <- "DM"
|
|
||||||
levels(comb_df_sl$mutation_info)[levels(comb_df_sl$mutation_info)==other_muts_col] <- "OM"
|
|
||||||
|
|
||||||
table(comb_df_sl$mutation_info)
|
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
#======================
|
|
||||||
# Selecting dfs
|
|
||||||
# with appropriate cols
|
|
||||||
#=======================
|
|
||||||
static_cols_start = c("mutationinformation"
|
|
||||||
, "position"
|
|
||||||
, "mutation"
|
|
||||||
, "mutation_info")
|
|
||||||
|
|
||||||
static_cols_end = c(lig_dn
|
|
||||||
, "ASA"
|
|
||||||
, "RSA"
|
|
||||||
, "RD"
|
|
||||||
, "KD")
|
|
||||||
|
|
||||||
# ordering is important!
|
|
||||||
|
|
||||||
#########################################################################
|
|
||||||
#==============
|
|
||||||
# DUET: LF
|
|
||||||
#==============
|
|
||||||
cols_to_select_duet = c(static_cols_start, c("duet_outcome", duet_dn), static_cols_end)
|
|
||||||
wf_duet = comb_df_sl[, cols_to_select_duet]
|
|
||||||
|
|
||||||
#pivot_cols_ps = cols_to_select_ps[1:5]; pivot_cols_ps
|
|
||||||
pivot_cols_duet = cols_to_select_duet[1: (length(static_cols_start) + 1)]; pivot_cols_duet
|
|
||||||
|
|
||||||
expected_rows_lf = nrow(wf_duet) * (length(wf_duet) - length(pivot_cols_duet))
|
|
||||||
expected_rows_lf
|
|
||||||
|
|
||||||
# LF data: duet
|
|
||||||
lf_duet = gather(wf_duet
|
|
||||||
, key = param_type
|
|
||||||
, value = param_value
|
|
||||||
, all_of(duet_dn):tail(static_cols_end,1)
|
|
||||||
, factor_key = TRUE)
|
|
||||||
|
|
||||||
if (nrow(lf_duet) == expected_rows_lf){
|
|
||||||
cat("\nPASS: long format data created for ", duet_dn)
|
|
||||||
}else{
|
|
||||||
cat("\nFAIL: long format data could not be created for duet")
|
|
||||||
quit()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
############################################################################
|
if (tolower(gene)%in%geneL_dy){
|
||||||
#==============
|
wf_dynamut = all_dm_om_df[['wf_dynamut']]
|
||||||
# FoldX: LF
|
lf_dynamut = all_dm_om_df[['lf_dynamut']]
|
||||||
#==============
|
|
||||||
cols_to_select_foldx= c(static_cols_start, c("foldx_outcome", foldx_dn), static_cols_end)
|
|
||||||
wf_foldx = comb_df_sl[, cols_to_select_foldx]
|
|
||||||
|
|
||||||
pivot_cols_foldx = cols_to_select_foldx[1: (length(static_cols_start) + 1)]; pivot_cols_foldx
|
wf_encomddg = all_dm_om_df[['wf_encomddg']]
|
||||||
|
lf_encomddg = all_dm_om_df[['lf_encomddg']]
|
||||||
|
|
||||||
expected_rows_lf = nrow(wf_foldx) * (length(wf_foldx) - length(pivot_cols_foldx))
|
wf_encomdds = all_dm_om_df[['wf_encomdds']]
|
||||||
expected_rows_lf
|
lf_encomdds = all_dm_om_df[['lf_encomdds']]
|
||||||
|
|
||||||
# LF data: Foldx
|
wf_sdm = all_dm_om_df[['wf_sdm']]
|
||||||
lf_foldx <<- gather(wf_foldx
|
lf_sdm = all_dm_om_df[['lf_sdm']]
|
||||||
, key = param_type
|
|
||||||
, value = param_value
|
|
||||||
, all_of(foldx_dn):tail(static_cols_end,1)
|
|
||||||
, factor_key = TRUE)
|
|
||||||
|
|
||||||
if (nrow(lf_foldx) == expected_rows_lf){
|
wf_mcsm = all_dm_om_df[['wf_mcsm']]
|
||||||
cat("\nPASS: long format data created for ", foldx_dn)
|
lf_mcsm = all_dm_om_df[['lf_mcsm']]
|
||||||
}else{
|
|
||||||
cat("\nFAIL: long format data could not be created for duet")
|
|
||||||
quit()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
############################################################################
|
|
||||||
#==============
|
|
||||||
# Deepddg: LF
|
|
||||||
#==============
|
|
||||||
cols_to_select_deepddg = c(static_cols_start, c("deepddg_outcome", deepddg_dn), static_cols_end)
|
|
||||||
wf_deepddg = comb_df_sl[, cols_to_select_deepddg]
|
|
||||||
|
|
||||||
pivot_cols_deepddg = cols_to_select_deepddg[1: (length(static_cols_start) + 1)]; pivot_cols_deepddg
|
|
||||||
|
|
||||||
expected_rows_lf = nrow(wf_deepddg) * (length(wf_deepddg) - length(pivot_cols_deepddg))
|
|
||||||
expected_rows_lf
|
|
||||||
|
|
||||||
# LF data: Deepddg
|
|
||||||
lf_deepddg = gather(wf_deepddg
|
|
||||||
, key = param_type
|
|
||||||
, value = param_value
|
|
||||||
, all_of(deepddg_dn):tail(static_cols_end,1)
|
|
||||||
, factor_key = TRUE)
|
|
||||||
|
|
||||||
if (nrow(lf_deepddg) == expected_rows_lf){
|
|
||||||
cat("\nPASS: long format data created for ", deepddg_dn)
|
|
||||||
}else{
|
|
||||||
cat("\nFAIL: long format data could not be created for duet")
|
|
||||||
quit()
|
|
||||||
}
|
|
||||||
|
|
||||||
############################################################################
|
|
||||||
#==============
|
|
||||||
# mCSM-NA: LF
|
|
||||||
#==============
|
|
||||||
cols_to_select_mcsm_na = c(static_cols_start, c("mcsm_na_outcome", mcsm_na_dn), static_cols_end)
|
|
||||||
wf_mcsm_na = comb_df_sl[, cols_to_select_mcsm_na]
|
|
||||||
|
|
||||||
pivot_cols_mcsm_na = cols_to_select_mcsm_na[1: (length(static_cols_start) + 1)]; pivot_cols_mcsm_na
|
|
||||||
|
|
||||||
expected_rows_lf = nrow(wf_mcsm_na) * (length(wf_mcsm_na) - length(pivot_cols_mcsm_na))
|
|
||||||
expected_rows_lf
|
|
||||||
|
|
||||||
# LF data: mcsm_na
|
|
||||||
lf_mcsm_na = gather(wf_mcsm_na
|
|
||||||
, key = param_type
|
|
||||||
, value = param_value
|
|
||||||
, all_of(mcsm_na_dn):tail(static_cols_end,1)
|
|
||||||
, factor_key = TRUE)
|
|
||||||
|
|
||||||
if (nrow(lf_mcsm_na) == expected_rows_lf){
|
|
||||||
cat("\nPASS: long format data created for ", mcsm_na_dn)
|
|
||||||
}else{
|
|
||||||
cat("\nFAIL: long format data could not be created for duet")
|
|
||||||
quit()
|
|
||||||
}
|
|
||||||
|
|
||||||
############################################################################
|
|
||||||
#==============
|
|
||||||
# Dynamut: LF
|
|
||||||
#==============
|
|
||||||
cols_to_select_dynamut = c(static_cols_start, c("ddg_dynamut_outcome", dynamut_dn), static_cols_end)
|
|
||||||
wf_dynamut = comb_df_sl[, cols_to_select_dynamut]
|
|
||||||
|
|
||||||
pivot_cols_dynamut = cols_to_select_dynamut[1: (length(static_cols_start) + 1)]; pivot_cols_dynamut
|
|
||||||
|
|
||||||
expected_rows_lf = nrow(wf_dynamut) * (length(wf_dynamut) - length(pivot_cols_dynamut))
|
|
||||||
expected_rows_lf
|
|
||||||
|
|
||||||
# LF data: dynamut
|
|
||||||
lf_dynamut = gather(wf_dynamut
|
|
||||||
, key = param_type
|
|
||||||
, value = param_value
|
|
||||||
, all_of(dynamut_dn):tail(static_cols_end,1)
|
|
||||||
, factor_key = TRUE)
|
|
||||||
|
|
||||||
if (nrow(lf_dynamut) == expected_rows_lf){
|
|
||||||
cat("\nPASS: long format data created for ", dynamut_dn)
|
|
||||||
}else{
|
|
||||||
cat("\nFAIL: long format data could not be created for duet")
|
|
||||||
quit()
|
|
||||||
}
|
|
||||||
|
|
||||||
############################################################################
|
|
||||||
#==============
|
|
||||||
# Dynamut2: LF
|
|
||||||
#==============
|
|
||||||
cols_to_select_dynamut2 = c(static_cols_start, c("ddg_dynamut2_outcome", dynamut2_dn), static_cols_end)
|
|
||||||
|
|
||||||
wf_dynamut2 = comb_df_sl[, cols_to_select_dynamut2]
|
|
||||||
|
|
||||||
pivot_cols_dynamut2 = cols_to_select_dynamut2[1: (length(static_cols_start) + 1)]; pivot_cols_dynamut2
|
|
||||||
|
|
||||||
expected_rows_lf = nrow(wf_dynamut2) * (length(wf_dynamut2) - length(pivot_cols_dynamut2))
|
|
||||||
expected_rows_lf
|
|
||||||
|
|
||||||
# LF data: dynamut2
|
|
||||||
lf_dynamut2 = gather(wf_dynamut2
|
|
||||||
, key = param_type
|
|
||||||
, value = param_value
|
|
||||||
, all_of(dynamut2_dn):tail(static_cols_end,1)
|
|
||||||
, factor_key = TRUE)
|
|
||||||
|
|
||||||
if (nrow(lf_dynamut2) == expected_rows_lf){
|
|
||||||
cat("\nPASS: long format data created for ", dynamut2_dn)
|
|
||||||
}else{
|
|
||||||
cat("\nFAIL: long format data could not be created for duet")
|
|
||||||
quit()
|
|
||||||
}
|
|
||||||
|
|
||||||
############################################################################
|
|
||||||
#==============
|
|
||||||
# EnCOM ddg: LF
|
|
||||||
#==============
|
|
||||||
cols_to_select_encomddg = c(static_cols_start, c("ddg_encom_outcome", encom_ddg_dn), static_cols_end)
|
|
||||||
wf_encomddg = comb_df_sl[, cols_to_select_encomddg]
|
|
||||||
|
|
||||||
pivot_cols_encomddg = cols_to_select_encomddg[1: (length(static_cols_start) + 1)]; pivot_cols_encomddg
|
|
||||||
|
|
||||||
expected_rows_lf = nrow(wf_encomddg ) * (length(wf_encomddg ) - length(pivot_cols_encomddg))
|
|
||||||
expected_rows_lf
|
|
||||||
|
|
||||||
# LF data: encomddg
|
|
||||||
lf_encomddg = gather(wf_encomddg
|
|
||||||
, key = param_type
|
|
||||||
, value = param_value
|
|
||||||
, all_of(encom_ddg_dn):tail(static_cols_end,1)
|
|
||||||
, factor_key = TRUE)
|
|
||||||
|
|
||||||
if (nrow(lf_encomddg) == expected_rows_lf){
|
|
||||||
cat("\nPASS: long format data created for ", encom_ddg_dn)
|
|
||||||
}else{
|
|
||||||
cat("\nFAIL: long format data could not be created for duet")
|
|
||||||
quit()
|
|
||||||
}
|
|
||||||
############################################################################
|
|
||||||
#==============
|
|
||||||
# EnCOM dds: LF
|
|
||||||
#==============
|
|
||||||
cols_to_select_encomdds = c(static_cols_start, c("dds_encom_outcome", encom_dds_dn), static_cols_end)
|
|
||||||
wf_encomdds = comb_df_sl[, cols_to_select_encomdds]
|
|
||||||
|
|
||||||
pivot_cols_encomdds = cols_to_select_encomdds[1: (length(static_cols_start) + 1)]; pivot_cols_encomdds
|
|
||||||
|
|
||||||
expected_rows_lf = nrow(wf_encomdds) * (length(wf_encomdds) - length(pivot_cols_encomdds))
|
|
||||||
expected_rows_lf
|
|
||||||
|
|
||||||
# LF data: encomdds
|
|
||||||
lf_encomdds = gather(wf_encomdds
|
|
||||||
, key = param_type
|
|
||||||
, value = param_value
|
|
||||||
, all_of(encom_dds_dn):tail(static_cols_end,1)
|
|
||||||
, factor_key = TRUE)
|
|
||||||
|
|
||||||
if (nrow(lf_encomdds) == expected_rows_lf){
|
|
||||||
cat("\nPASS: long format data created for", encom_dds_dn)
|
|
||||||
}else{
|
|
||||||
cat("\nFAIL: long format data could not be created for duet")
|
|
||||||
quit()
|
|
||||||
}
|
|
||||||
|
|
||||||
############################################################################
|
|
||||||
#==============
|
|
||||||
# SDM: LF
|
|
||||||
#==============
|
|
||||||
cols_to_select_sdm = c(static_cols_start, c("ddg_sdm_outcome", sdm_dn), static_cols_end)
|
|
||||||
wf_sdm = comb_df_sl[, cols_to_select_sdm]
|
|
||||||
|
|
||||||
pivot_cols_sdm = cols_to_select_sdm[1: (length(static_cols_start) + 1)]; pivot_cols_sdm
|
|
||||||
|
|
||||||
expected_rows_lf = nrow(wf_sdm) * (length(wf_sdm) - length(pivot_cols_sdm))
|
|
||||||
expected_rows_lf
|
|
||||||
|
|
||||||
# LF data: sdm
|
|
||||||
lf_sdm = gather(wf_sdm
|
|
||||||
, key = param_type
|
|
||||||
, value = param_value
|
|
||||||
, all_of(sdm_dn):tail(static_cols_end,1)
|
|
||||||
, factor_key = TRUE)
|
|
||||||
|
|
||||||
if (nrow(lf_sdm) == expected_rows_lf){
|
|
||||||
cat("\nPASS: long format data created for", sdm_dn)
|
|
||||||
}else{
|
|
||||||
cat("\nFAIL: long format data could not be created for duet")
|
|
||||||
quit()
|
|
||||||
}
|
|
||||||
|
|
||||||
############################################################################
|
|
||||||
#==============
|
|
||||||
# mCSM: LF
|
|
||||||
#==============
|
|
||||||
cols_to_select_mcsm = c(static_cols_start, c("ddg_mcsm_outcome", mcsm_dn), static_cols_end)
|
|
||||||
wf_mcsm = comb_df_sl[, cols_to_select_mcsm]
|
|
||||||
|
|
||||||
pivot_cols_mcsm = cols_to_select_mcsm[1: (length(static_cols_start) + 1)]; pivot_cols_mcsm
|
|
||||||
|
|
||||||
expected_rows_lf = nrow(wf_mcsm) * (length(wf_mcsm) - length(pivot_cols_mcsm))
|
|
||||||
expected_rows_lf
|
|
||||||
|
|
||||||
# LF data: mcsm
|
|
||||||
lf_mcsm = gather(wf_mcsm
|
|
||||||
, key = param_type
|
|
||||||
, value = param_value
|
|
||||||
, all_of(mcsm_dn):tail(static_cols_end,1)
|
|
||||||
, factor_key = TRUE)
|
|
||||||
|
|
||||||
if (nrow(lf_mcsm) == expected_rows_lf){
|
|
||||||
cat("\nPASS: long format data created for", mcsm_dn)
|
|
||||||
}else{
|
|
||||||
cat("\nFAIL: long format data could not be created for duet")
|
|
||||||
quit()
|
|
||||||
}
|
|
||||||
|
|
||||||
#==========================
|
|
||||||
# Duet-d(from Dynamut): LF
|
|
||||||
#===========================
|
|
||||||
|
|
||||||
#Not created, redundant and chaos!
|
|
||||||
|
|
||||||
############################################################################
|
|
||||||
|
|
||||||
|
|
|
@ -122,38 +122,31 @@ s1 = c("\nSuccessfully sourced logo_data_msa.R")
|
||||||
cat(s1)
|
cat(s1)
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
# Data for DM OM Plots: Long format dfs
|
# Data for DM OM Plots: WF and LF dfs
|
||||||
|
# My function: dm_om_wf_lf_data()
|
||||||
####################################################################
|
####################################################################
|
||||||
#source("other_plots_data.R")
|
#source("other_plots_data.R")
|
||||||
|
# converted to a function
|
||||||
# FIXME
|
# moved old one to redundant. Added suffix to filename i.e. _nf(non-function)
|
||||||
#source(paste0(plot_script_path, "dm_om_data.R"))
|
source(paste0(plot_script_path, "dm_om_data.R"))
|
||||||
|
|
||||||
#s2 = c("\nSuccessfully sourced other_plots_data.R")
|
s2 = c("\nSuccessfully sourced other_plots_data.R")
|
||||||
#cat(s2)
|
cat(s2)
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
# Data for Lineage barplots: WF and LF dfs
|
# Data for Lineage barplots: WF and LF dfs
|
||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
#source(paste0(plot_script_path, "lineage_data.R"))
|
source(paste0(plot_script_path, "lineage_data.R"))
|
||||||
|
|
||||||
#s3 = c("\nSuccessfully sourced lineage_data.R")
|
s3 = c("\nSuccessfully sourced lineage_data.R")
|
||||||
#cat(s3)
|
cat(s3)
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
# Data for corr plots:
|
# Data for corr plots:
|
||||||
|
# My function: corr_data_extract()
|
||||||
####################################################################
|
####################################################################
|
||||||
# make sure the above script works because merged_df2_combined is needed
|
# make sure the above script works because merged_df2_combined is needed
|
||||||
#source(paste0(plot_script_path, "corr_data.R"))
|
|
||||||
|
|
||||||
#s4 = c("\nSuccessfully sourced corr_data.R")
|
|
||||||
#cat(s4)
|
|
||||||
|
|
||||||
# Moved "logo_data.R" to redundant/
|
|
||||||
#-----------------------------------------
|
|
||||||
# Replaced above with my function
|
|
||||||
# corr_data_extract()
|
|
||||||
|
|
||||||
corr_df_m3_f = corr_data_extract(merged_df3, extract_scaled_cols = F)
|
corr_df_m3_f = corr_data_extract(merged_df3, extract_scaled_cols = F)
|
||||||
head(corr_df_m3_f)
|
head(corr_df_m3_f)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue