## ----setup, include=FALSE----------------------------------------------------- knitr::opts_chunk$set( echo = TRUE, message = FALSE, warning = FALSE, eval = FALSE ) ## ----------------------------------------------------------------------------- # # Conceptual representation of the initial annotation process # initial_results <- list() # for (model in models) { # initial_results[[model]] <- annotate_cell_types( # input = marker_data, # tissue_name = tissue_name, # model = model, # api_key = api_keys[[get_provider(model)]] # ) # } ## ----------------------------------------------------------------------------- # # Conceptual representation of controversial cluster identification # controversial_clusters <- identify_controversial_clusters( # initial_results, # threshold = discussion_threshold # ) ## ----------------------------------------------------------------------------- # # Conceptual representation of the discussion process # discussion_results <- facilitate_cluster_discussion( # controversial_clusters, # initial_results, # marker_data, # tissue_name, # discussion_model, # api_key # ) ## ----------------------------------------------------------------------------- # # Conceptual representation of consensus formation # final_annotations <- combine_results( # initial_results, # discussion_results, # controversial_clusters # ) ## ----------------------------------------------------------------------------- # # Conceptual calculation of consensus proportion # consensus_proportion <- sapply(clusters, function(cluster) { # annotations <- sapply(models, function(model) initial_results[[model]][cluster]) # most_common <- names(which.max(table(annotations))) # sum(annotations == most_common) / length(annotations) # }) ## ----------------------------------------------------------------------------- # # Conceptual calculation of Shannon entropy # shannon_entropy <- sapply(clusters, function(cluster) { # annotations <- sapply(models, function(model) initial_results[[model]][cluster]) # p <- table(annotations) / length(annotations) # -sum(p * log2(p)) # })