Sandbox

From "A B C"
Revision as of 05:24, 12 September 2022 by Boris (talk | contribs) (→‎Please edit below)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Welcome to the Course Wiki Sandbox! This page is for editing experiments. Feel free to try your skills at formatting here. To edit, click the edit tab at the top of the page, make your changes in the dialog box, and click the Save page button when you are finished. Content added here will not stay permanently. Please note that you have to be registered and logged in for changes. If you would like to try a Wiki Sandbox but don't want to register, you can use the Wikimedia Sandbox.

For information on how to edit pages see the Editing help page.

 

Please edit below

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


 

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


 


CreativeCommonsBy.png This copyrighted material is licensed under a Creative Commons Attribution 4.0 International License. Follow the link to learn more.


GeSHI

a <- 5 # just a simple test
a
[1] 5
b <- "test"
c <- rnorm(1, 100)
plot(b, d, xlim=c(1,100)) # margins?
for (1:100) do { this }

Expand

The Road Not Taken    Robert Frost

Two roads diverged in a yellow wood,
And sorry I could not travel both
And be one traveler, long I stood
And looked down one as far as I could
To where it bent in the undergrowth;
 
Then took the other, as just as fair,
And having perhaps the better claim
Because it was grassy and wanted wear,
Though as for that the passing there
Had worn them really about the same,
 
And both that morning equally lay
In leaves no step had trodden black.
Oh, I marked the first for another day!
Yet knowing how way leads on to way
I doubted if I should ever come back.
 
I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I,
I took the one less traveled by,
And that has made all the difference.

Perl code solution    Click for the code
a <- 5 # just a simple test
a
[1] 5
b <- "test"
c <- rnorm(1, 100)
plot(b, d, xlim=c(1,100)) # margins?
for (1:100) do { this }