Skip to content

Instantly share code, notes, and snippets.

View Swarchal's full-sized avatar

Scott Warchal Swarchal

View GitHub Profile
@Swarchal
Swarchal / readmap.ipynb
Created September 25, 2018 09:58
Adding data from a plate-map matrix
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Swarchal
Swarchal / multi_z_factor.py
Created August 23, 2018 18:05
Multivariate Z-prime/factor (Kummel et al, 2010) in python
import numpy as np
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
def z_factor(p, n):
numerator = 3 * (np.std(p) + np.std(n))
denominator = np.abs(np.mean(p) - np.mean(n))
return 1 - (numerator / denominator)
def multivariate_z_factor(data, labels):
@Swarchal
Swarchal / bashpy.sh
Created June 30, 2018 07:03
writing python within a shell script
#!/bin/bash
MY_ARG="world"
python /dev/stdin "$MY_ARG" << EOF
import sys
print(f"Hello {sys.argv[1]}")
EOF
codon_table = {
'AUA':'I', 'AUC':'I', 'AUU':'I', 'AUG':'M',
'ACA':'U', 'ACC':'U', 'ACG':'U', 'ACU':'U',
'AAC':'N', 'AAU':'N', 'AAA':'K', 'AAG':'K',
'AGC':'S', 'AGU':'S', 'AGA':'R', 'AGG':'R',
'CUA':'L', 'CUC':'L', 'CUG':'L', 'CUU':'L',
'CCA':'P', 'CCC':'P', 'CCG':'P', 'CCU':'P',
'CAC':'H', 'CAU':'H', 'CAA':'Q', 'CAG':'Q',
'CGA':'R', 'CGC':'R', 'CGG':'R', 'CGU':'R',
'GUA':'V', 'GUC':'V', 'GUG':'V', 'GUU':'V',
@Swarchal
Swarchal / install_cellprofiler.sh
Last active April 3, 2018 14:04
install cellprofiler into a conda env on eddie
#!/bin/bash
# script to install cellprofiler into a conda environment
# named 'cellprofiler'
#
# to activate this environment you will need to load anaconda/4.3.1
# then run
#>>> source activate cellprofiler
# load anaconda
#!/usr/bin/env python3
import train_funcs
cell_lines = [
"MDA-157",
"MDA-231",
"MCF7",
"KPL4",
"T47D",
@Swarchal
Swarchal / titanic_R.ipynb
Created September 1, 2017 12:56
kaggle titanic R
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Swarchal
Swarchal / titanic(2).ipynb
Created August 25, 2017 11:53
kaggle titanic
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Swarchal
Swarchal / ipython_test.py
Created August 4, 2017 12:19
test if running within ipython
def run_from_ipython():
try:
__IPYTHON__
return True
except NameError:
return False
#!/usr/bin/env python3
"""
project euler # 17
If the numbers 1 to 5 are written out in words: one, two, three, four, five,
then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in
words, how many letters would be used?