Esempio n. 1
0
                        "<a href=\"https://www.ncbi.nlm.nih.gov/pubmed/" + lid
                        + "\">" + lid + "</a>"
                        if not lid.startswith('PMC') else
                        "<a href=\"https://www.ncbi.nlm.nih.gov/pmc/articles/"
                        + lid + "\">" + lid + "</a>")),
                'MIRECORD':
                ", ".join(
                    makeLinks(
                        mirecordEvs, lambda lid:
                        "<a href=\"https://www.ncbi.nlm.nih.gov/pubmed/" + lid
                        + "\">" + lid + "</a>")),
                'MIRTARBASE':
                ", ".join(mirtarbaseEvs),
                'MIRWALK':
                ", ".join(mirwalkEvs)
            }

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

    print("Total Additional miRNAs", totalAdditional)

    missingDF.export(
        "/mnt/c/ownCloud/data/miRExplore/overview_no_mirwalk_sase.xlsx",
        ExportTYPE.XLSX)
    linkedDF.export(
        "/mnt/c/ownCloud/data/miRExplore/overview_no_mirwalk_sase.html",
        ExportTYPE.HTML)

    #CytoscapeGrapher.showGraph(graph, location=dirTemp, name='chemokines', title='Chemokines', nodeLabel=lambda x: x, edgeLabel=lambda x: '')
Esempio n. 2
0
                '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)
Esempio n. 3
0
            if args.fpkm:

                #print(curGeneID, geneLength)

                fpkmValue = row[sample] / (sample2total[sample] *
                                           geneLength) * pow(10, 9)
                rowDict[sample + ".FPKM"] = fpkmValue

            if args.tpm:

                tpmValue = row[sample] / (geneLength *
                                          sample2ratio[sample]) * pow(10, 6)
                rowDict[sample + ".TPM"] = tpmValue

        allRowUpdates.append(rowDict)

    allCols = set()
    for x in allRowUpdates:
        for y in x:
            if not y in featureCountsColumns:
                allCols.add(y)

    outdf.addColumns(featureCountsColumns)
    outdf.addColumns(sorted(allCols), default=0, ignoreDuplicates=True)
    outdf.updateRowIndexed("Geneid",
                           allRowUpdates,
                           ignoreMissingCols=True,
                           addIfNotFound=True)

    outdf.export(args.output.name, exType=ExportTYPE.TSV)
Esempio n. 4
0
                data[x] = row[x]

        for x in df1Col2New:
            data[df1Col2New[x]] = row[x]

        id2dataDf[data["id"]] = data

    for row in indf2:
        data = id2dataDf.get(row["id"], {})

        for x in df12CommonCols:
            data[x] = row[x]

        for x in df2UniqueCols + df2SampleCols:
            if args.prefix_counts:
                data[args.prefix2 + "_" + x] = row[x]
            else:
                data[x] = row[x]

        for x in df2Col2New:
            data[df2Col2New[x]] = row[x]

    allRowUpdates = [id2dataDf[x] for x in sorted([y for y in id2dataDf])]

    outdf.updateRowIndexed("id",
                           allRowUpdates,
                           ignoreMissingCols=True,
                           addIfNotFound=True)

    outdf.export(args.output.name, ExportTYPE.TSV)
Esempio n. 5
0
    dataDict = {
        'SET':
        'NTinflamm',
        '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 ntd
    }

    res.addRow(DataRow.fromDict(dataDict))

    print(x, pmidt[x])

res.export("/home/mjoppich/win/Desktop/soehnlein_overview.html",
           ExportTYPE.HTML)

with open('/home/mjoppich/win/Desktop/soehnlein.svg', 'w') as f:
    f.write(
        render_four_set_venn(allelems['NEUTROPHIL'],
                             allelems['TISSUES'],
                             allelems['DOID'],
                             allelems['INFLAMM'],
                             titles={
                                 'A': 'NEUTROPHIL',
                                 'B': 'TISSUES',
                                 'C': 'Infection',
                                 'D': 'Inflammation'
                             }))
                ", ".join(
                    makeLinks(
                        sorted([
                            x[1] for x in findEdgeInfo(x, interact, ['PUBMED'])
                        ]), lambda lid:
                        "<a href=\"https://www.ncbi.nlm.nih.gov/pubmed/" + lid
                        + "\">" + lid + "</a>")),
                'MIRTARBASE':
                ", ".join(
                    makeLinks(
                        sorted([
                            x[1]
                            for x in findEdgeInfo(x, interact, ['MIRTARBASE'])
                        ]), lambda lid:
                        "<a href=\"http://mirtarbase.mbc.nctu.edu.tw/php/search.php?opt=search_box&kw="
                        + x + "&sort=id\">" + lid + "</a>"))
            }

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

    print("Total Missing miRNAs", totalMissing)
    print("Total Additional miRNAs", totalAdditional)

    missingDF.export("/mnt/c/ownCloud/data/miRExplore/overview_weber.xlsx",
                     ExportTYPE.XLSX)
    linkedDF.export("/mnt/c/ownCloud/data/miRExplore/overview_weber.html",
                    ExportTYPE.HTML)

    #CytoscapeGrapher.showGraph(graph, location=dirTemp, name='chemokines', title='Chemokines', nodeLabel=lambda x: x, edgeLabel=lambda x: '')
Esempio n. 7
0
                print(
                    "Gene:", gene, "Status: ", ", ".join([
                        ": ".join([x, str(typeByGene[gene][x])])
                        for x in typeByGene[gene]
                    ]), "Missing miRNAs: " +
                    ",".join(elemsByGene[gene]['missing']))

            print()
            print()
            print()
            print()

        networkGraphs[network] = networkGraph

        htmlDF.export(
            "/mnt/d/yanc_network/" + network.replace(" ", "_") + ".html",
            ExportTYPE.HTML)
        htmlDF.export(
            "/mnt/d/yanc_network/" + network.replace(" ", "_") + ".tsv",
            ExportTYPE.TSV)

    figidx = 0
    for stages in makeStory:

        mergedGraph = networkGraphs[stages[0]]

        for i in range(1, len(stages)):
            mergedGraph = nx.compose(mergedGraph, networkGraphs[stages[i]])

        hasLargeStage = any(['large' in stage for stage in stages])
Esempio n. 8
0

    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()

    plotKeys = []
    plotValues = []
    for (cell, count) in cellCounter.most_common(20):
Esempio n. 9
0
        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:
            val = org in homDB.get_homology_cluster(homID)