print('Hello IPython World!') 

!pip list

result1 = 1+1
result2 = 2*3

result2
result1

print('2nd = ' + str(result2))
print('1st = ' + str(result1))

print('2nd = ' + str(result2))
print('1st = ' + str(result1))

"""
Explanation: VIZBI Tutorial Session
Part 2: Cytoscape, IPython, Docker, and reproducible network data visualization workflows
Tuesday, 3/24/2015
Lesson 0: Introduction to IPython Notebook
by Keiichiro Ono


IPython Notebook is a simple tool to run your code in human-frienfly documents (Notebooks), and you can boost your productivity by learning some basic commands.
Keyboard Shortcuts
There are many keyboard shortcuts, but for now, you just need to learn the following:

Shift-Enter - Run cell
Ctrl-Enter - Run cell in-place

Alt-Enter - Run cell, insert below


Esc and Enter - Command mode and edit mode


Basic Commands in Command Mode

x - cut cell
v - paste cell below
SHIFT + v - paste cell above
dd - dlete cell

Complete list of shortcuts is available under Help menu:

OK, let's start!
End of explanation
"""


!ls -alh

!ifconfig

"""
Explanation: Run System Command
You can run system commands by adding ! at the beggining.
Remember: you are running this notebook in Linux container.  You cannot use Windows/Mac commands even if you are using those machines!
End of explanation
"""


# Import NetworkX library, which is already installed in your Docker container
import networkx as nx

# Create a ranom graph with 100 nodes using Barabashi-Albert Model ()
ba=nx.barabasi_albert_graph(100,5)

# Check the performance of a NetworkX function (calculate betweenness centrality) by running 10 times
%timeit -n 10 nx.betweenness_centrality(ba)

%%timeit -n 10

# Or, check performance of the entire cell
ws = nx.watts_strogatz_graph(100,3,0.1)
btw = nx.betweenness_centrality(ws)

"""
Explanation: Magic!
In IPython Notebook, there is a nice feature called magic.  Magic is a group of commands to execute some usuful functions just like system commands.
Two types of Magic

Line magics: Prepended by one % character, only to the end of the current line.
Cell magics: Start with  %% and applied to the entire cell

Here is the list of handy magics:
Simple performance test with %timeit
End of explanation
"""


%%writefile data/small_network.sif
node1 is_a node2
node2 child_of node3
node3 child_of node1

!cat data/small_network.sif

"""
Explanation: Create file manually with %%writefile
End of explanation
"""


%%bash
export FOO='Env var 1'
echo $FOO

%%javascript
var foo = function(a) {
    return a+1;
};

console.log(foo(2));

"""
Explanation: Execute under other interpreters
End of explanation
"""


