view CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/mash/CommandTriangle.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
line wrap: on
line source
// Copyright © 2015, Battelle National Biodefense Institute (BNBI);
// all rights reserved. Authored by: Brian Ondov, Todd Treangen,
// Sergey Koren, and Adam Phillippy
//
// See the LICENSE.txt file included with this software for license information.

#ifndef INCLUDED_CommandTriangle
#define INCLUDED_CommandTriangle

#include "Command.h"
#include "CommandDistance.h"
#include "Sketch.h"

namespace mash {

class CommandTriangle : public Command
{
public:
    
    struct TriangleInput
    {
        TriangleInput(const Sketch & sketchNew, uint64_t indexNew, const Sketch::Parameters & parametersNew, double maxDistanceNew, double maxPValueNew)
            :
            sketch(sketchNew),
            index(indexNew),
            parameters(parametersNew),
            maxDistance(maxDistanceNew),
            maxPValue(maxPValueNew)
            {}
        
        const Sketch & sketch;
        uint64_t index;
        const Sketch::Parameters & parameters;
        double maxDistance;
        double maxPValue;
    };
    
    struct TriangleOutput
    {
        TriangleOutput(const Sketch & sketchNew, uint64_t indexNew)
            :
            sketch(sketchNew),
            index(indexNew)
        {
            pairs = new CommandDistance::CompareOutput::PairOutput[index];
        }
        
        ~TriangleOutput()
        {
            delete [] pairs;
        }
        
        const Sketch & sketch;
        uint64_t index;
        
        CommandDistance::CompareOutput::PairOutput * pairs;
    };
    
    CommandTriangle();
    
    int run() const; // override
    
private:
    
    double pValueMax;
    bool comment;
    
    void writeOutput(TriangleOutput * output, bool comment, bool edge, double & pValuePeakToSet) const;
};

CommandTriangle::TriangleOutput * compare(CommandTriangle::TriangleInput * input);

} // namespace mash

#endif