#' @title extractNetworkGenes
#' @export
extractNetworkGenes <- function(network_df, pathway_list, gene_key){
output <- c()
results <- c()
lengths1 <- c()
lengths2 <- c()
for (i in 1:nrow(network_df)){
pathway1 <- network_df$pathway1[i]
pathway2 <- network_df$pathway2[i]
lengths1[i] <- length(pathway_list[[pathway1]])
lengths2[i] <- length(pathway_list[[pathway2]])
all_genes <- c(pathway_list[[pathway1]], pathway_list[[pathway2]])
all_genes <- unique(all_genes)
results[[i]] <- all_genes
}
names(results) <- network_df$edge
genes_df <- stack(results)
colnames(genes_df) <- c('entrezgene_id', 'edge')
genes_df %<>% filter(entrezgene_id != 'None')
genes_df %<>% left_join(key)
len_df = data.frame('pathway1_length' = lengths1,
'pathway2_length' = lengths2
# ,
# 'intersection_length' = in_length
)
network_df <- bind_cols(network_df, len_df)
output[['network_df']] <- network_df
output[['genes_df']] <- genes_df
return(output)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.