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
def bootstrap(invec): | |
idx = npr.randint(0, len(invec), len(invec)) | |
return [invec[i] for i in idx] | |
def estimatePi0(p, numBoot=100, numLambda=100, maxLambda=0.95): | |
p.sort() | |
n=len(p) | |
lambdas=np.linspace(maxLambda/numLambda,maxLambda,numLambda) | |
Wls=np.array([n-np.argmax(p>=l) for l in lambdas]) | |
pi0s=np.array([Wls[i] / (n * (1 - lambdas[i])) for i in range(numLambda)]) |
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
def bootstrap(invec): | |
idx = npr.randint(0, len(invec), len(invec)) | |
return [invec[i] for i in idx] | |
def estimatePi0(p, numBoot=100, numLambda=100, maxLambda=0.95): | |
p.sort() | |
n=len(p) | |
lambdas=np.linspace(maxLambda/numLambda,maxLambda,numLambda) | |
Wls=np.array([n-np.argmax(p>=l) for l in lambdas]) | |
pi0s=np.array([Wls[i] / (n * (1 - lambdas[i])) for i in range(numLambda)]) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
PAM250 = { | |
'A': {'A': 2, 'C': -2, 'D': 0, 'E': 0, 'F': -3, 'G': 1, 'H': -1, 'I': -1, 'K': -1, 'L': -2, 'M': -1, 'N': 0, 'P': 1, 'Q': 0, 'R': -2, 'S': 1, 'T': 1, 'V': 0, 'W': -6, 'Y': -3}, | |
'C': {'A': -2, 'C': 12, 'D': -5, 'E':-5, 'F': -4, 'G': -3, 'H': -3, 'I': -2, 'K': -5, 'L': -6, 'M': -5, 'N': -4, 'P': -3, 'Q': -5, 'R': -4, 'S': 0, 'T': -2, 'V': -2, 'W': -8, 'Y': 0}, | |
'D': {'A': 0, 'C': -5, 'D': 4, 'E': 3, 'F': -6, 'G': 1, 'H': 1, 'I': -2, 'K': 0, 'L': -4, 'M': -3, 'N': 2, 'P': -1, 'Q': 2, 'R': -1, 'S': 0, 'T': 0, 'V': -2, 'W': -7, 'Y': -4}, | |
'E': {'A': 0, 'C': -5, 'D': 3, 'E': 4, 'F': -5, 'G': 0, 'H': 1, 'I': -2, 'K': 0, 'L': -3, 'M': -2, 'N': 1, 'P': -1, 'Q': 2, 'R': -1, 'S': 0, 'T': 0, 'V': -2, 'W': -7, 'Y': -4}, | |
'F': {'A': -3, 'C': -4, 'D': -6, 'E':-5, 'F': 9, 'G': -5, 'H': -2, 'I': 1, 'K': -5, 'L': 2, 'M': 0, 'N': -3, 'P': -5, 'Q': -5, 'R': -4, 'S': -3, 'T': -3, 'V': -1, 'W': 0, 'Y': 7}, | |
'G': {'A': 1, 'C': -3, 'D': 1, 'E': 0, 'F': -5, 'G': 5, 'H': -2, 'I': -3, 'K': - |
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 | |
import numpy.random as npr | |
import pandas as pd | |
def generate_expression_data(n_analytes=100, n_samples=2, n_replicates=3, p_regulated=0.2, mean_offset=3.0, var=0.2, diff_var=2.0): | |
# Here we follow a convension, The first sample is the reference i.e. have all label 1 | |
labels = npr.binomial(1, p_regulated, (n_analytes,n_samples-1)) | |
template = np.hstack((np.zeros((n_analytes,1)),labels)) | |
# We expand the template labels into several replicates |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Bokeh Plot</title> | |
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.css" type="text/css" /> | |
<script type="text/javascript" src="https://cdn.pydata.org/bokeh/release/bokeh-0.12.4.min.js"></script> |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
""" | |
Test of file to see if it confirms to the iPRG2016 study instructios | |
Usage: checkiPRGResultFile.py -i input-file [-f fasta-file] | |
If no fasta file given, iPRG2016.fasta will be used | |
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
"" "A1" "A2" "A3" "B1" "B2" "B3" "C1" "C2" "C3" "D1" "D2" "D3" | |
"HPRR4110123" 0.9499281264973647 1.0 0.9592384671711008 1.0 0.9522402757262433 1.0 1.0 1.0 1.0 0.8138319260152794 0.67724609375 1.0 | |
"HPRR260088" 0.0 1.0 1.0 1.0 1.0 1.0 0.0021141649048625794 1.0 1.0 1.0 1.0 1.0 | |
"HPRR3730024" 0.0 0.0 0.0 0.0 0.0 0.0 0.0021141649048625794 0.0 0.0 1.0 1.0 1.0 | |
"HPRR3730022" 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 0.9590454692034828 1.0 1.0 1.0 | |
"HPRR4160392" 0.9499281264973647 1.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 0.5327816677275621 1.0 0.4713896457765668 | |
"HPRR4290990" 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 | |
"HPRR4290991" 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 | |
"HPRR4290996" 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 | |
"HPRR4290997" 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder