Find plotFingerprint output. Both --outQualityMetrics and --outRawCounts
513215
def parse_plotFingerprint(self):
        """"""
        self.deeptools_plotFingerprintOutQualityMetrics = dict()
        for f in self.find_log_files('deeptools/plotFingerprintOutQualityMetrics'):
            parsed_data = self.parsePlotFingerprintOutQualityMetrics(f)
            for k, v in parsed_data.items():
                if k in self.deeptools_plotFingerprintOutQualityMetrics:
                    log.warning("Replacing duplicate sample {}.".format(k))
                # Values are fractions - convert to percentages for consistency with other MultiQC output
                self.deeptools_plotFingerprintOutQualityMetrics[k] = { i:float(j)*100.0 for i,j in v.items() }

            if len(parsed_data) > 0:
                self.add_data_source(f, section='plotFingerprint')

        self.deeptools_plotFingerprintOutRawCounts= dict()
        for f in self.find_log_files('deeptools/plotFingerprintOutRawCounts'):
            parsed_data = self.parsePlotFingerprintOutRawCounts(f)
            for k, v in parsed_data.items():
                if k in self.deeptools_plotFingerprintOutRawCounts:
                    log.warning("Replacing duplicate sample {}.".format(k))
                self.deeptools_plotFingerprintOutRawCounts[k] = v

            if len(parsed_data) > 0:
                self.add_data_source(f, section='plotFingerprint')

        if len(self.deeptools_plotFingerprintOutRawCounts) > 0:
            self.add_section(name="Fingerprint plot",
                             anchor="deeptools_fingerprint",
                             description="Signal fingerprint according to plotFingerprint",
                             plot=linegraph.plot(
                                self.deeptools_plotFingerprintOutRawCounts,
                                {
                                    'id': 'deeptools_fingerprint_plot',
                                    'title': 'deepTools: Fingerprint plot',
                                    'xmin': 0.0,
                                    'xmax': 1.0,
                                    'ymin': 0.0,
                                    'ymax': 1.0,
                                    'xlab': 'rank',
                                    'ylab': 'Fraction w.r.t. bin with highest coverage'
                                }
                             ))

        if len(self.deeptools_plotFingerprintOutQualityMetrics) > 0:
            self.add_section(name="Fingerprint quality metrics",
                             anchor="plotFingerprint",
                             description="Various quality metrics returned by plotFingerprint",
                             plot=linegraph.plot(
                                self.deeptools_plotFingerprintOutQualityMetrics,
                                {
                                    'id': 'plotFingerprint_quality_metrics',
                                    'title': 'deepTools: Fingerprint quality metrics',
                                    'stacking': None,
                                    'ymin': 0,
                                    'ymax': 100,
                                    'yLabelFormat': '{value}%',
                                    'ylab': 'Percentage of fragments',
                                    'categories': True,
                                    'tt_label': '<strong>{point.x}</strong>: {point.y:.2f}%'
                                }
                             ))

        return len(self.deeptools_plotFingerprintOutQualityMetrics), len(self.deeptools_plotFingerprintOutRawCounts)
1063873
def exportNewKey(fingerprint):
    
    log.info("Exporting key: %s" % fingerprint)

    keyfn = os.path.join(gpg.homedir,
                         fingerprint + '-8192-bit-key') + os.path.extsep

    pubkey = gpg.export_keys(fingerprint)
    seckey = gpg.export_keys(fingerprint, secret=True)
    subkey = gpg.export_keys(fingerprint, secret=True, subkeys=True)

    with open(keyfn + 'pub' + os.path.extsep + 'asc', 'w') as fh:
        fh.write(pubkey)
    with open(keyfn + 'sec' + os.path.extsep + 'asc', 'w') as fh:
        fh.write(seckey)
    with open(keyfn + 'sub' + os.path.extsep + 'asc', 'w') as fh:
        fh.write(subkey)
310468
def get_printout(out, opts=None, **kwargs):
    '''
    
    '''
    if opts is None:
        opts = {}

    if 'output' in opts and opts['output'] != 'highstate':
        # new --out option, but don't choke when using --out=highstate at CLI
        # See Issue #29796 for more information.
        out = opts['output']

    # Handle setting the output when --static is passed.
    if not out and opts.get('static'):
        if opts.get('output'):
            out = opts['output']
        elif opts.get('fun', '').split('.')[0] == 'state':
            # --static doesn't have an output set at this point, but if we're
            # running a state function and "out" hasn't already been set, we
            # should set the out variable to "highstate". Otherwise state runs
            # are set to "nested" below. See Issue #44556 for more information.
            out = 'highstate'

    if out == 'text':
        out = 'txt'
    elif out is None or out == '':
        out = 'nested'
    if opts.get('progress', False):
        out = 'progress'

    opts.update(kwargs)
    if 'color' not in opts:
        def is_pipe():
            '''
            Check if sys.stdout is a pipe or not
            '''
            try:
                fileno = sys.stdout.fileno()
            except (AttributeError, io.UnsupportedOperation):
                fileno = -1  # sys.stdout is StringIO or fake
            return not os.isatty(fileno)

        if opts.get('force_color', False):
            opts['color'] = True
        elif opts.get('no_color', False) or is_pipe() or salt.utils.platform.is_windows():
            opts['color'] = False
        else:
            opts['color'] = True
    else:
        if opts.get('force_color', False):
            opts['color'] = True
        elif opts.get('no_color', False) or salt.utils.platform.is_windows():
            opts['color'] = False
        else:
            pass

    outputters = salt.loader.outputters(opts)
    if out not in outputters:
        # Since the grains outputter was removed we don't need to fire this
        # error when old minions are asking for it
        if out != 'grains':
            log.error('Invalid outputter %s specified, falling back to nested', out)
        return outputters['nested']
    return outputters[out]
870129
def fingerprint_from_file(filename):
    """"""
    cmd = flatten([gnupg_bin(), gnupg_home(), filename])
    outp = stderr_output(cmd).split('\n')
    if not outp[0].startswith('pub'):
        raise CryptoritoError('probably an invalid gpg key')

    return outp[1].strip()
617663
def has_fingerprint_dlog(self, modulus):
        
        if not self.is_acceptable_modulus(modulus):
            return False

        self.tested += 1
        positive = self.dlog_fprinter.fprint(modulus)

        if positive:
            self.found += 1

        return positive
341693
def tree_analysisOutput(self, *args, **kwargs):
        
        fn_outputcallback           = None
        for k, v in kwargs.items():
            if k == 'outputcallback':           fn_outputcallback           = v
        index   = 1
        total   = len(self.d_inputTree.keys())
        for path, d_analysis in self.d_outputTree.items():
            self.simpleProgress_show(index, total)
            self.dp.qprint("Processing analysis results in output: %s" % path)
            d_output        = fn_outputcallback((path, d_analysis), **kwargs)
        return {
            'status':   True
        }
253853
def ProcessFingerprint(self, responses):
    """"""
    if not responses.success:
      # Its better to raise rather than merely logging since it will make it to
      # the flow's protobuf and users can inspect the reason this flow failed.
      raise flow.FlowError("Could not fingerprint file: %s" % responses.status)

    response = responses.First()
    if response.pathspec.path:
      pathspec = response.pathspec
    else:
      pathspec = self.args.pathspec

    self.state.urn = pathspec.AFF4Path(self.client_urn)

    hash_obj = response.hash

    if data_store.AFF4Enabled():
      with aff4.FACTORY.Create(
          self.state.urn, aff4_grr.VFSFile, mode="w", token=self.token) as fd:
        fd.Set(fd.Schema.HASH, hash_obj)

    if data_store.RelationalDBEnabled():
      path_info = rdf_objects.PathInfo.FromPathSpec(pathspec)
      path_info.hash_entry = response.hash

      data_store.REL_DB.WritePathInfos(self.client_id, [path_info])

    self.ReceiveFileFingerprint(
        self.state.urn, hash_obj, request_data=responses.request_data)
860634
private double computeOutputError(double[] output, double[] gradient) {
        if (output.length != outputLayer.units) {
            throw new IllegalArgumentException(String.format("Invalid output vector size: %d, expected: %d", output.length, outputLayer.units));
        }

        double error = 0.0;
        for (int i = 0; i < outputLayer.units; i++) {
            double out = outputLayer.output[i];
            double g = output[i] - out;

            if (errorFunction == ErrorFunction.LEAST_MEAN_SQUARES) {
                error += 0.5 * g * g;
            } else if (errorFunction == ErrorFunction.CROSS_ENTROPY) {
                if (activationFunction == ActivationFunction.SOFTMAX) {
                    error -= output[i] * log(out);
                } else if (activationFunction == ActivationFunction.LOGISTIC_SIGMOID) {
                    // We have only one output neuron in this case.
                    error = -output[i] * log(out) - (1.0 - output[i]) * log(1.0 - out);
                }
            }

            if (errorFunction == ErrorFunction.LEAST_MEAN_SQUARES && activationFunction == ActivationFunction.LOGISTIC_SIGMOID) {
                g *= out * (1.0 - out);
            }

            gradient[i] = g;
        }

        return error;
    }
135555
private void calculateGTPointQualities(){
        for (int p = 0; p < numPoints; p++) {
            CMMPoint cmdp = cmmpoints.get(p);
            if(!cmdp.isNoise()){
                cmdp.connectivity = getConnectionValue(cmdp, cmdp.workclass());
                cmdp.p.setMeasureValue("Connectivity", cmdp.connectivity);
            }
        }
    }
