TABLE OF CONTENTS:
If you have python 3 you will have pip by default. If like me you installed python2 and then installed python 3 you will need to call pip by "pip3" instead of just "pip".
If that does not work for some reason, reinstall python3 by using brew command line method? that is what I did and it worked that way.upgrade pip
pip install --upgrade pip
update pip tools
pip install -U setuptools
Checking what packages you have:
pip list
pip3 list
a list of packages you have installed for python should appear as well as their version
For details see:
https://github.com/ucsd-ccbb/NetColoc
installing basic packages:
packages 'ddot' and 'mygenes' are not required for this example notebook
New project training with Brin
More Warning/errors
when installed statsmodels , seaborn has trouble being imported
pip install Cython --install-option="--no-cython-compile"
statsmodels version needs to be 0.9.0 for this to work. statsmodels version0.11 will cause error in loading seaborn
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-55-36b96096ade4> in <module>()
1 # how many genes are in the network?
----> 2 len(np.intersect1d(heat.DEG_list,heat.DG_universe.nodes()))
AttributeError: 'NoneType' object has no attribute 'nodes'
AttributeError: 'NoneType' object has no attribute 'nodes'
Solution: this error might be happening because you did not specify the right kind of notation for your gene_type in Heat
In my particulare case error was resolved by going to heat = Heat2.Heat(gene_type = symbol, species = human) and change symbol to entrez.
Incase post is deleted instructions were as follows:
The idea here is to install multiple ipython kernels. Here are instructions for anaconda. If you are not using anaconda, I recently added instructions using pure virtualenvs.
Since version 4.1.0, anaconda includes a special package nb_conda_kernels that detects conda environments with notebook kernels and automatically registers them. This makes using a new python version as easy as creating new conda environments:
conda create -n py27 python=2.7 ipykernel
conda create -n py36 python=3.6 ipykernel
After a restart of jupyter notebook, the new kernels are available over the graphical interface. Please note that new packages have to be explicitly installed into the new environments. The Managing environments section in conda's docs provides further information.
Users who do not want to use nb_conda_kernels or still use older versions of anaconda can use the following steps to manually register ipython kernels.
configure the python2.7 environment:
conda create -n py27 python=2.7
conda activate py27
conda install notebook ipykernel
ipython kernel install --user
configure the python3.6 environment:
conda create -n py36 python=3.6
conda activate py36
conda install notebook ipykernel
ipython kernel install --user
After that you should be able to choose between python2
and python3 when creating a new notebook in the interface.
Additionally you can pass the --name and --display-name options to ipython kernel install if you want to change the names of your kernels. See ipython kernel install --help for more informations.
To save the file in jupyter-notebook, there are several ways. By default, if you press save it will save it as the Notebook (.ipynb) file you have opened. However that are some pros and cons to condsider I will list out some options and pro and cons below:
Pro: Simple for reproducing, can directly edit once opened up in jupyter-notbook
Con: Can be somewhat inconvenient because it can't be viewed directly unless someone opens it up using jupyter-notebook.
By default, if you press save it will save it as the Notebook (.ipynb) file you have opened. If you wish to save an additional copy of your current notebook you can also do so with several options.
Option1(it will open immediately):
In jupyternotebook go to File > Make a copy
This will create an exact copy of your notebook in the same directory using the same kernel (it will open immediately)
Option2(It will not open immediately):
In jupyternotebook go to File > Download as > Notebook(.ipynb)
This will download a copy of your notebook in your default download location. (It will not open immediately)
You need to open this with a new kernel
Pro: html is great for attaching in emails. The person who receives it will be able to open it as a kind of webpage and see all the code and images.
Con: can't edit directly, but you can copy and paste the text pretty easily if you'd like.
Go to File > Download as > HTML (.html)
Pro: Good for printing and viewing on phones/mobile device
Con: can't edit directly, but you can copy and paste the text pretty easily if you'd like.
The download option "PDF vis LaTex (.pdf) in jupyter notebook sometimes fail me (I'm not sure why but I sometimes get the error: "500: Internal Server Error" when I try to use that option.
So instead, I will save as pdf via my browser. Depending on the browser you use instructions may vary, but the concept should be similar. I am using Firefox.
IMPORTANT NOTE WHEN SAVING PDF using browser: Make sure you enter into "Print Preview" mode before saving as pdf. If you try to save the page without entering "Print Preview" it will still produce a pdf file, but codes at the end of the code black will be cut off! (code cut off is very bad! It will be like owning a nice book with the last couple of pages ripped out! You'll be so sad, your team will be sad when they want to reproduce it some day). See details below on how to enter print preview mode and prevent everyone from being sad:
Step 1: Within jupyter notebook go to File > Print Preview
Setp2: A new tab that looks one continuous page will open. Now pretend like you want to print a normal document. On mac press "command + P" or go to File > Print...
Step 3: A page for printing will pop up, for destination instead of picking a printer select "Save to PDF" and press "Save". The file will now be saved in your default download location.