Esempio n. 1
0
def main(argv):
    d2l = getlims()
    d2t = gettargets()
    excerpt = '/Users/berriz/Work/scratch/excerpt.tsv'
    header, rows = rt.readtable(excerpt, headerrow=0)
    sigclass = co.namedtuple('sigclass', header[1:], rename=True)
    flds = set(si.SignatureData._fields)
    t2s = dict()
    rn.seed(0)
    for row in sorted(rows):
        drug, vv = row[0], row[1:]
        if drug not in d2t:
            continue
        rangetested = d2l[drug]
        signature = tuple(convert_conc_row(vv))
        isclinical = rn.random() < ISCLINICAL_CUTOFF
        isselective = rn.random() < ISSELECTIVE_CUTOFF
        isprimary = rn.random() < ISPRIMARY_CUTOFF

        data = si.SignatureData(**(sd.superdict(locals()).subdict(flds)))
        for t in d2t[drug]:
            t2s.setdefault(t, []).append(data)

    for vv in t2s.values():
        drugs = set(v.drug for v in vv)
        assert len(drugs) == len(vv)

    print '    LATEST =',
    pp.pprint(t2s)
Esempio n. 2
0
def main(argv):
    d2l = getlims()
    d2t = gettargets()
    excerpt = '/Users/berriz/Work/scratch/excerpt.tsv'
    header, rows = rt.readtable(excerpt, headerrow=0)
    sigclass = co.namedtuple('sigclass', header[1:], rename=True)
    flds = set(si.SignatureData._fields)
    t2s = dict()
    rn.seed(0)
    for row in sorted(rows):
        drug, vv = row[0], row[1:]
        if drug not in d2t:
            continue
        rangetested = d2l[drug]
        signature = tuple(convert_conc_row(vv))
        isclinical = rn.random() < ISCLINICAL_CUTOFF
        isselective = rn.random() < ISSELECTIVE_CUTOFF
        isprimary = rn.random() < ISPRIMARY_CUTOFF

        data = si.SignatureData(**(sd.superdict(locals()).subdict(flds)))
        for t in d2t[drug]:
            t2s.setdefault(t, []).append(data)

    for vv in t2s.values():
        drugs = set(v.drug for v in vv)
        assert len(drugs) == len(vv)

    print '    LATEST =',
    pp.pprint(t2s)
Esempio n. 3
0
    def parseEvent(self, isctx=False):
	ev = superdict()
	self.io.reset()

	for line in self.io:
	    if line == '\n': break
	    self.processLine(ev, line)

	if not isctx:
	    rawlength = ev.get('Content_Length')
	    if rawlength: ev.rawresponse = self.io.read(int(rawlength))

	self.io.reset()
	self.io.truncate()
	return ev
Esempio n. 4
0
    def dispatchEvent(self, ctx, event):
	ctx.data = superdict(event.copy())
	reactor.callLater(0, self.eventHandler, superdict(ctx.copy()))
	self.ctx = self.rawlen = None
Esempio n. 5
0
    def readRawResponse(self):
	self.io.reset()
	chunk = self.io.read(int(self.ctx.Content_Length))
	self.io.reset()
	self.io.truncate()
	return superdict(rawresponse=chunk)