Difference between revisions of "Sandbox"

From "A B C"
Jump to navigation Jump to search
m
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<div id="BIO>
+
<div id="BIO">
 
{{sandbox}}
 
{{sandbox}}
 
<!-- We politely ask you to leave the lines above unchanged.  As this page is for editing experiments, content is subject to deletion without notice -->
 
<!-- We politely ask you to leave the lines above unchanged.  As this page is for editing experiments, content is subject to deletion without notice -->
Line 5: Line 5:
 
== Please edit below ==
 
== Please edit below ==
  
Text, ''italic'' and '''bold'''.
+
<!-- HTML comments will not be rendered by the wiki. -->
  
:-)
+
<div class="b1">
 +
Sample Journal
 +
</div>
  
 +
{{Vspace}}
  
<math>\sqrt{2}\approx 1.4</math>
+
<!-- A table of contents will replace the __TOC__ "magic text" -->
  
<math>\nearrow \; \searrow \; \swarrow \; \nwarrow</math>
+
__TOC__
 +
 
 +
{{Vspace}}
 +
 
 +
<!-- =================== BEGIN of template for one entry =================== -->
 +
== <my activity> ==
 +
 
 +
;Objective
 +
: text ...
 +
 
 +
<div class="time-estimate">
 +
Time estimated: XXX h; taken XXX h;<br/>
 +
Date started: 2020-MM-DD; completed: 2020-MM-DD
 +
</div>
 +
 
 +
'''Progress'''
 +
----
 +
 
 +
;Activity 1
 +
: Notes ...
 +
 
 +
;Activity 2
 +
: Notes ...
 +
 
 +
'''Conclusion and outlook'''
 +
----
 +
Describe ...
 +
 
 +
{{Vspace}}
 +
 
 +
<!-- ==================== END of template for one entry ==================== -->
 +
 
 +
 
 +
<!-- ========================== BEGIN sample entry ========================= -->
 +
 
 +
== (Example Journal Entry) Explore Cytoscape ==
 +
 
 +
;Objective
 +
: Write R code to generate a random network. Explore it with Cytoscape.
 +
 
 +
<div class="time-estimate">
 +
Time estimated: 2 h; taken 4 h;<br/>
 +
Date started: 2017-09-16; completed: 2017-09-18
 +
</div>
 +
 
 +
'''Progress'''
 +
----
 +
 
 +
;R code for a random network.
 +
: Cytoscape can read networks in [http://wiki.cytoscape.org/Cytoscape_User_Manual/Network_Formats#SIF_format SIF format]. Wrote the following code to generate N random nodes with random interactions and write them to file.
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="width:800px">
 +
My R code below ...
 +
<div class="mw-collapsible-content">
 +
 
 +
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)
 +
 
 +
</div>
 +
</div>
 +
 
 +
;Install Cytoscape
 +
: Straightforward installation of <b>Cytoscape 3.5.1</b> 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.
 +
 
 +
{{Vspace}}
 +
 
 +
'''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.
 +
 
 +
<!-- =========================== END sample entry ========================== -->
 +
 
 +
{{Vspace}}
 +
 
 +
----
 +
 
 +
<!-- Footnotes -->
 +
==Notes and References==
 +
<references />
 +
 
 +
{{Vspace}}
 +
 
 +
<!-- Category and Footer -->
 +
[[Category:BCH441-2021_Journal]]
 +
 
 +
----
 +
 
 +
{{CC-BY}}
 +
 
 +
<!-- END -->
  
 
==GeSHI==
 
==GeSHI==

Latest revision as of 05:24, 12 September 2022

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 }