knitr::opts_chunk$set(echo = TRUE) suppressPackageStartupMessages({ library(PItools) library(data.table) library(igraph) library(microbenchmark) })
This article shows how to download protein interaction data using PItools, import it into igraph and calculate degree of each protein using PItools and igraph.
human_interactome = fullInteractome(taxid = "9606", database = "IntActFTP", format = "tab27", clean = T, protein_only = TRUE)
human_interactome_igraph = graph_from_data_frame(d = human_interactome$data[, .(IDs_interactor_A, IDs_interactor_B, Publication_Identifiers, Confidence_values)], directed = F)
microbenchmark function from microbenchmark R package is the most convenient and accurate way to measure how long code runs. Let's use this to find which, PItools or igraph will calculate node degree faster.
microbenchmark({edgelist2degree(human_interactome$data)})
# igraph is much faster than PItools microbenchmark({degree(human_interactome_igraph)}) # but only if you don't account for time it takes to create an igraph object microbenchmark({ human_interactome_igraph = graph_from_data_frame(d = human_interactome$data[, .(IDs_interactor_A, IDs_interactor_B, Publication_Identifiers, Confidence_values)], directed = F) degree(human_interactome_igraph) })
Sys.Date. = Sys.Date() Sys.Date. session_info. = devtools::session_info() session_info.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.