Ejemplo n.º 1
0
    featureFile = args[1]

    iplMatrix = None
    global verbose, globalList, globalPathway
    for o, a in opts:
        if o == "-q":
            verbose = False
        elif o == "-i":
            iplMatrix = a

    ## build sourceList
    typeFile = "/".join(re.split("/", sifFile)[:-2] + ["TYPE.NA"])
    sourceList = re.split("/", sifFile)[-2] + ".list_t"

    h = mData.rList(featureFile)
    (n, i) = mPathway.rSIF(sifFile, typef=typeFile)
    (gn, gi) = mPathway.rPathway(globalPathway)
    p = mPathway.Pathway(n, i)
    s = mPathway.sortConnected(p)
    f = open(sourceList, "w")
    c = 1
    for i in s:
        u = list(set(i) & set(h))
        if len(u) >= 5:
            f.write("component_%s\t%s\n" % (c, "\t".join(u)))
            c += 1
            break
    f.write("component_all\t%s\n" % ("\t".join(list(set(n.keys()) & set(h)))))
    f.write("all\t%s\n" % ("\t".join(list(set(gn.keys()) & set(h)))))
    f.close()
Ejemplo n.º 2
0
    featureFile = args[1]

    iplMatrix = None
    global verbose, globalList, globalPathway
    for o, a in opts:
        if o == "-q":
            verbose = False
        elif o == "-i":
            iplMatrix = a

    ## build sourceList
    typeFile = "/".join(re.split("/", sifFile)[:-2] + ["TYPE.NA"])
    sourceList = re.split("/", sifFile)[-2] + ".list_t"

    h = mData.rList(featureFile)
    (n, i) = mPathway.rSIF(sifFile, typef=typeFile)
    (gn, gi) = mPathway.rPathway(globalPathway)
    p = mPathway.Pathway(n, i)
    s = mPathway.sortConnected(p)
    f = open(sourceList, "w")
    c = 1
    for i in s:
        u = list(set(i) & set(h))
        if len(u) >= 5:
            f.write("component_%s\t%s\n" % (c, "\t".join(u)))
            c += 1
            break
    f.write("component_all\t%s\n" % ("\t".join(list(set(n.keys()) & set(h)))))
    f.write("all\t%s\n" % ("\t".join(list(set(gn.keys()) & set(h)))))
    f.close()
Ejemplo n.º 3
0
    assert os.path.exists("TYPE.NA")
    assert os.path.exists("%s_SCORE.NA" % (feature))
    assert os.path.exists("%s" % (feature))
    if feature.startswith("disc-plot"):
        mutTable = True
        mutGene = re.sub("disc-plot", "", feature)
    if os.path.exists("%s/img" % (feature)):
        customImage = True

    ## identify nets with feature
    sifFile = None
    for i in os.listdir("%s" % (feature+"/")):
        if i.endswith(netExtension):
            sifFile = feature+"/"+i
            break
    (allNodes, allInteractions) = mPathway.rSIF(sifFile)
    idMap = dict()
    nodeMap = dict()
    for i, node in enumerate(allNodes.keys()):
        idMap[node] = i+1
        nodeMap[i+1] = node
    labelMap = mData.r2Col("LABEL.NA", delim = " = ", header = True)
    typeMap = mData.r2Col("TYPE.NA", delim = " = ", header = True)
    scoreMap = mData.r2Col("%s_SCORE.NA" % (feature), delim = " = ", header = True)
    nodes = nodeMap.keys()
    nodes.sort()
    
    ## create graphml structure
    graphmlContent = """<graphml>\\
                    <key id="name" for="node" attr.name="name" attr.type="string"/>\\
                    <key id="label" for="node" attr.name="label" attr.type="string"/>\\
Ejemplo n.º 4
0
    assert os.path.exists("TYPE.NA")
    assert os.path.exists("%s_SCORE.NA" % (feature))
    assert os.path.exists("%s" % (feature))
    if feature.startswith("disc-plot"):
        mutTable = True
        mutGene = re.sub("disc-plot", "", feature)
    if os.path.exists("%s/img" % (feature)):
        customImage = True

    ## identify nets with feature
    sifFile = None
    for i in os.listdir("%s" % (feature + "/")):
        if i.endswith(netExtension):
            sifFile = feature + "/" + i
            break
    (allNodes, allInteractions) = mPathway.rSIF(sifFile)
    idMap = dict()
    nodeMap = dict()
    for i, node in enumerate(allNodes.keys()):
        idMap[node] = i + 1
        nodeMap[i + 1] = node
    labelMap = mData.r2Col("LABEL.NA", delim=" = ", header=True)
    typeMap = mData.r2Col("TYPE.NA", delim=" = ", header=True)
    scoreMap = mData.r2Col("%s_SCORE.NA" % (feature), delim=" = ", header=True)
    nodes = nodeMap.keys()
    nodes.sort()

    ## create graphml structure
    graphmlContent = """<graphml>\\
                    <key id="name" for="node" attr.name="name" attr.type="string"/>\\
                    <key id="label" for="node" attr.name="label" attr.type="string"/>\\