Ejemplo n.º 1
0
    def dfSummary(cls, thisObservation, mc=10):

        df = DataFrame()

        madeObs = cls.summarizeKmers(thisObservation, mc)

        for idx, obs in enumerate(madeObs):

            if idx == 0:  # header
                cols = [x for x in obs]

                df.addColumns(cols)

            dfrow = DataRow.fromDict(obs)

            df.addRow(dfrow)

        return df
Ejemplo n.º 2
0
                "+" +
                mirna.getStringFromParts([miRNAPART.MATURE, miRNAPART.ID]) +
                "\">Search PUBMED</a>"
                "</br><a href=\"" + dianaLink + "\">Search DIANA</a>",
                'PubMed':
                "",
                'MIRECORD':
                '',
                'MIRTARBASE':
                "",
                'MIRWALK':
                ""
            }

            row = DataRow.fromDict(addRow)
            missingDF.addRow(row)
            linkedDF.addRow(row)

    print("Total Missing miRNAs", totalMissing)

    def makeLinks(mylist, lnkFnc):

        return [lnkFnc(x) for x in mylist]

    print("Accepted miRNAs")
    for x in foundAcceptedInteractions:

        geneCap = x.upper()
        geneLow = x.lower()

        if not geneLow[0].isdigit():
Ejemplo n.º 3
0
                'elem_id': setElem,
                'population_size': populationSize,
                'success_population': numSuccInPopulation,
                'sample_size': sampleSize,
                'success_samples': drawnSuccesses,
                'pval': pval,
                'sample_success_fraction': fractionOfHitSamples,
                'genes': ";".join(successIntersection),
                'direction': direction
            }

            setToResult[setElem] = resultObj

        sortedElems = [x for x in setToResult]
        elemPvals = [setToResult[x]["pval"] for x in sortedElems]

        rej, elemAdjPvals, _, _ = multipletests(elemPvals,
                                                alpha=0.05,
                                                method='fdr_bh',
                                                is_sorted=False,
                                                returnsorted=False)

        for eidx, elem in enumerate(sortedElems):
            assert (setToResult[elem]['pval'] == elemPvals[eidx])
            setToResult[elem]['adj_pval'] = elemAdjPvals[eidx]

        for elem in sortedElems:
            dr = DataRow.fromDict(setToResult[elem])
            outdf.addRow(dr)

    outdf.export(args.output.name)
Ejemplo n.º 4
0
pmidt = getPMIDTitles(ntd)
for x in sorted([x for x in pmidt]):

    dataDict = {
        'SET':
        'NTinfect',
        'PMID_ID':
        "<a href='https://www.ncbi.nlm.nih.gov/pubmed/" + str(x) +
        "' target='_blank'>" + str(x) + "</a>",
        'PMID_TITLE':
        pmidt[x],
        'Common':
        x in ntg
    }

    res.addRow(DataRow.fromDict(dataDict))

    print(x, pmidt[x])

print("\n\n\n\n\n")

print(ntg)
print("NTG", len(ntg))
pmidt = getPMIDTitles(ntg)
for x in sorted([x for x in pmidt]):
    dataDict = {
        'SET':
        'NTinflamm',
        'PMID_ID':
        "<a href='https://www.ncbi.nlm.nih.gov/pubmed/" + str(x) +
        "' target='_blank'>" + str(x) + "</a>",
Ejemplo n.º 5
0
                                     ")")

            else:
                for elem in restricts[restrictType]:
                    otherElems.append(elem['name'] + " (" + elem['termid'] +
                                      ")")

        networkDRdict['Cells'] = "\makecell[l]{" + "\\\\".join(
            sorted(cellElems)) + "}"
        networkDRdict['Disease'] = "\makecell[l]{" + "\\\\".join(
            sorted(diseaseElems)) + "}"
        networkDRdict['Other'] = "\makecell[l]{" + "\\\\".join(
            sorted(otherElems)) + "}"

        dr = DataRow.fromDict(networkDRdict)
        restrictDF.addRow(dr)

    print(restrictDF._makeLatex())

    #exit()

    allMissing = {}
    figidx = 0

    mirna2cellOut = open("/mnt/d/yanc_network/important_process.txt", 'w')

    for network in networks:
        figidx += 1

        networkGraph = nx.Graph()
Ejemplo n.º 6
0
                                     ")")

            else:
                for elem in restricts[restrictType]:
                    otherElems.append(elem['name'] + " (" + elem['termid'] +
                                      ")")

        networkDRdict['Cells'] = "\makecell[l]{" + "\\\\".join(
            sorted(cellElems)) + "}"
        networkDRdict['Disease'] = "\makecell[l]{" + "\\\\".join(
            sorted(diseaseElems)) + "}"
        networkDRdict['Other'] = "\makecell[l]{" + "\\\\".join(
            sorted(otherElems)) + "}"

        dr = DataRow.fromDict(networkDRdict)
        restrictDF.addRow(dr)

    print(restrictDF._makeLatex())

    mirna2cellOut = open("/mnt/d/yanc_network/important_networks.txt", 'w')

    def acceptEvidence(ev):

        return True

    figidx = 0

    for network in networks:
        figidx += 1

        networkGraph = nx.Graph()
Ejemplo n.º 7
0
        cells = tuple(sorted(mirna2cells[mirna]))

        cells2mirnas[cells].add(mirna)


    for cells in cells2mirnas:

        ncells = []
        for cell in cells:
            ncells.append( ""+cell+"}" )

        rowdict = {
            'miRNA': "\\makecell[l]{" + "\\\\".join(sorted(cells2mirnas[cells])) + "}",
            'cells': "\\makecell[l]{" + "\\\\".join(cells) + "}"
        }
        cellCommunicatorDF.addRow(DataRow.fromDict(rowdict))


    cellCommunicatorDF.export("/mnt/d/yanc_network/stage_cells_cliques"+stage+".latex", ExportTYPE.LATEX)
    cellCommunicatorDF.export("/mnt/d/yanc_network/stage_cells_cliques"+stage+".tsv", ExportTYPE.TSV)


    CytoscapeGrapher.showGraph(cellgraph, '/mnt/d/yanc_network/', name="stage_cells_" + stage)
    figidx = CytoscapeGrapher.plotNXGraph(cellgraph, stage, ["/mnt/d/yanc_network/stage_cells_" + stage.replace(" ", "_") + ".png", "/mnt/d/yanc_network/stage_cells_" + stage.replace(" ", "_") + ".pdf"], figidx)

    print()
    print()
    print()
    print()
    print()
Ejemplo n.º 8
0
    for org in mc + nmc:

        rowdict = {'sample': org}

        for homid in targetHOMIDS:

            homID = homid
            val = homDB.get_cluster(homID)

            if org in val:
                rowdict[homID] = 1
            else:
                rowdict[homID] = 0

        dfrow = DataRow.fromDict(rowdict)
        df.addRow(dfrow)

    df.export(outFile=None)

    print(allorgs)
    print(len(homClusterIDs))

    if len(homClusterIDs) < 10:
        print(homClusterIDs)

    orgMatrix = {}

    for org in mc + nmc:

        orgRes = []
        for homID in homClusterIDs: