diff --git a/ariaec/__init__.pyc b/ariaec/__init__.pyc index 0a688692da7f9ad1b88e6a73d21eb46c831377cc..42b779115f1d982b021de34a3c088eee58d048d0 100644 Binary files a/ariaec/__init__.pyc and b/ariaec/__init__.pyc differ diff --git a/ariaec/base.pyc b/ariaec/base.pyc index a2225329ee2801ba5b4989df43d92d0b97f98486..365e981ec59a720d21add9b113c4e20cdc1f84c5 100644 Binary files a/ariaec/base.pyc and b/ariaec/base.pyc differ diff --git a/ariaec/commands.py b/ariaec/commands.py index eda008cb93ca4d4c72f8e02e9c1413eb10fb039b..0ba025427effe7dd85401c468bdbb151f357fcff 100644 --- a/ariaec/commands.py +++ b/ariaec/commands.py @@ -177,6 +177,9 @@ class AriaEcCommand: default=None, help="Do not use contact list " "filter and select top n " "contacts") + parser.add_argument("--onlyreport", dest="onlyreport", + action="store_true", + default=False, help="Generate only report file") parser.add_argument("--ssidx", dest="ssidx", action="store_true", default=False, help="Use secondary structure index") diff --git a/ariaec/commands.pyc b/ariaec/commands.pyc index fe3093884131b3a59940f934fcdc43822ecc88e3..a38614cf856c3c4ad6a026166825a4c9e29811d7 100644 Binary files a/ariaec/commands.pyc and b/ariaec/commands.pyc differ diff --git a/ariaec/maplot.py b/ariaec/maplot.py index 18dee19188c7109298ea9b12d713aaea9e1273c5..645711f6bb0e2bb1d61f32aa6085803ba88ea5d6 100644 --- a/ariaec/maplot.py +++ b/ariaec/maplot.py @@ -90,7 +90,8 @@ class AriaEcContactMap(object): outdir = self.settings.outdir prefix = "_".join((self.outprefix, mapt, self.reftype)) - if mapt == self.reftype: + if mapt == self.reftype and not \ + self.settings.contactmap.args.get("onlyreport", False): refmap.write_contacts("_".join((self.outprefix, mapt)), outdir=outdir, scoremap=self.refmap.get("scoremap", @@ -128,26 +129,30 @@ class AriaEcContactMap(object): # TODO: only one function for output files # Write contact list in txt file - cmpmap.write_contacts("_".join((self.outprefix, mapt)), - scoremap=scoremap, - outdir=outdir) - # Write cmp stats - cmpmap.compare_contactmap(refmap, cmplist, prefix, - distmap=self.refmap["distmap"], - human_idx=True, - outdir=outdir) refmap.report(cmpmap, scoremap=scoremap, outprefix=prefix, - outdir=outdir, plotdir=self.settings.infra.get("graphics", outdir)) + outdir=outdir, + plotag=not self.settings.contactmap.args.get( + "onlyreport"), + plotdir=self.settings.infra.get("graphics", outdir)) # Contact map comparison plot # TODO: elementwise error with compare method - refmap.compareplot(cmpmap, outprefix=prefix, - outdir=outdir, - save_fig=self.settings.contactmap.config.get( - "save_fig"), - alpha=self.settings.contactmap.config.get( - "alpha"), - **plotparams) - # Contingency table - # print(cmpmap.to_series()) - # logger.info(pd.crosstab(cmpmap.values, refmap.values, - # rownames=[mapt], colnames=[self.reftype])) + # Write cmp stats + if not self.settings.contactmap.args.get("onlyreport", False): + cmpmap.write_contacts("_".join((self.outprefix, mapt)), + scoremap=scoremap, + outdir=outdir) + cmpmap.compare_contactmap(refmap, cmplist, prefix, + distmap=self.refmap["distmap"], + human_idx=True, + outdir=outdir) + refmap.compareplot(cmpmap, outprefix=prefix, + outdir=outdir, + save_fig=self.settings.contactmap.config.get( + "save_fig"), + alpha=self.settings.contactmap.config.get( + "alpha"), + **plotparams) + # Contingency table + # print(cmpmap.to_series()) + # logger.info(pd.crosstab(cmpmap.values, refmap.values, + # rownames=[mapt], colnames=[self.reftype])) diff --git a/ariaec/maplot.pyc b/ariaec/maplot.pyc index 3474cdebf8089529afd56bbcf930a6ec6981bd15..8e2d7a1dde7431180f65dcb0d0c4c1faed158943 100644 Binary files a/ariaec/maplot.pyc and b/ariaec/maplot.pyc differ diff --git a/ariaec/protein.pyc b/ariaec/protein.pyc index 0fdf07a9316395e7555b137bf7d945d91e2ebe25..284b67088a7c769f0534a12991a39d4cbd2b4cf9 100644 Binary files a/ariaec/protein.pyc and b/ariaec/protein.pyc differ diff --git a/ariaec/protmap.py b/ariaec/protmap.py index ec12220c196627eed3f8f6feda95830f3aa4d37d..21ebafdaba7cde2d7193bb68b69a318c6afbb80b 100644 --- a/ariaec/protmap.py +++ b/ariaec/protmap.py @@ -294,7 +294,7 @@ class ProteinMap(Map): self.saveplot(**kwargs) def report(self, cmpmap, scoremap=None, outprefix="", outdir="", plotdir="", - plot_ext="pdf"): + plot_ext="pdf", plotag=True): reportpath = "%s/%s.report" % (outdir, outprefix) logger.info("Generate report file (%s)" % reportpath) with open(reportpath, 'w') as reportf: @@ -320,36 +320,39 @@ class ProteinMap(Map): allfpr, alltpr, rocthresholds = skm.roc_curve(y_true, y_scores, pos_label=1) roc_auc = skm.roc_auc_score(y_true, y_scores) - plotpath = os.path.join(plotdir, "%s.roc.%s" % (outprefix, - plot_ext)) - plt.figure() - plt.plot(allfpr, alltpr, label='ROC curve (area = %0.2f)' % roc_auc) - plt.plot([0, 1], [0, 1], 'k--') - plt.xlim([0.0, 1.0]) - plt.ylim([0.0, 1.0]) - plt.xlabel('False Positive Rate') - plt.ylabel('True Positive Rate') - plt.title('Receiver operating characteristic %s vs. %s' % ( - map1name, map2name)) - plt.legend(loc="lower right") - plt.savefig(plotpath) allprec, allrec, prthresholds = skm.precision_recall_curve( y_true, y_scores) aver_prec = skm.average_precision_score(y_true, y_scores) - plotpath = os.path.join(plotdir, "%s.precall.%s" % (outprefix, + + if plotag: + plotpath = os.path.join(plotdir, "%s.roc.%s" % (outprefix, plot_ext)) - # Precision recall curve - plt.clf() - plt.plot(allrec, allprec, label='Precision-Recall curve') - plt.xlabel('Recall') - plt.ylabel('Precision') - plt.ylim([0.0, 1.0]) - plt.xlim([0.0, 1.0]) - plt.title('Precision-Recall {1} vs. {2}: AUC={0:0.2f}'.format( - aver_prec, map1name, map2name)) - plt.legend(loc="lower left") - plt.savefig(plotpath) + plt.figure() + plt.plot(allfpr, alltpr, label='ROC curve (area = %0.2f)' % roc_auc) + plt.plot([0, 1], [0, 1], 'k--') + plt.xlim([0.0, 1.0]) + plt.ylim([0.0, 1.0]) + plt.xlabel('False Positive Rate') + plt.ylabel('True Positive Rate') + plt.title('Receiver operating characteristic %s vs. %s' % ( + map1name, map2name)) + plt.legend(loc="lower right") + plt.savefig(plotpath) + + plotpath = os.path.join(plotdir, "%s.precall.%s" % (outprefix, + plot_ext)) + # Precision recall curve + plt.clf() + plt.plot(allrec, allprec, label='Precision-Recall curve') + plt.xlabel('Recall') + plt.ylabel('Precision') + plt.ylim([0.0, 1.0]) + plt.xlim([0.0, 1.0]) + plt.title('Precision-Recall {1} vs. {2}: AUC={0:0.2f}'.format( + aver_prec, map1name, map2name)) + plt.legend(loc="lower left") + plt.savefig(plotpath) msg = """\ ## Report {map1name} vs. {map2name} diff --git a/ariaec/protmap.pyc b/ariaec/protmap.pyc index 6e5726397f52407b3bafcf63675c9133ccb4dd47..82d8147e5f4d45b223f11cd5d4ca80546517ad4d 100644 Binary files a/ariaec/protmap.pyc and b/ariaec/protmap.pyc differ diff --git a/ariaec/setup.pyc b/ariaec/setup.pyc index ddb0fe923f1b90ba63df12363dfd88aff5391197..bd6a1ed465b9192de27b9c0798e347979ff36b34 100644 Binary files a/ariaec/setup.pyc and b/ariaec/setup.pyc differ