This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to use the ModelMultipleChoiceField widget outside the Django admin interface | |
# when processing forms with Crispy-forms | |
## Prerequisites | |
django-crispy-forms installed and included in settings (as per crispy docs) | |
## Edited files: | |
### urls.py (root, not app/urls.py) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy import stats | |
from itertools import combinations | |
from statsmodels.stats.multitest import multipletests | |
from statsmodels.stats.libqsturng import psturng | |
import warnings | |
def kw_dunn(groups, to_compare=None, alpha=0.05, method='bonf'): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import subprocess | |
import numpy as np | |
import pandas as pd | |
from sample_class import Sample | |
from custom_parser import Parser | |
from pipeline_tools import file_checker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The [Cufflinks](http://cole-trapnell-lab.github.io/cufflinks/) Unix package is extremely well regarded for RNA-seq analysis. Yet it is widely acknowledged that installation is difficult, not least by the [Cufflinks authors themselves](http://cole-trapnell-lab.github.io/cufflinks/getting_started/#installing-a-pre-compiled-binary-release)! Whilst the authors provide precompiled binaries to make the installation process easier [the instructions aren't very explicit](http://cole-trapnell-lab.github.io/cufflinks/getting_started/). Having spent a good hour on Google and StackOverflow I've put together an instruction list for the less experienced Unix user like myself. | |
Note this guide is for Unix distributions. | |
1. Download the Cufflinks tar from http://cole-trapnell-lab.github.io/cufflinks/install/ | |
'''shell | |
wget http://cole-trapnell-lab.github.io/cufflinks/install/ | |
''' | |
2. Untar the downloaded file | |
'''shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# argparse section | |
import argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument("-l","--list", help="pass a list", nargs="*") | |
parser.add_argument("-b","--boolean", action="store_true", default=False, help="use this flag to turn on an option") | |
# grab the options here from the command line, console overrides email | |
args = parser.parse_args() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Plots a Pandas dataframe as a heatmap""" | |
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
def heatmap(df, | |
edgecolors='w', | |
cmap=mpl.cm.RdBu, | |
log=False,vmin=0,vmax=500): | |
width = len(df.columns)/4 | |
height = len(df.index)/4 |