Ejemplo n.º 1
0
def parseOnlyEffScores(inFname):
    """ return a dict seq -> scoreType -> score 
    """
    print "reading %s" % inFname

    scores = {}
    #freqs  = {}
    for row in annotateOffs.iterTsvRows(inFname):
        seq = row.seq
        scores[seq] = {}
        dataDict = row._asdict()
        for st in annotateOffs.scoreTypes:
            scores[seq][st] = float(dataDict[st])

        guideSeq = row.seq[:20]
        scores[seq]["finalGc6"] = int(annotateOffs.countFinalGc(guideSeq, 6)>=4)
        scores[seq]["finalGg"] = int(guideSeq[-2:]=="GG")
        scores[seq]["modFreq"] = float(row.modFreq)

        #freq = float(row.modFreq)
        #freqs[seq] = freq
        
    assert(len(scores)!=0)
    return scores
Ejemplo n.º 2
0
#import rpy
#import rpy2.robjects as ro

fnames = ["effData/concordet2.scores.tab", "effData/alenaAll.scores.tab", \
    "effData/teboulVivo_mm9.scores.tab", "effData/schoenig.scores.tab", "effData/eschstruth.scores.tab"]

#corrOverlap = ro.r['cocor.dep.groups.overlap']

ofh = open("out/signFig5.tab", "w")

for fname in fnames:
    x1 = []
    x2 = []
    y = []
    #for scoreType in ["fusi", "crisprScan"]:
    for row in annotateOffs.iterTsvRows(fname):
        x1.append(float(row.fusi))
        x2.append(float(row.crisprScan))
        y.append(float(row.modFreq))

    r1 = stats.pearsonr(x1, y)[0]
    r2 = stats.pearsonr(x2, y)[0]
    r12 = stats.pearsonr(x1, x2)[0]
    #res = corrOverlap(r.jk=r1, r.jh=r2, r.kh=r12, n=len(x1), alternative="less", alpha=0.05, conf.level=0.95, null.value=0)
    if r1 < r2:
        way = "less"
    else:
        way = "more"
    row = [fname, r1, r2, r12, len(x1), way]
    row = [str(x) for x in row]
    ofh.write("\t".join(row) + "\n")
Ejemplo n.º 3
0
#import rpy
#import rpy2.robjects as ro

fnames = ["effData/concordet2.scores.tab", "effData/alenaAll.scores.tab", \
    "effData/teboulVivo_mm9.scores.tab", "effData/schoenig.scores.tab", "effData/eschstruth.scores.tab"]

#corrOverlap = ro.r['cocor.dep.groups.overlap']

ofh = open("out/signFig5.tab", "w")

for fname in fnames:
        x1 = []
        x2 = []
        y = []
        #for scoreType in ["fusi", "crisprScan"]:
        for row in annotateOffs.iterTsvRows(fname):
            x1.append(float(row.fusi))
            x2.append(float(row.crisprScan))
            y.append(float(row.modFreq))

        r1 = stats.pearsonr(x1, y)[0]
        r2 = stats.pearsonr(x2, y)[0]
        r12 = stats.pearsonr(x1, x2)[0]
        #res = corrOverlap(r.jk=r1, r.jh=r2, r.kh=r12, n=len(x1), alternative="less", alpha=0.05, conf.level=0.95, null.value=0)
        if r1 < r2:
            way = "less"
        else:
            way = "more"
        row = [fname, r1, r2, r12, len(x1), way]
        row = [str(x) for x in row]
        ofh.write("\t".join(row)+"\n")