440 likes | 649 Views
Amazon EC2 Cloud and Using R in EC2 instance. Ishwor Thapa. Log in to: . https://uno-biocloud.signin.aws.amazon.com/ console username and password provided to you. EC2Page. Selecting Instance (A). Selecting Instance (B). Instance Details. Instance Details. Create KEY PAIR (PASSWORD FILE).
E N D
Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa
Log in to: • https://uno-biocloud.signin.aws.amazon.com/console • username and password provided to you.
Instance is up and running • Now how to connect to the machine and work in the ubuntu instance in cloud? • Linux/ mac -> ssh (already installed) • Windows -> putty (need to install) For Windows Users: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html Scroll Down to Binaries and download putty.zip and extract the files.
Instance Information from EC2 console Copy the public DNS value: ec2-50-17-17-23.compute-1.amazonaws.com
Connecting to ec2 instance using ssh (linux/ mac) • chmod 700 ithapa.pem • ssh-v -iithapa.pem ubuntu@ec2-50-16-181-117.compute-1.amazonaws.com • Linux ip-10-117-89-77 2.6.35-24-virtual #42-Ubuntu SMP Thu Dec 2 05:15:26 UTC 2010 x86_64 GNU/Linux • Ubuntu 10.10 • Welcome to Ubuntu!
Connecting to ec2 instance using putty (Windows) Login Name:ubuntu Linux ip-10-117-89-77 2.6.35-24-virtual #42-Ubuntu SMP Thu Dec 2 05:15:26 UTC 2010 x86_64 GNU/Linux Ubuntu 10.10 Welcome to Ubuntu!
Installing / Using R ubuntu@ip-10-117-89-77:~$ R The program 'R' is currently not installed. You can install it by typing: sudo apt-get install r-base-core ubuntu@ip-10-117-89-77:~$ sudo apt-get update ubuntu@ip-10-117-89-77:~$ sudo apt-get install r-base-core
Installing iGraph in R R > install.packages("igraph") Warning in install.packages("igraph") : argument 'lib' is missing: using '/usr/local/lib/R/site-library' Warning in install.packages("igraph") : 'lib = "/usr/local/lib/R/site-library"' is not writable Would you like to create a personal library '~/R/x86_64-pc-linux-gnu-library/2.11' to install packages into? (y/n) y 69: USA (AZ) 70: USA (CA 1) 71: USA (CA 2) 72: USA (IA) 73: USA (MA) 74: USA (MI) 75: USA (MO) 76: USA (OH) 77: USA (OR) 78: USA (PA 1) 79: USA (PA 2) 80: USA (TX 1) 81: USA (TX 2) 82: USA (WA 1) 83: USA (WA 2) Selection: 72
Graph Basic Concepts • Graph is defined by nodes/vertices and the connection between the nodes, called edges. • directed/ undirected • Weighted/ Unweighted • library(“igraph”) • G<-graph(c(0,1, 1,2, 3,4, 5,6)) Definition of the Graph: • G
iGraph Data model Vertices • V(G) Edges • E(G) Undirected Graph • G<-graph(c(0,1, 1,2, 3,4, 5,6), directed=F)
Network Structure • Star • Ring • Lattice • Tree
Network Structure • s<-graph.star(n=3) • s<-graph.star(n=4,mode=“in”, center=1) • r<-graph.ring(n=4) • Other parameters: directed, mutual, circular • l<-graph.lattice(c(5,5)) • e<-graph.empty() • e<-graph.empty(n=5) • f<-graph.full(n=3)
Read network from a file • g<-read.graph(“sample.txt”, format=“ncol”) • g Big graphs • g<-read.graph(“ppi.mouse.uniprot”, format=“ncol”) • summary(g) • V(g)$[0] • E(g)$[2]
Sample and PPI network • PPI : EBI intact page with mouse search key word. • sample network
Analyzing a network • Network Centrality ( the most central node in the network) • PPI : proteins having many interactions with other proteins • Degree Centrality, Closeness Centrality and Betweenness Centrality • Degree: The number of edges coming to/from a vertex • d<-degree(g) • which.max(d) • V(g)[which.max(d) -1]
Closeness/ Betweenness Centrality • Average Number of steps needed to travel to reach other vertices. • cl<-closeness(g) • V(g)[which.max(cl)-1] Betweenness: to which extent a vertex is “in between” other vertices • be<-betweenness(g) • V(g)[which.max(be)-1]
Community Detection • Densely connected subgraphs • wtc<-walktrap.community(g) • through random walks (short random walks tend to stay in the same community) • memb<-community.to.membership(g, wtc$merges, steps=4)
References • http://igraph.sourceforge.net/igraphbook/index.html • http://igraph.sourceforge.net/doc/html/index.html • http://geza.kzoo.edu/bionet/bioinf.pdf