711743
def fingerprint_from_raw_ssh_pub_key(key):
    
    fp_plain = hashlib.md5(key).hexdigest()
    return ':'.join(a + b for a, b in zip(fp_plain[::2], fp_plain[1::2]))
747613
def ILIKE(pattern):
    """"""
    return P(lambda x: fnmatch.fnmatch(x.lower(), pattern.lower()))
11997
function () {
        var prefix = 'TRACE';
        this.output(prefix, prefix.cyan, Array.prototype.slice.call(arguments));
    }
170648
def _get_output_cwl_keys(fnargs):
    
    for d in utils.flatten(fnargs):
        if isinstance(d, dict) and d.get("output_cwl_keys"):
            return d["output_cwl_keys"]
    raise ValueError("Did not find output_cwl_keys in %s" % (pprint.pformat(fnargs)))
1244672
def roc(args):
    
    outputfile = args.outfile
    # Default extension for image
    if outputfile and not outputfile.endswith(".png"):
        outputfile += ".png"
    
    motifs = read_motifs(args.pwmfile, fmt="pwm")

    ids = []
    if args.ids:
        ids = args.ids.split(",")
    else:
        ids = [m.id for m in motifs]
    motifs = [m for m in motifs if (m.id in ids)]
    
    stats = [
            "phyper_at_fpr",
            "roc_auc", 
            "pr_auc", 
            "enr_at_fpr",
            "recall_at_fdr", 
            "roc_values",
            "matches_at_fpr",
            ]
    
    plot_x = []
    plot_y = []
    legend = []
    
    f_out = sys.stdout
    if args.outdir:
        if not os.path.exists(args.outdir):
            os.makedirs(args.outdir)
        f_out = open(args.outdir + "/gimme.roc.report.txt", "w")
    
    # Print the metrics
    f_out.write("Motif\t# matches\t# matches background\tP-value\tlog10 P-value\tROC AUC\tPR AUC\tEnr. at 1% FPR\tRecall at 10% FDR\n")
    
    
    for motif_stats in calc_stats_iterator(motifs, args.sample, args.background, 
            genome=args.genome, stats=stats, ncpus=args.ncpus):
    
        for motif in motifs:
            if str(motif) in motif_stats:
                if outputfile:
                    x, y = motif_stats[str(motif)]["roc_values"]
                    plot_x.append(x)
                    plot_y.append(y)
                    legend.append(motif.id)
                log_pvalue = np.inf
                if motif_stats[str(motif)]["phyper_at_fpr"] > 0:
                    log_pvalue = -np.log10(motif_stats[str(motif)]["phyper_at_fpr"])
                f_out.write("{}\t{:d}\t{:d}\t{:.2e}\t{:.3f}\t{:.3f}\t{:.3f}\t{:.2f}\t{:0.4f}\n".format(
                      motif.id, 
                      motif_stats[str(motif)]["matches_at_fpr"][0], 
                      motif_stats[str(motif)]["matches_at_fpr"][1], 
                      motif_stats[str(motif)]["phyper_at_fpr"], 
                      log_pvalue, 
                      motif_stats[str(motif)]["roc_auc"], 
                      motif_stats[str(motif)]["pr_auc"], 
                      motif_stats[str(motif)]["enr_at_fpr"], 
                      motif_stats[str(motif)]["recall_at_fdr"],
                      ))
    f_out.close() 
    
    if args.outdir:
        html_report(
            args.outdir,
            args.outdir + "/gimme.roc.report.txt",
            args.pwmfile,
            0.01,
            )

    # Plot the ROC curve
    if outputfile:
        roc_plot(outputfile, plot_x, plot_y, ids=legend)
1040374
@StaplerDispatchable
    public Object getFingerprint( String md5sum ) throws IOException {
        Fingerprint r = fingerprintMap.get(md5sum);
        if(r==null)     return new NoFingerprintMatch(md5sum);
        else            return r;
    }
304788
function _getEllipseImageCoordinates(startHandle, endHandle) {
  return {
    left: Math.round(Math.min(startHandle.x, endHandle.x)),
    top: Math.round(Math.min(startHandle.y, endHandle.y)),
    width: Math.round(Math.abs(startHandle.x - endHandle.x)),
    height: Math.round(Math.abs(startHandle.y - endHandle.y)),
  };
}
263579
def _add_plots_to_output(out, data):
    
    out["plot"] = {}
    diagram_plot = _add_diagram_plot(out, data)
    if diagram_plot:
        out["plot"]["diagram"] = diagram_plot
    scatter = _add_scatter_plot(out, data)
    if scatter:
        out["plot"]["scatter"] = scatter
    scatter_global = _add_global_scatter_plot(out, data)
    if scatter_global:
        out["plot"]["scatter_global"] = scatter_global
    return out