Test
Jump to navigation
Jump to search
Sample Journal
<my activity>
- Objective
- text ...
Time estimated: XXX h; taken XXX h;
Date started: 2020-MM-DD; completed: 2020-MM-DD
Progress
- Activity 1
- Notes ...
- Activity 2
- Notes ...
Conclusion and outlook
Describe ...
(Example Journal Entry) Explore Cytoscape
- Objective
- Write R code to generate a random network. Explore it with Cytoscape.
Time estimated: 2 h; taken 4 h;
Date started: 2017-09-16; completed: 2017-09-18
Progress
- R code for a random network.
- Cytoscape can read networks in SIF format. Wrote the following code to generate N random nodes with random interactions and write them to file.
My R code below ...
N <- 15 # number of nodes nMin <- 1 # minimum number of edges nMax <- 5 # maximum number of edges OUT <- "myRandomSIF.txt"
# Create N random strings from three uppercase characters # First make more than we need, because some might not be unique ... nodes <- character(2*N)
set.seed(161803) for (i in 1:(2*N)) { nodes[i] <- paste0(sample(LETTERS, 1), sample(LETTERS, 1), sample(LETTERS, 1)) } set.seed(NULL)
nodes <- unique(nodes) # throw away duplicates ... nodes <- nodes[1:N] # ... and keep only N
# Create SIF output mySIF <- character()
set.seed(112358) for (myA in nodes) { # for each node for (i in 1:sample(nMin:nMax, 1)) { # for a random number of interactors ... myB <- sample(nodes, 1) # ... randomly choose interactor ... # ... create record and apend to mySIF mySIF <- c(mySIF, sprintf("%s\tpp\t%s", myA, myB)) # myA, "pp", myB # separated by tabs } } set.seed(NULL)
# write mySIF to file writeLines(mySIF, OUT)
- Install Cytoscape
- Straightforward installation of Cytoscape 3.5.1 from http://www.cytoscape.org
- Visualize and explore options
- Worked through an introductory tutorial from http://opentutorials.cgl.ucsf.edu/index.php/Tutorial:Introduction_to_Cytoscape_3.1-part2 Noteworthy: nodes can be coloured by attribute values.
- Loaded my own SIF file with the File → Import → Network → File option. Explored various layout options and visualization styles. Manually added nodes and edges with the options one gets when ctrl-clicking on the canvas.
Conclusion and outlook
- Creating layouts, applying styles, adding nodes and edges with Cytoscape seems straightforward and creates evocative images.
- Analyzing and interpreting the network needs more thought. Need to explore ideas and tools for network analysis next - e.g. clustering tools, enrichment tools, motif discovery ...
- Next: write some code to create attribute values for nodes, import the values, and have Cytoscape style the nodes accordingly.
Notes and References
This copyrighted material is licensed under a Creative Commons Attribution 4.0 International License. Follow the link to learn more.