This file contains hidden or 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
{ | |
"metadata": { | |
"name": "pandas" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
This file contains hidden or 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
""" | |
C-alpha test for rare variants. Copied from AssotesteR | |
Only reports the permutation p-value, not the asymptotic | |
This also wraps all of the functions in R's AssotesteR using | |
rpy2. Any function available in AssotesteR, e.g. CALPHA is | |
availailable here has r_calpha(). | |
The args are always | |
casecon: a list of 0's, 1's indicating case/control status |
This file contains hidden or 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
library(survey) | |
args = commandArgs(TRUE) | |
fclin = args[1] | |
fmeth = args[2] | |
clin = read.table(fclin, header=T, sep="\t") | |
clin$Barcode = as.character(clin$Unique.ID) | |
clin$strata = as.factor(clin$strata) |
This file contains hidden or 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
from bein import * | |
from bein.util import * | |
import os | |
M = MiniLIMS("data.db") | |
""" | |
GATK=/home/brentp/src/gatk/GenomeAnalysisTK-2.0-38-g45f7b0d/ |
This file contains hidden or 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
#!/mnt/storage4/bin/python-2.6.6/bin/python | |
from toolshed import nopen | |
import sys | |
fh = nopen("|showq -r") | |
header = fh.next().strip().split() | |
job_name = len(sys.argv) > 1 and sys.argv[1] or None | |
d = {} |
This file contains hidden or 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 itertools | |
from collections import Counter | |
def euler_52(): | |
for i in itertools.count(1): | |
nums = [str(i * j) for j in range(1, 7)] | |
s = frozenset(nums[0]) | |
sall = set() | |
sall.update(*nums) | |
if sall == s: |
This file contains hidden or 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
UPSTREAM=400 | |
INSTREAM=100 | |
ORG=hg18 | |
mysql --user genome --host genome-mysql.cse.ucsc.edu -NAD $ORG -e \ | |
"select chrom, txStart, txEnd, X.geneSymbol, strand from knownGene as K, kgXref as X WHERE txStart != txEnd AND X.kgID = K.name" \ | |
| awk -v ups=$UPSTREAM -v ins=$INSTREAM 'BEGIN{OFS=FS="\t"} | |
$5 == "-" { print $1,$3-ins,$3+ups,$4 } | |
$5 == "+" { print $1,$2-ins,$2+ups,$4 }' \ | |
| sort -k1,1 -k2,2n \ |
This file contains hidden or 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
from docopt import docopt | |
import sys | |
class command(object): | |
registry = {} | |
short_docs = [] | |
def __init__(self, doc = None): | |
self.short_docs.append(doc) | |
def __call__(self, fn): |
This file contains hidden or 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
""" | |
qvality must be on the $PATH. | |
run on a file with pvalues in column 4: | |
$ python qvality.py --column 4 input.bed > output.bed | |
output file will have extra columns for PEP (posterior error prob) | |
and q-value. | |
if input.bed has a header, it is retained. |
This file contains hidden or 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
xs = read.table('mod4.txt', sep="\t", header=T) | |
y = read.table('y4.txt', sep="\t", header=T) | |
colnames(y) = "Survival" | |
df = cbind(y, xs) | |
print(colnames(df)) | |
print(drop1(lm(Survival ~ SexMale + AgeChild + class_crewTRUE, data=df), test="F")) |