MegaScale / src /02.2_check_assembled_datasets.R
maom's picture
update upload assemble and upload scripts
f356ef8
# consistency between models and function predictions
source("src/summarize_map.R")
dataset1_name <- arrow::read_parquet(
"intermediate/dataset1.parquet",
col_select = "name") |>
dplyr::mutate(
WT_name = name |> stringr::str_replace("pdb_[A-Z][0-9]+[A-Z]", "pdb")) |>
dplyr::filter(
!(WT_name |> stringr::str_detect("[0-9][A-Z0-9a-z]{3}([.]pdb)?")),
!(WT_name |> stringr::str_detect("ruler")))
names_joined |> dplyr::filter(is.na(name_models)) |> dplyr::select(-name_models) |> dplyr::filter(!(WT_name |> stringr::str_detect("ruler")), !(WT_name |> stringr::str_detect("set")), !(WT_name |> stringr::str_detect("_del")), !(WT_name |> stringr::str_detect("_ins")), !(WT_name |> stringr::str_detect("_wt[a-z]")), !(WT_name |> stringr::str_detect("scramble")), !(WT_name |> stringr::str_detect("(PP5|ZF5)[.]3")), !(WT_name |> stringr::str_detect("(UAH|SAH)-p53-8R"))) |> dplyr::filter(WT_name |> stringr::str_detect("pdb"))
models_name <- arrow::read_parquet(
"intermediate/AlphaFold_model_PDBs.parquet",
col_select = "name") |>
dplyr::mutate(
name = name |> stringr::str_replace(":", "[|]"))
names_joined <- dplyr::full_join(
dataset1_name |> dplyr::mutate(name_dataset1 = WT_name),
models_name |> dplyr::mutate(name_models = name),
by = c("WT_name" = "name"))
names_joined_summary <- names_joined |>
summarize_map(
x_cols = name_dataset1,
y_cols = name_models,
verbose = TRUE)
check_id_consistency <- function(
dataset_tag,
split,
verbose = FALSE) {
if (verbose) {
cat("Loading model ids...\n")
}
dataset1 <- arrow::read_parquet(
paste0("intermediate/", dataset_tag, "_", split, ".parquet"),
col_select = "id")
if (verbose) {
cat("Loading function prediction ids...\n")
}
ids_anno <- arrow::read_parquet(
paste0("intermediate/", dataset_tag, "_function_predictions.parquet"),
col_select = "id") |>
dplyr::distinct(id)
problems <- dplyr::full_join(
ids_model |>
dplyr::mutate(model_id = id),
ids_anno |>
dplyr::mutate(anno_id = id),
by = "id") |>
summarize_map(
x_cols = model_id,
y_cols = anno_id,
verbose = verbose)
problems
}
check_id_consistency("rosetta_high_quality")
check_id_consistency("rosetta_low_quality")
check_id_consistency("dmpfold_high_quality")
check_id_consistency("dmpfold_low_quality")