예제 #1
0
from progress.bar import Bar
import numpy as np

px.print_libraries()
libs = px.list_libraries()
gmt_file = px.load_library(libs[28])

outname = libs[28]
correlationFolder = "correlation_100_folder"
predictionFolder = "prediction_100_folder"
outfolder = "prismxresult_100"

px.predict_gmt("gobp_model_100.pkl",
               gmt_file,
               correlationFolder,
               predictionFolder,
               outfolder,
               outname,
               step_size=1000,
               verbose=True)

geneAUC, setAUC = px.benchmarkGMT(gmt_file,
                                  correlationFolder,
                                  predictionFolder,
                                  outfolder + "/" + outname + ".f",
                                  verbose=True)

fig, ax = plt.subplots(figsize=[4, 16])
violin_parts = ax.violinplot(setAUC.values,
                             range(0, setAUC.shape[1]),
                             points=200,
                             vert=False,
예제 #2
0
                          verbose=True)
    pickle.dump(model, open(lib + "_model_" + str(clusterCount) + ".pkl",
                            'wb'))

outfolder = "prismxresult_" + str(clusterCount)

os.makedirs("test_data", exist_ok=True)
for lib in genesetlibs[0:2]:
    for lib2 in genesetlibs[0:6]:
        outname = lib2
        gmt_file = px.load_library(lib2)
        px.predict_gmt(lib + "_model_" + str(clusterCount) + ".pkl",
                       gmt_file,
                       correlationFolder,
                       predictionFolder,
                       outfolder,
                       outname,
                       step_size=200,
                       intersect=True,
                       verbose=True)
        # benchmark the prediction quality
        geneAUC, setAUC = px.benchmarkGMTfast(gmt_file,
                                              correlationFolder,
                                              predictionFolder,
                                              outfolder + "/" + outname + ".f",
                                              intersect=True,
                                              verbose=True)
        geneAUC = geneAUC.reset_index()
        setAUC = setAUC.reset_index()
        geneAUC.to_feather("test_data/auc_gene_" + lib + "_" + lib2 + ".f")
        setAUC.to_feather("test_data/auc_set_" + lib + "_" + lib2 + ".f")