Esempio n. 1
0
def find_interesting_genes(inputs, threshold):

    print "  Restoring pickled data (%d)..." % len(inputs)
    experiment = [ DataSet.restore(input) for input in inputs ]
    uninteresting = lambda feature: abs(feature.normed_ratio) < threshold

    print "  Pruning uninteresting data (%d)..." % len(inputs)
    for timepoint in experiment:
        timepoint.prune(uninteresting)

    print "  Flattening all timepoints (%d)...\n" % len(inputs)
    target, others = experiment[0], experiment[1:]
    target.union(*others)

    return target
Esempio n. 2
0
#!/usr/bin/env python
# vim: tw=0

import sys
from microarray import DataSet

try:
    stress, ours, theirs = sys.argv[1:]
except ValueError:
    print "Usage: display.py <stress> <ours> <theirs>"
    sys.exit()

input = 'pickles/{}/ours={},theirs={}.pkl'.format(stress, ours, theirs)
output = 'output/{}/ours={},theirs={}.txt'.format(stress, ours, theirs)

# Display a number of useful parameters:
#header = '{:<15}{:<15}{:<20}{:<20}{:<20}'.format("Gene_ID", "Gene_Name", "Expression_Level", "Signal_Quality", "Regression")
#template = '{0.id:<15}{0.name:<15}{0.normed_ratio:<20}{0.signal.red.signal_to_noise:<20}{0.regression_quality}'

# Produce only raw output (for use in database queries):
header = ""
template = '{0.name}'

data = DataSet.restore(input)
data.display(template, header, output)

print "Formatting %d genes." % len(data)
Esempio n. 3
0
#!/usr/bin/env python

from __future__ import division

import math
from microarray import DataSet

pickles = ["pickles/A+D.000.pkl", "pickles/A+D.030.pkl", "pickles/A+D.060.pkl", "pickles/A+D.180.pkl"]


def log_ratio(feature):
    return feature.log_ratio


def too_extreme(feature):
    return abs(feature.log_ratio) > 15


header = "{0.path} (R/G = {0.intensity_ratio})"
feature = "{0.id:<15} {0.log_ratio}"

timepoints = [DataSet.restore(path) for path in pickles]

for timepoint in timepoints:
    timepoint.prune(too_extreme)
    timepoint.sort(log_ratio, reverse=True)
    timepoint.truncate(50)

DataSet.tabulate(header, feature, *timepoints)