Skip to content

Instantly share code, notes, and snippets.

View fomightez's full-sized avatar

Wayne's Bioinformatics Code Portal fomightez

View GitHub Profile
@fomightez
fomightez / compositioncalc1.py
Last active December 20, 2015 05:09
compositioncalc1.py from Practical Computing for Biologists by Steven H. D. Haddock and Casey W. Dunn. Posted as a Gist by Wayne Decatur (fomightez) with full credit and reference to the original authors and specifying where they freely share the code online. You can see a static IPython Notebook version at http://nbviewer.ipython.org/6077226
# code by Steven H. D. Haddock and Casey W. Dunn as described in:
# Practical Computing for Biologists
# Steven H. D. Haddock and Casey W. Dunn
# Published in 2011 by Sinauer Associates.
# ISBN 978-0-87893-391-4
# http://www.sinauer.com/practical-computing-for-biologists.html
# see practicalcomputing.org
#
#scripts freely available by the original authors at practicalcomputing.org
#DIRECT LINK: http://practicalcomputing.org/files/pcfb_examples.zip
@fomightez
fomightez / compositioncalc1.ipynb
Last active December 20, 2015 05:19
compositioncalc1.py from Practical Computing for Biologists by Steven H. D. Haddock and Casey W. Dunn AS A STATIC IPYTHON Notebook. Posted as a Gist by Wayne Decatur (fomightez) with full credit and reference to the original authors and note where the freely share the code online. You can see an interactive IPython gist of this at https://www.py…
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fomightez
fomightez / compositioncalc2.py
Last active December 20, 2015 07:59
compositioncalc2.py from Practical Computing for Biologists by Steven H. D. Haddock and Casey W. Dunn. Posted as a Gist by Wayne Decatur (fomightez) with full credit and reference to the original authors and specifying where they freely share the code online. You can see a static IPython Notebook version at http://nbviewer.ipython.org/6102154
# code by Steven H. D. Haddock and Casey W. Dunn as described in:
# Practical Computing for Biologists
# Steven H. D. Haddock and Casey W. Dunn
# Published in 2011 by Sinauer Associates.
# ISBN 978-0-87893-391-4
# http://www.sinauer.com/practical-computing-for-biologists.html
# see practicalcomputing.org
#
#scripts freely available by the original authors at practicalcomputing.org
#DIRECT LINK: http://practicalcomputing.org/files/pcfb_examples.zip
@fomightez
fomightez / compositioncalc2.ipynb
Last active December 20, 2015 08:39
compositioncalc2.py from Practical Computing for Biologists by Steven H. D. Haddock and Casey W. Dunn AS A STATIC IPYTHON Notebook. Posted as a Gist by Wayne Decatur (fomightez) with full credit and reference to the original authors and note where the freely share the code online. You can see an interactive IPython gist of this at https://www.py…
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fomightez
fomightez / realtime_vpython_matplotlib_combo.py
Last active November 4, 2016 13:44
code to paste into a cell of a notebook from VPython Binder to demonstrate realtime integration of matplotlib with VPython
%matplotlib notebook
# use `%matplotlib notebook` if you are using current JupyterLab
from vpython import *
import matplotlib.pyplot as plt
plt.style.use('ggplot')
# based on "AtomicSolid" by Bruce Sherwood
# adapted to include realtime matplotlib by Wayne Decatur
@fomightez
fomightez / How-to for Launching VPython Binder.md
Last active March 26, 2017 18:15
How-to for Launching VPython Binder
  • Go to VPython.org in your browser. The landing page will look like below.

zvpythonDOTorg.png

  • Click on Binder package link on that page. That link is near the very bottom of the part of the page that is showing above; it is just below Demo Programs.

  • A notebook will then launch. (Sometimes first times they hang, just hit reload in your browser.)
    After it loads fully it will look like below with a URL different from what you see but similar.
    zexample_VPython_launch.png

@fomightez
fomightez / Launch VPython Binder with Seaborn Support.md
Last active July 6, 2017 03:29
Launch VPython Binder with Seaborn Support
  • Go to my fork of the VPython Binder repository in your browser.

  • Click on the Binder on the bottom of that page.

  • That will take you to a new page and trigger deploying version of the jupyter notebook environment from the correct repository. You shouldn't need to do anything as this takes place; you can watch the progress bar roughly in the middle of the screen, just below the Launch button. It may take about a minute. After it boots up, it should bring you to the dashboard that will look like below

zexample_dashboard.png

@evanmiltenburg
evanmiltenburg / legend_circles.py
Created February 13, 2018 15:02
Circles in legend
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.lines import Line2D
my_palette = sns.color_palette("cubehelix", 3)
sns.set_palette(my_palette)
def legend_circles(labels, palette, loc=1, markersize=10, marker='o', padding=0):
"Make a legend where the color is indicated by a circle."
@astrojuanlu
astrojuanlu / Visualizing the SpaceX Tesla Roadster trip to Mars.ipynb
Created February 18, 2018 11:11
Visualizing the SpaceX Tesla Roadster trip to Mars
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@parente
parente / README.md
Last active August 23, 2018 13:16
Jupyter Tidbit: %run your ipynb file

Summary

The %run magic provided by IPython not only supports the execution of regular Python scripts, it also runs Jupyter Notebook files (.ipynb).

Example

Binder

The run_demo.ipynb notebook below uses %run to execute all of the cells in reusable_stuff.ipynb. Once it does, both globals defined in reusable_stuff are available in run_demo for use.