amazon ec2 cloud and using r in ec2 instance ishwor thapa

Post on 19-Dec-2015

232 Views

Category:

Documents

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Amazon EC2 Cloud and Using R in EC2 instanceIshwor 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)

Save the pem file

Security Definitions

Review Page

Launching……

What to see on EC2 console page

EC2 console page (right click on instance!!)

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 -i ithapa.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)

Connecting to ec2 instance using putty (Windows)

Connecting to ec2 instance using putty (Windows)

Connecting to ec2 instance using putty (Windows)

Connecting to ec2 instance using putty (Windows)

Connecting to ec2 instance using putty (Windows)

Connecting to ec2 instance using putty (Windows)

Connecting to ec2 instance using putty (Windows)

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/LinuxUbuntu 10.10Welcome to Ubuntu!

Login Name:ubuntu

Connecting to ec2 instance using putty (Windows)

Installing / Using R

ubuntu@ip-10-117-89-77:~$ RThe program 'R' is currently not installed. You can install it by typing:sudo apt-get install r-base-coreubuntu@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 RR> 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 writableWould 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

VerticesV(G)

EdgesE(G)

Undirected GraphG<-graph(c(0,1, 1,2, 3,4, 5,6), directed=F)

Network Structure• Star• Ring• Lattice• Tree

Network Structures<-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 fileg<-read.graph(“sample.txt”, format=“ncol”)g

Big graphsg<-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 verticesbe<-betweenness(g)V(g)[which.max(be)-1]

Community Detection• Densely connected subgraphswtc<-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

top related