amazon ec2 cloud and using r in ec2 instance ishwor thapa

38
Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Post on 19-Dec-2015

232 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Amazon EC2 Cloud and Using R in EC2 instanceIshwor Thapa

Page 2: 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.

Page 3: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

EC2Page

Page 4: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Selecting Instance (A)

Page 5: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Selecting Instance (B)

Page 6: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Instance Details

Page 7: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Instance Details

Page 8: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Create KEY PAIR (PASSWORD FILE)

Page 9: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Save the pem file

Page 10: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Security Definitions

Page 11: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Review Page

Page 12: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Launching……

Page 13: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

What to see on EC2 console page

Page 14: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

EC2 console page (right click on instance!!)

Page 15: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

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.

Page 16: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Instance Information from EC2 console

Copy the public DNS value:ec2-50-17-17-23.compute-1.amazonaws.com

Page 17: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Connecting to ec2 instance using ssh (linux/ mac)

• chmod 700 ithapa.pem • ssh -v -i ithapa.pem [email protected]

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!

Page 18: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Connecting to ec2 instance using putty (Windows)

Page 19: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Connecting to ec2 instance using putty (Windows)

Page 20: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Connecting to ec2 instance using putty (Windows)

Page 21: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Connecting to ec2 instance using putty (Windows)

Page 22: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Connecting to ec2 instance using putty (Windows)

Page 23: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Connecting to ec2 instance using putty (Windows)

Page 24: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Connecting to ec2 instance using putty (Windows)

Page 25: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Connecting to ec2 instance using putty (Windows)

Page 26: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

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)

Page 27: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

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

Page 28: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

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

Page 29: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

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

Page 30: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

iGraph Data model

VerticesV(G)

EdgesE(G)

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

Page 31: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Network Structure• Star• Ring• Lattice• Tree

Page 32: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

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)

Page 33: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

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]

Page 34: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

Sample and PPI network• PPI : EBI intact page with mouse search key word.• sample network

Page 35: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

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]

Page 36: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

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]

Page 37: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

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)

Page 38: Amazon EC2 Cloud and Using R in EC2 instance Ishwor Thapa

References• http://igraph.sourceforge.net/igraphbook/index.html• http://igraph.sourceforge.net/doc/html/index.html• http://geza.kzoo.edu/bionet/bioinf.pdf