diff -Nru bedops-2.4.35+dfsg/applications/bed/bedmap/src/Bedmap.cpp bedops-2.4.36+dfsg/applications/bed/bedmap/src/Bedmap.cpp --- bedops-2.4.35+dfsg/applications/bed/bedmap/src/Bedmap.cpp 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/bedmap/src/Bedmap.cpp 2019-05-23 20:06:31.000000000 +0000 @@ -21,6 +21,8 @@ // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // +#include + #include #include #include @@ -81,6 +83,7 @@ bool nestCheck, const std::string& colSep, const std::string& multivalColSep, + const std::string& onEmptyMap, int precision, bool useScientific, bool fastMode, @@ -123,21 +126,21 @@ Bed::Overlapping sweepDist(0); // dist type for sweep different from BedBaseVisitor's BedMap::selectSweep(sweepDist, bedDist, input.refFileName_, input.mapFileName_, input.minRefFields_, input.minMapFields_, input.errorCheck_, nestCheck, - input.outDelim_, input.multiDelim_, prec, sci, input.fastMode_, + input.outDelim_, input.multiDelim_, input.unmappedVal_, prec, sci, input.fastMode_, input.sweepAll_, input.chrom_, input.skipUnmappedRows_, visitorNames, visitorArgs); } else if ( input.isPercRef_ ) { // % overlap relative to RefTypes's size (setops -e) Bed::PercentOverlapReference bedDist(input.percOvr_); Bed::Overlapping sweepDist(0); // dist type for sweep different from BedBaseVisitor's BedMap::selectSweep(sweepDist, bedDist, input.refFileName_, input.mapFileName_, input.minRefFields_, input.minMapFields_, input.errorCheck_, nestCheck, - input.outDelim_, input.multiDelim_, prec, sci, input.fastMode_, + input.outDelim_, input.multiDelim_, input.unmappedVal_, prec, sci, input.fastMode_, input.sweepAll_, input.chrom_, input.skipUnmappedRows_, visitorNames, visitorArgs); } else if ( input.isPercBoth_ ) { // % overlap relative to both MapType's and RefType's sizes Bed::PercentOverlapBoth bedDist(input.percOvr_); Bed::Overlapping sweepDist(0); // dist type for sweep different from BedBaseVisitor's BedMap::selectSweep(sweepDist, bedDist, input.refFileName_, input.mapFileName_, input.minRefFields_, input.minMapFields_, input.errorCheck_, nestCheck, - input.outDelim_, input.multiDelim_, prec, sci, input.fastMode_, + input.outDelim_, input.multiDelim_, input.unmappedVal_, prec, sci, input.fastMode_, input.sweepAll_, input.chrom_, input.skipUnmappedRows_, visitorNames, visitorArgs); } else if ( input.isExact_ ) { // must be identical coordinates; should work fine with fully-nested elements Bed::Exact bedDist; @@ -146,28 +149,28 @@ const bool noNestCheck = false; // safe with fully-nested elements BedMap::selectSweep(sweepDist, bedDist, input.refFileName_, input.mapFileName_, input.minRefFields_, input.minMapFields_, input.errorCheck_, noNestCheck, - input.outDelim_, input.multiDelim_, prec, sci, fastMode, + input.outDelim_, input.multiDelim_, input.unmappedVal_, prec, sci, fastMode, input.sweepAll_, input.chrom_, input.skipUnmappedRows_, visitorNames, visitorArgs); } else if ( input.isPercEither_ ) { // % overlap relative to either MapType's or RefType's size Bed::PercentOverlapEither bedDist(input.percOvr_); Bed::Overlapping sweepDist(0); // dist type for sweep different from BedBaseVisitor's BedMap::selectSweep(sweepDist, bedDist, input.refFileName_, input.mapFileName_, input.minRefFields_, input.minMapFields_, input.errorCheck_, nestCheck, - input.outDelim_, input.multiDelim_, prec, sci, input.fastMode_, + input.outDelim_, input.multiDelim_, input.unmappedVal_, prec, sci, input.fastMode_, input.sweepAll_, input.chrom_, input.skipUnmappedRows_, visitorNames, visitorArgs); } else if ( input.isRangeBP_ ) { // buffer each reference element Bed::RangedDist bedDist(input.rangeBP_); Bed::RangedDist sweepDist(input.rangeBP_); // same as bedDist in this case BedMap::selectSweep(sweepDist, bedDist, input.refFileName_, input.mapFileName_, input.minRefFields_, input.minMapFields_, input.errorCheck_, nestCheck, - input.outDelim_, input.multiDelim_, prec, sci, (input.fastMode_ || starchFast), + input.outDelim_, input.multiDelim_, input.unmappedVal_, prec, sci, (input.fastMode_ || starchFast), input.sweepAll_, input.chrom_, input.skipUnmappedRows_, visitorNames, visitorArgs); } else { // require a certain amount of bp overlap Bed::Overlapping bedDist(input.overlapBP_); Bed::Overlapping sweepDist(0); // dist type for sweep different from BedBaseVisitor's BedMap::selectSweep(sweepDist, bedDist, input.refFileName_, input.mapFileName_, input.minRefFields_, input.minMapFields_, input.errorCheck_, nestCheck, - input.outDelim_, input.multiDelim_, prec, sci, (input.fastMode_ || starchFast), + input.outDelim_, input.multiDelim_, input.unmappedVal_, prec, sci, (input.fastMode_ || starchFast), input.sweepAll_, input.chrom_, input.skipUnmappedRows_, visitorNames, visitorArgs); } @@ -466,6 +469,7 @@ BaseVisitor* generate(const DistType&, const std::string& className, const std::vector&, const std::string& multivalColSep, + const std::string& onEmptyMap, int precision, bool useScientific) { typedef VisitorTypes VTypes; @@ -479,19 +483,21 @@ else if ( nm == visName() ) { typedef typename VTypes::EchoMapAll::ProcessType PT; typedef typename PT::PType PType; - rtn = new typename VTypes::EchoMapAll(PT(PType(), multivalColSep)); + rtn = new typename VTypes::EchoMapAll(PT(PType(), multivalColSep, onEmptyMap)); } else if ( nm == visName() ) { typedef typename VTypes::EchoMapLength::ProcessType PT; typedef typename PT::PType PType; - rtn = new typename VTypes::EchoMapLength(PT(PType(), multivalColSep)); + rtn = new typename VTypes::EchoMapLength(PT(PType(), multivalColSep, onEmptyMap)); } else if ( nm == visName() ) { typedef typename VTypes::EchoMapIntersectLength::ProcessType PT; typedef typename PT::PType PType; - rtn = new typename VTypes::EchoMapIntersectLength(PT(PType(), multivalColSep)); - } else if ( nm == visName() ) - rtn = new typename VTypes::EchoMapRange; - else if ( nm == visName() ) + rtn = new typename VTypes::EchoMapIntersectLength(PT(PType(), multivalColSep, onEmptyMap)); + } else if ( nm == visName() ) { + typedef typename VTypes::EchoMapRange::ProcessType PT; + typedef typename PT::PType PType; + rtn = new typename VTypes::EchoMapRange(PT(PType(), onEmptyMap)); + } else if ( nm == visName() ) rtn = new typename VTypes::EchoRefAll; else if ( nm == visName() ) rtn = new typename VTypes::EchoRefLength; @@ -528,10 +534,11 @@ BaseVisitor* generate(const DistType& d, const std::string& className, const std::vector& args, const std::string& multivalColSep, + const std::string& onEmptyMap, int precision, bool useScientific) { typedef VisitorTypes VTypes; - BaseVisitor* rtn = SuperClass::generate(d, className, args, multivalColSep, precision, useScientific); + BaseVisitor* rtn = SuperClass::generate(d, className, args, multivalColSep, onEmptyMap, precision, useScientific); if ( rtn ) return rtn; @@ -540,10 +547,10 @@ if ( nm == visName() ) { typedef typename VTypes::EchoMapID::ProcessType PT; typedef typename PT::PType PType; - rtn = new typename VTypes::EchoMapID(PT(PType(), multivalColSep)); + rtn = new typename VTypes::EchoMapID(PT(PType(), multivalColSep, onEmptyMap)); } else if ( nm == visName() ) { typedef typename VTypes::EchoMapUniqueID::ProcessType PT; - rtn = new typename VTypes::EchoMapUniqueID(PT(multivalColSep)); + rtn = new typename VTypes::EchoMapUniqueID(PT(multivalColSep, onEmptyMap)); } return rtn; @@ -564,10 +571,11 @@ BaseVisitor* generate(const DistType& d, const std::string& className, const std::vector& args, const std::string& multivalColSep, + const std::string& onEmptyMap, int precision, bool useScientific) { typedef VisitorTypes VTypes; - BaseVisitor* rtn = SuperClass::generate(d, className, args, multivalColSep, precision, useScientific); + BaseVisitor* rtn = SuperClass::generate(d, className, args, multivalColSep, onEmptyMap, precision, useScientific); if ( rtn ) return rtn; @@ -582,7 +590,7 @@ rtn = new typename VTypes::CoeffVariation(pt); else if ( nm == visName() ) { typedef typename VTypes::EchoMapScore::ProcessType PT; - rtn = new typename VTypes::EchoMapScore(PT(pt, multivalColSep)); + rtn = new typename VTypes::EchoMapScore(PT(pt, multivalColSep, onEmptyMap)); } else if ( nm == visName() ) { Ext::Assert(1 == args.size(), "Need a value with " + nm); @@ -600,11 +608,11 @@ rtn = new typename VTypes::Max(pt); else if ( nm == visName() ) { typedef typename VTypes::MaxElementStable::ProcessType MPT; - rtn = new typename VTypes::MaxElementStable(MPT(precision, useScientific)); + rtn = new typename VTypes::MaxElementStable(MPT(precision, useScientific, onEmptyMap)); } else if ( nm == visName() ) { typedef typename VTypes::MaxElementRand::ProcessType MPT; - rtn = new typename VTypes::MaxElementRand(MPT(precision, useScientific)); + rtn = new typename VTypes::MaxElementRand(MPT(precision, useScientific, onEmptyMap)); } else if ( nm == visName() ) rtn = new typename VTypes::Median(pt); @@ -623,11 +631,11 @@ rtn = new typename VTypes::Min(pt); else if ( nm == visName() ) { typedef typename VTypes::MinElementRand::ProcessType MPT; - rtn = new typename VTypes::MinElementRand(MPT(precision, useScientific)); + rtn = new typename VTypes::MinElementRand(MPT(precision, useScientific, onEmptyMap)); } else if ( nm == visName() ) { typedef typename VTypes::MinElementStable::ProcessType MPT; - rtn = new typename VTypes::MinElementStable(MPT(precision, useScientific)); + rtn = new typename VTypes::MinElementStable(MPT(precision, useScientific, onEmptyMap)); } else if ( nm == visName() ) rtn = new typename VTypes::StdDev(pt); @@ -656,7 +664,7 @@ //=============== template std::vector - getVisitors(GV& gv, const BedDistType& dt, const std::string& multivalColSep, + getVisitors(GV& gv, const BedDistType& dt, const std::string& multivalColSep, const std::string& onEmptyMap, int precision, bool useScientific, const std::vector& visitorNames, const std::vector< std::vector >& visitorArgs) { @@ -664,7 +672,7 @@ std::vector::const_iterator iter = visitorNames.begin(); typename GV::BaseClass* bc = static_cast(0); while ( iter != visitorNames.end() ) { - bc = gv.generate(dt, *iter, visitorArgs[iter-visitorNames.begin()], multivalColSep, precision, useScientific); + bc = gv.generate(dt, *iter, visitorArgs[iter-visitorNames.begin()], multivalColSep, onEmptyMap, precision, useScientific); if ( !bc ) throw(Ext::ProgramError("Unknown Operation: " + *iter + ". Program Error Detected.")); visitorGroup.push_back(bc); @@ -710,13 +718,28 @@ typedef Bed::BTAllRestNoPool::Bed5Type BType; }; + //============== + // named_pipe() + //============== + bool named_pipe(const std::string& fname) { + bool is_namedpipe = false; + if ( !fname.empty() && fname != "-" ) { + struct stat st; + if ( stat(fname.c_str(), &st) == -1 ) + throw(Ext::InvalidFile("Error: stat() failed on: " + fname)); + is_namedpipe = (S_ISFIFO(st.st_mode) != 0); + } + return is_namedpipe; + } + //====================== // checkStarchNesting() //====================== bool checkStarchNesting(const std::string& f1, const std::string& f2) { constexpr bool NoUseMemPool = false; typedef SelectBED<3, NoUseMemPool>::BType BedType; - if ( f1 == "-" || f2 == "-" ) + + if ( f1 == "-" || f2 == "-" || named_pipe(f1) || named_pipe(f2) ) return true; // not applicable Ext::FPWrap file1(f1); Bed::allocate_iterator_starch_bed_mm a(file1); @@ -761,6 +784,7 @@ bool nestCheck, const std::string& colSep, const std::string& multivalColSep, + const std::string& onEmptyMap, int precision, bool useScientific, const std::string& chrom, @@ -781,7 +805,7 @@ typedef RefType MapType; typedef typename SelectBase::BaseClass BaseClass; BedMap::GenerateVisitors gv; - std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, precision, + std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, onEmptyMap, precision, useScientific, visitorNames, visitorArgs); runSweep(st, dt, refFileName, mapFileName, errorCheck, nestCheck, ProcessMode, sweepAll, colSep, chrom, skipUnmappedRows, visitorGroup); @@ -790,7 +814,7 @@ typedef RefType MapType; typedef typename SelectBase::BaseClass BaseClass; BedMap::GenerateVisitors gv; - std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, precision, + std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, onEmptyMap, precision, useScientific, visitorNames, visitorArgs); runSweep(st, dt, refFileName, mapFileName, errorCheck, nestCheck, ProcessMode, sweepAll, colSep, chrom, skipUnmappedRows, visitorGroup); @@ -803,7 +827,7 @@ typedef typename SelectBED<4, UseMemPool>::BType MapType; typedef typename SelectBase::BaseClass BaseClass; BedMap::GenerateVisitors gv; - std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, precision, + std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, onEmptyMap, precision, useScientific, visitorNames, visitorArgs); runSweep(st, dt, refFileName, mapFileName, errorCheck, nestCheck, ProcessMode, sweepAll, colSep, chrom, skipUnmappedRows, visitorGroup); @@ -814,7 +838,7 @@ typedef typename SelectBED<4, NoUseMemPool>::BType MapType; typedef typename SelectBase::BaseClass BaseClass; BedMap::GenerateVisitors gv; - std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, precision, + std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, onEmptyMap, precision, useScientific, visitorNames, visitorArgs); runSweep(st, dt, refFileName, mapFileName, errorCheck, nestCheck, ProcessMode, sweepAll, colSep, chrom, skipUnmappedRows, visitorGroup); @@ -827,7 +851,7 @@ typedef typename SelectBED<5, UseMemPool>::BType MapType; typedef typename SelectBase::BaseClass BaseClass; BedMap::GenerateVisitors gv; - std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, precision, + std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, onEmptyMap, precision, useScientific, visitorNames, visitorArgs); runSweep(st, dt, refFileName, mapFileName, errorCheck, nestCheck, ProcessMode, sweepAll, colSep, chrom, skipUnmappedRows, visitorGroup); @@ -838,7 +862,7 @@ typedef typename SelectBED<5, NoUseMemPool>::BType MapType; typedef typename SelectBase::BaseClass BaseClass; BedMap::GenerateVisitors gv; - std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, precision, + std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, onEmptyMap, precision, useScientific, visitorNames, visitorArgs); runSweep(st, dt, refFileName, mapFileName, errorCheck, nestCheck, ProcessMode, sweepAll, colSep, chrom, skipUnmappedRows, visitorGroup); @@ -858,6 +882,7 @@ bool nestCheck, const std::string& colSep, const std::string& multivalColSep, + const std::string& onEmptyMap, int precision, bool useScientific, const std::string& chrom, @@ -872,7 +897,7 @@ typedef typename SelectBED<3, UseMemPool>::BType RefType; typedef typename SelectBase::BaseClass BaseClass; BedMap::GenerateVisitors gv; - std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, precision, + std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, onEmptyMap, precision, useScientific, visitorNames, visitorArgs); runSweep(st, dt, refFileName, errorCheck, nestCheck, ProcessMode, colSep, chrom, skipUnmappedRows, visitorGroup); @@ -880,7 +905,7 @@ typedef typename SelectBED<3, NoUseMemPool>::BType RefType; typedef typename SelectBase::BaseClass BaseClass; BedMap::GenerateVisitors gv; - std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, precision, + std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, onEmptyMap, precision, useScientific, visitorNames, visitorArgs); runSweep(st, dt, refFileName, errorCheck, nestCheck, ProcessMode, colSep, chrom, skipUnmappedRows, visitorGroup); @@ -890,7 +915,7 @@ typedef typename SelectBED<4, UseMemPool>::BType RefType; typedef typename SelectBase::BaseClass BaseClass; BedMap::GenerateVisitors gv; - std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, precision, + std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, onEmptyMap, precision, useScientific, visitorNames, visitorArgs); runSweep(st, dt, refFileName, errorCheck, nestCheck, ProcessMode, colSep, chrom, skipUnmappedRows, visitorGroup); @@ -898,7 +923,7 @@ typedef typename SelectBED<4, NoUseMemPool>::BType RefType; typedef typename SelectBase::BaseClass BaseClass; BedMap::GenerateVisitors gv; - std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, precision, + std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, onEmptyMap, precision, useScientific, visitorNames, visitorArgs); runSweep(st, dt, refFileName, errorCheck, nestCheck, ProcessMode, colSep, chrom, skipUnmappedRows, visitorGroup); @@ -908,7 +933,7 @@ typedef typename SelectBED<5, UseMemPool>::BType RefType; typedef typename SelectBase::BaseClass BaseClass; BedMap::GenerateVisitors gv; - std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, precision, + std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, onEmptyMap, precision, useScientific, visitorNames, visitorArgs); runSweep(st, dt, refFileName, errorCheck, nestCheck, ProcessMode, colSep, chrom, skipUnmappedRows, visitorGroup); @@ -916,7 +941,7 @@ typedef typename SelectBED<5, NoUseMemPool>::BType RefType; typedef typename SelectBase::BaseClass BaseClass; BedMap::GenerateVisitors gv; - std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, precision, + std::vector visitorGroup = getVisitors(gv, dt, multivalColSep, onEmptyMap, precision, useScientific, visitorNames, visitorArgs); runSweep(st, dt, refFileName, errorCheck, nestCheck, ProcessMode, colSep, chrom, skipUnmappedRows, visitorGroup); @@ -939,6 +964,7 @@ bool nestCheck, const std::string& colSep, const std::string& multivalColSep, + const std::string& onEmptyMap, int precision, bool useScientific, bool fastMode, @@ -955,19 +981,19 @@ if ( mapFileName.empty() ) { // single-file mode if ( fastMode ) - callSweep(st, dt, refFileName, minRefFields, errorCheck, nestCheck, colSep, multivalColSep, + callSweep(st, dt, refFileName, minRefFields, errorCheck, nestCheck, colSep, multivalColSep, onEmptyMap, precision, useScientific, chrom, skipUnmappedRows, visitorNames, visitorArgs); else - callSweep(st, dt, refFileName, minRefFields, errorCheck, nestCheck, colSep, multivalColSep, + callSweep(st, dt, refFileName, minRefFields, errorCheck, nestCheck, colSep, multivalColSep, onEmptyMap, precision, useScientific, chrom, skipUnmappedRows, visitorNames, visitorArgs); } else { // dual-file mode if ( fastMode ) - callSweep(st, dt, refFileName, mapFileName, minRefFields, minMapFields, - errorCheck, nestCheck, colSep, multivalColSep, precision, useScientific, + callSweep(st, dt, refFileName, mapFileName, minRefFields, minMapFields, errorCheck, + nestCheck, colSep, multivalColSep, onEmptyMap, precision, useScientific, chrom, skipUnmappedRows, sweepAll, visitorNames, visitorArgs); else - callSweep(st, dt, refFileName, mapFileName, minRefFields, minMapFields, - errorCheck, nestCheck, colSep, multivalColSep, precision, useScientific, + callSweep(st, dt, refFileName, mapFileName, minRefFields, minMapFields, errorCheck, + nestCheck, colSep, multivalColSep, onEmptyMap, precision, useScientific, chrom, skipUnmappedRows, sweepAll, visitorNames, visitorArgs); } } diff -Nru bedops-2.4.35+dfsg/applications/bed/bedmap/src/Input.hpp bedops-2.4.36+dfsg/applications/bed/bedmap/src/Input.hpp --- bedops-2.4.35+dfsg/applications/bed/bedmap/src/Input.hpp 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/bedmap/src/Input.hpp 2019-05-23 20:06:31.000000000 +0000 @@ -79,7 +79,7 @@ precision_(6), useScientific_(false), useMinMemory_(false), setPrec_(false), numFiles_(0), minRefFields_(0), minMapFields_(0), errorCheck_(false), sweepAll_(false), outDelim_("|"), multiDelim_(";"), fastMode_(false), rangeAlias_(false), - chrom_("all"), skipUnmappedRows_(false) { + chrom_("all"), skipUnmappedRows_(false), unmappedVal_("") { // Process user's operation options if ( argc <= 1 ) @@ -108,6 +108,12 @@ fastMode_ = true; } else if ( next == "sweep-all" ) { // --> sweep through all of second file sweepAll_ = true; + } else if ( next == "unmapped-val" ) { + Ext::Assert(unmappedVal_.empty(), "--unmapped-val specified multiple times"); + Ext::Assert(argcntr < argc, "No value given for --unmapped-val"); + unmappedVal_ = argv[argcntr++]; + Ext::Assert(unmappedVal_.find("--") != 0, + "Apparent option: " + std::string(argv[argcntr]) + " where expected for --unmapped-val."); } else if ( next == "delim" ) { Ext::Assert(outDelim_ == "|", "--delim specified multiple times"); Ext::Assert(argcntr < argc, "No output delimiter given"); @@ -399,6 +405,7 @@ bool rangeAlias_; std::string chrom_; bool skipUnmappedRows_; + std::string unmappedVal_; private: struct MapFields { @@ -480,6 +487,8 @@ usage << " --sci Use scientific notation for score outputs. \n"; usage << " --skip-unmapped Print no output for a row with no mapped elements. \n"; usage << " --sweep-all Ensure is read completely (helps to prevent broken pipes). \n"; + usage << " --unmapped-val Print on unmapped --echo-map* and --min/max-element* operations. \n"; + usage << " The default is to print nothing. \n"; usage << " --version Print program information. \n"; usage << " \n"; usage << " \n"; diff -Nru bedops-2.4.35+dfsg/applications/bed/bedops/test/Regression.java bedops-2.4.36+dfsg/applications/bed/bedops/test/Regression.java --- bedops-2.4.35+dfsg/applications/bed/bedops/test/Regression.java 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/bedops/test/Regression.java 2019-05-23 20:06:31.000000000 +0000 @@ -196,7 +196,7 @@ } private int order_ = -1; -private String call_ = "../../bin/bedops --ec "; +private String call_ = "../../bin/bedops-typical --ec "; private String inputFiles_ = ""; private String answer_ = ""; private String output_ = ""; diff -Nru bedops-2.4.35+dfsg/applications/bed/conversion/src/convert2bed.h bedops-2.4.36+dfsg/applications/bed/conversion/src/convert2bed.h --- bedops-2.4.35+dfsg/applications/bed/conversion/src/convert2bed.h 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/conversion/src/convert2bed.h 2019-05-23 20:06:31.000000000 +0000 @@ -53,7 +53,7 @@ #include "suite/BEDOPS.Constants.hpp" -#define C2B_VERSION "2.4.35" +#define C2B_VERSION "2.4.36" typedef int boolean; extern const boolean kTrue; diff -Nru bedops-2.4.35+dfsg/applications/bed/sort-bed/src/update-sort-bed-migrate-candidates.py bedops-2.4.36+dfsg/applications/bed/sort-bed/src/update-sort-bed-migrate-candidates.py --- bedops-2.4.35+dfsg/applications/bed/sort-bed/src/update-sort-bed-migrate-candidates.py 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/sort-bed/src/update-sort-bed-migrate-candidates.py 2019-05-23 20:06:31.000000000 +0000 @@ -32,7 +32,7 @@ name = "update-sort-bed-migrate-candidates" citation = " citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract" authors = " authors: Alex Reynolds and Shane Neph" -version = " version: 2.4.35" +version = " version: 2.4.36" usage = """ $ update-sort-bed-migrate-candidates [ --dry-run ] [ --debug ] [ --write-list | --resort-immediately | diff -Nru bedops-2.4.35+dfsg/applications/bed/sort-bed/src/update-sort-bed-slurm.py bedops-2.4.36+dfsg/applications/bed/sort-bed/src/update-sort-bed-slurm.py --- bedops-2.4.35+dfsg/applications/bed/sort-bed/src/update-sort-bed-slurm.py 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/sort-bed/src/update-sort-bed-slurm.py 2019-05-23 20:06:31.000000000 +0000 @@ -33,7 +33,7 @@ name = "update-sort-bed-slurm" citation = " citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract" authors = " authors: Alex Reynolds and Shane Neph" -version = " version: 2.4.35" +version = " version: 2.4.36" usage = """ $ update-sort-bed-slurm [ --slurm-memory ] [ --slurm-partition ] [ --slurm-workdir ] diff -Nru bedops-2.4.35+dfsg/applications/bed/sort-bed/src/update-sort-bed-starch-slurm.py bedops-2.4.36+dfsg/applications/bed/sort-bed/src/update-sort-bed-starch-slurm.py --- bedops-2.4.35+dfsg/applications/bed/sort-bed/src/update-sort-bed-starch-slurm.py 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/sort-bed/src/update-sort-bed-starch-slurm.py 2019-05-23 20:06:31.000000000 +0000 @@ -33,7 +33,7 @@ name = "update-sort-bed-starch-slurm" citation = " citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract" authors = " authors: Alex Reynolds and Shane Neph" -version = " version: 2.4.35" +version = " version: 2.4.36" usage = """ $ update-sort-bed-starch-slurm [ --slurm-memory ] [ --slurm-partition ] [ --slurm-workdir ] diff -Nru bedops-2.4.35+dfsg/applications/bed/starch/src/Makefile bedops-2.4.36+dfsg/applications/bed/starch/src/Makefile --- bedops-2.4.35+dfsg/applications/bed/starch/src/Makefile 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/starch/src/Makefile 2019-05-23 20:06:31.000000000 +0000 @@ -49,9 +49,9 @@ build: starch unstarch starchcat starchcluster starch-diff starchstrip rm -rf ${LOCALOBJDIR} -build_debug: $(BINDIR)/debug.starch $(BINDIR)/debug.unstarch $(BINDIR)/debug.starchcat $(BINDIR)/debug.starchstrip +build_debug: $(BINDIR)/debug.starch $(BINDIR)/debug.unstarch $(BINDIR)/debug.starchcat $(BINDIR)/debug.starchstrip starchcluster starch-diff rm -rf ${LOCALOBJDIR} -build_gprof: $(BINDIR)/gprof.starch $(BINDIR)/gprof.unstarch $(BINDIR)/gprof.starchcat $(BINDIR)/gprof.starchstrip +build_gprof: $(BINDIR)/gprof.starch $(BINDIR)/gprof.unstarch $(BINDIR)/gprof.starchcat $(BINDIR)/gprof.starchstrip starchcluster starch-diff rm -rf ${LOCALOBJDIR} # Cancel implicit compilation rules diff -Nru bedops-2.4.35+dfsg/applications/bed/starch/src/Makefile.darwin bedops-2.4.36+dfsg/applications/bed/starch/src/Makefile.darwin --- bedops-2.4.35+dfsg/applications/bed/starch/src/Makefile.darwin 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/starch/src/Makefile.darwin 2019-05-23 20:06:31.000000000 +0000 @@ -31,7 +31,7 @@ BINDIR = ../bin WARNINGS = -Weverything -Wno-c++98-compat-pedantic -Wno-padded ARCH_VERSION = v2.2 -BIN_VERSION = v2.4.35 +BIN_VERSION = v2.4.36 TEST = ../test TEST_OSX_BINDIR = ${TEST}/binaries/osx/${ARCH_VERSION}/bin diff -Nru bedops-2.4.35+dfsg/applications/bed/starch/src/starch.c bedops-2.4.36+dfsg/applications/bed/starch/src/starch.c --- bedops-2.4.35+dfsg/applications/bed/starch/src/starch.c 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/starch/src/starch.c 2019-05-23 20:06:31.000000000 +0000 @@ -46,18 +46,27 @@ #ifdef DEBUG fprintf (stderr, "\n--- starch main() - enter ---\n"); #endif - int parseValue = 0; - CompressionType type; +#ifdef __cplusplus + char *note = nullptr; + char *tag = nullptr; + char *bedFn = nullptr; + FILE *bedFnPtr = nullptr; + Metadata *metadata = nullptr; + unsigned char *starchHeader = nullptr; +#else char *note = NULL; char *tag = NULL; char *bedFn = NULL; FILE *bedFnPtr = NULL; Metadata *metadata = NULL; + unsigned char *starchHeader = NULL; +#endif + int parseValue = 0; + CompressionType type; Boolean bedGeneratePerChrSignatureFlag = kStarchFalse; Boolean bedReportProgressFlag = kStarchFalse; LineCountType bedReportProgressN = 0; Boolean bedHeaderFlag = kStarchFalse; - unsigned char *starchHeader = NULL; setlocale (LC_ALL, "POSIX"); @@ -93,7 +102,7 @@ if ((bedHeaderFlag == kStarchTrue) && #ifdef __cplusplus (STARCH_transformInput(&metadata, - NULL, + nullptr, static_cast( type ), reinterpret_cast( tag ), reinterpret_cast( note )) != 0)) @@ -108,7 +117,7 @@ else if ((bedHeaderFlag == kStarchFalse) && #ifdef __cplusplus (STARCH_transformHeaderlessInput(&metadata, - NULL, + nullptr, static_cast( type ), reinterpret_cast( tag ), static_cast( kStarchFinalizeTransformTrue ), @@ -212,6 +221,22 @@ } /* cleanup */ +#ifdef __cplusplus + if (bedFnPtr != nullptr) { + fclose (bedFnPtr); + bedFnPtr = nullptr; + } + if (metadata != nullptr) + STARCH_freeMetadata (&metadata); + if (starchHeader) { + free (starchHeader); + starchHeader = nullptr; + } + if (starch_client_global_args.uniqueTag) { + free (starch_client_global_args.uniqueTag); + starch_client_global_args.uniqueTag = nullptr; + } +#else if (bedFnPtr != NULL) { fclose (bedFnPtr); bedFnPtr = NULL; @@ -226,6 +251,7 @@ free (starch_client_global_args.uniqueTag); starch_client_global_args.uniqueTag = NULL; } +#endif #ifdef DEBUG fprintf (stderr, "\n--- starch main() - exit ---\n"); @@ -244,16 +270,23 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCH_initializeGlobals() ---\n"); #endif +#ifdef __cplusplus + starch_client_global_args.note = nullptr; + starch_client_global_args.inputFile = nullptr; + starch_client_global_args.uniqueTag = nullptr; + starch_client_global_args.inputFiles = nullptr; +#else starch_client_global_args.note = NULL; + starch_client_global_args.inputFile = NULL; + starch_client_global_args.uniqueTag = NULL; + starch_client_global_args.inputFiles = NULL; +#endif starch_client_global_args.compressionType = STARCH_DEFAULT_COMPRESSION_TYPE; starch_client_global_args.generatePerChromosomeSignatureFlag = kStarchTrue; starch_client_global_args.reportProgressFlag = kStarchFalse; starch_client_global_args.reportProgressN = 0; starch_client_global_args.headerFlag = kStarchFalse; - starch_client_global_args.inputFile = NULL; - starch_client_global_args.uniqueTag = NULL; starch_client_global_args.numberInputFiles = 0; - starch_client_global_args.inputFiles = NULL; } int @@ -294,7 +327,11 @@ case 'r': starch_client_global_args.reportProgressFlag = kStarchTrue; errno = 0; +#ifdef __cplusplus + starch_client_global_args.reportProgressN = strtoumax(optarg, nullptr, 10); +#else starch_client_global_args.reportProgressN = strtoumax(optarg, NULL, 10); +#endif if (errno == ERANGE) { fprintf (stderr, "ERROR: Numerical value is outside of range.\n"); return STARCH_FATAL_ERROR; @@ -353,13 +390,15 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCH_printUsage() ---\n"); #endif - char *avStr = NULL; #ifdef __cplusplus + char *avStr = nullptr; avStr = static_cast( malloc (STARCH_ARCHIVE_VERSION_STRING_LENGTH) ); + if (avStr != nullptr) { #else + char *avStr = NULL; avStr = malloc (STARCH_ARCHIVE_VERSION_STRING_LENGTH); -#endif if (avStr != NULL) { +#endif int result = sprintf (avStr, "%d.%d.%d", STARCH_MAJOR_VERSION, STARCH_MINOR_VERSION, STARCH_REVISION_VERSION); if (result != -1) { switch (errorType) { @@ -381,13 +420,15 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCH_printRevision() ---\n"); #endif - char *avStr = NULL; #ifdef __cplusplus + char *avStr = nullptr; avStr = static_cast( malloc (STARCH_ARCHIVE_VERSION_STRING_LENGTH) ); + if (avStr != nullptr) { #else + char *avStr = NULL; avStr = malloc (STARCH_ARCHIVE_VERSION_STRING_LENGTH); -#endif if (avStr != NULL) { +#endif int result = sprintf (avStr, "%d.%d.%d", STARCH_MAJOR_VERSION, STARCH_MINOR_VERSION, STARCH_REVISION_VERSION); if (result != -1) fprintf (stderr, "%s\n binary version: %s (creates archive version: %s)\n", name, BEDOPS::version(), avStr); diff -Nru bedops-2.4.35+dfsg/applications/bed/starch/src/starchcat.c bedops-2.4.36+dfsg/applications/bed/starch/src/starchcat.c --- bedops-2.4.35+dfsg/applications/bed/starch/src/starchcat.c 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/starch/src/starchcat.c 2019-05-23 20:06:31.000000000 +0000 @@ -69,19 +69,29 @@ #ifdef DEBUG fprintf (stderr, "\n--- starchcat main() - enter ---\n"); #endif +#ifdef __cplusplus + char *note = nullptr; + ChromosomeSummaries *summaries = nullptr; + ChromosomeSummary *summary = nullptr; + MetadataRecord *mdRecords = nullptr; + char **chromosomes = nullptr; + json_t **metadataJSONs = nullptr; + unsigned char *header = nullptr; +#else char *note = NULL; ChromosomeSummaries *summaries = NULL; ChromosomeSummary *summary = NULL; MetadataRecord *mdRecords = NULL; + char **chromosomes = NULL; + json_t **metadataJSONs = NULL; + unsigned char *header = NULL; +#endif CompressionType outputType = STARCH_DEFAULT_COMPRESSION_TYPE; int parseResult = 0; unsigned int firstArgc = UINT_MAX; unsigned int numRecords = 0U; - char **chromosomes = NULL; unsigned int numChromosomes = 0U; - json_t **metadataJSONs = NULL; size_t cumulativeRecSize = 0U; - unsigned char *header = NULL; Boolean bedGeneratePerChrSignatureFlag = kStarchFalse; Boolean bedReportProgressFlag = kStarchFalse; LineCountType bedReportProgressN = 0; @@ -243,10 +253,15 @@ fprintf (stderr, "\n--- STARCHCAT_initializeGlobals() ---\n"); #endif +#ifdef __cplusplus + starchcat_client_global_args.note = nullptr; + starchcat_client_global_args.inputFiles = nullptr; +#else starchcat_client_global_args.note = NULL; + starchcat_client_global_args.inputFiles = NULL; +#endif starchcat_client_global_args.compressionType = STARCH_DEFAULT_COMPRESSION_TYPE; starchcat_client_global_args.numberInputFiles = 0; - starchcat_client_global_args.inputFiles = NULL; starchcat_client_global_args.generatePerChromosomeSignatureFlag = kStarchTrue; } @@ -281,7 +296,11 @@ case 'r': starchcat_client_global_args.reportProgressFlag = kStarchTrue; errno = 0; +#ifdef __cplusplus + starchcat_client_global_args.reportProgressN = strtoumax(optarg, nullptr, 10); +#else starchcat_client_global_args.reportProgressN = strtoumax(optarg, NULL, 10); +#endif if (errno == ERANGE) { fprintf (stderr, "ERROR: Numerical value is outside of range.\n"); return STARCHCAT_FATAL_ERROR; @@ -319,13 +338,18 @@ of data to standard output. The output metadata specifics are copied over without alterations to the stream. */ +#ifdef __cplusplus + char *outFn = nullptr; + char *outSignature = nullptr; +#else char *outFn = NULL; + char *outSignature = NULL; +#endif FILE *outFnPtr = stdout; uint64_t startOffset = 0; uint64_t endOffset = 0; uint64_t outFileSize = 0; uint64_t outFileSizeCounter = 0; - char *outSignature = NULL; LineCountType outFileLineCount = 0; LineLengthType outFileLineMaxStringLength = STARCH_DEFAULT_LINE_STRING_LENGTH; BaseCountType outFileNonUniqueBases = 0; @@ -389,7 +413,11 @@ fprintf(stderr, "\tdetermined startOffset -> %" PRId64 "\n", startOffset); #endif +#ifdef __cplusplus + for (iter = inMd; iter != nullptr; iter = iter->next) { +#else for (iter = inMd; iter != NULL; iter = iter->next) { +#endif if (strcmp(iter->chromosome, inChr) == 0) { if (((av->major == 1) && (av->minor >= 4)) || (av->major == 2)) { outFileLineCount = iter->lineCount; @@ -548,6 +576,15 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT_copyInputRecordToOutput() ---\n"); #endif +#ifdef __cplusplus + FILE *outFnPtr = nullptr; + char *outFn = nullptr; + char *outSignature = nullptr; +#else + FILE *outFnPtr = NULL; + char *outFn = NULL; + char *outSignature = NULL; +#endif uint64_t startOffset = inRec->mdOffset; uint64_t endOffset = 0; uint64_t outFileSize = 0; @@ -561,9 +598,6 @@ Metadata *iter, *inMd = inRec->metadata; const ArchiveVersion *av = inRec->av; char buffer[STARCHCAT_COPY_BUFFER_MAXSIZE]; - FILE *outFnPtr = NULL; - char *outFn = NULL; - char *outSignature = NULL; size_t nBytesRead = 0; if (!inMd) { @@ -611,7 +645,11 @@ } /* determine the offsets of the stream-of-interest */ +#ifdef __cplusplus + for (iter = inMd; iter != nullptr; iter = iter->next) { +#else for (iter = inMd; iter != NULL; iter = iter->next) { +#endif if (strcmp(iter->chromosome, inChr) != 0) startOffset += iter->size; else { @@ -761,19 +799,25 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT2_rewriteInputRecordToOutput() ---\n"); #endif +#ifdef __cplusplus + char *outTagFn = nullptr; + unsigned char *retransformLineBuf = nullptr; + unsigned char *retransformBuf = nullptr; +#else + char *outTagFn = NULL; + unsigned char *retransformLineBuf = NULL; + unsigned char *retransformBuf = NULL; +#endif FILE *inFp = inRec->fp; FILE *outFp = stdout; CompressionType inType = inRec->type; - char *outTagFn = NULL; SignedCoordType startOffset = 0; Metadata *iter, *inMd = inRec->metadata; ArchiveVersion *av = inRec->av; /* intermediate buffer variables */ - unsigned char *retransformLineBuf = NULL; int64_t nRetransformLineBuf = 0; int64_t nRetransformLineBufPos = 0; - unsigned char *retransformBuf = NULL; int64_t nRetransformBuf = 0; /* allocate memory for intermediate buffer variables */ @@ -798,17 +842,25 @@ } /* bzip2 variables */ +#ifdef __cplusplus + BZFILE *bzInFp = nullptr; + BZFILE *bzOutFp = nullptr; + unsigned char *bzReadBuf = nullptr; + unsigned char *bzRemainderBuf = nullptr; + unsigned char *bzLineBuf = nullptr; +#else BZFILE *bzInFp = NULL; BZFILE *bzOutFp = NULL; + unsigned char *bzReadBuf = NULL; + unsigned char *bzRemainderBuf = NULL; + unsigned char *bzLineBuf = NULL; +#endif int bzInError = BZ_OK; int bzOutError = BZ_OK; - unsigned char *bzReadBuf = NULL; size_t nBzReadBuf = STARCH_BZ_BUFFER_MAX_LENGTH; - unsigned char *bzRemainderBuf = NULL; size_t nBzRemainderBuf = 0; size_t nBzRead = 0; size_t bzBufIndex = 0; - unsigned char *bzLineBuf = NULL; unsigned int bzOutBytesConsumedLo32 = 0U; unsigned int bzOutBytesConsumedHi32 = 0U; size_t bzOutBytesWritten = 0; @@ -847,19 +899,27 @@ } /* gzip variables */ +#ifdef __cplusplus + unsigned char *zOutBuffer = nullptr; + unsigned char *zReadBuf = nullptr; + unsigned char *zOutBuf = nullptr; + unsigned char *zRemainderBuf = nullptr; + unsigned char *zLineBuf = nullptr; +#else + unsigned char *zOutBuffer = NULL; + unsigned char *zReadBuf = NULL; + unsigned char *zOutBuf = NULL; + unsigned char *zRemainderBuf = NULL; + unsigned char *zLineBuf = NULL; +#endif z_stream zInStream; z_stream zOutStream; int zInError = -1; int zOutError = -1; - unsigned char *zOutBuffer = NULL; - unsigned char *zReadBuf = NULL; - unsigned char *zOutBuf = NULL; size_t zInHave = 0; size_t zOutHave = 0; size_t zBufIndex = 0; - unsigned char *zRemainderBuf = NULL; size_t nZRemainderBuf = 0; - unsigned char *zLineBuf = NULL; /* allocate memory for gzip variables */ #ifdef __cplusplus @@ -913,19 +973,26 @@ } /* transformation variables */ +#ifdef __cplusplus + char *t_firstInputToken = nullptr; + char *t_secondInputToken = nullptr; + char *t_currChr = nullptr; + char *t_currRemainder = nullptr; +#else + char *t_firstInputToken = NULL; + char *t_secondInputToken = NULL; + char *t_currChr = NULL; + char *t_currRemainder = NULL; +#endif size_t lastNewlineOffset = 0U; unsigned char bufChar = '\0'; size_t bufCharIndex = 0; SignedCoordType t_start = 0; SignedCoordType t_pLength = 0; SignedCoordType t_lastEnd = 0; - char *t_firstInputToken = NULL; - char *t_secondInputToken = NULL; - char *t_currChr = NULL; size_t t_currChrLen = 0U; SignedCoordType t_currStart = 0; SignedCoordType t_currStop = 0; - char *t_currRemainder = NULL; size_t t_currRemainderLen = 0U; LineCountType t_lineIdx = 0; SignedCoordType t_pStart = 0; @@ -964,7 +1031,11 @@ /* hash variables */ struct sha1_ctx t_perChromosomeHashCtx; unsigned char t_sha1Digest[STARCH2_MD_FOOTER_SHA1_LENGTH] = {0}; +#ifdef __cplusplus + char *t_base64EncodedSha1Digest = nullptr; +#else char *t_base64EncodedSha1Digest = NULL; +#endif static const char tab = '\t'; @@ -1009,7 +1080,11 @@ else if (av->major == 1) startOffset += inRec->mdOffset; +#ifdef __cplusplus + for (iter = inMd; iter != nullptr; iter = iter->next) { +#else for (iter = inMd; iter != NULL; iter = iter->next) { +#endif if (strcmp(iter->chromosome, inChr) == 0) break; else @@ -1078,9 +1153,15 @@ #ifdef DEBUG fprintf (stderr, "\tsetting up gzip write stream...\n"); #endif +#ifdef __cplusplus + zOutStream.zalloc = nullptr; + zOutStream.zfree = nullptr; + zOutStream.opaque = nullptr; +#else zOutStream.zalloc = Z_NULL; zOutStream.zfree = Z_NULL; zOutStream.opaque = Z_NULL; +#endif /* cf. http://www.zlib.net/manual.html for level information */ /* zOutError = deflateInit2(&zOutStream, STARCH_Z_COMPRESSION_LEVEL, Z_DEFLATED, STARCH_Z_WINDOW_BITS, STARCH_Z_MEMORY_LEVEL, Z_DEFAULT_STRATEGY); */ zOutError = deflateInit(&zOutStream, STARCH_Z_COMPRESSION_LEVEL); @@ -1123,7 +1204,11 @@ #ifdef DEBUG fprintf (stderr, "\tsetting up bzip2 read stream...\n"); #endif +#ifdef __cplusplus + bzInFp = BZ2_bzReadOpen(&bzInError, inFp, STARCH_BZ_VERBOSITY, STARCH_BZ_SMALL, nullptr, 0); /* http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html#bzreadopen */ +#else bzInFp = BZ2_bzReadOpen(&bzInError, inFp, STARCH_BZ_VERBOSITY, STARCH_BZ_SMALL, NULL, 0); /* http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html#bzreadopen */ +#endif if (bzInError != BZ_OK) { switch (bzInError) { case BZ_CONFIG_ERROR: { @@ -1586,11 +1671,18 @@ #ifdef DEBUG fprintf (stderr, "\tsetting up gzip read stream...\n"); #endif +#ifdef __cplusplus + zInStream.zalloc = nullptr; + zInStream.zfree = nullptr; + zInStream.opaque = nullptr; + zInStream.next_in = nullptr; +#else zInStream.zalloc = Z_NULL; zInStream.zfree = Z_NULL; zInStream.opaque = Z_NULL; - zInStream.avail_in = 0; zInStream.next_in = Z_NULL; +#endif + zInStream.avail_in = 0; /* cf. http://www.zlib.net/manual.html for level information */ zInError = inflateInit2(&zInStream, (15+32)); if (zInError != Z_OK) { @@ -2035,7 +2127,11 @@ } } } +#ifdef __cplusplus + bzOutBytesWritten = static_cast( bzOutBytesWrittenHi32 ) << 32 | bzOutBytesWrittenLo32; +#else bzOutBytesWritten = (size_t) bzOutBytesWrittenHi32 << 32 | bzOutBytesWrittenLo32; +#endif t_fileSize += bzOutBytesWritten; *cumulativeOutputSize += bzOutBytesWritten; bzOutBytesWritten = 0; @@ -2061,9 +2157,15 @@ } } } +#ifdef __cplusplus + zOutStream.zalloc = nullptr; + zOutStream.zfree = nullptr; + zOutStream.opaque = nullptr; +#else zOutStream.zalloc = Z_NULL; zOutStream.zfree = Z_NULL; zOutStream.opaque = Z_NULL; +#endif break; } case kUndefined: { @@ -2136,98 +2238,154 @@ fprintf(stderr, "outTagFn freed...\n"); #endif free(outTagFn); +#ifdef __cplusplus + outTagFn = nullptr; +#else outTagFn = NULL; +#endif } if (t_base64EncodedSha1Digest) { #ifdef DEBUG fprintf(stderr, "t_base64EncodedSha1Digest freed...\n"); #endif free(t_base64EncodedSha1Digest); +#ifdef __cplusplus + t_base64EncodedSha1Digest = nullptr; +#else t_base64EncodedSha1Digest = NULL; +#endif } if (retransformLineBuf) { #ifdef DEBUG fprintf(stderr, "retransformLineBuf freed...\n"); #endif free(retransformLineBuf); +#ifdef __cplusplus + retransformLineBuf = nullptr; +#else retransformLineBuf = NULL; +#endif } if (retransformBuf) { #ifdef DEBUG fprintf(stderr, "retransformBuf freed...\n"); #endif free(retransformBuf); +#ifdef __cplusplus + retransformBuf = nullptr; +#else retransformBuf = NULL; +#endif } if (bzReadBuf) { #ifdef DEBUG fprintf(stderr, "bzReadBuf freed...\n"); #endif free(bzReadBuf); +#ifdef __cplusplus + bzReadBuf = nullptr; +#else bzReadBuf = NULL; +#endif } if (bzRemainderBuf) { #ifdef DEBUG fprintf(stderr, "bzRemainderBuf freed...\n"); #endif free(bzRemainderBuf); +#ifdef __cplusplus + bzRemainderBuf = nullptr; +#else bzRemainderBuf = NULL; +#endif } if (bzLineBuf) { #ifdef DEBUG fprintf(stderr, "bzLineBuf freed...\n"); #endif free(bzLineBuf); +#ifdef __cplusplus + bzLineBuf = nullptr; +#else bzLineBuf = NULL; +#endif } if (zOutBuffer) { #ifdef DEBUG fprintf(stderr, "zOutBuffer freed...\n"); #endif free(zOutBuffer); +#ifdef __cplusplus + zOutBuffer = nullptr; +#else zOutBuffer = NULL; +#endif } if (zReadBuf) { #ifdef DEBUG fprintf(stderr, "zReadBuf freed...\n"); #endif free(zReadBuf); +#ifdef __cplusplus + zReadBuf = nullptr; +#else zReadBuf = NULL; +#endif } if (zOutBuf) { #ifdef DEBUG fprintf(stderr, "zOutBuf freed...\n"); #endif free(zOutBuf); +#ifdef __cplusplus + zOutBuf = nullptr; +#else zOutBuf = NULL; +#endif } if (zRemainderBuf) { #ifdef DEBUG fprintf(stderr, "zRemainderBuf freed...\n"); #endif free(zRemainderBuf); +#ifdef __cplusplus + zRemainderBuf = nullptr; +#else zRemainderBuf = NULL; +#endif } if (zLineBuf) { #ifdef DEBUG fprintf(stderr, "zLineBuf freed...\n"); #endif free(zLineBuf); +#ifdef __cplusplus + zLineBuf = nullptr; +#else zLineBuf = NULL; +#endif } if (t_firstInputToken) { #ifdef DEBUG fprintf(stderr, "t_firstInputToken freed...\n"); #endif free(t_firstInputToken); +#ifdef __cplusplus + t_firstInputToken = nullptr; +#else t_firstInputToken = NULL; +#endif } if (t_secondInputToken) { #ifdef DEBUG fprintf(stderr, "t_secondInputToken freed...\n"); #endif free(t_secondInputToken); +#ifdef __cplusplus + t_secondInputToken = nullptr; +#else t_secondInputToken = NULL; +#endif } return STARCHCAT_EXIT_SUCCESS; @@ -2245,14 +2403,22 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT_rewriteInputRecordToOutput() ---\n"); #endif - FILE *inFp = inRec->fp; - Metadata *inMd = inRec->metadata; - CompressionType inType = inRec->type; +#ifdef __cplusplus + char *uncomprOutFn = nullptr; + char *comprOutFn = nullptr; + FILE *uncomprOutFnPtr = nullptr; + FILE *transformFnPtr = nullptr; + char *note = nullptr; +#else char *uncomprOutFn = NULL; char *comprOutFn = NULL; FILE *uncomprOutFnPtr = NULL; FILE *transformFnPtr = NULL; char *note = NULL; +#endif + FILE *inFp = inRec->fp; + Metadata *inMd = inRec->metadata; + CompressionType inType = inRec->type; /* extract input record to uncompressed file */ #ifdef __cplusplus @@ -2325,7 +2491,11 @@ /* cleanup */ fclose(uncomprOutFnPtr); +#ifdef __cplusplus + uncomprOutFnPtr = nullptr; +#else uncomprOutFnPtr = NULL; +#endif /* transform and recompress extracted, headerless data with new output type */ transformFnPtr = STARCH_fopen(uncomprOutFn, "rb"); @@ -2357,7 +2527,11 @@ /* cleanup */ fclose(transformFnPtr); +#ifdef __cplusplus + transformFnPtr = nullptr; +#else transformFnPtr = NULL; +#endif /* delete uncompressed/untransformed file */ if ( remove(uncomprOutFn) != 0 ) { @@ -2407,11 +2581,19 @@ #ifdef __cplusplus switch (fieldIdx) { case TOKEN_START_FIELD_INDEX: { +#ifdef __cplusplus + starts[inRecIdx] = static_cast( strtoll(reinterpret_cast( fieldBuf ), nullptr, STARCH_RADIX) ); +#else starts[inRecIdx] = static_cast( strtoll(reinterpret_cast( fieldBuf ), NULL, STARCH_RADIX) ); +#endif break; } case TOKEN_STOP_FIELD_INDEX: { +#ifdef __cplusplus + stops[inRecIdx] = static_cast( strtoll(reinterpret_cast( fieldBuf ), nullptr, STARCH_RADIX) ); +#else stops[inRecIdx] = static_cast( strtoll(reinterpret_cast( fieldBuf ), NULL, STARCH_RADIX) ); +#endif break; } default: @@ -2420,11 +2602,19 @@ #else switch (fieldIdx) { case TOKEN_START_FIELD_INDEX: { +#ifdef __cplusplus + starts[inRecIdx] = (SignedCoordType) strtoll((const char *)fieldBuf, nullptr, STARCH_RADIX); +#else starts[inRecIdx] = (SignedCoordType) strtoll((const char *)fieldBuf, NULL, STARCH_RADIX); +#endif break; } case TOKEN_STOP_FIELD_INDEX: { +#ifdef __cplusplus + stops[inRecIdx] = (SignedCoordType) strtoll((const char *)fieldBuf, nullptr, STARCH_RADIX); +#else stops[inRecIdx] = (SignedCoordType) strtoll((const char *)fieldBuf, NULL, STARCH_RADIX); +#endif break; } default: @@ -2572,7 +2762,11 @@ if (checkStopFlag == kStarchTrue) { +#ifdef __cplusplus + size_t *lowestStopMatches = nullptr; +#else size_t *lowestStopMatches = NULL; +#endif size_t lowestStopMatchesCapacity = 0; #ifdef __cplusplus lowestStopMatches = static_cast (malloc(numRecords * sizeof(*lowestStopMatches))); @@ -2618,7 +2812,11 @@ } free(lowestStopMatches); +#ifdef __cplusplus + lowestStopMatches = nullptr; +#else lowestStopMatches = NULL; +#endif } #ifdef DEBUG @@ -2707,31 +2905,68 @@ b. If all starch files are off-line, do the same, but quit afterwards -- we're done. */ - size_t inRecIdx = 0U; +#ifdef __cplusplus + char **extractionBuffers = nullptr; + size_t *nExtractionBuffers = nullptr; + int *extractionBufferOffsets = nullptr; + char **extractionRemainderBufs = nullptr; + size_t *nExtractionRemainderBufs = nullptr; + char *compressionBuffer = nullptr; + LineCountType *extractedLineCounts = nullptr; + char **extractedElements = nullptr; + SignedCoordType *starts = nullptr; + SignedCoordType *stops = nullptr; + char **remainders = nullptr; + Boolean *eobFlags = nullptr; + Boolean *eofFlags = nullptr; + FILE *inFp = nullptr; + BZFILE *bzOutFp = nullptr; + FILE **zInFps = nullptr; + BZFILE **bzInFps = nullptr; + z_stream *zInStreams = nullptr; + char *finalSignature = nullptr; + char *finalOutTagFn = nullptr; + MetadataRecord *inRecord = nullptr; + size_t *nBzReads = nullptr; + size_t *nZReads = nullptr; + TransformState **transformStates = nullptr; + char *retransformedOutputBuffer = nullptr; + TransformState *outputRetransformState = nullptr; +#else char **extractionBuffers = NULL; size_t *nExtractionBuffers = NULL; int *extractionBufferOffsets = NULL; char **extractionRemainderBufs = NULL; size_t *nExtractionRemainderBufs = NULL; char *compressionBuffer = NULL; - LineCountType compressionLineCount = 0; LineCountType *extractedLineCounts = NULL; char **extractedElements = NULL; SignedCoordType *starts = NULL; SignedCoordType *stops = NULL; char **remainders = NULL; - size_t remainderCapacity = TOKENS_MAX_LENGTH + 1; - size_t lowestStartElementIdx = 0U; Boolean *eobFlags = NULL; Boolean *eofFlags = NULL; - Boolean allEOF = kStarchFalse; FILE *inFp = NULL; - FILE *outFp = stdout; BZFILE *bzOutFp = NULL; FILE **zInFps = NULL; - z_stream zOutStream; BZFILE **bzInFps = NULL; z_stream *zInStreams = NULL; + char *finalSignature = NULL; + char *finalOutTagFn = NULL; + MetadataRecord *inRecord = NULL; + size_t *nBzReads = NULL; + size_t *nZReads = NULL; + TransformState **transformStates = NULL; + char *retransformedOutputBuffer = NULL; + TransformState *outputRetransformState = NULL; +#endif + size_t inRecIdx = 0U; + LineCountType compressionLineCount = 0; + size_t remainderCapacity = TOKENS_MAX_LENGTH + 1; + size_t lowestStartElementIdx = 0U; + Boolean allEOF = kStarchFalse; + FILE *outFp = stdout; + z_stream zOutStream; CompressionType inType = kUndefined; uint64_t bzOutBytesConsumed = 0; uint64_t bzOutBytesWritten = 0; @@ -2742,14 +2977,6 @@ BaseCountType finalTotalUniqueBases = 0; Boolean finalDuplicateElementExists = STARCH_DEFAULT_DUPLICATE_ELEMENT_FLAG_VALUE; Boolean finalNestedElementExists = STARCH_DEFAULT_NESTED_ELEMENT_FLAG_VALUE; - char *finalSignature = NULL; - char *finalOutTagFn = NULL; - MetadataRecord *inRecord = NULL; - size_t *nBzReads = NULL; - size_t *nZReads = NULL; - TransformState **transformStates = NULL; - char *retransformedOutputBuffer = NULL; - TransformState *outputRetransformState = NULL; Boolean flushZStreamFlag = kStarchFalse; size_t nCompressionBuffer = STARCHCAT_RETRANSFORM_LINE_COUNT_MAX * TOKENS_MAX_LENGTH + 1; int lowestElementRes = STARCHCAT_EXIT_SUCCESS; @@ -2757,7 +2984,11 @@ /* hash variables */ struct sha1_ctx r_perChromosomeHashCtx; unsigned char r_sha1Digest[STARCH2_MD_FOOTER_SHA1_LENGTH]; +#ifdef __cplusplus + char *r_base64EncodedSha1Digest = nullptr; +#else char *r_base64EncodedSha1Digest = NULL; +#endif /* setup */ #ifdef __cplusplus @@ -3008,7 +3239,11 @@ outputRetransformState->r_lastPosition = 0; outputRetransformState->r_totalNonUniqueBases = 0; outputRetransformState->r_totalUniqueBases = 0; +#ifdef __cplusplus + outputRetransformState->r_signature = nullptr; +#else outputRetransformState->r_signature = NULL; +#endif outputRetransformState->r_lineMaxStringLength = STARCH_DEFAULT_LINE_STRING_LENGTH; outputRetransformState->r_duplicateElementExists = STARCH_DEFAULT_DUPLICATE_ELEMENT_FLAG_VALUE; outputRetransformState->r_nestedElementExists = STARCH_DEFAULT_NESTED_ELEMENT_FLAG_VALUE; @@ -3324,19 +3559,35 @@ if (STARCHCAT2_testSummaryForChromosomeExistence(inChr, summary, inRecIdx) == STARCHCAT_EXIT_SUCCESS) { if (extractionBuffers[inRecIdx]) { free(extractionBuffers[inRecIdx]); +#ifdef __cplusplus + extractionBuffers[inRecIdx] = nullptr; +#else extractionBuffers[inRecIdx] = NULL; +#endif } if (extractedElements[inRecIdx]) { free(extractedElements[inRecIdx]); +#ifdef __cplusplus + extractedElements[inRecIdx] = nullptr; +#else extractedElements[inRecIdx] = NULL; +#endif } if (extractionRemainderBufs[inRecIdx]) { free(extractionRemainderBufs[inRecIdx]); +#ifdef __cplusplus + extractionRemainderBufs[inRecIdx] = nullptr; +#else extractionRemainderBufs[inRecIdx] = NULL; +#endif } if (remainders[inRecIdx]) { free(remainders[inRecIdx]); +#ifdef __cplusplus + remainders[inRecIdx] = nullptr; +#else remainders[inRecIdx] = NULL; +#endif } inRecord = *(summary->records) + inRecIdx; inType = inRecord->type; /* get record type of input stream */ @@ -3364,95 +3615,187 @@ } if (extractionBuffers) { free(extractionBuffers); +#ifdef __cplusplus + extractionBuffers = nullptr; +#else extractionBuffers = NULL; +#endif } if (nExtractionBuffers) { free(nExtractionBuffers); +#ifdef __cplusplus + nExtractionBuffers = nullptr; +#else nExtractionBuffers = NULL; +#endif } if (extractionBufferOffsets) { free(extractionBufferOffsets); +#ifdef __cplusplus + extractionBufferOffsets = nullptr; +#else extractionBufferOffsets = NULL; +#endif } if (compressionBuffer) { free(compressionBuffer); +#ifdef __cplusplus + compressionBuffer = nullptr; +#else compressionBuffer = NULL; +#endif } if (zInFps) { free(zInFps); +#ifdef __cplusplus + zInFps = nullptr; +#else zInFps = NULL; +#endif } if (extractedLineCounts) { free(extractedLineCounts); +#ifdef __cplusplus + extractedLineCounts = nullptr; +#else extractedLineCounts = NULL; +#endif } if (extractedElements) { free(extractedElements); +#ifdef __cplusplus + extractedElements = nullptr; +#else extractedElements = NULL; +#endif } if (eobFlags) { free(eobFlags); +#ifdef __cplusplus + eobFlags = nullptr; +#else eobFlags = NULL; +#endif } if (eofFlags) { free(eofFlags); +#ifdef __cplusplus + eofFlags = nullptr; +#else eofFlags = NULL; +#endif } if (starts) { free(starts); - starts = NULL; +#ifdef __cplusplus + starts = nullptr; +#else + starts = NULL; +#endif } if (stops) { free(stops); +#ifdef __cplusplus + stops = nullptr; +#else stops = NULL; +#endif } if (remainders) { free(remainders); +#ifdef __cplusplus + remainders = nullptr; +#else remainders = NULL; +#endif } if (transformStates) { free(transformStates); +#ifdef __cplusplus + transformStates = nullptr; +#else transformStates = NULL; +#endif } if (extractionRemainderBufs) { free(extractionRemainderBufs); +#ifdef __cplusplus + extractionRemainderBufs = nullptr; +#else extractionRemainderBufs = NULL; +#endif } if (nExtractionRemainderBufs) { free(nExtractionRemainderBufs); +#ifdef __cplusplus + nExtractionRemainderBufs = nullptr; +#else nExtractionRemainderBufs = NULL; +#endif } if (bzInFps) { free(bzInFps); +#ifdef __cplusplus + bzInFps = nullptr; +#else bzInFps = NULL; +#endif } if (nBzReads) { free(nBzReads); +#ifdef __cplusplus + nBzReads = nullptr; +#else nBzReads = NULL; +#endif } if (zInStreams) { free(zInStreams); +#ifdef __cplusplus + zInStreams = nullptr; +#else zInStreams = NULL; +#endif } if (nZReads) { free(nZReads); +#ifdef __cplusplus + nZReads = nullptr; +#else nZReads = NULL; +#endif } if (retransformedOutputBuffer) { free(retransformedOutputBuffer); +#ifdef __cplusplus + retransformedOutputBuffer = nullptr; +#else retransformedOutputBuffer = NULL; +#endif } if (outputRetransformState) { free(outputRetransformState); +#ifdef __cplusplus + outputRetransformState = nullptr; +#else outputRetransformState = NULL; +#endif } if (finalOutTagFn) { free(finalOutTagFn); +#ifdef __cplusplus + finalOutTagFn = nullptr; +#else finalOutTagFn = NULL; +#endif } if (r_base64EncodedSha1Digest) { free(r_base64EncodedSha1Digest); +#ifdef __cplusplus + r_base64EncodedSha1Digest = nullptr; +#else r_base64EncodedSha1Digest = NULL; +#endif } return STARCHCAT_EXIT_SUCCESS; @@ -3472,19 +3815,39 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT_mergeInputRecordsToOutput() ---\n"); #endif +#ifdef __cplusplus + MetadataRecord *inRec = nullptr; + char *tempOutFn = nullptr; + char **tempOutFns = nullptr; + FILE *tempOutFp = nullptr; + FILE **tempOutFps = nullptr; + char **lineBuffers = nullptr; + SignedCoordType *starts = nullptr; + SignedCoordType *stops = nullptr; + int *lowestStartIdxs = nullptr; + char *uncomprOutFn = nullptr; + FILE *uncomprOutFnPtr = nullptr; + FILE *transformFnPtr = nullptr; + char *note = nullptr; +#else MetadataRecord *inRec = NULL; char *tempOutFn = NULL; char **tempOutFns = NULL; FILE *tempOutFp = NULL; FILE **tempOutFps = NULL; - unsigned int inRecIdx; - unsigned int allEOFFlag = 0U; char **lineBuffers = NULL; - unsigned int bufferIdx; - int c; SignedCoordType *starts = NULL; SignedCoordType *stops = NULL; int *lowestStartIdxs = NULL; + char *uncomprOutFn = NULL; + FILE *uncomprOutFnPtr = NULL; + FILE *transformFnPtr = NULL; + char *note = NULL; +#endif + unsigned int inRecIdx; + unsigned int allEOFFlag = 0U; + unsigned int bufferIdx; + int c; unsigned int lsiIdx, lsiTestIdx; SignedCoordType lowestStart; SignedCoordType lowestStop; @@ -3492,10 +3855,6 @@ unsigned long fieldIdx; char fieldBuffer[STARCHCAT_FIELD_BUFFER_MAX_LENGTH]; unsigned int fieldBufferIdx; - char *uncomprOutFn = NULL; - FILE *uncomprOutFnPtr = NULL; - FILE *transformFnPtr = NULL; - char *note = NULL; /* Set up temporary output streams, which will contain uncompressed, @@ -3679,8 +4038,13 @@ */ for (inRecIdx = 0U; inRecIdx < summary->numRecords; inRecIdx++) { fieldIdx = 0U; +#ifdef __cplusplus + if (lineBuffers[inRecIdx] == nullptr) + continue; +#else if (lineBuffers[inRecIdx] == NULL) continue; +#endif for (bufferIdx = 0U, fieldBufferIdx = 0U; bufferIdx < strlen(lineBuffers[inRecIdx]); bufferIdx++, fieldBufferIdx++) { fieldBuffer[fieldBufferIdx] = lineBuffers[inRecIdx][bufferIdx]; if (fieldBuffer[fieldBufferIdx] == '\t') { @@ -3689,9 +4053,9 @@ fieldBufferIdx = static_cast( -1 ); fieldIdx++; if (fieldIdx == 2) - starts[inRecIdx] = static_cast( strtoll(fieldBuffer, NULL, 10) ); + starts[inRecIdx] = static_cast( strtoll(fieldBuffer, nullptr, 10) ); else if (fieldIdx == 3) - stops[inRecIdx] = static_cast( strtoll(fieldBuffer, NULL, 10) ); + stops[inRecIdx] = static_cast( strtoll(fieldBuffer, nullptr, 10) ); else if (fieldIdx > 3) break; #else @@ -3713,8 +4077,13 @@ */ lsiIdx = 0U; for (inRecIdx = 0U; inRecIdx < summary->numRecords; inRecIdx++) { +#ifdef __cplusplus + if (lineBuffers[inRecIdx] == nullptr) + continue; +#else if (lineBuffers[inRecIdx] == NULL) continue; +#endif if (starts[inRecIdx] < lowestStart) { lowestStart = starts[inRecIdx]; lsiIdx = 0U; @@ -3771,7 +4140,11 @@ while ( (c = fgetc(tempOutFps[lsiIdx])) ) { if (c == EOF) { free(lineBuffers[lsiIdx]); +#ifdef __cplusplus + lineBuffers[lsiIdx] = nullptr; +#else lineBuffers[lsiIdx] = NULL; +#endif break; } #ifdef __cplusplus @@ -3804,7 +4177,11 @@ while ( (c = fgetc(tempOutFps[lowestStopIdx])) ) { if (c == EOF) { free(lineBuffers[lowestStopIdx]); +#ifdef __cplusplus + lineBuffers[lowestStopIdx] = nullptr; +#else lineBuffers[lowestStopIdx] = NULL; +#endif break; } #ifdef __cplusplus @@ -3823,7 +4200,11 @@ */ allEOFFlag = 1; for (inRecIdx = 0U; inRecIdx < summary->numRecords; inRecIdx++) { +#ifdef __cplusplus + if (lineBuffers[inRecIdx] != nullptr) { +#else if (lineBuffers[inRecIdx] != NULL) { +#endif allEOFFlag = 0; break; } @@ -3905,7 +4286,11 @@ #endif fclose(transformFnPtr); +#ifdef __cplusplus + transformFnPtr = nullptr; +#else transformFnPtr = NULL; +#endif /* Delete uncompressed (untransformed) file as we no longer need it. @@ -3933,15 +4318,25 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT_mergeChromosomeStreams() ---\n"); #endif - unsigned int chrIdx = 0U; +#ifdef __cplusplus + ChromosomeSummary *summary = nullptr; + MetadataRecord *inputRecord = nullptr; + Metadata *headOutputMd = nullptr; + Metadata *outputMd = nullptr; + char *outputTag = nullptr; + char *inputChr = nullptr; + char *dynamicMdBuffer = nullptr; +#else ChromosomeSummary *summary = NULL; - CompressionType inputType; MetadataRecord *inputRecord = NULL; Metadata *headOutputMd = NULL; Metadata *outputMd = NULL; char *outputTag = NULL; char *inputChr = NULL; char *dynamicMdBuffer = NULL; +#endif + unsigned int chrIdx = 0U; + CompressionType inputType; Boolean firstOutputMd = kStarchTrue; Boolean hFlag = kStarchFalse; /* starchcat does not currently support headers */ @@ -4123,7 +4518,11 @@ } free(*chrs); +#ifdef __cplusplus + *chrs = nullptr; +#else *chrs = NULL; +#endif return STARCHCAT_EXIT_SUCCESS; } @@ -4144,7 +4543,11 @@ STARCHCAT_freeChromosomeSummary( &((*chrSums)->summary), (const unsigned int) (*chrSums)->numChromosomes ); #endif free(*chrSums); +#ifdef __cplusplus + *chrSums = nullptr; +#else *chrSums = NULL; +#endif return STARCHCAT_EXIT_SUCCESS; } @@ -4161,16 +4564,20 @@ #ifdef __cplusplus *chrSums = static_cast( malloc( sizeof(ChromosomeSummaries) * numChromosomes ) ); + if (*chrSums == nullptr) { + fprintf(stderr, "ERROR: Could not allocate space for chromosome summaries.\n"); + return STARCHCAT_EXIT_FAILURE; + } + (*chrSums)->summary = nullptr; #else *chrSums = malloc( sizeof(ChromosomeSummaries) * numChromosomes ); -#endif - if (*chrSums == NULL) { fprintf(stderr, "ERROR: Could not allocate space for chromosome summaries.\n"); return STARCHCAT_EXIT_FAILURE; } - (*chrSums)->summary = NULL; +#endif + (*chrSums)->numChromosomes = 0U; return STARCHCAT_EXIT_SUCCESS; @@ -4204,12 +4611,19 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT_printChromosomeSummaries() ---\n"); #endif - unsigned int chrIdx = 0U; - unsigned int recIdx = 0U; +#ifdef __cplusplus + ChromosomeSummary *summary = nullptr; + MetadataRecord **recs = nullptr; + MetadataRecord *mdRecord = nullptr; + Metadata *iter, *md = nullptr; +#else ChromosomeSummary *summary = NULL; MetadataRecord **recs = NULL; MetadataRecord *mdRecord = NULL; Metadata *iter, *md = NULL; +#endif + unsigned int chrIdx = 0U; + unsigned int recIdx = 0U; if (!chrSums) return STARCHCAT_EXIT_FAILURE; @@ -4224,11 +4638,13 @@ mdRecord = recs[recIdx]; #ifdef __cplusplus md = static_cast( mdRecord->metadata ); + /* loop through Metadata * to look for matching chromosome */ + for (iter = md; iter != nullptr; iter = iter->next) { #else md = (Metadata *) mdRecord->metadata; -#endif /* loop through Metadata * to look for matching chromosome */ for (iter = md; iter != NULL; iter = iter->next) { +#endif #ifdef DEBUG fprintf(stderr, "COMPARING [%s] chromosome iter [%s] vs summary [%s]\n", mdRecord->filename, iter->chromosome, summary->chromosome); #endif @@ -4289,11 +4705,18 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT_freeChromosomeSummary() ---\n"); #endif - unsigned int chrIdx = 0U; +#ifdef __cplusplus + ChromosomeSummary *summaryInstance = nullptr; + + if (*summary == nullptr) + return STARCHCAT_EXIT_SUCCESS; +#else ChromosomeSummary *summaryInstance = NULL; if (*summary == NULL) return STARCHCAT_EXIT_SUCCESS; +#endif + unsigned int chrIdx = 0U; for (chrIdx = 0U; chrIdx < numChromosomes; chrIdx++) { summaryInstance = *summary + chrIdx; @@ -4302,7 +4725,11 @@ #endif if (summaryInstance->chromosome) { free( summaryInstance->chromosome ); +#ifdef __cplusplus + summaryInstance->chromosome = nullptr; +#else summaryInstance->chromosome = NULL; +#endif } if (summaryInstance->records) if ( STARCHCAT_freeMetadataRecords(summaryInstance->records, summaryInstance->numRecords) != STARCHCAT_EXIT_SUCCESS ) @@ -4318,10 +4745,18 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT_allocChromosomeSummary() ---\n"); #endif - unsigned int chrIdx = 0U; +#ifdef __cplusplus + ChromosomeSummary *instance = nullptr; +#else ChromosomeSummary *instance = NULL; +#endif + unsigned int chrIdx = 0U; +#ifdef __cplusplus + if (*summary != nullptr) { +#else if (*summary != NULL) { +#endif fprintf(stderr, "ERROR: Chromosome summary is not empty.\n"); return STARCHCAT_EXIT_FAILURE; } @@ -4332,10 +4767,18 @@ #ifdef __cplusplus *summary = static_cast( malloc( sizeof(ChromosomeSummary) * numChromosomes ) ); + if (*summary == nullptr) { + fprintf(stderr, "ERROR: Could not allocate space for chromosome summary.\n"); + return STARCHCAT_EXIT_FAILURE; + } + for (chrIdx = 0U; chrIdx < numChromosomes; chrIdx++) { + instance = *summary + chrIdx; + instance->chromosome = nullptr; + instance->records = nullptr; + instance->numRecords = 0U; + } #else *summary = malloc( sizeof(ChromosomeSummary) * numChromosomes ); -#endif - if (*summary == NULL) { fprintf(stderr, "ERROR: Could not allocate space for chromosome summary.\n"); return STARCHCAT_EXIT_FAILURE; @@ -4346,6 +4789,7 @@ instance->records = NULL; instance->numRecords = 0U; } +#endif return STARCHCAT_EXIT_SUCCESS; } @@ -4356,11 +4800,15 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT_buildChromosomeSummary() ---\n"); #endif +#ifdef __cplusplus + Metadata *iter, *md = nullptr; +#else + Metadata *iter, *md = NULL; +#endif unsigned int numHits; unsigned int chrIdx; unsigned int recIdx; unsigned int hitIdx; - Metadata *iter, *md = NULL; ChromosomeSummary *instance; for (chrIdx = 0U; chrIdx < numChromosomes; chrIdx++) { @@ -4372,7 +4820,11 @@ instance->chromosome = STARCH_strdup( *(chromosomes + chrIdx) ); for (recIdx = 0U; recIdx < numRecords; recIdx++) { md = (mdRecords + recIdx)->metadata; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif #ifdef DEBUG fprintf(stderr, "\tcomparing [%s] against [record %u | %s]...\n", instance->chromosome, recIdx, iter->chromosome); #endif @@ -4395,10 +4847,18 @@ #endif instance->numRecords = numHits; +#ifdef __cplusplus + if (instance->records != nullptr) { +#else if (instance->records != NULL) { +#endif for (recIdx = 0U, hitIdx = 0U; recIdx < numRecords; recIdx++) { md = (mdRecords + recIdx)->metadata; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) +#else for (iter = md; iter != NULL; iter = iter->next) +#endif if (strcmp(instance->chromosome, iter->chromosome) == 0) { #ifdef DEBUG fprintf(stderr, "\treferencing metadata record idx %u -> hit idx %u\n", recIdx, hitIdx); @@ -4430,7 +4890,11 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT_copyMetadataRecord() ---\n"); #endif +#ifdef __cplusplus + MetadataRecord *copy = nullptr; +#else MetadataRecord *copy = NULL; +#endif #ifdef __cplusplus copy = static_cast( malloc(sizeof(MetadataRecord)) ); @@ -4456,13 +4920,21 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT_buildUniqueChromosomeList() ---\n"); #endif - unsigned int idx = 0U; - size_t uninitIdx = 0U; +#ifdef __cplusplus + Metadata *iter, *md = nullptr; + char **chr = nullptr; + char **chrCopy = nullptr; + char **sortedChr = nullptr; + char **sortedUniqChr = nullptr; +#else Metadata *iter, *md = NULL; char **chr = NULL; char **chrCopy = NULL; char **sortedChr = NULL; char **sortedUniqChr = NULL; +#endif + unsigned int idx = 0U; + size_t uninitIdx = 0U; size_t totalChr = 1; size_t currChr = 1; unsigned int allSortedChr = 0; @@ -4475,7 +4947,11 @@ #ifdef DEBUG fprintf(stderr, "\t%s\n", (mdRecords + idx)->filename); #endif +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next, currChr++) { +#else for (iter = md; iter != NULL; iter = iter->next, currChr++) { +#endif if (currChr == totalChr) { totalChr *= 2; #ifdef __cplusplus @@ -4488,8 +4964,13 @@ return STARCHCAT_EXIT_FAILURE; } chr = chrCopy; - for (uninitIdx = totalChr - 1; uninitIdx >= currChr; uninitIdx--) + for (uninitIdx = totalChr - 1; uninitIdx >= currChr; uninitIdx--) { +#ifdef __cplusplus + *(chr + uninitIdx) = nullptr; +#else *(chr + uninitIdx) = NULL; +#endif + } } #ifdef DEBUG fprintf(stderr, "\t\t(%zu | %zu) %-25s\n", totalChr, currChr, iter->chromosome); @@ -4541,18 +5022,30 @@ *numChr = allSortedChr; /* delete temporary chromosome list */ +#ifdef __cplusplus + if (chr != nullptr) { +#else if (chr != NULL) { +#endif for (idx = 0U; idx < currChr; idx++) { if (*(chr + idx)) { #ifdef DEBUG fprintf(stderr, "\tfreeing temporary chromosome... %s\n", *(chr + idx)); #endif free( *(chr + idx) ); +#ifdef __cplusplus + *(chr + idx) = nullptr; +#else *(chr + idx) = NULL; +#endif } } free(chr); +#ifdef __cplusplus + chr = nullptr; +#else chr = NULL; +#endif } return STARCHCAT_EXIT_SUCCESS; @@ -4580,10 +5073,18 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT_allocMetadataRecords() ---\n"); #endif - unsigned int recIdx = 0U; +#ifdef __cplusplus + MetadataRecord *instance = nullptr; +#else MetadataRecord *instance = NULL; +#endif + unsigned int recIdx = 0U; +#ifdef __cplusplus + if (*mdRecords != nullptr) { +#else if (*mdRecords != NULL) { +#endif fprintf(stderr, "ERROR: Metadata records are not empty.\n"); return STARCHCAT_EXIT_FAILURE; } @@ -4598,18 +5099,29 @@ *mdRecords = malloc( sizeof(MetadataRecord) * numRecords ); #endif +#ifdef __cplusplus + if (*mdRecords == nullptr) { +#else if (*mdRecords == NULL) { +#endif fprintf(stderr, "ERROR: Could not allocate space for metadata records.\n"); return STARCHCAT_EXIT_FAILURE; } for (recIdx = 0U; recIdx < numRecords; recIdx++) { - instance = *mdRecords + recIdx; +#ifdef __cplusplus + instance->metadata = nullptr; + instance->filename = nullptr; + instance->fp = nullptr; + instance->av = nullptr; +#else instance->metadata = NULL; instance->filename = NULL; instance->fp = NULL; + instance->av = NULL; +#endif + instance = *mdRecords + recIdx; instance->type = STARCH_DEFAULT_COMPRESSION_TYPE; instance->hFlag = kStarchFalse; - instance->av = NULL; } return STARCHCAT_EXIT_SUCCESS; @@ -4621,8 +5133,12 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT_freeMetadataRecords() ---\n"); #endif - unsigned int recIdx = 0U; +#ifdef __cplusplus + MetadataRecord *instance = nullptr; +#else MetadataRecord *instance = NULL; +#endif + unsigned int recIdx = 0U; if (! *mdRecords) { return STARCHCAT_EXIT_SUCCESS; @@ -4636,23 +5152,43 @@ instance = *mdRecords + recIdx; if (instance->filename) { free(instance->filename); +#ifdef __cplusplus + instance->filename = nullptr; +#else instance->filename = NULL; +#endif } if (instance->metadata) { STARCH_freeMetadata( &(instance->metadata) ); +#ifdef __cplusplus + instance->metadata = nullptr; +#else instance->metadata = NULL; +#endif } if (instance->fp) { fclose(instance->fp); +#ifdef __cplusplus + instance->fp = nullptr; +#else instance->fp = NULL; +#endif } if (instance->av) { free(instance->av); +#ifdef __cplusplus + instance->av = nullptr; +#else instance->av = NULL; +#endif } if (instance->cTime) { free(instance->cTime); +#ifdef __cplusplus + instance->cTime = nullptr; +#else instance->cTime = NULL; +#endif } } } @@ -4670,24 +5206,37 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT_buildMetadataRecords() ---\n"); #endif - unsigned int idx = 0U; - unsigned int realIdx = 0U; +#ifdef __cplusplus + FILE *inFilePtr = nullptr; + char *inFile = nullptr; + Metadata *md = nullptr; + ArchiveVersion *version = nullptr; + char *creationTimestamp = nullptr; + char *cTime = nullptr; + char *note = nullptr; + MetadataRecord *mdRecord = nullptr; + json_t *mdJSON = nullptr; + struct tm *creationTimeInformation = nullptr; +#else FILE *inFilePtr = NULL; char *inFile = NULL; Metadata *md = NULL; - CompressionType inType = STARCH_DEFAULT_COMPRESSION_TYPE; ArchiveVersion *version = NULL; char *creationTimestamp = NULL; char *cTime = NULL; char *note = NULL; + MetadataRecord *mdRecord = NULL; + json_t *mdJSON = NULL; + struct tm *creationTimeInformation = NULL; +#endif + unsigned int idx = 0U; + unsigned int realIdx = 0U; + CompressionType inType = STARCH_DEFAULT_COMPRESSION_TYPE; uint64_t mdOffset = 0; Boolean hFlag = kStarchFalse; - MetadataRecord *mdRecord = NULL; const Boolean suppressErrorMsgs = kStarchFalse; /* i.e., we want to see error messages */ const Boolean preserveJSONRef = kStarchTrue; - json_t *mdJSON = NULL; time_t creationTime; - struct tm *creationTimeInformation = NULL; size_t creationTimestampLength = STARCH_CREATION_TIMESTAMP_LENGTH; unsigned int numGzipRecs = 0U; @@ -4700,15 +5249,18 @@ mdRecord = (*mdRecords + realIdx); /* reset */ - inFilePtr = NULL; #ifdef __cplusplus + inFilePtr = nullptr; inFile = const_cast( argv[idx] ); + md = nullptr; + version = nullptr; #else + inFilePtr = NULL; inFile = (char *) argv[idx]; -#endif md = NULL; - inType = STARCH_DEFAULT_COMPRESSION_TYPE; version = NULL; +#endif + inType = STARCH_DEFAULT_COMPRESSION_TYPE; hFlag = kStarchFalse; /* debug */ @@ -4814,7 +5366,11 @@ } strncpy(cTime, creationTimestamp, strlen(creationTimestamp) + 1); free(creationTimestamp); +#ifdef __cplusplus + creationTimestamp = nullptr; +#else creationTimestamp = NULL; +#endif } mdRecord->cTime = cTime; @@ -4851,6 +5407,16 @@ } /* cleanup */ +#ifdef __cplusplus + if (md) { + STARCH_freeMetadata(&md); + md = nullptr; + } + if (version) { + free(version); + version = nullptr; + } +#else if (md) { STARCH_freeMetadata(&md); md = NULL; @@ -4859,6 +5425,7 @@ free(version); version = NULL; } +#endif } return STARCHCAT_EXIT_SUCCESS; @@ -4894,7 +5461,11 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT_printUsage() ---\n"); #endif +#ifdef __cplusplus + char *avStr = nullptr; +#else char *avStr = NULL; +#endif #ifdef __cplusplus avStr = static_cast( malloc (STARCH_ARCHIVE_VERSION_STRING_LENGTH) ); @@ -4926,7 +5497,11 @@ #ifdef DEBUG fprintf (stderr, "\n--- STARCHCAT_printRevision() ---\n"); #endif +#ifdef __cplusplus + char *avStr = nullptr; +#else char *avStr = NULL; +#endif #ifdef __cplusplus avStr = static_cast( malloc (STARCH_ARCHIVE_VERSION_STRING_LENGTH) ); @@ -4934,7 +5509,11 @@ avStr = malloc (STARCH_ARCHIVE_VERSION_STRING_LENGTH); #endif +#ifdef __cplusplus + if (avStr != nullptr) { +#else if (avStr != NULL) { +#endif int result = sprintf (avStr, "%d.%d.%d", STARCH_MAJOR_VERSION, STARCH_MINOR_VERSION, STARCH_REVISION_VERSION); if (result != -1) { fprintf(stderr, "%s\n binary version: %s (creates archive version: %s)\n", name, BEDOPS::version(), avStr); @@ -5072,8 +5651,15 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCHCAT_checkMetadataJSONVersions() ---\n"); #endif - unsigned int idx; - json_t *mdJSON; +#ifdef __cplusplus + json_t *streamArchive = nullptr; + json_t *streamArchiveVersion = nullptr; + const char *jsonObjKey = nullptr; + json_t *jsonObjValue = nullptr; + const char *jsonObjAvKey = nullptr; + json_t *jsonObjAvValue = nullptr; + ArchiveVersion *av = nullptr; +#else json_t *streamArchive = NULL; json_t *streamArchiveVersion = NULL; const char *jsonObjKey = NULL; @@ -5081,6 +5667,9 @@ const char *jsonObjAvKey = NULL; json_t *jsonObjAvValue = NULL; ArchiveVersion *av = NULL; +#endif + unsigned int idx; + json_t *mdJSON; #ifdef __cplusplus av = static_cast( malloc (sizeof(ArchiveVersion)) ); @@ -5102,32 +5691,43 @@ streamArchive = json_object_get(mdJSON, STARCH_METADATA_STREAM_ARCHIVE_KEY); if (streamArchive) { +#ifdef __cplusplus json_object_foreach(streamArchive, jsonObjKey, jsonObjValue) { if (strcmp(jsonObjKey, STARCH_METADATA_STREAM_ARCHIVE_VERSION_KEY) == 0) { streamArchiveVersion = json_object_get(streamArchive, STARCH_METADATA_STREAM_ARCHIVE_VERSION_KEY); json_object_foreach(streamArchiveVersion, jsonObjAvKey, jsonObjAvValue) { -#ifdef __cplusplus if ( strcmp(jsonObjAvKey, STARCH_METADATA_STREAM_ARCHIVE_VERSION_MAJOR_KEY) == 0) av->major = static_cast( json_integer_value(jsonObjAvValue) ); else if ( strcmp(jsonObjAvKey, STARCH_METADATA_STREAM_ARCHIVE_VERSION_MINOR_KEY) == 0) av->minor = static_cast( json_integer_value(jsonObjAvValue) ); else if ( strcmp(jsonObjAvKey, STARCH_METADATA_STREAM_ARCHIVE_VERSION_REVISION_KEY) == 0) av->revision = static_cast( json_integer_value(jsonObjAvValue) ); + } + streamArchiveVersion = nullptr; + } + } + streamArchive = nullptr; #else + json_object_foreach(streamArchive, jsonObjKey, jsonObjValue) + { + if (strcmp(jsonObjKey, STARCH_METADATA_STREAM_ARCHIVE_VERSION_KEY) == 0) { + streamArchiveVersion = json_object_get(streamArchive, STARCH_METADATA_STREAM_ARCHIVE_VERSION_KEY); + json_object_foreach(streamArchiveVersion, jsonObjAvKey, jsonObjAvValue) + { if ( strcmp(jsonObjAvKey, STARCH_METADATA_STREAM_ARCHIVE_VERSION_MAJOR_KEY) == 0) av->major = (int) json_integer_value(jsonObjAvValue); else if ( strcmp(jsonObjAvKey, STARCH_METADATA_STREAM_ARCHIVE_VERSION_MINOR_KEY) == 0) av->minor = (int) json_integer_value(jsonObjAvValue); else if ( strcmp(jsonObjAvKey, STARCH_METADATA_STREAM_ARCHIVE_VERSION_REVISION_KEY) == 0) av->revision = (int) json_integer_value(jsonObjAvValue); -#endif } streamArchiveVersion = NULL; } } streamArchive = NULL; +#endif } else { fprintf(stderr, "ERROR: Could not retrieve stream archive object from metadata JSON string\n"); @@ -5143,7 +5743,11 @@ return kStarchFalse; } json_decref(mdJSON); +#ifdef __cplusplus + mdJSON = nullptr; +#else mdJSON = NULL; +#endif } return kStarchTrue; @@ -5155,24 +5759,37 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCHCAT2_mergeChromosomeStreams() ---\n"); #endif +#ifdef __cplusplus + char *outputTag = nullptr; + ChromosomeSummary *summary = nullptr; + MetadataRecord *inputRecord = nullptr; + char *inputChr = nullptr; + Metadata *outputMd = nullptr; + Metadata *headOutputMd = nullptr; + char *dynamicMdBuffer = nullptr; + char *dynamicMdBufferCopy = nullptr; + char *base64EncodedSha1Digest = nullptr; + ArchiveVersion *av120 = nullptr; +#else char *outputTag = NULL; - unsigned int chrIdx = 0U; ChromosomeSummary *summary = NULL; - CompressionType inputType; MetadataRecord *inputRecord = NULL; char *inputChr = NULL; Metadata *outputMd = NULL; Metadata *headOutputMd = NULL; - Boolean firstOutputMdFlag = kStarchTrue; - Boolean hFlag = kStarchFalse; /* starchcat does not currently support headers */ char *dynamicMdBuffer = NULL; char *dynamicMdBufferCopy = NULL; - unsigned char sha1Digest[STARCH2_MD_FOOTER_SHA1_LENGTH] = {0}; char *base64EncodedSha1Digest = NULL; + ArchiveVersion *av120 = NULL; +#endif + unsigned int chrIdx = 0U; + CompressionType inputType; + Boolean firstOutputMdFlag = kStarchTrue; + Boolean hFlag = kStarchFalse; /* starchcat does not currently support headers */ + unsigned char sha1Digest[STARCH2_MD_FOOTER_SHA1_LENGTH] = {0}; char footerCumulativeRecordSizeBuffer[STARCH2_MD_FOOTER_CUMULATIVE_RECORD_SIZE_LENGTH + 1] = {0}; char footerRemainderBuffer[STARCH2_MD_FOOTER_REMAINDER_LENGTH + 1] = {0}; char footerBuffer[STARCH2_MD_FOOTER_LENGTH + 1] = {0}; - ArchiveVersion *av120 = NULL; int footerCumulativeRecordSizeBufferCharsCopied = -1; if (!chrSums) { @@ -5470,15 +6087,27 @@ /* cleanup */ if (dynamicMdBuffer) { free(dynamicMdBuffer); +#ifdef __cplusplus + dynamicMdBuffer = nullptr; +#else dynamicMdBuffer = NULL; +#endif } if (base64EncodedSha1Digest) { free(base64EncodedSha1Digest); +#ifdef __cplusplus + base64EncodedSha1Digest = nullptr; +#else base64EncodedSha1Digest = NULL; +#endif } if (av120) { free(av120); +#ifdef __cplusplus + av120 = nullptr; +#else av120 = NULL; +#endif } return STARCHCAT_EXIT_SUCCESS; @@ -5536,9 +6165,15 @@ int zError; z_stream *zStreamPtr = zStream; +#ifdef __cplusplus + zStreamPtr->zalloc = nullptr; + zStreamPtr->zfree = nullptr; + zStreamPtr->opaque = nullptr; +#else zStreamPtr->zalloc = Z_NULL; zStreamPtr->zfree = Z_NULL; zStreamPtr->opaque = Z_NULL; +#endif /* cf. http://www.zlib.net/manual.html for level information */ #ifdef __cplusplus @@ -5580,16 +6215,27 @@ fprintf(stderr, "\n--- STARCHCAT2_testSummaryForChromosomeExistence() ---\n"); #endif +#ifdef __cplusplus + MetadataRecord *rec = nullptr; + MetadataRecord **recs = nullptr; + Metadata *md = nullptr; + Metadata *iter = nullptr; +#else MetadataRecord *rec = NULL; MetadataRecord **recs = NULL; Metadata *md = NULL; Metadata *iter = NULL; +#endif recs = chrSummary->records; rec = recs[recIndex]; md = rec->metadata; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif if (strcmp(iter->chromosome, chrName) == 0) return STARCHCAT_EXIT_SUCCESS; } @@ -5604,11 +6250,18 @@ fprintf(stderr, "\n--- STARCHCAT2_setupInitialFileOffsets() ---\n"); #endif - uint64_t offset = 0; +#ifdef __cplusplus + MetadataRecord *rec = nullptr; + MetadataRecord **recs = nullptr; + Metadata *md = nullptr; + Metadata *iter = nullptr; +#else MetadataRecord *rec = NULL; MetadataRecord **recs = NULL; Metadata *md = NULL; Metadata *iter = NULL; +#endif + uint64_t offset = 0; recs = chrSummary->records; rec = recs[recIndex]; @@ -5618,7 +6271,12 @@ else if (rec->av->major == 1) offset = rec->mdOffset; md = rec->metadata; + +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif if (strcmp(iter->chromosome, chrName) == 0) break; else @@ -5641,16 +6299,36 @@ fprintf(stderr, "\n--- STARCHCAT2_setupBzip2InputStream() ---\n"); #endif +#ifdef __cplusplus + MetadataRecord **inRecs = nullptr; + MetadataRecord *inRec = nullptr; + FILE *inFp = nullptr; +#else MetadataRecord **inRecs = NULL; MetadataRecord *inRec = NULL; FILE *inFp = NULL; +#endif int bzError = BZ_OK; inRecs = chrSummary->records; inRec = inRecs[recIdx]; inFp = inRec->fp; - *bzStream = BZ2_bzReadOpen(&bzError, inFp, STARCH_BZ_VERBOSITY, STARCH_BZ_SMALL, NULL, 0); +#ifdef __cplusplus + *bzStream = BZ2_bzReadOpen(&bzError, + inFp, + STARCH_BZ_VERBOSITY, + STARCH_BZ_SMALL, + nullptr, + 0); +#else + *bzStream = BZ2_bzReadOpen(&bzError, + inFp, + STARCH_BZ_VERBOSITY, + STARCH_BZ_SMALL, + NULL, + 0); +#endif if (!*bzStream) { fprintf(stderr, "ERROR: Could not instantiate BZFILE pointer\n"); @@ -5694,11 +6372,18 @@ int zError = Z_OK; +#ifdef __cplusplus + zStream->zalloc = nullptr; + zStream->zfree = nullptr; + zStream->opaque = nullptr; + zStream->next_in = nullptr; +#else zStream->zalloc = Z_NULL; zStream->zfree = Z_NULL; zStream->opaque = Z_NULL; - zStream->avail_in = 0; zStream->next_in = Z_NULL; +#endif + zStream->avail_in = 0; /* cf. http://www.zlib.net/manual.html for level information */ zError = inflateInit2(zStream, (15+32)); @@ -5822,9 +6507,15 @@ return STARCHCAT_EXIT_FAILURE; } +#ifdef __cplusplus + zStreamPtr->zalloc = nullptr; + zStreamPtr->zfree = nullptr; + zStreamPtr->opaque = nullptr; +#else zStreamPtr->zalloc = Z_NULL; zStreamPtr->zfree = Z_NULL; zStreamPtr->opaque = Z_NULL; +#endif return STARCHCAT_EXIT_SUCCESS; } @@ -5840,11 +6531,19 @@ return STARCHCAT_EXIT_SUCCESS; char *finalBuffer = extractionBuffer; +#ifdef __cplusplus + unsigned char *bzReadBuf = nullptr; +#else unsigned char *bzReadBuf = NULL; +#endif size_t nBzReadBuf = 1024*1024/8; size_t bzBufIndex = 0; int bzError = BZ_OK; +#ifdef __cplusplus + unsigned char *bzLineBuf = nullptr; +#else unsigned char *bzLineBuf = NULL; +#endif size_t bzCharIndex = 0; static const char tab = '\t'; @@ -5865,11 +6564,16 @@ size_t *t_nExtractionBuffer = &t_state->t_nExtractionBuffer; size_t *t_nExtractionBufferPos = &t_state->t_nExtractionBufferPos; +#ifdef __cplusplus + unsigned char *retransformedLineBuffer = nullptr; + char *resizedExtractionBuffer = nullptr; +#else unsigned char *retransformedLineBuffer = NULL; + char *resizedExtractionBuffer = NULL; +#endif int64_t nRetransformedLineBuffer = 0; int64_t nRetransformedLineBufferPosition = 0; size_t nResizedExtractionBuffer = 0U; - char *resizedExtractionBuffer = NULL; if (!*bzStream) { fprintf(stderr, "ERROR: Bzip2 stream is NULL. Something went wrong setting up extraction!\n"); @@ -6090,17 +6794,29 @@ /* cleanup */ if (bzReadBuf) { free(bzReadBuf); +#ifdef __cplusplus + bzReadBuf = nullptr; +#else bzReadBuf = NULL; +#endif } if (bzLineBuf) { free(bzLineBuf); +#ifdef __cplusplus + bzLineBuf = nullptr; +#else bzLineBuf = NULL; +#endif } if (retransformedLineBuffer) { free(retransformedLineBuffer); +#ifdef __cplusplus + retransformedLineBuffer = nullptr; +#else retransformedLineBuffer = NULL; +#endif } #ifdef DEBUG @@ -6117,12 +6833,18 @@ fprintf(stderr, "\n--- STARCHCAT2_fillExtractionBufferFromGzipStream() ---\n"); #endif +#ifdef __cplusplus + unsigned char *zInBuf = nullptr; + unsigned char *zReadBuf = nullptr; + unsigned char *zLineBuf = nullptr; +#else unsigned char *zInBuf = NULL; unsigned char *zReadBuf = NULL; + unsigned char *zLineBuf = NULL; +#endif int zError = Z_OK; size_t zCharIndex = 0; size_t zBufIndex = 0; - unsigned char *zLineBuf = NULL; static const char tab = '\t'; LineCountType *t_lineIdxPtr = &t_state->t_lineIdx; @@ -6142,12 +6864,17 @@ size_t *t_nExtractionBuffer = &t_state->t_nExtractionBuffer; size_t *t_nExtractionBufferPos = &t_state->t_nExtractionBufferPos; - char *extractionBufferStart = extractionBuffer; +#ifdef __cplusplus + unsigned char *retransformedLineBuffer = nullptr; + char *resizedExtractionBuffer = nullptr; +#else unsigned char *retransformedLineBuffer = NULL; + char *resizedExtractionBuffer = NULL; +#endif + char *extractionBufferStart = extractionBuffer; int64_t nRetransformedLineBuffer = 0; int64_t nRetransformedLineBufferPosition = 0; size_t nResizedExtractionBuffer = 0U; - char *resizedExtractionBuffer = NULL; #ifdef DEBUG fprintf(stderr, "ALLOC in STARCHCAT2_fillExtractionBufferFromGzipStream()\n"); @@ -6226,10 +6953,17 @@ #endif if (zStream->avail_in == 0) { +#ifdef __cplusplus + free(zInBuf); + zInBuf = nullptr; + free(zReadBuf); + zReadBuf = nullptr; +#else free(zInBuf); zInBuf = NULL; free(zReadBuf); zReadBuf = NULL; +#endif *eofFlag = kStarchTrue; return STARCHCAT_EXIT_SUCCESS; } @@ -6410,6 +7144,22 @@ #endif /* cleanup */ +#ifdef __cplusplus + if (zInBuf) { + free(zInBuf); + zInBuf = nullptr; + } + + if (zReadBuf) { + free(zReadBuf); + zReadBuf = nullptr; + } + + if (retransformedLineBuffer) { + free(retransformedLineBuffer); + retransformedLineBuffer = nullptr; + } +#else if (zInBuf) { free(zInBuf); zInBuf = NULL; @@ -6424,6 +7174,7 @@ free(retransformedLineBuffer); retransformedLineBuffer = NULL; } +#endif return STARCHCAT_EXIT_SUCCESS; } @@ -6513,7 +7264,7 @@ } #ifdef __cplusplus - result = static_cast( strtoll(startStr, NULL, STARCH_RADIX) ); + result = static_cast( strtoll(startStr, nullptr, STARCH_RADIX) ); #else result = (SignedCoordType) strtoll(startStr, NULL, STARCH_RADIX); #endif @@ -6531,7 +7282,7 @@ *start = result; #ifdef __cplusplus - result = static_cast( strtoll(stopStr, NULL, STARCH_RADIX) ); + result = static_cast( strtoll(stopStr, nullptr, STARCH_RADIX) ); #else result = (SignedCoordType) strtoll(stopStr, NULL, STARCH_RADIX); #endif @@ -6607,7 +7358,7 @@ } #ifdef __cplusplus - result = static_cast( strtoll(startStr, NULL, STARCH_RADIX) ); + result = static_cast( strtoll(startStr, nullptr, STARCH_RADIX) ); #else result = (SignedCoordType) strtoll(startStr, NULL, STARCH_RADIX); #endif @@ -6625,7 +7376,7 @@ *start = result; #ifdef __cplusplus - result = static_cast( strtoll(stopStr, NULL, STARCH_RADIX) ); + result = static_cast( strtoll(stopStr, nullptr, STARCH_RADIX) ); #else result = (SignedCoordType) strtoll(stopStr, NULL, STARCH_RADIX); #endif @@ -6669,13 +7420,13 @@ fprintf(stderr, "\n--- STARCHCAT2_transformCompressionBuffer() ---\n"); #endif -#if CLANG_COMPILER +#if HAS_GNU == 0 #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpointer-bool-conversion" #endif if ((!retransState->r_chromosome) || (strlen(retransState->r_chromosome) == 0)) return STARCH_EXIT_FAILURE; -#if CLANG_COMPILER +#if HAS_GNU == 0 #pragma clang diagnostic pop #endif @@ -6823,6 +7574,16 @@ } } +#ifdef __cplusplus + if (retransChromosome) { + free(retransChromosome); + retransChromosome = nullptr; + } + if (retransRemainder) { + free(retransRemainder); + retransRemainder = nullptr; + } +#else if (retransChromosome) { free(retransChromosome); retransChromosome = NULL; @@ -6831,6 +7592,7 @@ free(retransRemainder); retransRemainder = NULL; } +#endif return STARCH_EXIT_SUCCESS; } diff -Nru bedops-2.4.35+dfsg/applications/bed/starch/src/starchcat.h bedops-2.4.36+dfsg/applications/bed/starch/src/starchcat.h --- bedops-2.4.35+dfsg/applications/bed/starch/src/starchcat.h 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/starch/src/starchcat.h 2019-05-23 20:06:31.000000000 +0000 @@ -57,8 +57,11 @@ #define STARCHCAT_RETRANSFORM_BUFFER_SIZE 1024*1024 #define STARCHCAT_FIELD_BUFFER_MAX_LENGTH 16 -#define GCC_COMPILER (defined(__GNUC__) && !defined(__clang__)) -#define CLANG_COMPILER defined(__clang__) +#if defined(__GNUC__) && !defined(__clang__) +#define HAS_GNU 1 +#else +#define HAS_GNU 0 +#endif /* This is simply a struct containing a starch file's @@ -177,6 +180,18 @@ LineCountType reportProgressN; } starchcat_client_global_args; +#ifdef __cplusplus +static struct option starchcat_client_long_options[] = { + {"note", required_argument, nullptr, 'n'}, + {"bzip2", no_argument, nullptr, 'b'}, + {"gzip", no_argument, nullptr, 'g'}, + {"omit-signature", no_argument, nullptr, 'o'}, + {"report-progress", required_argument, nullptr, 'r'}, + {"version", no_argument, nullptr, 'v'}, + {"help", no_argument, nullptr, 'h'}, + {nullptr, no_argument, nullptr, 0 } +}; +#else static struct option starchcat_client_long_options[] = { {"note", required_argument, NULL, 'n'}, {"bzip2", no_argument, NULL, 'b'}, @@ -187,6 +202,7 @@ {"help", no_argument, NULL, 'h'}, {NULL, no_argument, NULL, 0 } }; +#endif static const char *starchcat_client_opt_string = "n:bgorvh?"; diff -Nru bedops-2.4.35+dfsg/applications/bed/starch/src/starchcluster_gnuParallel.tcsh bedops-2.4.36+dfsg/applications/bed/starch/src/starchcluster_gnuParallel.tcsh --- bedops-2.4.35+dfsg/applications/bed/starch/src/starchcluster_gnuParallel.tcsh 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/starch/src/starchcluster_gnuParallel.tcsh 2019-05-23 20:06:31.000000000 +0000 @@ -2,7 +2,7 @@ # author : sjn and apr # date : Feb 2012 -# version : v2.4.35 +# version : v2.4.36 # # BEDOPS diff -Nru bedops-2.4.35+dfsg/applications/bed/starch/src/starchcluster_sge.tcsh bedops-2.4.36+dfsg/applications/bed/starch/src/starchcluster_sge.tcsh --- bedops-2.4.35+dfsg/applications/bed/starch/src/starchcluster_sge.tcsh 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/starch/src/starchcluster_sge.tcsh 2019-05-23 20:06:31.000000000 +0000 @@ -2,7 +2,7 @@ # author : sjn and apr # date : Feb 2012 -# version : v2.4.35 +# version : v2.4.36 # # BEDOPS diff -Nru bedops-2.4.35+dfsg/applications/bed/starch/src/starchcluster_slurm.tcsh bedops-2.4.36+dfsg/applications/bed/starch/src/starchcluster_slurm.tcsh --- bedops-2.4.35+dfsg/applications/bed/starch/src/starchcluster_slurm.tcsh 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/starch/src/starchcluster_slurm.tcsh 2019-05-23 20:06:31.000000000 +0000 @@ -2,7 +2,7 @@ # author : sjn and apr # date : 13 Sep 2016 -# version : v2.4.35 +# version : v2.4.36 # # BEDOPS diff -Nru bedops-2.4.35+dfsg/applications/bed/starch/src/starch-diff.py bedops-2.4.36+dfsg/applications/bed/starch/src/starch-diff.py --- bedops-2.4.35+dfsg/applications/bed/starch/src/starch-diff.py 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/starch/src/starch-diff.py 2019-05-23 20:06:31.000000000 +0000 @@ -32,7 +32,7 @@ name = "starch-diff" citation = " citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract" authors = " authors: Alex Reynolds and Shane Neph" -version = " version: 2.4.35" +version = " version: 2.4.36" usage = " $ starch-diff [ --chr ] starch-file-1 starch-file-2 [ starch-file-3 ... ]" help = """ The 'starch-diff' utility compares the signatures of two or more specified diff -Nru bedops-2.4.35+dfsg/applications/bed/starch/src/starch.h bedops-2.4.36+dfsg/applications/bed/starch/src/starch.h --- bedops-2.4.35+dfsg/applications/bed/starch/src/starch.h 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/starch/src/starch.h 2019-05-23 20:06:31.000000000 +0000 @@ -83,17 +83,31 @@ size_t numberInputFiles; } starch_client_global_args; +#ifdef __cplusplus static struct option starch_client_long_options[] = { - {"note", required_argument, NULL, 'n'}, - {"bzip2", no_argument, NULL, 'b'}, - {"gzip", no_argument, NULL, 'g'}, - {"omit-signature", no_argument, NULL, 'o'}, - {"report-progress", required_argument, NULL, 'r'}, - {"header", no_argument, NULL, 'e'}, - {"version", no_argument, NULL, 'v'}, - {"help", no_argument, NULL, 'h'}, - {NULL, no_argument, NULL, 0 } + {"note", required_argument, nullptr, 'n'}, + {"bzip2", no_argument, nullptr, 'b'}, + {"gzip", no_argument, nullptr, 'g'}, + {"omit-signature", no_argument, nullptr, 'o'}, + {"report-progress", required_argument, nullptr, 'r'}, + {"header", no_argument, nullptr, 'e'}, + {"version", no_argument, nullptr, 'v'}, + {"help", no_argument, nullptr, 'h'}, + {nullptr, no_argument, nullptr, 0 } }; +#else +static struct option starch_client_long_options[] = { + {"note", required_argument, NULL, 'n'}, + {"bzip2", no_argument, NULL, 'b'}, + {"gzip", no_argument, NULL, 'g'}, + {"omit-signature", no_argument, NULL, 'o'}, + {"report-progress", required_argument, NULL, 'r'}, + {"header", no_argument, NULL, 'e'}, + {"version", no_argument, NULL, 'v'}, + {"help", no_argument, NULL, 'h'}, + {NULL, no_argument, NULL, 0 } +}; +#endif static const char *starch_client_opt_string = "n:bgorevh?"; diff -Nru bedops-2.4.35+dfsg/applications/bed/starch/src/starchstrip.c bedops-2.4.36+dfsg/applications/bed/starch/src/starchstrip.c --- bedops-2.4.35+dfsg/applications/bed/starch/src/starchstrip.c 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/starch/src/starchstrip.c 2019-05-23 20:06:31.000000000 +0000 @@ -83,10 +83,14 @@ #ifdef DEBUG fprintf(stderr, "--- STARCHSTRIP_write_updated_metadata() - enter ---\n"); #endif - +#ifdef __cplusplus + char *md_json_buffer = nullptr; + char *base64_encoded_sha1_digest = nullptr; +#else char *md_json_buffer = NULL; - unsigned char sha1_digest[STARCH2_MD_FOOTER_SHA1_LENGTH] = {0}; char *base64_encoded_sha1_digest = NULL; +#endif + unsigned char sha1_digest[STARCH2_MD_FOOTER_SHA1_LENGTH] = {0}; char footer_cumulative_record_size_buffer[STARCH2_MD_FOOTER_CUMULATIVE_RECORD_SIZE_LENGTH + 1] = {0}; char footer_remainder_buffer[STARCH2_MD_FOOTER_REMAINDER_LENGTH + 1] = {0}; char footer_buffer[STARCH2_MD_FOOTER_LENGTH + 1] = {0}; @@ -100,7 +104,11 @@ md_json_buffer = STARCH_generateJSONMetadata(starchstrip_globals.output_records, starchstrip_globals.archive_type, starchstrip_globals.archive_version, +#ifdef __cplusplus + nullptr, +#else NULL, +#endif starchstrip_globals.archive_note, starchstrip_globals.archive_header_flag); if (!md_json_buffer) { @@ -141,10 +149,17 @@ fflush(os); /* cleanup */ +#ifdef __cplusplus + free(md_json_buffer); + md_json_buffer = nullptr; + free(base64_encoded_sha1_digest); + base64_encoded_sha1_digest = nullptr; +#else free(md_json_buffer); md_json_buffer = NULL; free(base64_encoded_sha1_digest); base64_encoded_sha1_digest = NULL; +#endif #ifdef DEBUG fprintf(stderr, "--- STARCHSTRIP_write_updated_metadata() - exit ---\n"); @@ -157,9 +172,13 @@ #ifdef DEBUG fprintf(stderr, "--- STARCHSTRIP_write_chromosome_streams() - enter ---\n"); #endif - +#ifdef __cplusplus + Metadata* iter = nullptr; + Metadata* output_records_tail = nullptr; +#else Metadata* iter = NULL; Metadata* output_records_tail = NULL; +#endif size_t chr_to_process_idx = 0; uint64_t start_offset = 0; uint64_t bytes_to_copy = 0; @@ -169,7 +188,11 @@ if (starchstrip_globals.archive_version->major == 2) { start_offset += STARCH2_MD_HEADER_BYTE_LENGTH; +#ifdef __cplusplus + for (iter = starchstrip_globals.archive_records; iter != nullptr; iter = iter->next) { +#else for (iter = starchstrip_globals.archive_records; iter != NULL; iter = iter->next) { +#endif if ((starchstrip_globals.exclusion_flag) && (strcmp(iter->chromosome, starchstrip_globals.chromosomes_to_process[chr_to_process_idx]) == 0)) { continue; } @@ -293,7 +316,11 @@ #endif if (starchstrip_globals.archive_version->major == 2) { +#ifdef __cplusplus + unsigned char* archive_header = nullptr; +#else unsigned char* archive_header = NULL; +#endif if (STARCH2_initializeStarchHeader(&archive_header) != STARCH_EXIT_SUCCESS) { fprintf(stderr, "Error: Could not initialize output archive header\n"); exit(EIO); /* Input/output error (POSIX.1) */ @@ -303,7 +330,11 @@ exit(EIO); /* Input/output error (POSIX.1) */ } free(archive_header); +#ifdef __cplusplus + archive_header = nullptr; +#else archive_header = NULL; +#endif starchstrip_globals.cumulative_output_size += STARCH2_MD_HEADER_BYTE_LENGTH; } else { @@ -322,8 +353,11 @@ #ifdef DEBUG fprintf(stderr, "--- STARCHSTRIP_check_chromosome_stream_names() - enter ---\n"); #endif - +#ifdef __cplusplus + Metadata* iter = nullptr; +#else Metadata* iter = NULL; +#endif size_t chr_idx = 0; size_t chr_to_process_idx = 0; size_t num_records = 0; @@ -333,12 +367,20 @@ // loop through input metadata records, compare against chromosome name array if (starchstrip_globals.archive_version->major == 2) { // full count +#ifdef __cplusplus + for (iter = starchstrip_globals.archive_records; iter != nullptr; iter = iter->next) { +#else for (iter = starchstrip_globals.archive_records; iter != NULL; iter = iter->next) { +#endif num_records++; } // inclusion if (starchstrip_globals.inclusion_flag) { +#ifdef __cplusplus + for (iter = starchstrip_globals.archive_records; iter != nullptr; iter = iter->next) { +#else for (iter = starchstrip_globals.archive_records; iter != NULL; iter = iter->next) { +#endif while (strcmp(iter->chromosome, starchstrip_globals.chromosomes[chr_idx]) > 0) { chr_idx++; if (chr_idx == starchstrip_globals.chromosomes_num) { @@ -369,15 +411,22 @@ starchstrip_globals.chromosomes_to_process_num = num_records_to_include; #ifdef __cplusplus starchstrip_globals.chromosomes_to_process = static_cast( malloc(sizeof(char*) * starchstrip_globals.chromosomes_to_process_num) ); + for (chr_to_process_idx = 0; chr_to_process_idx < starchstrip_globals.chromosomes_to_process_num; ++chr_to_process_idx) { + starchstrip_globals.chromosomes_to_process[chr_to_process_idx] = nullptr; + } #else starchstrip_globals.chromosomes_to_process = malloc(sizeof(char*) * starchstrip_globals.chromosomes_to_process_num); -#endif for (chr_to_process_idx = 0; chr_to_process_idx < starchstrip_globals.chromosomes_to_process_num; ++chr_to_process_idx) { starchstrip_globals.chromosomes_to_process[chr_to_process_idx] = NULL; } +#endif chr_idx = 0; chr_to_process_idx = 0; +#ifdef __cplusplus + for (iter = starchstrip_globals.archive_records; iter != nullptr; iter = iter->next) { +#else for (iter = starchstrip_globals.archive_records; iter != NULL; iter = iter->next) { +#endif while (strcmp(iter->chromosome, starchstrip_globals.chromosomes[chr_idx]) > 0) { chr_idx++; if (chr_idx == starchstrip_globals.chromosomes_num) { @@ -409,7 +458,11 @@ // exclusion else if (starchstrip_globals.exclusion_flag) { +#ifdef __cplusplus + for (iter = starchstrip_globals.archive_records; iter != nullptr; iter = iter->next) { +#else for (iter = starchstrip_globals.archive_records; iter != NULL; iter = iter->next) { +#endif while (strcmp(iter->chromosome, starchstrip_globals.chromosomes[chr_idx]) > 0) { chr_idx++; if (chr_idx == starchstrip_globals.chromosomes_num) { @@ -440,15 +493,22 @@ starchstrip_globals.chromosomes_to_process_num = num_records_to_exclude; #ifdef __cplusplus starchstrip_globals.chromosomes_to_process = static_cast( malloc(sizeof(char*) * starchstrip_globals.chromosomes_to_process_num) ); + for (chr_idx = 0; chr_idx < starchstrip_globals.chromosomes_to_process_num; ++chr_idx) { + starchstrip_globals.chromosomes_to_process[chr_idx] = nullptr; + } #else starchstrip_globals.chromosomes_to_process = malloc(sizeof(char*) * starchstrip_globals.chromosomes_to_process_num); -#endif for (chr_idx = 0; chr_idx < starchstrip_globals.chromosomes_to_process_num; ++chr_idx) { starchstrip_globals.chromosomes_to_process[chr_idx] = NULL; } +#endif chr_idx = 0; chr_to_process_idx = 0; +#ifdef __cplusplus + for (iter = starchstrip_globals.archive_records; iter != nullptr; iter = iter->next) { +#else for (iter = starchstrip_globals.archive_records; iter != NULL; iter = iter->next) { +#endif while (strcmp(iter->chromosome, starchstrip_globals.chromosomes[chr_idx]) > 0) { chr_idx++; if (chr_idx == starchstrip_globals.chromosomes_num) { @@ -605,13 +665,16 @@ #ifdef __cplusplus starchstrip_globals.chromosomes_num = static_cast( delimiters_found + 1 ); starchstrip_globals.chromosomes = static_cast( malloc(sizeof(char*) * starchstrip_globals.chromosomes_num) ); + for (size_t chr_idx = 0; chr_idx < starchstrip_globals.chromosomes_num; ++chr_idx) { + starchstrip_globals.chromosomes[chr_idx] = nullptr; + } #else starchstrip_globals.chromosomes_num = (size_t) delimiters_found + 1; starchstrip_globals.chromosomes = malloc(sizeof(char*) * starchstrip_globals.chromosomes_num); -#endif for (size_t chr_idx = 0; chr_idx < starchstrip_globals.chromosomes_num; ++chr_idx) { starchstrip_globals.chromosomes[chr_idx] = NULL; } +#endif /* populate chromosome name array */ size_t start = 0; @@ -671,24 +734,38 @@ fprintf(stderr, "--- STARCHSTRIP_init_globals() - enter ---\n"); #endif +#ifdef __cplusplus + starchstrip_globals.chromosomes_str = nullptr; + starchstrip_globals.chromosomes = nullptr; + starchstrip_globals.chromosomes_to_process = nullptr; + starchstrip_globals.output_records = nullptr; + starchstrip_globals.archive_fn = nullptr; + starchstrip_globals.archive_metadata_json = nullptr; + starchstrip_globals.archive_fp = nullptr; + starchstrip_globals.archive_records = nullptr; + starchstrip_globals.archive_version = nullptr; + starchstrip_globals.archive_timestamp = nullptr; + starchstrip_globals.archive_note = nullptr; +#else starchstrip_globals.chromosomes_str = NULL; starchstrip_globals.chromosomes = NULL; - starchstrip_globals.chromosomes_num = 0; starchstrip_globals.chromosomes_to_process = NULL; - starchstrip_globals.chromosomes_to_process_num = 0; - starchstrip_globals.inclusion_flag = kStarchFalse; - starchstrip_globals.exclusion_flag = kStarchFalse; - starchstrip_globals.cumulative_output_size = 0; starchstrip_globals.output_records = NULL; - // -- starchstrip_globals.archive_fn = NULL; starchstrip_globals.archive_metadata_json = NULL; starchstrip_globals.archive_fp = NULL; starchstrip_globals.archive_records = NULL; - starchstrip_globals.archive_type = STARCH_DEFAULT_COMPRESSION_TYPE; starchstrip_globals.archive_version = NULL; starchstrip_globals.archive_timestamp = NULL; starchstrip_globals.archive_note = NULL; +#endif + starchstrip_globals.chromosomes_num = 0; + starchstrip_globals.chromosomes_to_process_num = 0; + starchstrip_globals.inclusion_flag = kStarchFalse; + starchstrip_globals.exclusion_flag = kStarchFalse; + starchstrip_globals.cumulative_output_size = 0; + // -- + starchstrip_globals.archive_type = STARCH_DEFAULT_COMPRESSION_TYPE; starchstrip_globals.archive_metadata_offset = UINT64_C(0); starchstrip_globals.archive_header_flag = kStarchFalse; starchstrip_globals.archive_suppress_error_msgs = kStarchTrue; @@ -706,6 +783,53 @@ fprintf(stderr, "--- STARCHSTRIP_delete_globals() - enter ---\n"); #endif +#ifdef __cplusplus + for (size_t idx = 0; idx < starchstrip_globals.chromosomes_num; ++idx) { + free(starchstrip_globals.chromosomes[idx]); + starchstrip_globals.chromosomes[idx] = nullptr; + } + free(starchstrip_globals.chromosomes); + starchstrip_globals.chromosomes = nullptr; + starchstrip_globals.chromosomes_num = 0; + + free(starchstrip_globals.chromosomes_str); + starchstrip_globals.chromosomes_str = nullptr; + + for (size_t idx = 0; idx < starchstrip_globals.chromosomes_to_process_num; ++idx) { + free(starchstrip_globals.chromosomes_to_process[idx]); + starchstrip_globals.chromosomes_to_process[idx] = nullptr; + } + free(starchstrip_globals.chromosomes_to_process); + starchstrip_globals.chromosomes_to_process = nullptr; + starchstrip_globals.chromosomes_to_process_num = 0; + + free(starchstrip_globals.archive_fn); + starchstrip_globals.archive_fn = nullptr; + if (starchstrip_globals.archive_metadata_json) { + json_decref(starchstrip_globals.archive_metadata_json); + starchstrip_globals.archive_metadata_json = nullptr; + } + if (starchstrip_globals.archive_fp) { + fclose(starchstrip_globals.archive_fp); + starchstrip_globals.archive_fp = nullptr; + } + if (starchstrip_globals.archive_records) { + STARCH_freeMetadata(&starchstrip_globals.archive_records); + starchstrip_globals.archive_records = nullptr; + } + if (starchstrip_globals.archive_version) { + free(starchstrip_globals.archive_version); + starchstrip_globals.archive_version = nullptr; + } + if (starchstrip_globals.archive_timestamp) { + free(starchstrip_globals.archive_timestamp); + starchstrip_globals.archive_timestamp = nullptr; + } + if (starchstrip_globals.archive_note) { + free(starchstrip_globals.archive_note); + starchstrip_globals.archive_note = nullptr; + } +#else for (size_t idx = 0; idx < starchstrip_globals.chromosomes_num; ++idx) { free(starchstrip_globals.chromosomes[idx]); starchstrip_globals.chromosomes[idx] = NULL; @@ -751,6 +875,7 @@ free(starchstrip_globals.archive_note); starchstrip_globals.archive_note = NULL; } +#endif STARCH_freeMetadata(&starchstrip_globals.output_records); diff -Nru bedops-2.4.35+dfsg/applications/bed/starch/src/starchstrip.h bedops-2.4.36+dfsg/applications/bed/starch/src/starchstrip.h --- bedops-2.4.35+dfsg/applications/bed/starch/src/starchstrip.h 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/starch/src/starchstrip.h 2019-05-23 20:06:31.000000000 +0000 @@ -93,6 +93,15 @@ Boolean archive_preserve_json_ref; } starchstrip_globals; +#ifdef __cplusplus +static struct option starchstrip_long_options[] = { + { "include", required_argument, nullptr, 'i' }, + { "exclude", required_argument, nullptr, 'x' }, + { "version", no_argument, nullptr, 'v' }, + { "help", no_argument, nullptr, 'h' }, + { nullptr, no_argument, nullptr, 0 } +}; +#else static struct option starchstrip_long_options[] = { { "include", required_argument, NULL, 'i' }, { "exclude", required_argument, NULL, 'x' }, @@ -100,6 +109,7 @@ { "help", no_argument, NULL, 'h' }, { NULL, no_argument, NULL, 0 } }; +#endif static const char *starchstrip_opt_string = "i:x:vh?"; diff -Nru bedops-2.4.35+dfsg/applications/bed/starch/src/unstarch.c bedops-2.4.36+dfsg/applications/bed/starch/src/unstarch.c --- bedops-2.4.35+dfsg/applications/bed/starch/src/unstarch.c 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/bed/starch/src/unstarch.c 2019-05-23 20:06:31.000000000 +0000 @@ -60,9 +60,18 @@ #ifdef DEBUG fprintf(stderr, "\n--- unstarch main() enter ---\n"); #endif - int resultValue = 0; - int parseValue = 0; - CompressionType type = STARCH_DEFAULT_COMPRESSION_TYPE; +#ifdef __cplusplus + char *archiveTimestamp = nullptr; + char *note = nullptr; + char *whichChromosome = nullptr; + char *inFile = nullptr; + char *option = nullptr; + FILE *inFilePtr = nullptr; + Metadata *records = nullptr; + ArchiveVersion *archiveVersion = nullptr; + json_t *metadataJSON = nullptr; + char *jsonString = nullptr; +#else char *archiveTimestamp = NULL; char *note = NULL; char *whichChromosome = NULL; @@ -71,13 +80,17 @@ FILE *inFilePtr = NULL; Metadata *records = NULL; ArchiveVersion *archiveVersion = NULL; + json_t *metadataJSON = NULL; + char *jsonString = NULL; +#endif + int resultValue = 0; + int parseValue = 0; + CompressionType type = STARCH_DEFAULT_COMPRESSION_TYPE; uint64_t metadataOffset = UINT64_C(0); Boolean headerFlag = kStarchFalse; Boolean showNewlineFlag = kStarchTrue; - json_t *metadataJSON = NULL; const Boolean suppressErrorMsgs = kStarchFalse; /* we want to see error messages */ const Boolean preserveJSONRef = kStarchFalse; /* we generally do not want to preserve JSON reference */ - char *jsonString = NULL; unsigned char mdHashBuffer[STARCH2_MD_FOOTER_SHA1_LENGTH + 1] = {0}; Boolean signatureVerificationFlag = kStarchFalse; @@ -315,15 +328,19 @@ STARCH_SHA1_All(reinterpret_cast( reinterpret_cast( jsonString ) ), strlen(jsonString), mdHashBuffer); + free(jsonString); + jsonString = nullptr; + json_decref(metadataJSON); + metadataJSON = nullptr; #else STARCH_SHA1_All((const unsigned char *) jsonString, strlen(jsonString), mdHashBuffer); -#endif free(jsonString); jsonString = NULL; json_decref(metadataJSON); metadataJSON = NULL; +#endif } else { fprintf(stderr, "ERROR: Could not encode JSON structure into string representation\n"); @@ -349,7 +366,27 @@ UNSTARCH_printUsage(EXIT_FAILURE); return EXIT_FAILURE; } - if (STARCH_listJSONMetadata(NULL, NULL, records, type, archiveVersion, archiveTimestamp, note, headerFlag, showNewlineFlag) != STARCH_EXIT_SUCCESS) { +#ifdef __cplusplus + if (STARCH_listJSONMetadata(nullptr, + nullptr, + records, + type, + archiveVersion, + archiveTimestamp, + note, + headerFlag, + showNewlineFlag) != STARCH_EXIT_SUCCESS) { +#else + if (STARCH_listJSONMetadata(NULL, + NULL, + records, + type, + archiveVersion, + archiveTimestamp, + note, + headerFlag, + showNewlineFlag) != STARCH_EXIT_SUCCESS) { +#endif fprintf(stderr, "ERROR: Metadata extraction failed\n"); resultValue = EXIT_FAILURE; UNSTARCH_printUsage(EXIT_FAILURE); @@ -367,7 +404,7 @@ case kBzip2: { #ifdef __cplusplus if (UNSTARCH_extractDataWithBzip2(&inFilePtr, - NULL, + nullptr, whichChromosome, reinterpret_cast( records ), static_cast( metadataOffset ), @@ -388,7 +425,7 @@ case kGzip: { #ifdef __cplusplus if (UNSTARCH_extractDataWithGzip(&inFilePtr, - NULL, + nullptr, whichChromosome, reinterpret_cast( records ), static_cast( metadataOffset ), @@ -418,7 +455,7 @@ case kBzip2: { #ifdef __cplusplus if (UNSTARCH_extractDataWithBzip2(&inFilePtr, - NULL, + nullptr, whichChromosome, reinterpret_cast( records ), static_cast( sizeof(starchRevision2HeaderBytes) ), @@ -439,7 +476,7 @@ case kGzip: { #ifdef __cplusplus if (UNSTARCH_extractDataWithGzip(&inFilePtr, - NULL, + nullptr, whichChromosome, reinterpret_cast( records ), static_cast( sizeof(starchRevision2HeaderBytes) ), @@ -884,10 +921,17 @@ fprintf(stderr, "\n--- UNSTARCH_parseCommandLineInputs() ---\n"); #endif +#ifdef __cplusplus + char *hdr1 = nullptr; + char *ftr1 = nullptr; + char *hdr2 = nullptr; + char *ftr2 = nullptr; +#else char *hdr1 = NULL; char *ftr1 = NULL; char *hdr2 = NULL; char *ftr2 = NULL; +#endif #ifdef DEBUG fprintf(stderr, "\targc: %d\n", argc); @@ -1061,7 +1105,11 @@ return UNSTARCH_FATAL_ERROR; } +#ifdef __cplusplus + *optn = (ftr1) ? STARCH_strdup(ftr1) : ((ftr2) ? STARCH_strdup(ftr2) : nullptr); +#else *optn = (ftr1) ? STARCH_strdup(ftr1) : ((ftr2) ? STARCH_strdup(ftr2) : NULL); +#endif if (*optn) { if (strcmp(*optn, "help") == 0) { @@ -1158,13 +1206,15 @@ #ifdef DEBUG fprintf(stderr, "\n--- UNSTARCH_printUsage() ---\n"); #endif - char *avStr = NULL; #ifdef __cplusplus + char *avStr = nullptr; avStr = static_cast( malloc(STARCH_ARCHIVE_VERSION_STRING_LENGTH) ); + if (avStr != nullptr) { #else + char *avStr = NULL; avStr = malloc(STARCH_ARCHIVE_VERSION_STRING_LENGTH); -#endif if (avStr != NULL) { +#endif int result = sprintf(avStr, "%d.%d.%d", STARCH_MAJOR_VERSION, STARCH_MINOR_VERSION, STARCH_REVISION_VERSION); if (result != -1) { switch (errorType) { @@ -1192,13 +1242,15 @@ #ifdef DEBUG fprintf(stderr, "\n--- UNSTARCH_printRevision() ---\n"); #endif - char *avStr = NULL; #ifdef __cplusplus + char *avStr = nullptr; avStr = static_cast( malloc(STARCH_ARCHIVE_VERSION_STRING_LENGTH) ); + if (avStr != nullptr) { #else + char *avStr = NULL; avStr = malloc(STARCH_ARCHIVE_VERSION_STRING_LENGTH); -#endif if (avStr != NULL) { +#endif int result = sprintf(avStr, "%d.%d.%d", STARCH_MAJOR_VERSION, STARCH_MINOR_VERSION, STARCH_REVISION_VERSION); if (result != -1) fprintf(stdout, @@ -1274,8 +1326,12 @@ #ifdef DEBUG fprintf(stderr, "\n--- UNSTARCH_printMetadataSha1Signature() ---\n"); #endif - size_t sha1BufferLength = STARCH2_MD_FOOTER_SHA1_LENGTH; +#ifdef __cplusplus + char *jsonBase64String = nullptr; +#else char *jsonBase64String = NULL; +#endif + size_t sha1BufferLength = STARCH2_MD_FOOTER_SHA1_LENGTH; #ifdef DEBUG fwrite(sha1Buffer, sizeof(unsigned char), STARCH2_MD_FOOTER_SHA1_LENGTH, stderr); @@ -1300,7 +1356,11 @@ } fprintf(stdout, "%s\n", jsonBase64String); free(jsonBase64String); +#ifdef __cplusplus + jsonBase64String = nullptr; +#else jsonBase64String = NULL; +#endif } #ifdef __cplusplus diff -Nru bedops-2.4.35+dfsg/applications/other/switch-BEDOPS-binary-type bedops-2.4.36+dfsg/applications/other/switch-BEDOPS-binary-type --- bedops-2.4.35+dfsg/applications/other/switch-BEDOPS-binary-type 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/applications/other/switch-BEDOPS-binary-type 2019-05-23 20:06:31.000000000 +0000 @@ -83,6 +83,7 @@ TYPE=float128 fi +echo $BINDIR for SRCNAME in `find ${BINDIR} -maxdepth 1 -mindepth 1 -type f -name "*${TYPE}" -print0 | xargs -L1 -0 -I{} sh -c 'basename {}'` do DESTNAME=`echo ${SRCNAME} | perl -Tpe 's/-'${TYPE}'//'` diff -Nru bedops-2.4.35+dfsg/debian/changelog bedops-2.4.36+dfsg/debian/changelog --- bedops-2.4.35+dfsg/debian/changelog 2018-05-23 15:43:00.000000000 +0000 +++ bedops-2.4.36+dfsg/debian/changelog 2019-08-04 09:14:39.000000000 +0000 @@ -1,3 +1,15 @@ +bedops (2.4.36+dfsg-1) unstable; urgency=medium + + * Team upload. + * New upstream version + * debhelper-compat 12 + * Standards-Version: 4.4.0 + * Remove trailing whitespace in debian/changelog + * Trim trailing whitespace. + * Do not run dh_dwz + + -- Andreas Tille Sun, 04 Aug 2019 11:14:39 +0200 + bedops (2.4.35+dfsg-1) unstable; urgency=medium * Team upload. @@ -24,12 +36,12 @@ bedops (2.4.32+dfsg-1) unstable; urgency=medium * Team upload. - + [ Steffen Moeller ] * debian/upstream/metadata: - Added references to registries. - Worked towards yamllint-cleanliness. - + [ Andreas Tille ] * New upstream version * cme fix dpkg-control @@ -46,14 +58,14 @@ bedops (2.4.26+dfsg-1) unstable; urgency=medium - * New upstream release + * New upstream release -- Olivier Sallou Wed, 21 Jun 2017 12:03:13 +0000 bedops (2.4.20+dfsg-2) unstable; urgency=medium * avoid underlinking when linking with --as-needed (Closes: #854003) - Thanks to ginggs@debian.org + Thanks to ginggs@debian.org * rename starch binary to bedops-starch (Closes: #853892) -- Olivier Sallou Fri, 03 Feb 2017 11:26:22 +0000 diff -Nru bedops-2.4.35+dfsg/debian/compat bedops-2.4.36+dfsg/debian/compat --- bedops-2.4.35+dfsg/debian/compat 2018-05-23 15:43:00.000000000 +0000 +++ bedops-2.4.36+dfsg/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -11 diff -Nru bedops-2.4.35+dfsg/debian/control bedops-2.4.36+dfsg/debian/control --- bedops-2.4.35+dfsg/debian/control 2018-05-23 15:43:00.000000000 +0000 +++ bedops-2.4.36+dfsg/debian/control 2019-08-04 09:14:39.000000000 +0000 @@ -3,7 +3,7 @@ Uploaders: Olivier Sallou Section: science Priority: optional -Build-Depends: debhelper (>= 11~), +Build-Depends: debhelper-compat (= 12), help2man, libbz2-dev, libjansson-dev, @@ -11,7 +11,7 @@ python3-distutils, python3-sphinx, zlib1g-dev -Standards-Version: 4.1.4 +Standards-Version: 4.4.0 Vcs-Browser: https://salsa.debian.org/med-team/bedops Vcs-Git: https://salsa.debian.org/med-team/bedops.git Homepage: https://github.com/bedops/bedops diff -Nru bedops-2.4.35+dfsg/debian/rules bedops-2.4.36+dfsg/debian/rules --- bedops-2.4.35+dfsg/debian/rules 2018-05-23 15:43:00.000000000 +0000 +++ bedops-2.4.36+dfsg/debian/rules 2019-08-04 09:14:39.000000000 +0000 @@ -45,5 +45,6 @@ cd bin && for f in * ; do help2man --no-discard-stderr --version-string="$(DEB_VERSION_UPSTREAM)" -o $$f.1 ./$$f; done dh_installman -a - - +override_dh_dwz: + # Work around: dwz: Too few files for multifile optimization + echo "Do not run dh_dwz" diff -Nru bedops-2.4.35+dfsg/docs/conf.py bedops-2.4.36+dfsg/docs/conf.py --- bedops-2.4.35+dfsg/docs/conf.py 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/conf.py 2019-05-23 20:06:31.000000000 +0000 @@ -43,7 +43,7 @@ # General information about the project. project = u'BEDOPS' -copyright = u'2011-2018, Shane Neph, Alex Reynolds' +copyright = u'2011-2019, Shane Neph, Alex Reynolds' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -52,7 +52,7 @@ # The short X.Y version. version = '2.4' # The full version, including alpha/beta/rc tags. -release = '2.4.35' +release = '2.4.36' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -134,7 +134,7 @@ # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". #html_static_path = ['_build/html/_static'] -#html_static_path = ['_static'] +html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. diff -Nru bedops-2.4.35+dfsg/docs/content/reference/file-management/compression/starchcat.rst bedops-2.4.36+dfsg/docs/content/reference/file-management/compression/starchcat.rst --- bedops-2.4.35+dfsg/docs/content/reference/file-management/compression/starchcat.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/reference/file-management/compression/starchcat.rst 2019-05-23 20:06:31.000000000 +0000 @@ -57,7 +57,7 @@ starchcat citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract - version: 2.4.35 (typical) + version: 2.4.36 (typical) authors: Alex Reynolds and Shane Neph USAGE: starchcat [ --note="..." ] diff -Nru bedops-2.4.35+dfsg/docs/content/reference/file-management/compression/starch-diff.rst bedops-2.4.36+dfsg/docs/content/reference/file-management/compression/starch-diff.rst --- bedops-2.4.35+dfsg/docs/content/reference/file-management/compression/starch-diff.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/reference/file-management/compression/starch-diff.rst 2019-05-23 20:06:31.000000000 +0000 @@ -39,7 +39,7 @@ starch-diff citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract - version: 2.4.35 + version: 2.4.36 authors: Alex Reynolds and Shane Neph $ starch-diff [ --chr ] starch-file-1 starch-file-2 [ starch-file-3 ... ] diff -Nru bedops-2.4.35+dfsg/docs/content/reference/file-management/compression/starch.rst bedops-2.4.36+dfsg/docs/content/reference/file-management/compression/starch.rst --- bedops-2.4.35+dfsg/docs/content/reference/file-management/compression/starch.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/reference/file-management/compression/starch.rst 2019-05-23 20:06:31.000000000 +0000 @@ -49,7 +49,7 @@ starch citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract - binary version: 2.4.35 (typical) (creates archive version: 2.2.0) + binary version: 2.4.36 (typical) (creates archive version: 2.2.0) authors: Alex Reynolds and Shane Neph USAGE: starch [ --note="foo bar..." ] diff -Nru bedops-2.4.35+dfsg/docs/content/reference/file-management/compression/starchstrip.rst bedops-2.4.36+dfsg/docs/content/reference/file-management/compression/starchstrip.rst --- bedops-2.4.35+dfsg/docs/content/reference/file-management/compression/starchstrip.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/reference/file-management/compression/starchstrip.rst 2019-05-23 20:06:31.000000000 +0000 @@ -39,7 +39,7 @@ starchstrip citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract - version: 2.4.35 (typical) + version: 2.4.36 (typical) authors: Alex Reynolds and Shane Neph USAGE: starchstrip [ --include | --exclude ] diff -Nru bedops-2.4.35+dfsg/docs/content/reference/file-management/compression/unstarch.rst bedops-2.4.36+dfsg/docs/content/reference/file-management/compression/unstarch.rst --- bedops-2.4.35+dfsg/docs/content/reference/file-management/compression/unstarch.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/reference/file-management/compression/unstarch.rst 2019-05-23 20:06:31.000000000 +0000 @@ -43,7 +43,7 @@ unstarch citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract - binary version: 2.4.35 (typical) (extracts archive version: 2.2.0 or older) + binary version: 2.4.36 (typical) (extracts archive version: 2.2.0 or older) authors: Alex Reynolds and Shane Neph USAGE: unstarch [ ] [ --elements | diff -Nru bedops-2.4.35+dfsg/docs/content/reference/file-management/conversion/gtf2bed.rst bedops-2.4.36+dfsg/docs/content/reference/file-management/conversion/gtf2bed.rst --- bedops-2.4.35+dfsg/docs/content/reference/file-management/conversion/gtf2bed.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/reference/file-management/conversion/gtf2bed.rst 2019-05-23 20:06:31.000000000 +0000 @@ -41,18 +41,18 @@ :: - chr20 protein_coding exon 9874841 9874841 . + . gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.35"; gene_name "ZNF366"; - chr20 protein_coding CDS 9873504 9874841 . + 0 gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.35"; gene_name "ZNF366"; - chr20 protein_coding exon 9877488 9877679 . + . gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.35"; + chr20 protein_coding exon 9874841 9874841 . + . gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.36"; gene_name "ZNF366"; + chr20 protein_coding CDS 9873504 9874841 . + 0 gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.36"; gene_name "ZNF366"; + chr20 protein_coding exon 9877488 9877679 . + . gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.36"; We can convert it to sorted BED data in the following manner: :: $ gtf2bed < foo.gtf - chr20 9874840 9874841 ZNF366 . + protein_coding exon . gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.35"; gene_name "ZNF366"; zero_length_insertion "True"; - chr20 9873503 9874841 ZNF366 . + protein_coding CDS 0 gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.35"; gene_name "ZNF366"; - chr20 9877487 9877679 ENSBTAG00000020601 . + protein_coding exon . gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.35"; + chr20 9874840 9874841 ZNF366 . + protein_coding exon . gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.36"; gene_name "ZNF366"; zero_length_insertion "True"; + chr20 9873503 9874841 ZNF366 . + protein_coding CDS 0 gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.36"; gene_name "ZNF366"; + chr20 9877487 9877679 ENSBTAG00000020601 . + protein_coding exon . gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.36"; .. tip:: After, say, performing set or statistical operations with :ref:`bedops`, :ref:`bedmap` etc., converting data back to GTF is accomplished through an ``awk`` statement that re-orders columns and shifts the coordinate index: diff -Nru bedops-2.4.35+dfsg/docs/content/reference/file-management/conversion/psl2bed.rst bedops-2.4.36+dfsg/docs/content/reference/file-management/conversion/psl2bed.rst --- bedops-2.4.35+dfsg/docs/content/reference/file-management/conversion/psl2bed.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/reference/file-management/conversion/psl2bed.rst 2019-05-23 20:06:31.000000000 +0000 @@ -57,7 +57,7 @@ 30 0 0 0 0 0 0 0 + foo 50 14 44 chr6 171115067 127685756 127685786 1 30, 14, 127685756, 30 0 0 0 0 0 0 0 + foo 50 14 44 chr6 171115067 93161871 93161901 1 30, 14, 93161871, 31 0 0 0 0 0 0 0 + foo 50 13 44 chr5 180915260 119897315 119897346 1 31, 13, 119897315, - 30 0 0 0 0 0 0 0 + foo 50 14 44 chr5 180915260 1232.4.35 1232.4.355 1 30, 14, 1232.4.35, + 30 0 0 0 0 0 0 0 + foo 50 14 44 chr5 180915260 1232.4.36 1232.4.365 1 30, 14, 1232.4.36, ... We can convert it to sorted BED data in the following manner: diff -Nru bedops-2.4.35+dfsg/docs/content/reference/file-management/conversion/vcf2bed.rst bedops-2.4.36+dfsg/docs/content/reference/file-management/conversion/vcf2bed.rst --- bedops-2.4.35+dfsg/docs/content/reference/file-management/conversion/vcf2bed.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/reference/file-management/conversion/vcf2bed.rst 2019-05-23 20:06:31.000000000 +0000 @@ -54,7 +54,7 @@ :: #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NA00001 NA00002 NA00003 - 20 12.4.357 microsat1 GTC G,GTCT 50 PASS NS=3;DP=9;AA=G GT:GQ:DP 0/1:35:4 0/2:17:2 1/1:40:3 + 20 12.4.367 microsat1 GTC G,GTCT 50 PASS NS=3;DP=9;AA=G GT:GQ:DP 0/1:35:4 0/2:17:2 1/1:40:3 When using ``--snvs``, ``--insertions`` or ``--deletions``, this record is split into two distinct BED records and filtered depending on which custom option was chosen. The ``--insertions`` option would only export the single-base position of the insertion in this mixed variant, while ``--deletions`` would show the deletion. diff -Nru bedops-2.4.35+dfsg/docs/content/reference/file-management/sorting/sort-bed.rst bedops-2.4.36+dfsg/docs/content/reference/file-management/sorting/sort-bed.rst --- bedops-2.4.35+dfsg/docs/content/reference/file-management/sorting/sort-bed.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/reference/file-management/sorting/sort-bed.rst 2019-05-23 20:06:31.000000000 +0000 @@ -43,7 +43,7 @@ sort-bed citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract - version: 2.4.35 (typical) + version: 2.4.36 (typical) authors: Scott Kuehn USAGE: sort-bed [--help] [--version] [--check-sort] [--max-mem ] [--tmpdir ] [--unique] [--duplicates] <...> diff -Nru bedops-2.4.35+dfsg/docs/content/reference/set-operations/bedextract.rst bedops-2.4.36+dfsg/docs/content/reference/set-operations/bedextract.rst --- bedops-2.4.35+dfsg/docs/content/reference/set-operations/bedextract.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/reference/set-operations/bedextract.rst 2019-05-23 20:06:31.000000000 +0000 @@ -60,7 +60,7 @@ bedextract citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract - version: 2.4.35 (typical) + version: 2.4.36 (typical) authors: Shane Neph & Alex Reynolds Every input file must be sorted per sort-bed. diff -Nru bedops-2.4.35+dfsg/docs/content/reference/set-operations/bedops.rst bedops-2.4.36+dfsg/docs/content/reference/set-operations/bedops.rst --- bedops-2.4.35+dfsg/docs/content/reference/set-operations/bedops.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/reference/set-operations/bedops.rst 2019-05-23 20:06:31.000000000 +0000 @@ -53,7 +53,7 @@ bedops citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract - version: 2.4.35 (typical) + version: 2.4.36 (typical) authors: Shane Neph & Scott Kuehn USAGE: bedops [process-flags] * diff -Nru bedops-2.4.35+dfsg/docs/content/reference/set-operations/closest-features.rst bedops-2.4.36+dfsg/docs/content/reference/set-operations/closest-features.rst --- bedops-2.4.35+dfsg/docs/content/reference/set-operations/closest-features.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/reference/set-operations/closest-features.rst 2019-05-23 20:06:31.000000000 +0000 @@ -45,7 +45,7 @@ closest-features citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract - version: 2.4.35 (typical) + version: 2.4.36 (typical) authors: Shane Neph & Scott Kuehn USAGE: closest-features [Process-Flags] diff -Nru bedops-2.4.35+dfsg/docs/content/reference/statistics/bedmap.rst bedops-2.4.36+dfsg/docs/content/reference/statistics/bedmap.rst --- bedops-2.4.35+dfsg/docs/content/reference/statistics/bedmap.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/reference/statistics/bedmap.rst 2019-05-23 20:06:31.000000000 +0000 @@ -20,6 +20,10 @@ The :ref:`bedmap` program requires files in a relaxed variation of the BED format as described by `UCSC's browser documentation `_. The chromosome field can be any non-empty string, the score field can be any valid numeric value, and information is unconstrained beyond the minimum number of columns required by the chosen options. +.. note:: Information is unconstrained, with one important exception: Map input (defined below) should not contain spaces in the ID or in subsequent fields. Running :ref:`bedmap` with :code:`--ec` will identify problematic input. + + An :code:`awk` script can help with translating ID spaces to another non-whitespace delimiter, *e.g.*, :code:`bedmap (--options...) reference.bed <(awk -vOFS="\t" -vFS="\t" '{gsub(" ", "%%", $4); print;}' map.bed)` and then `awk -vOFS="\t" -vFS="\t" '{gsub("%%", " "); print;}' result.bed` to convert delimiters back to spaces. + Alternatively, :ref:`bedmap` can accept :ref:`Starch-formatted archives ` of BED data as input |---| it is no longer necessary to extract Starch archive data to intermediate BED files! Support for common headers (including UCSC browser track headers) is available with the ``--header`` option, although headers are stripped from output. @@ -48,7 +52,7 @@ bedmap citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract - version: 2.4.35 (typical) + version: 2.4.36 (typical) authors: Shane Neph & Scott Kuehn USAGE: bedmap [process-flags] [overlap-option] [map-file] @@ -78,6 +82,9 @@ --sci Use scientific notation for score outputs. --skip-unmapped Print no output for a row with no mapped elements. --sweep-all Ensure is read completely (helps to prevent broken pipes). + --unmapped-val Print on unmapped --echo-map* and --min/max-element* operations. + The default is to print nothing. + --unmapped-val Use in place of the empty string on unmapped --echo-map* ops. --version Print program information. Overlap Options (At most, one may be selected. By default, --bp-ovr 1 is used): @@ -281,6 +288,10 @@ One can also take the sum of scores (``--sum``), find the minimum or maximum score over a region (``--min`` and ``--max``, respectively), or retrieve the map element with the least or greatest signal over the reference region (``--min-element`` and ``--max-element``, respectively). +.. note:: Map input should not contain spaces in the ID or in subsequent fields. Running :ref:`bedmap` with :code:`--ec` will identify problematic input. Spaces in these fields will cause problems with :code:`--min-element`, :code:`--max-element`, and other options that require parsing of the fourth and subsequent columns of the map input. + + An :code:`awk` script can help with translating ID spaces to another non-whitespace delimiter, *e.g.*, :code:`bedmap (--options...) reference.bed <(awk -vOFS="\t" -vFS="\t" '{gsub(" ", "%%", $4); print;}' map.bed)` and then `awk -vOFS="\t" -vFS="\t" '{gsub("%%", " "); print;}' result.bed` to convert delimiters back to spaces. + We will demonstrate some of these operators by applying them to the ``Reference`` and ``Map`` datasets (see the :ref:`Downloads ` section for sample inputs). As a reminder, the ``Map`` file contains regions of DNaseI-seq tag density. If we want the mean of the density across `Reference` elements, we use the ``--mean`` option: @@ -421,9 +432,9 @@ :: chr1 4534161 4534177 -V_GRE_C 4.20586e-06 - CGTACACACAGTTCTT - chr1 4534192.4.354205 -V_STAT_Q6 2.21622e-06 - AGCACTTCTGGGA + chr1 4534192.4.364205 -V_STAT_Q6 2.21622e-06 - AGCACTTCTGGGA chr1 4534209 4534223 +V_HNF4_Q6_01 6.93604e-06 + GGACCAGAGTCCAC - chr1 4962522.4.352540 -V_GCNF_01 9.4497e-06 - CCCAAGGTCAAGATAAAG + chr1 4962522.4.362540 -V_GCNF_01 9.4497e-06 - CCCAAGGTCAAGATAAAG chr1 4962529 4962539 +V_NUR77_Q5 8.43564e-06 + TTGACCTTGG ... @@ -469,6 +480,10 @@ .. note:: The ``--echo-map-range`` option produces three-column BED results that are not always guaranteed to be sorted. The ``--echo`` operation is independent, and it produces reference elements in proper BEDOPS order, as shown. If the results of the ``--echo-map-range`` option will be used directly as BED coordinates in downstream BEDOPS analyses (*i.e.*, no ``--echo`` operator), first pipe them to :ref:`sort-bed` to ensure proper sort order. +.. note:: Map input should not contain spaces in the ID or in subsequent fields. Running :ref:`bedmap` with :code:`--ec` will identify problematic input. Spaces in these fields will cause problems with :code:`--echo-map-id`, :code:`--echo-map-id-uniq`, and other options that require parsing of the fourth and subsequent columns of the map input. + + An :code:`awk` script can help with translating ID spaces to another non-whitespace delimiter, *e.g.*, :code:`bedmap (--options...) reference.bed <(awk -vOFS="\t" -vFS="\t" '{gsub(" ", "%%", $4); print;}' map.bed)` and then `awk -vOFS="\t" -vFS="\t" '{gsub("%%", " "); print;}' result.bed` to convert delimiters back to spaces. + The ``--echo-ref-size`` flag reports the difference between the stop and start coordinates of the reference element. The ``--echo-ref-name`` flag produces a converted format for the first 3 BED fields, A:B-C, where A is the chromosome name, B is the start coordinate, and C is the stop coordinate for that reference element. The ``--echo-ref-row-id`` flag prints the prefix ``id-`` with the line number of the reference element. @@ -675,9 +690,9 @@ :: chr1 4534161 4534177 -V_GRE_C 4.20586e-06 - CGTACACACAGTTCTT - chr1 4534192.4.354205 -V_STAT_Q6 2.21622e-06 - AGCACTTCTGGGA + chr1 4534192.4.364205 -V_STAT_Q6 2.21622e-06 - AGCACTTCTGGGA chr1 4534209 4534223 +V_HNF4_Q6_01 6.93604e-06 + GGACCAGAGTCCAC - chr1 4962522.4.352540 -V_GCNF_01 9.4497e-06 - CCCAAGGTCAAGATAAAG + chr1 4962522.4.362540 -V_GCNF_01 9.4497e-06 - CCCAAGGTCAAGATAAAG chr1 4962529 4962539 +V_NUR77_Q5 8.43564e-06 + TTGACCTTGG ... diff -Nru bedops-2.4.35+dfsg/docs/content/release.rst bedops-2.4.36+dfsg/docs/content/release.rst --- bedops-2.4.35+dfsg/docs/content/release.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/release.rst 2019-05-23 20:06:31.000000000 +0000 @@ -15,7 +15,7 @@ a. Close out open documentation or feature issues, making necessary pushes to the current development branch. - b. If any issues can't be closed out, rename the assigned version tag to the next anticipated release version (*e.g.*, *v2.4.35* to *v2p5p0*, etc.) + b. If any issues can't be closed out, rename the assigned version tag to the next anticipated release version (*e.g.*, *v2.4.36* to *v2p5p0*, etc.) 2. Pull the most recent commit for the development branch to a local folder on build hosts (Linux with sufficiently old kernel, current OS X, etc.). @@ -43,7 +43,7 @@ BEDOPS.X.Y.Z.pkg.zip - The *X.Y.Z* scheme should follow the development branch name, *e.g.* 2.4.35, etc. + The *X.Y.Z* scheme should follow the development branch name, *e.g.* 2.4.36, etc. 3. Collect tarballs and zipped Installer in one location for later addition with web browser, via BEDOPS Github web site. @@ -62,7 +62,7 @@ Ideally, whatever steps are used to merge the development branch into the master branch should preserve the overall commit history. - As before, the *X.Y.Z* scheme should follow the development branch name, *e.g.* 2.4.35, etc. + As before, the *X.Y.Z* scheme should follow the development branch name, *e.g.* 2.4.36, etc. 2. Add a `new release `_ via the Github site. Or click on the `Draft a new release `_ button from the Github Releases page. @@ -104,7 +104,7 @@ If not, take a look at the `build `_ page to manually trigger document rebuilds, or examine error logs, if necessary. -4. Update the Github bedops/bedops master `README.md `_ file to note the current version number, if necessary. +4. Update the Github bedops/bedops master `README.md `_ file to note the current version number, if necessary. 5. Push fixes to any documentation errors in the master branch. diff -Nru bedops-2.4.35+dfsg/docs/content/revision-history.rst bedops-2.4.36+dfsg/docs/content/revision-history.rst --- bedops-2.4.35+dfsg/docs/content/revision-history.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/revision-history.rst 2019-05-23 20:06:31.000000000 +0000 @@ -12,20 +12,40 @@ =============== ------- -v2.4.35 +v2.4.36 ------- -Released: **May 2, 2018** +Released: **May 2, 2019** -* :ref:`starch ` +* :ref:`bedmap ` - * When compressing records, if the last interval in the former chromosome is identical to the first interval of the next chromosome, then a test on the sort order of the remainder string of that interval is applied (incorrectly). This is patched to test that chromosome names are identical before applying sort order rules. Thanks to Andrew Nishida for the report and for providing test input. + * Resolved an issue preventing use of a :code:`bash` process substitution or Unix named pipe in the reference position: *i.e.*, :code:`bedmap --options <(processToGenerateReferenceElements) map.bed` and similar would issue incorrect output. Thanks to Wouter Meuleman and others for reports and test input. + + * To avoid mapping problems, map elements should not contain spaces in the ID or subsequent non-interval fields. Use of the :code:`--ec` can help identify problems in map input, at the cost of a longer runtime. The documentation is clarified to warn users about avoiding spaces in map input. Thanks to Wouter Meuleman for the report and providing test input. + + * Added :code:`--unmapped-val ` option, where :code:`` replaces the empty string output of :code:`--echo-map*` operations when there are no mapped elements. The :code:`--min/max-element` operators will give results as before (the empty string). + +* :ref:General + + * Reduced :code:`warning: zero as null pointer constant [-Wzero-as-null-pointer-constant]` compiler warnings via Clang. + + * Begun work on a comprehensive test suite for BEDOPS applications. Tests are available via source distribution in :code:`${root}/tests` and can be run by entering :code:`make` in this directory. ================= Previous versions ================= ------- +v2.4.35 +------- + +Released: **May 2, 2018** + +* :ref:`starch ` + + * When compressing records, if the last interval in the former chromosome is identical to the first interval of the next chromosome, then a test on the sort order of the remainder string of that interval is applied (incorrectly). This is patched to test that chromosome names are identical before applying sort order rules. Thanks to Andrew Nishida for the report and for providing test input. + +------- v2.4.34 ------- diff -Nru bedops-2.4.35+dfsg/docs/content/usage-examples/snps-within-dhses.rst bedops-2.4.36+dfsg/docs/content/usage-examples/snps-within-dhses.rst --- bedops-2.4.35+dfsg/docs/content/usage-examples/snps-within-dhses.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/content/usage-examples/snps-within-dhses.rst 2019-05-23 20:06:31.000000000 +0000 @@ -30,7 +30,7 @@ :: - chr1 10799576 10799577 rs12.4.358 Systolic_blood_pressure Cardiovascular|chr1 10799460 10799610 MCV-1 9.18063 + chr1 10799576 10799577 rs12.4.368 Systolic_blood_pressure Cardiovascular|chr1 10799460 10799610 MCV-1 9.18063 The output is delimited by pipe symbols (``|``), showing the reference element (SNP) and the mapped element (DHS). diff -Nru bedops-2.4.35+dfsg/docs/index.rst bedops-2.4.36+dfsg/docs/index.rst --- bedops-2.4.35+dfsg/docs/index.rst 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/index.rst 2019-05-23 20:06:31.000000000 +0000 @@ -48,31 +48,31 @@ .. |quick_start_html| raw:: html -
+
.. |downloads| raw:: html - +
- +
- +
- +
@@ -83,19 +83,19 @@ .. |downloads_html| raw:: html - + .. |linux_png| image:: assets/index/linux_v2.png :height: 26px .. |linux_html| raw:: html - + .. |linux_downloads| raw:: html @@ -104,12 +104,12 @@ .. |macosx_html| raw:: html - + .. |macosx_downloads| raw:: html @@ -118,22 +118,22 @@ .. |source_html| raw:: html - + .. |source_downloads| raw:: html .. |reference| raw:: html - +
- +
  • bedops - apply set operations on any number of BED inputs
  • bedextract - efficiently extract BED features
  • @@ -141,13 +141,13 @@
- +
  • bedmap - map overlapping BED elements onto target regions and optionally compute any number of common statistical operations
- +
  • sort-bed - apply lexicographical sort to BED data
  • starch and unstarch - compress and extract BED data
  • @@ -159,7 +159,7 @@
- +
- +
- +
  • How to install BEDOPS
  • Usage examples of BEDOPS tools in action
  • @@ -194,14 +194,14 @@ .. |reference_html| raw:: html - + .. |set_operations_png| image:: assets/index/set_operations_v2.png :height: 130px .. |set_operations_html| raw:: html - + .. |set_operations| raw:: html @@ -216,7 +216,7 @@ .. |statistics_html| raw:: html - + .. |statistics| raw:: html @@ -229,7 +229,7 @@ .. |file_management_html| raw:: html - + .. |file_management| raw:: html @@ -245,7 +245,7 @@ .. |performance_html| raw:: html - + .. |performance| raw:: html @@ -260,7 +260,7 @@ .. |support_html| raw:: html - + .. |support| raw:: html @@ -275,7 +275,7 @@ .. |other_html| raw:: html - + .. |other| raw:: html diff -Nru bedops-2.4.35+dfsg/docs/Makefile bedops-2.4.36+dfsg/docs/Makefile --- bedops-2.4.35+dfsg/docs/Makefile 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/docs/Makefile 2019-05-23 20:06:31.000000000 +0000 @@ -51,6 +51,7 @@ html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + find $(BUILDDIR)/../assets -type f -name "*.png" -exec cp -f "{}" $(BUILDDIR)/html/_static \; @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." diff -Nru bedops-2.4.35+dfsg/interfaces/general-headers/algorithm/visitors/helpers/ProcessBedVisitorRow.hpp bedops-2.4.36+dfsg/interfaces/general-headers/algorithm/visitors/helpers/ProcessBedVisitorRow.hpp --- bedops-2.4.35+dfsg/interfaces/general-headers/algorithm/visitors/helpers/ProcessBedVisitorRow.hpp 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/interfaces/general-headers/algorithm/visitors/helpers/ProcessBedVisitorRow.hpp 2019-05-23 20:06:31.000000000 +0000 @@ -180,8 +180,8 @@ // PrintAllScorePrecision() //========================== struct PrintAllScorePrecision { - PrintAllScorePrecision(int precision, bool inScientific) - : precision_(precision), scientific_(inScientific) + PrintAllScorePrecision(int precision, bool inScientific, const std::string& onEmpty = "") + : precision_(precision), scientific_(inScientific), oe_(onEmpty) { /* */ } template @@ -205,7 +205,8 @@ } void operator()(const Signal::NaN& s) const { - PrintTypes::Print(""); + if ( !oe_.empty() ) + PrintTypes::Print(oe_.c_str()); } protected: @@ -223,6 +224,7 @@ protected: int precision_; bool scientific_; + std::string oe_; }; //================ @@ -378,15 +380,18 @@ struct PrintUniqueRangeIDs : private Visitors::Helpers::PrintDelim { typedef Visitors::Helpers::PrintDelim Base; - explicit PrintUniqueRangeIDs(const std::string& delim = ";") - : Base(delim) + explicit PrintUniqueRangeIDs(const std::string& delim = ";", const std::string& onEmpty = "") + : Base(delim), oe_(onEmpty) { /* */ } template void operator()(Iter beg, Iter end) const { typedef std::set SortType; - if ( beg == end ) + if ( beg == end ) { + if ( !oe_.empty() ) + PrintTypes::Print(oe_.c_str()); return; + } SortType srt; while ( beg != end ) { srt.insert((*beg)->id()); @@ -400,6 +405,9 @@ PrintTypes::Print(i->c_str()); } // while } + + private: + std::string oe_; }; //========================= @@ -448,9 +456,10 @@ //===================== template struct PrintGenomicRange { + typedef PrintType PType; - explicit PrintGenomicRange(const PrintType& p = PrintType()) - : pt_(p) + explicit PrintGenomicRange(const PrintType& p = PrintType(), const std::string& onEmpty = "") + : pt_(p), oe_(onEmpty) { /* */ } template @@ -458,8 +467,11 @@ // It is often possible/likely that beg->end is not in an order // of the original input file (sorted by sort-bed), due to // issues of BED types (see BedBaseVisitor.hpp). - if ( beg == end ) + if ( beg == end ) { + if ( !oe_.empty() ) + PrintTypes::Print(oe_.c_str()); return; + } typename std::remove_const::type>::type val = **beg; while ( ++beg != end ) { @@ -474,6 +486,7 @@ private: PrintType pt_; + std::string oe_; }; } // namespace BedHelpers diff -Nru bedops-2.4.35+dfsg/interfaces/general-headers/algorithm/visitors/helpers/ProcessVisitorRow.hpp bedops-2.4.36+dfsg/interfaces/general-headers/algorithm/visitors/helpers/ProcessVisitorRow.hpp --- bedops-2.4.35+dfsg/interfaces/general-headers/algorithm/visitors/helpers/ProcessVisitorRow.hpp 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/interfaces/general-headers/algorithm/visitors/helpers/ProcessVisitorRow.hpp 2019-05-23 20:06:31.000000000 +0000 @@ -150,14 +150,18 @@ typedef PrintType PType; explicit PrintRangeDelim(const PrintType& p = PrintType(), - const std::string& delim = ";") - : Base(delim), pt_(p) + const std::string& delim = ";", + const std::string& onEmpty = "") + : Base(delim), pt_(p), oe_(onEmpty) { /* */ } template void operator()(Iter beg, Iter end) const { - if ( beg == end ) + if ( beg == end ) { + if ( !oe_.empty() ) + PrintTypes::Print(oe_.c_str()); return; + } pt_.operator()(*beg); while ( ++beg != end ) { Base::operator()(); @@ -167,6 +171,7 @@ private: PrintType pt_; + std::string oe_; }; } // namespace Helpers diff -Nru bedops-2.4.35+dfsg/interfaces/general-headers/data/bed/AllocateIterator_BED_starch.hpp bedops-2.4.36+dfsg/interfaces/general-headers/data/bed/AllocateIterator_BED_starch.hpp --- bedops-2.4.35+dfsg/interfaces/general-headers/data/bed/AllocateIterator_BED_starch.hpp 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/interfaces/general-headers/data/bed/AllocateIterator_BED_starch.hpp 2019-05-23 20:06:31.000000000 +0000 @@ -65,7 +65,7 @@ allocate_iterator_starch_bed(Ext::FPWrap& fp, Ext::PooledMemory& p, const std::string& chr = "all") /* this ASSUMES fp is open and meaningful */ : fp_(fp), _M_ok(fp_ && !std::feof(fp_)), _M_value(0), - is_starch_(_M_ok && (fp_ != stdin) && starch::Starch::isStarch(fp_)), + is_starch_(false), all_(0 == std::strcmp(chr.c_str(), "all")), archive_(NULL), pool_(&p) { chr_[0] = '\0'; @@ -86,7 +86,7 @@ throw(ErrorType("Error: stat() failed on: " + fp.Name())); is_namedpipe = (S_ISFIFO(st.st_mode) != 0); } - is_starch_ = (is_starch_ && !is_namedpipe); + is_starch_ = !is_namedpipe && _M_ok && (fp_ != stdin) && starch::Starch::isStarch(fp_); if ( (fp_ == stdin || is_namedpipe) && !all_ ) { // BED, chrom-specific, using stdin // stream through until we find what we want diff -Nru bedops-2.4.35+dfsg/interfaces/general-headers/data/bed/AllocateIterator_BED_starch_minmem.hpp bedops-2.4.36+dfsg/interfaces/general-headers/data/bed/AllocateIterator_BED_starch_minmem.hpp --- bedops-2.4.35+dfsg/interfaces/general-headers/data/bed/AllocateIterator_BED_starch_minmem.hpp 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/interfaces/general-headers/data/bed/AllocateIterator_BED_starch_minmem.hpp 2019-05-23 20:06:31.000000000 +0000 @@ -59,7 +59,7 @@ template allocate_iterator_starch_bed_mm(Ext::FPWrap& fp, const std::string& chr = "all") /* this ASSUMES fp is open and meaningful */ : fp_(fp), _M_ok(fp_ && !std::feof(fp_)), _M_value(0), - is_starch_(_M_ok && (fp_ != stdin) && starch::Starch::isStarch(fp_)), + is_starch_(false), all_(0 == std::strcmp(chr.c_str(), "all")), archive_(NULL) { chr_[0] = '\0'; @@ -80,7 +80,7 @@ throw(ErrorType("Error: stat() failed on: " + fp.Name())); is_namedpipe = (S_ISFIFO(st.st_mode) != 0); } - is_starch_ = (is_starch_ && !is_namedpipe); + is_starch_ = !is_namedpipe && _M_ok && (fp_ != stdin) && starch::Starch::isStarch(fp_); if ( (fp_ == stdin || is_namedpipe) && !all_ ) { // BED, chrom-specific, using stdin // stream through until we find what we want diff -Nru bedops-2.4.35+dfsg/interfaces/general-headers/suite/BEDOPS.Version.hpp bedops-2.4.36+dfsg/interfaces/general-headers/suite/BEDOPS.Version.hpp --- bedops-2.4.35+dfsg/interfaces/general-headers/suite/BEDOPS.Version.hpp 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/interfaces/general-headers/suite/BEDOPS.Version.hpp 2019-05-23 20:06:31.000000000 +0000 @@ -36,7 +36,7 @@ #endif static const char* version() { - return "2.4.35 " BUILD_OPTS; // preprocessor string concatenation + return "2.4.36 " BUILD_OPTS; // preprocessor string concatenation } static const char* citation() { diff -Nru bedops-2.4.35+dfsg/interfaces/src/data/starch/starchBase64Coding.c bedops-2.4.36+dfsg/interfaces/src/data/starch/starchBase64Coding.c --- bedops-2.4.35+dfsg/interfaces/src/data/starch/starchBase64Coding.c 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/interfaces/src/data/starch/starchBase64Coding.c 2019-05-23 20:06:31.000000000 +0000 @@ -73,8 +73,13 @@ #else unsigned char *inputPointer = (unsigned char *) inputBytes; #endif +#ifdef __cplusplus + char *objPointer = nullptr; + char *strResult = nullptr; +#else char *objPointer = NULL; char *strResult = NULL; +#endif size_t bytesLength = inputLength; /* size_t resultLength = (((bytesLength + 2) / 3) * 4) + 1; */ diff -Nru bedops-2.4.35+dfsg/interfaces/src/data/starch/starchFileHelpers.c bedops-2.4.36+dfsg/interfaces/src/data/starch/starchFileHelpers.c --- bedops-2.4.35+dfsg/interfaces/src/data/starch/starchFileHelpers.c 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/interfaces/src/data/starch/starchFileHelpers.c 2019-05-23 20:06:31.000000000 +0000 @@ -94,11 +94,19 @@ fprintf(stderr, "\n--- STARCH_fopen() ---\n"); fprintf(stderr, "\tfilename: %s\ttype: %s\n\n", filename, type); #endif +#ifdef __cplusplus + FILE *fnPtr = nullptr; +#else FILE *fnPtr = NULL; +#endif fnPtr = fopen(filename, type); +#ifdef __cplusplus + if ((fnPtr == nullptr) && (errno != 0)) { +#else if ((fnPtr == NULL) && (errno != 0)) { +#endif switch (errno) { case EACCES: fprintf(stderr, "ERROR: EACCES - Search permission is denied on a component of the path prefix, or the file exists and the permissions specified by mode are denied, or the file does not exist and write permission is denied for the parent directory of the file to be created\n"); @@ -148,11 +156,13 @@ default: #ifdef __cplusplus fprintf(stderr, "ERROR: UNKNOWN - Run into unknown file access error (%d)\n", static_cast( errno )); + } + return nullptr; #else fprintf(stderr, "ERROR: UNKNOWN - Run into unknown file access error (%d)\n", (int) errno); -#endif } return NULL; +#endif } return fnPtr; @@ -171,9 +181,15 @@ unsigned char out[STARCH_Z_CHUNK + 1]; /* allocate deflate state */ +#ifdef __cplusplus + strm.zalloc = nullptr; + strm.zfree = nullptr; + strm.opaque = nullptr; +#else strm.zalloc = Z_NULL; strm.zfree = Z_NULL; strm.opaque = Z_NULL; +#endif /* deflateInit2 allows creation of archive with gzip header, i.e. a gzip file */ /* cf. http://www.zlib.net/manual.html */ diff -Nru bedops-2.4.35+dfsg/interfaces/src/data/starch/starchHelpers.c bedops-2.4.36+dfsg/interfaces/src/data/starch/starchHelpers.c --- bedops-2.4.35+dfsg/interfaces/src/data/starch/starchHelpers.c 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/interfaces/src/data/starch/starchHelpers.c 2019-05-23 20:06:31.000000000 +0000 @@ -57,11 +57,13 @@ STARCH_strdup(const char *str) { /* Cygwin does not include support for strdup() so we include our own implementation here */ - char *dup = NULL; - if (str) { #ifdef __cplusplus + char *dup = nullptr; + if (str) { dup = static_cast( malloc(strlen(str) + 1) ); /* sizeof(char) = 1, of course */ #else + char *dup = NULL; + if (str) { dup = malloc(strlen(str) + 1); /* sizeof(char) = 1, of course */ #endif if (!dup) { @@ -79,8 +81,13 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCH_compressFileWithGzip() ---\n"); #endif +#ifdef __cplusplus + FILE *inFnPtr = nullptr; + FILE *outFnPtr = nullptr; +#else FILE *inFnPtr = NULL; - FILE *outFnPtr = NULL; + FILE *outFnPtr = NULL; +#endif struct stat outSt; /* create output file handle */ @@ -135,9 +142,15 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCH_compressFileWithBzip2() ---\n"); #endif +#ifdef __cplusplus + FILE *inFnPtr = nullptr; + FILE *outFnPtr = nullptr; + BZFILE *bzFp = nullptr; +#else FILE *inFnPtr = NULL; FILE *outFnPtr = NULL; BZFILE *bzFp = NULL; +#endif int nBzBuf = STARCH_BZ_BUFFER_MAX_LENGTH; char bzBuf[STARCH_BZ_BUFFER_MAX_LENGTH]; int bzError; @@ -170,7 +183,11 @@ } bzFp = BZ2_bzWriteOpen( &bzError, outFnPtr, STARCH_BZ_COMPRESSION_LEVEL, 0, 0 ); if (bzError != BZ_OK) { +#ifdef __cplusplus + BZ2_bzWriteClose ( &bzError, bzFp, 0, nullptr, nullptr ); +#else BZ2_bzWriteClose ( &bzError, bzFp, 0, NULL, NULL ); +#endif fprintf(stderr, "ERROR: Could not open bzip2 file handle\n"); return STARCH_FATAL_ERROR; } @@ -185,7 +202,11 @@ if (idx == STARCH_BZ_BUFFER_MAX_LENGTH) { BZ2_bzWrite( &bzError, bzFp, bzBuf, nBzBuf ); if (bzError == BZ_IO_ERROR) { +#ifdef __cplusplus + BZ2_bzWriteClose ( &bzError, bzFp, 0, nullptr, nullptr ); +#else BZ2_bzWriteClose ( &bzError, bzFp, 0, NULL, NULL ); +#endif fprintf(stderr, "ERROR: Could not write to bzip2 file handle\n"); return STARCH_FATAL_ERROR; } @@ -200,13 +221,21 @@ BZ2_bzWrite(&bzError, bzFp, bzBuf, (int) idx); #endif if (bzError == BZ_IO_ERROR) { +#ifdef __cplusplus + BZ2_bzWriteClose ( &bzError, bzFp, 0, nullptr, nullptr ); +#else BZ2_bzWriteClose ( &bzError, bzFp, 0, NULL, NULL ); +#endif fprintf(stderr, "ERROR: Could not write to bzip2 file handle\n"); return STARCH_FATAL_ERROR; } /* close bzip2 stream */ +#ifdef __cplusplus + BZ2_bzWriteClose( &bzError, bzFp, 0, nullptr, nullptr ); +#else BZ2_bzWriteClose( &bzError, bzFp, 0, NULL, NULL ); +#endif if (bzError == BZ_IO_ERROR) { fprintf(stderr, "ERROR: Could not close bzip2 file handle\n"); return STARCH_FATAL_ERROR; @@ -366,7 +395,7 @@ } /* convert element string to start coordinate */ #ifdef __cplusplus - *start = static_cast( strtoull(reinterpret_cast( buffer ), NULL, STARCH_RADIX) ); + *start = static_cast( strtoull(reinterpret_cast( buffer ), nullptr, STARCH_RADIX) ); #else *start = (int64_t) strtoull((const char *)buffer, NULL, STARCH_RADIX); #endif @@ -393,7 +422,7 @@ } /* convert element string to stop coordinate */ #ifdef __cplusplus - *stop = static_cast( strtoull(reinterpret_cast( buffer ), NULL, STARCH_RADIX) ); + *stop = static_cast( strtoull(reinterpret_cast( buffer ), nullptr, STARCH_RADIX) ); #else *stop = (int64_t) strtoull((const char *)buffer, NULL, STARCH_RADIX); #endif @@ -471,10 +500,15 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCH_createTransformTokensForHeaderlessInput() ---\n"); #endif - unsigned int charCnt, sCnt, elemCnt; - char buffer[STARCH_BUFFER_MAX_LENGTH]; +#ifdef __cplusplus + char *chrCopy = nullptr; + char *remainderCopy = nullptr; +#else char *chrCopy = NULL; char *remainderCopy = NULL; +#endif + unsigned int charCnt, sCnt, elemCnt; + char buffer[STARCH_BUFFER_MAX_LENGTH]; unsigned int idIdx = 0U; unsigned int restIdx = 0U; @@ -540,7 +574,7 @@ } /* convert element string to start coordinate */ #ifdef __cplusplus - *start = static_cast( strtoll(reinterpret_cast( buffer ), NULL, STARCH_RADIX) ); + *start = static_cast( strtoll(reinterpret_cast( buffer ), nullptr, STARCH_RADIX) ); #else *start = (int64_t) strtoll((const char *)buffer, NULL, STARCH_RADIX); #endif @@ -567,7 +601,7 @@ } /* convert element string to stop coordinate */ #ifdef __cplusplus - *stop = static_cast( strtoll(reinterpret_cast( buffer ), NULL, STARCH_RADIX) ); + *stop = static_cast( strtoll(reinterpret_cast( buffer ), nullptr, STARCH_RADIX) ); #else *stop = (int64_t) strtoll((const char *)buffer, NULL, STARCH_RADIX); #endif @@ -664,22 +698,33 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCH_transformInput() ---\n"); #endif - int c; - int cIdx = 0; - int recIdx = 0; - char buffer[STARCH_BUFFER_MAX_LENGTH]; - char *outFn = NULL; - FILE *outFnPtr = NULL; #ifdef __cplusplus + char *outFn = nullptr; + FILE *outFnPtr = nullptr; FILE *streamPtr = const_cast( fp ); + char *outCompressedFn = nullptr; + char *remainder = nullptr; + char *prevChromosome = nullptr; + char *chromosome = nullptr; + Metadata *firstRecord = nullptr; + char *legacyMdBuf = nullptr; + char *dynamicMdBuf = nullptr; #else + char *outFn = NULL; + FILE *outFnPtr = NULL; FILE *streamPtr = (FILE *) fp; -#endif char *outCompressedFn = NULL; char *remainder = NULL; char *prevChromosome = NULL; char *chromosome = NULL; Metadata *firstRecord = NULL; + char *legacyMdBuf = NULL; + char *dynamicMdBuf = NULL; +#endif + int c; + int cIdx = 0; + int recIdx = 0; + char buffer[STARCH_BUFFER_MAX_LENGTH]; int64_t start = 0; int64_t stop = 0; int64_t previousStop = 0; @@ -690,8 +735,6 @@ Boolean withinChr = kStarchFalse; unsigned long lineIdx = 0UL; off_t outCompressedFnSize = 0; - char *legacyMdBuf = NULL; - char *dynamicMdBuf = NULL; BedLineType lineType = kBedLineTypeUndefined; char nonCoordLineBuf[STARCH_BUFFER_MAX_LENGTH] = {0}; Boolean nonCoordLineBufNeedsPrinting = kStarchFalse; @@ -720,18 +763,24 @@ */ if ( (lineType == kBedLineCoordinates) && ((!prevChromosome) || (strcmp(chromosome, prevChromosome) != 0)) ) { /* close old output file pointer */ - if (outFnPtr != NULL) { +#ifdef __cplusplus + if (outFnPtr != nullptr) { fclose(outFnPtr); - outFnPtr = NULL; + outFnPtr = nullptr; if (type == kBzip2) { /* bzip-compress the previous file */ -#ifdef __cplusplus if (STARCH_compressFileWithBzip2(reinterpret_cast( outFn ), &outCompressedFn, static_cast( &outCompressedFnSize ) ) != 0) { fprintf(stderr, "ERROR: Could not bzip2 compress per-chromosome output file %s\n", outFn); return STARCH_FATAL_ERROR; } #else + if (outFnPtr != NULL) { + fclose(outFnPtr); + outFnPtr = NULL; + + if (type == kBzip2) { + /* bzip-compress the previous file */ if (STARCH_compressFileWithBzip2((const char *)outFn, &outCompressedFn, (off_t *) &outCompressedFnSize ) != 0) { fprintf(stderr, "ERROR: Could not bzip2 compress per-chromosome output file %s\n", outFn); return STARCH_FATAL_ERROR; @@ -776,14 +825,24 @@ totalUniqueBases, duplicateElementExistsFlag, nestedElementExistsFlag, +#ifdef __cplusplus + nullptr, +#else NULL, +#endif STARCH_DEFAULT_LINE_STRING_LENGTH) != STARCH_EXIT_SUCCESS) { fprintf(stderr, "ERROR: Could not update metadata%s\n", outFn); return STARCH_FATAL_ERROR; } /* cleanup */ - free(outCompressedFn); outCompressedFn = NULL; +#ifdef __cplusplus + free(outCompressedFn); + outCompressedFn = nullptr; +#else + free(outCompressedFn); + outCompressedFn = NULL; +#endif } /* test if current chromosome is already a Metadata record */ @@ -828,7 +887,11 @@ totalUniqueBases, duplicateElementExistsFlag, nestedElementExistsFlag, +#ifdef __cplusplus + nullptr, +#else NULL, +#endif STARCH_DEFAULT_LINE_STRING_LENGTH); firstRecord = *md; } @@ -842,19 +905,27 @@ totalUniqueBases, duplicateElementExistsFlag, nestedElementExistsFlag, +#ifdef __cplusplus + nullptr, +#else NULL, +#endif STARCH_DEFAULT_LINE_STRING_LENGTH); } /* make previous chromosome the current chromosome */ - if (prevChromosome != NULL) { +#ifdef __cplusplus + if (prevChromosome != nullptr) { free(prevChromosome); - prevChromosome = NULL; + prevChromosome = nullptr; } -#ifdef __cplusplus prevChromosome = static_cast( malloc(strlen(chromosome) + 1) ); strncpy(prevChromosome, reinterpret_cast( chromosome ), strlen(chromosome) + 1); #else + if (prevChromosome != NULL) { + free(prevChromosome); + prevChromosome = NULL; + } prevChromosome = malloc(strlen(chromosome) + 1); strncpy(prevChromosome, (const char *)chromosome, strlen(chromosome) + 1); #endif @@ -947,12 +1018,21 @@ } /* cleanup unused data */ +#ifdef __cplusplus + if (withinChr == kStarchTrue) { + free(chromosome); chromosome = nullptr; + } + if (remainder) { + free(remainder); remainder = nullptr; + } +#else if (withinChr == kStarchTrue) { free(chromosome); chromosome = NULL; } if (remainder) { free(remainder); remainder = NULL; } +#endif cIdx = 0; } else { @@ -965,12 +1045,15 @@ } /* compress the remaining file */ - if (outFnPtr != NULL) { - fclose(outFnPtr); outFnPtr = NULL; - if (type == kBzip2) { #ifdef __cplusplus + if (outFnPtr != nullptr) { + fclose(outFnPtr); outFnPtr = nullptr; + if (type == kBzip2) { if (STARCH_compressFileWithBzip2(reinterpret_cast( outFn ), &outCompressedFn, static_cast( &outCompressedFnSize ) ) != 0) { #else + if (outFnPtr != NULL) { + fclose(outFnPtr); outFnPtr = NULL; + if (type == kBzip2) { if (STARCH_compressFileWithBzip2((const char *)outFn, &outCompressedFn, (off_t *) &outCompressedFnSize ) != 0) { #endif fprintf(stderr, "ERROR: Could not bzip2 compress per-chromosome output file %s\n", outFn); @@ -1012,9 +1095,17 @@ totalUniqueBases, duplicateElementExistsFlag, nestedElementExistsFlag, +#ifdef __cplusplus + nullptr, +#else NULL, +#endif STARCH_DEFAULT_LINE_STRING_LENGTH); - free(outCompressedFn); outCompressedFn = NULL; +#ifdef __cplusplus + free(outCompressedFn); outCompressedFn = nullptr; +#else + free(outCompressedFn); outCompressedFn = NULL; +#endif } /* reposition metadata pointer to first record */ @@ -1025,28 +1116,31 @@ if ((STARCH_MAJOR_VERSION == 1) && (STARCH_MINOR_VERSION == 0) && (STARCH_REVISION_VERSION == 0)) { #ifdef __cplusplus legacyMdBuf = static_cast( malloc(STARCH_LEGACY_METADATA_SIZE + 1) ); + if (legacyMdBuf != nullptr) { + if (STARCH_writeJSONMetadata(reinterpret_cast( *md ), &legacyMdBuf, const_cast( &type ), kStarchFalse, reinterpret_cast( note )) != STARCH_EXIT_SUCCESS) { + fprintf(stderr, "ERROR: Could not write metadata to buffer\n"); + return STARCH_FATAL_ERROR; + } + if (STARCH_mergeMetadataWithCompressedFiles(reinterpret_cast( *md ), legacyMdBuf) != STARCH_EXIT_SUCCESS) { + fprintf(stderr, "ERROR: Could not merge metadata with compressed streams\n"); + return STARCH_FATAL_ERROR; + } + free(legacyMdBuf); + legacyMdBuf = nullptr; #else legacyMdBuf = malloc(STARCH_LEGACY_METADATA_SIZE + 1); -#endif if (legacyMdBuf != NULL) { -#ifdef __cplusplus - if (STARCH_writeJSONMetadata(reinterpret_cast( *md ), &legacyMdBuf, const_cast( &type ), kStarchFalse, reinterpret_cast( note )) != STARCH_EXIT_SUCCESS) { -#else if (STARCH_writeJSONMetadata((const Metadata *)*md, &legacyMdBuf, (CompressionType *) &type, kStarchFalse, (const char *) note) != STARCH_EXIT_SUCCESS) { -#endif fprintf(stderr, "ERROR: Could not write metadata to buffer\n"); return STARCH_FATAL_ERROR; } -#ifdef __cplusplus - if (STARCH_mergeMetadataWithCompressedFiles(reinterpret_cast( *md ), legacyMdBuf) != STARCH_EXIT_SUCCESS) { -#else if (STARCH_mergeMetadataWithCompressedFiles((const Metadata *)*md, legacyMdBuf) != STARCH_EXIT_SUCCESS) { -#endif fprintf(stderr, "ERROR: Could not merge metadata with compressed streams\n"); return STARCH_FATAL_ERROR; } free(legacyMdBuf); legacyMdBuf = NULL; +#endif } else return STARCH_FATAL_ERROR; @@ -1055,17 +1149,23 @@ /* this is the custom header version of the parser, so we set headerFlag to TRUE */ #ifdef __cplusplus if (STARCH_writeJSONMetadata(reinterpret_cast( *md ), &dynamicMdBuf, const_cast( &type ), kStarchTrue, reinterpret_cast( note )) != STARCH_EXIT_SUCCESS) { -#else - if (STARCH_writeJSONMetadata((const Metadata *)*md, &dynamicMdBuf, (CompressionType *) &type, kStarchTrue, (const char *) note) != STARCH_EXIT_SUCCESS) { -#endif fprintf(stderr, "ERROR: Could not write metadata to buffer\n"); return STARCH_FATAL_ERROR; } -#ifdef __cplusplus if (STARCH_mergeMetadataWithCompressedFiles(reinterpret_cast( *md ), dynamicMdBuf) != STARCH_EXIT_SUCCESS) { + fprintf(stderr, "ERROR: Could not merge metadata with compressed streams\n"); + return STARCH_FATAL_ERROR; + } + if (dynamicMdBuf != nullptr) { + free(dynamicMdBuf); + dynamicMdBuf = nullptr; + } #else + if (STARCH_writeJSONMetadata((const Metadata *)*md, &dynamicMdBuf, (CompressionType *) &type, kStarchTrue, (const char *) note) != STARCH_EXIT_SUCCESS) { + fprintf(stderr, "ERROR: Could not write metadata to buffer\n"); + return STARCH_FATAL_ERROR; + } if (STARCH_mergeMetadataWithCompressedFiles((const Metadata *)*md, dynamicMdBuf) != STARCH_EXIT_SUCCESS) { -#endif fprintf(stderr, "ERROR: Could not merge metadata with compressed streams\n"); return STARCH_FATAL_ERROR; } @@ -1073,6 +1173,7 @@ free(dynamicMdBuf); dynamicMdBuf = NULL; } +#endif else return STARCH_FATAL_ERROR; } @@ -1099,22 +1200,33 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCH_transformHeaderlessInput() ---\n"); #endif - int c; - int cIdx = 0; - int recIdx = 0; - char buffer[STARCH_BUFFER_MAX_LENGTH]; - char *outFn = NULL; - FILE *outFnPtr = NULL; #ifdef __cplusplus + char *outFn = nullptr; + FILE *outFnPtr = nullptr; FILE *streamPtr = const_cast( fp ); + char *outCompressedFn = nullptr; + char *remainder = nullptr; + char *prevChromosome = nullptr; + char *chromosome = nullptr; + Metadata *firstRecord = nullptr; + char *legacyMdBuf = nullptr; + char *dynamicMdBuf = nullptr; #else + char *outFn = NULL; + FILE *outFnPtr = NULL; FILE *streamPtr = (FILE *) fp; -#endif char *outCompressedFn = NULL; char *remainder = NULL; char *prevChromosome = NULL; char *chromosome = NULL; Metadata *firstRecord = NULL; + char *legacyMdBuf = NULL; + char *dynamicMdBuf = NULL; +#endif + int c; + int cIdx = 0; + int recIdx = 0; + char buffer[STARCH_BUFFER_MAX_LENGTH]; int64_t start = 0; int64_t stop = 0; int64_t previousStop = 0; @@ -1125,8 +1237,6 @@ Boolean withinChr = kStarchFalse; unsigned long lineIdx = 0UL; off_t outCompressedFnSize = 0; - char *legacyMdBuf = NULL; - char *dynamicMdBuf = NULL; BaseCountType totalNonUniqueBases = 0; BaseCountType totalUniqueBases = 0; Boolean duplicateElementExistsFlag = STARCH_DEFAULT_DUPLICATE_ELEMENT_FLAG_VALUE; @@ -1154,15 +1264,19 @@ if ( (!prevChromosome) || (strcmp(chromosome, prevChromosome) != 0) ) { /* close old output file pointer */ - if (outFnPtr != NULL) { +#ifdef __cplusplus + if (outFnPtr != nullptr) { fclose(outFnPtr); - outFnPtr = NULL; - + outFnPtr = nullptr; if (type == kBzip2) { /* bzip-compress the previous file */ -#ifdef __cplusplus if (STARCH_compressFileWithBzip2(reinterpret_cast( outFn ), &outCompressedFn, static_cast( &outCompressedFnSize ) ) != 0) { #else + if (outFnPtr != NULL) { + fclose(outFnPtr); + outFnPtr = NULL; + if (type == kBzip2) { + /* bzip-compress the previous file */ if (STARCH_compressFileWithBzip2((const char *)outFn, &outCompressedFn, (off_t *) &outCompressedFnSize ) != 0) { #endif fprintf(stderr, "ERROR: Could not bzip2 compress per-chromosome output file %s\n", outFn); @@ -1204,14 +1318,22 @@ totalUniqueBases, duplicateElementExistsFlag, nestedElementExistsFlag, +#ifdef __cplusplus + nullptr, +#else NULL, +#endif STARCH_DEFAULT_LINE_STRING_LENGTH) != STARCH_EXIT_SUCCESS) { fprintf(stderr, "ERROR: Could not update metadata%s\n", outFn); return STARCH_FATAL_ERROR; } /* cleanup */ +#ifdef __cplusplus + free(outCompressedFn); outCompressedFn = nullptr; +#else free(outCompressedFn); outCompressedFn = NULL; +#endif } /* test if current chromosome is already a Metadata record */ @@ -1253,7 +1375,11 @@ totalUniqueBases, duplicateElementExistsFlag, nestedElementExistsFlag, +#ifdef __cplusplus + nullptr, +#else NULL, +#endif STARCH_DEFAULT_LINE_STRING_LENGTH); firstRecord = *md; } @@ -1267,19 +1393,27 @@ totalUniqueBases, duplicateElementExistsFlag, nestedElementExistsFlag, +#ifdef __cplusplus + nullptr, +#else NULL, +#endif STARCH_DEFAULT_LINE_STRING_LENGTH); } /* make previous chromosome the current chromosome */ - if (prevChromosome != NULL) { +#ifdef __cplusplus + if (prevChromosome != nullptr) { free(prevChromosome); - prevChromosome = NULL; + prevChromosome = nullptr; } -#ifdef __cplusplus prevChromosome = static_cast( malloc(strlen(chromosome) + 1) ); strncpy(prevChromosome, reinterpret_cast( chromosome ), strlen(chromosome) + 1); #else + if (prevChromosome != NULL) { + free(prevChromosome); + prevChromosome = NULL; + } prevChromosome = malloc(strlen(chromosome) + 1); strncpy(prevChromosome, (const char *)chromosome, strlen(chromosome) + 1); #endif @@ -1303,7 +1437,7 @@ if (stop > start) coordDiff = stop - start; else { - fprintf(stderr, "ERROR: BED data is corrupt at line %lu (stop: %" PRId64 ", start: %" PRId64 ")\n", lineIdx, stop, start); + fprintf(stderr, "ERROR: (A) BED data is corrupt at line %lu (stop: %" PRId64 ", start: %" PRId64 ")\n", lineIdx, stop, start); return STARCH_FATAL_ERROR; } if (coordDiff != lcDiff) { @@ -1360,11 +1494,19 @@ /* cleanup unused data */ if (withinChr == kStarchTrue) { free(chromosome); +#ifdef __cplusplus + chromosome = nullptr; +#else chromosome = NULL; +#endif } if (remainder) { free(remainder); +#ifdef __cplusplus + remainder = nullptr; +#else remainder = NULL; +#endif } cIdx = 0; } @@ -1378,12 +1520,12 @@ } /* compress the remaining file */ - if (outFnPtr != NULL) { +#ifdef __cplusplus + if (outFnPtr != nullptr) { fclose(outFnPtr); - outFnPtr = NULL; + outFnPtr = nullptr; if (type == kBzip2) { -#ifdef __cplusplus if (STARCH_compressFileWithBzip2(reinterpret_cast( outFn ), &outCompressedFn, static_cast( &outCompressedFnSize )) != 0) { @@ -1391,6 +1533,11 @@ return STARCH_FATAL_ERROR; } #else + if (outFnPtr != NULL) { + fclose(outFnPtr); + outFnPtr = NULL; + + if (type == kBzip2) { if (STARCH_compressFileWithBzip2((const char *)outFn, &outCompressedFn, (off_t *) &outCompressedFnSize) != 0) { @@ -1443,11 +1590,20 @@ totalUniqueBases, duplicateElementExistsFlag, nestedElementExistsFlag, +#ifdef __cplusplus + nullptr, +#else NULL, +#endif STARCH_DEFAULT_LINE_STRING_LENGTH); - free(outCompressedFn); outCompressedFn = NULL; +#ifdef __cplusplus + free(outCompressedFn); outCompressedFn = nullptr; + free(outFn); outFn = nullptr; +#else + free(outCompressedFn); outCompressedFn = NULL; free(outFn); outFn = NULL; +#endif } /* @@ -1473,38 +1629,43 @@ if ((STARCH_MAJOR_VERSION == 1) && (STARCH_MINOR_VERSION == 0) && (STARCH_REVISION_VERSION == 0)) { #ifdef __cplusplus legacyMdBuf = static_cast( malloc(STARCH_LEGACY_METADATA_SIZE + 1) ); -#else - legacyMdBuf = malloc(STARCH_LEGACY_METADATA_SIZE + 1); -#endif - if (legacyMdBuf != NULL) { + if (legacyMdBuf != nullptr) { /* headerless input was not supported in this version, so it is set to FALSE */ -#ifdef __cplusplus if (STARCH_writeJSONMetadata(reinterpret_cast( *md ), &legacyMdBuf, const_cast( &type ), kStarchFalse, reinterpret_cast( note )) != STARCH_EXIT_SUCCESS) { + fprintf(stderr, "ERROR: Could not write metadata to buffer\n"); + return STARCH_FATAL_ERROR; + } + if (STARCH_mergeMetadataWithCompressedFiles(reinterpret_cast( *md ), legacyMdBuf) != STARCH_EXIT_SUCCESS) { + fprintf(stderr, "ERROR: Could not merge metadata with compressed streams\n"); + return STARCH_FATAL_ERROR; + } + free(legacyMdBuf); + legacyMdBuf = nullptr; + } #else + legacyMdBuf = malloc(STARCH_LEGACY_METADATA_SIZE + 1); + if (legacyMdBuf != NULL) { + /* headerless input was not supported in this version, so it is set to FALSE */ if (STARCH_writeJSONMetadata((const Metadata *) *md, &legacyMdBuf, (CompressionType *) &type, kStarchFalse, (const char *) note) != STARCH_EXIT_SUCCESS) { -#endif fprintf(stderr, "ERROR: Could not write metadata to buffer\n"); return STARCH_FATAL_ERROR; } -#ifdef __cplusplus - if (STARCH_mergeMetadataWithCompressedFiles(reinterpret_cast( *md ), legacyMdBuf) != STARCH_EXIT_SUCCESS) { -#else if (STARCH_mergeMetadataWithCompressedFiles((const Metadata *) *md, legacyMdBuf) != STARCH_EXIT_SUCCESS) { -#endif fprintf(stderr, "ERROR: Could not merge metadata with compressed streams\n"); return STARCH_FATAL_ERROR; } free(legacyMdBuf); legacyMdBuf = NULL; } +#endif else return STARCH_FATAL_ERROR; } @@ -1516,21 +1677,28 @@ const_cast( &type ), kStarchFalse, reinterpret_cast( note )) != STARCH_EXIT_SUCCESS) { + fprintf(stderr, "ERROR: Could not write metadata to buffer\n"); + return STARCH_FATAL_ERROR; + } + if (STARCH_mergeMetadataWithCompressedFiles(reinterpret_cast( *md ), dynamicMdBuf) != STARCH_EXIT_SUCCESS) { + fprintf(stderr, "ERROR: Could not merge metadata with compressed streams\n"); + return STARCH_FATAL_ERROR; + } + + if (dynamicMdBuf != nullptr) { + free(dynamicMdBuf); + dynamicMdBuf = nullptr; + } #else if (STARCH_writeJSONMetadata((const Metadata *) *md, &dynamicMdBuf, (CompressionType *) &type, kStarchFalse, (const char *) note) != STARCH_EXIT_SUCCESS) { -#endif fprintf(stderr, "ERROR: Could not write metadata to buffer\n"); return STARCH_FATAL_ERROR; } -#ifdef __cplusplus - if (STARCH_mergeMetadataWithCompressedFiles(reinterpret_cast( *md ), dynamicMdBuf) != STARCH_EXIT_SUCCESS) { -#else if (STARCH_mergeMetadataWithCompressedFiles((const Metadata *) *md, dynamicMdBuf) != STARCH_EXIT_SUCCESS) { -#endif fprintf(stderr, "ERROR: Could not merge metadata with compressed streams\n"); return STARCH_FATAL_ERROR; } @@ -1539,6 +1707,7 @@ free(dynamicMdBuf); dynamicMdBuf = NULL; } +#endif else return STARCH_FATAL_ERROR; } @@ -1597,13 +1766,16 @@ #ifdef __cplusplus result = static_cast( malloc(len + 1) ); + if (!result) { + return nullptr; + } #else result = malloc(len + 1); + if (!result) { + return NULL; + } #endif - if (!result) - return NULL; - result[len] = '\0'; #ifdef __cplusplus return static_cast( memcpy (result, s, len) ); @@ -1703,6 +1875,27 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCH2_transformHeaderedBEDInput() ---\n"); #endif +#ifdef __cplusplus + char *pRemainder = nullptr; + char *prevChromosome = nullptr; + char *chromosome = nullptr; + char *remainder = nullptr; + char *compressedFn = nullptr; + Metadata *firstRecord = nullptr; + char *json = nullptr; + char *base64EncodedSha1Digest = nullptr; + BZFILE *bzFp = nullptr; +#else + char *pRemainder = NULL; + char *prevChromosome = NULL; + char *chromosome = NULL; + char *remainder = NULL; + char *compressedFn = NULL; + Metadata *firstRecord = NULL; + char *json = NULL; + char *base64EncodedSha1Digest = NULL; + BZFILE *bzFp = NULL; +#endif int c; unsigned int cIdx = 0; char untransformedBuffer[STARCH_BUFFER_MAX_LENGTH]; @@ -1713,14 +1906,10 @@ int64_t stop = 0; int64_t pStart = -1; int64_t pStop = -1; - char *pRemainder = NULL; int64_t previousStop = 0; int64_t lastPosition = 0; int64_t lcDiff = 0; int64_t coordDiff = 0; - char *prevChromosome = NULL; - char *chromosome = NULL; - char *remainder = NULL; Boolean withinChr = kStarchFalse; unsigned long totalNonUniqueBases = 0UL; unsigned long totalUniqueBases = 0UL; @@ -1731,12 +1920,8 @@ size_t recIdx = 0U; size_t currentRecSize = 0U; size_t cumulativeRecSize = 0U; - char *compressedFn = NULL; - Metadata *firstRecord = NULL; - char *json = NULL; CompressionType type = compressionType; unsigned char sha1Digest[STARCH2_MD_FOOTER_SHA1_LENGTH] = {0}; - char *base64EncodedSha1Digest = NULL; int zError = -1; char zBuffer[STARCH_Z_BUFFER_MAX_LENGTH] = {0}; z_stream zStream; @@ -1748,7 +1933,6 @@ unsigned int bzBytesWrittenLo32 = 0U; unsigned int bzBytesWrittenHi32 = 0U; FILE *outFp = stdout; - BZFILE *bzFp = NULL; char footerCumulativeRecordSizeBuffer[STARCH2_MD_FOOTER_CUMULATIVE_RECORD_SIZE_LENGTH + 1] = {0}; char footerRemainderBuffer[STARCH2_MD_FOOTER_REMAINDER_LENGTH] = {0}; char footerBuffer[STARCH2_MD_FOOTER_LENGTH] = {0}; @@ -1816,10 +2000,16 @@ else if (compressionType == kGzip) { #ifdef DEBUG fprintf(stderr, "\tsetting up gzip stream...\n"); -#endif +#endif +#ifdef __cplusplus + zStream.zalloc = nullptr; + zStream.zfree = nullptr; + zStream.opaque = nullptr; +#else zStream.zalloc = Z_NULL; zStream.zfree = Z_NULL; zStream.opaque = Z_NULL; +#endif /* cf. http://www.zlib.net/manual.html for level information */ /* zError = deflateInit2(&zStream, STARCH_Z_COMPRESSION_LEVEL, Z_DEFLATED, STARCH_Z_WINDOW_BITS, STARCH_Z_MEMORY_LEVEL, Z_DEFAULT_STRATEGY); */ zError = deflateInit(&zStream, STARCH_Z_COMPRESSION_LEVEL); @@ -1869,7 +2059,11 @@ return STARCH_FATAL_ERROR; } free(pRemainder); +#ifdef __cplusplus + pRemainder = nullptr; +#else pRemainder = NULL; +#endif } if ((reportProgressFlag == kStarchTrue) && (lineIdx % reportProgressN == 0)) { @@ -1973,13 +2167,21 @@ } } } +#ifdef __cplusplus + bzBytesWritten = static_cast( bzBytesWrittenHi32 ) << 32 | bzBytesWrittenLo32; +#else bzBytesWritten = (size_t) bzBytesWrittenHi32 << 32 | bzBytesWrittenLo32; +#endif cumulativeRecSize += bzBytesWritten; currentRecSize += bzBytesWritten; bzBytesWritten = 0; bzBytesWrittenLo32 = 0U; bzBytesWrittenHi32 = 0U; +#ifdef __cplusplus + bzFp = nullptr; +#else bzFp = NULL; +#endif if (STARCH_updateMetadataForChromosome(md, prevChromosome, @@ -2112,9 +2314,15 @@ #ifdef DEBUG fprintf(stderr, "\t(final-between-chromosome) creating fresh z-stream\n"); #endif +#ifdef __cplusplus + zStream.zalloc = nullptr; + zStream.zfree = nullptr; + zStream.opaque = nullptr; +#else zStream.zalloc = Z_NULL; zStream.zfree = Z_NULL; zStream.opaque = Z_NULL; +#endif #ifdef DEBUG fprintf(stderr, "\t(final-between-chromosome) initializing z-stream\n"); #endif @@ -2145,7 +2353,11 @@ /* clean up per-chromosome hash digest */ if (base64EncodedSha1Digest) { free(base64EncodedSha1Digest); +#ifdef __cplusplus + base64EncodedSha1Digest = nullptr; +#else base64EncodedSha1Digest = NULL; +#endif } } @@ -2155,7 +2367,11 @@ fprintf(stderr, "\t(final-between-chromosome) creating placeholder md record at chromosome: %s (compressedFn: %s)\n", chromosome, compressedFn); #endif if (recIdx == 0) { +#ifdef __cplusplus + *md = nullptr; +#else *md = NULL; +#endif *md = STARCH_createMetadata(chromosome, compressedFn, 0, @@ -2187,28 +2403,33 @@ } /* make previous chromosome the current chromosome */ - if (prevChromosome != NULL) { +#ifdef __cplusplus + if (prevChromosome != nullptr) { free(prevChromosome); - prevChromosome = NULL; + prevChromosome = nullptr; } -#ifdef __cplusplus prevChromosome = static_cast( malloc(strlen(chromosome) + 1) ); -#else - prevChromosome = malloc(strlen(chromosome) + 1); -#endif if (!prevChromosome) { fprintf(stderr, "ERROR: Could not allocate space for previous chromosome marker."); return STARCH_FATAL_ERROR; } -#ifdef __cplusplus strncpy(prevChromosome, reinterpret_cast( chromosome ), strlen(chromosome) + 1); #else + if (prevChromosome != NULL) { + free(prevChromosome); + prevChromosome = NULL; + } + prevChromosome = malloc(strlen(chromosome) + 1); + if (!prevChromosome) { + fprintf(stderr, "ERROR: Could not allocate space for previous chromosome marker."); + return STARCH_FATAL_ERROR; + } strncpy(prevChromosome, (const char *) chromosome, strlen(chromosome) + 1); #endif /* reset flag, lastPosition and lcDiff, increment record index */ #ifdef DEBUG - fprintf(stderr, "\t(final-between-chromosome) resetting per-chromosome stream transformation parameters...\n"); + fprintf(stderr, "\t(final-between-chromosome A) resetting per-chromosome stream transformation parameters...\n"); #endif withinChr = kStarchFalse; lastPosition = 0; @@ -2216,7 +2437,11 @@ pStop = -1; if (pRemainder) { free(pRemainder); +#ifdef __cplusplus + pRemainder = nullptr; +#else pRemainder = NULL; +#endif } previousStop = 0; lcDiff = 0; @@ -2263,7 +2488,7 @@ if (stop > start) coordDiff = stop - start; else { - fprintf(stderr, "ERROR: BED data is corrupt at line %lu (stop: %" PRId64 ", start: %" PRId64 ")\n", lineIdx, stop, start); + fprintf(stderr, "ERROR: (B) BED data is corrupt at line %lu (stop: %" PRId64 ", start: %" PRId64 ")\n", lineIdx, stop, start); return STARCH_FATAL_ERROR; } if (coordDiff != lcDiff) { @@ -2449,7 +2674,11 @@ pStop = stop; if (pRemainder) { free(pRemainder); +#ifdef __cplusplus + pRemainder = nullptr; +#else pRemainder = NULL; +#endif } if (remainder) pRemainder = STARCH_strndup(remainder, strlen(remainder)); @@ -2457,11 +2686,19 @@ if (withinChr == kStarchTrue) { free(chromosome); +#ifdef __cplusplus + chromosome = nullptr; +#else chromosome = NULL; +#endif } if (remainder) { free(remainder); +#ifdef __cplusplus + remainder = nullptr; +#else remainder = NULL; +#endif } cIdx = 0; } @@ -2502,7 +2739,7 @@ if (stop > start) coordDiff = stop - start; else { - fprintf(stderr, "ERROR: BED data is corrupt at line %lu (stop: %" PRId64 ", start: %" PRId64 ")\n", lineIdx, stop, start); + fprintf(stderr, "ERROR: (C) BED data is corrupt at line %lu (stop: %" PRId64 ", start: %" PRId64 ")\n", lineIdx, stop, start); return STARCH_FATAL_ERROR; } if (coordDiff != lcDiff) { @@ -2570,11 +2807,15 @@ return STARCH_FATAL_ERROR; } free(pRemainder); +#ifdef __cplusplus + pRemainder = nullptr; +#else pRemainder = NULL; +#endif } } else { - fprintf(stderr, "ERROR: BED data is corrupt at line %lu\n", lineIdx); + fprintf(stderr, "ERROR: (D) BED data is corrupt at line %lu\n", lineIdx); return STARCH_FATAL_ERROR; } } @@ -2663,7 +2904,11 @@ } } } +#ifdef __cplusplus + bzBytesWritten = static_cast( bzBytesWrittenHi32 ) << 32 | bzBytesWrittenLo32; +#else bzBytesWritten = (size_t) bzBytesWrittenHi32 << 32 | bzBytesWrittenLo32; +#endif cumulativeRecSize += bzBytesWritten; currentRecSize += bzBytesWritten; @@ -2744,7 +2989,11 @@ be NULL, as will the char pointer prevChromosome. So we put in a stub metadata record. */ lineIdx = 0; +#ifdef __cplusplus + *md = nullptr; +#else *md = NULL; +#endif *md = STARCH_createMetadata(nullChr, nullCompressedFn, currentRecSize, @@ -2765,7 +3014,11 @@ /* clean up per-chromosome hash digest */ if (base64EncodedSha1Digest) { free(base64EncodedSha1Digest); +#ifdef __cplusplus + base64EncodedSha1Digest = nullptr; +#else base64EncodedSha1Digest = NULL; +#endif } /* reset metadata pointer */ @@ -2839,6 +3092,24 @@ fprintf(stdout, "%s", footerBuffer); fflush(stdout); +#ifdef __cplusplus + if (json) { + free(json); + json = nullptr; + } + if (compressedFn) { + free(compressedFn); + compressedFn = nullptr; + } + if (prevChromosome) { + free(prevChromosome); + prevChromosome = nullptr; + } + if (base64EncodedSha1Digest) { + free(base64EncodedSha1Digest); + base64EncodedSha1Digest = nullptr; + } +#else if (json) { free(json); json = NULL; @@ -2855,6 +3126,7 @@ free(base64EncodedSha1Digest); base64EncodedSha1Digest = NULL; } +#endif return STARCH_EXIT_SUCCESS; } @@ -2865,6 +3137,29 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCH2_transformHeaderlessBEDInput() ---\n"); #endif +#ifdef __cplusplus + char *pRemainder = nullptr; + char *prevChromosome = nullptr; + char *chromosome = nullptr; + char *remainder = nullptr; + char *compressedFn = nullptr; + Metadata *firstRecord = nullptr; + char *json = nullptr; + char *jsonCopy = nullptr; + char *base64EncodedSha1Digest = nullptr; + BZFILE *bzFp = nullptr; +#else + char *pRemainder = NULL; + char *prevChromosome = NULL; + char *chromosome = NULL; + char *remainder = NULL; + char *compressedFn = NULL; + Metadata *firstRecord = NULL; + char *json = NULL; + char *jsonCopy = NULL; + char *base64EncodedSha1Digest = NULL; + BZFILE *bzFp = NULL; +#endif int c; unsigned int cIdx = 0; char untransformedBuffer[STARCH_BUFFER_MAX_LENGTH + 1] = {0}; @@ -2875,14 +3170,10 @@ int64_t stop = 0; int64_t pStart = -1; int64_t pStop = -1; - char *pRemainder = NULL; int64_t previousStop = 0; int64_t lastPosition = 0; int64_t lcDiff = 0; int64_t coordDiff = 0; - char *prevChromosome = NULL; - char *chromosome = NULL; - char *remainder = NULL; Boolean withinChr = kStarchFalse; unsigned long totalNonUniqueBases = 0UL; unsigned long totalUniqueBases = 0UL; @@ -2893,13 +3184,8 @@ size_t recIdx = 0U; size_t currentRecSize = 0U; size_t cumulativeRecSize = 0U; - char *compressedFn = NULL; - Metadata *firstRecord = NULL; - char *json = NULL; - char *jsonCopy = NULL; CompressionType type = compressionType; unsigned char sha1Digest[STARCH2_MD_FOOTER_SHA1_LENGTH] = {0}; - char *base64EncodedSha1Digest = NULL; int zError = -1; char zBuffer[STARCH_Z_BUFFER_MAX_LENGTH] = {0}; z_stream zStream; @@ -2911,7 +3197,6 @@ unsigned int bzBytesWrittenLo32 = 0U; unsigned int bzBytesWrittenHi32 = 0U; FILE *outFp = stdout; - BZFILE *bzFp = NULL; char footerCumulativeRecordSizeBuffer[STARCH2_MD_FOOTER_CUMULATIVE_RECORD_SIZE_LENGTH + 1] = {0}; char footerRemainderBuffer[STARCH2_MD_FOOTER_REMAINDER_LENGTH] = {0}; char footerBuffer[STARCH2_MD_FOOTER_LENGTH] = {0}; @@ -2976,10 +3261,16 @@ else if (compressionType == kGzip) { #ifdef DEBUG fprintf(stderr, "\tsetting up gzip stream...\n"); -#endif +#endif +#ifdef __cplusplus + zStream.zalloc = nullptr; + zStream.zfree = nullptr; + zStream.opaque = nullptr; +#else zStream.zalloc = Z_NULL; zStream.zfree = Z_NULL; zStream.opaque = Z_NULL; +#endif /* cf. http://www.zlib.net/manual.html for level information */ /* zError = deflateInit2(&zStream, STARCH_Z_COMPRESSION_LEVEL, Z_DEFLATED, STARCH_Z_WINDOW_BITS, STARCH_Z_MEMORY_LEVEL, Z_DEFAULT_STRATEGY); */ zError = deflateInit(&zStream, STARCH_Z_COMPRESSION_LEVEL); @@ -3021,6 +3312,9 @@ maxStringLength = (maxStringLength >= cIdx) ? maxStringLength : cIdx; if (STARCH_createTransformTokensForHeaderlessInput(untransformedBuffer, '\t', &chromosome, &start, &stop, &remainder) == 0) { +#ifdef DEBUG + fprintf(stderr, "\t(tokens) chromosome: [%s] start [%" PRId64 "] stop [%" PRId64 "] remainder [%s]\n", chromosome, start, stop, remainder); +#endif if (pRemainder) { previousAndCurrentChromosomesAreIdentical = ((prevChromosome) && (strcmp(chromosome, prevChromosome) == 0)) ? kStarchTrue : kStarchFalse; /* if previous start and stop coordinates are the same, compare the remainder here */ @@ -3028,8 +3322,12 @@ fprintf(stderr, "ERROR: (C) Elements with same start and stop coordinates have remainders in wrong sort order.\nBe sure to first sort input with sort-bed or remove --do-not-sort option from conversion script.\nDebug:\nchromosome [%s] start [%" PRId64 "] stop [%" PRId64 "]\nline [%ld]\nremainder A [%s]\nremainder B [%s]\nstrcmp(A,B) [%d]\n", chromosome, start, stop, lineIdx, remainder, pRemainder, strcmp(remainder, pRemainder)); return STARCH_FATAL_ERROR; } - free(pRemainder); + free(pRemainder); +#ifdef __cplusplus + pRemainder = nullptr; +#else pRemainder = NULL; +#endif } if ((reportProgressFlag == kStarchTrue) && (lineIdx % reportProgressN == 0)) { @@ -3132,13 +3430,21 @@ } } } +#ifdef __cplusplus + bzBytesWritten = static_cast( bzBytesWrittenHi32 ) << 32 | bzBytesWrittenLo32; +#else bzBytesWritten = (size_t) bzBytesWrittenHi32 << 32 | bzBytesWrittenLo32; +#endif cumulativeRecSize += bzBytesWritten; currentRecSize += bzBytesWritten; bzBytesWritten = 0; bzBytesWrittenLo32 = 0U; bzBytesWrittenHi32 = 0U; +#ifdef __cplusplus + bzFp = nullptr; +#else bzFp = NULL; +#endif if (STARCH_updateMetadataForChromosome(md, prevChromosome, @@ -3271,9 +3577,15 @@ #ifdef DEBUG fprintf(stderr, "\t(final-between-chromosome) creating fresh z-stream\n"); #endif +#ifdef __cplusplus + zStream.zalloc = nullptr; + zStream.zfree = nullptr; + zStream.opaque = nullptr; +#else zStream.zalloc = Z_NULL; zStream.zfree = Z_NULL; zStream.opaque = Z_NULL; +#endif #ifdef DEBUG fprintf(stderr, "\t(final-between-chromosome) initializing z-stream\n"); #endif @@ -3304,7 +3616,11 @@ /* clean up per-chromosome hash digest */ if (base64EncodedSha1Digest) { free(base64EncodedSha1Digest); +#ifdef __cplusplus + base64EncodedSha1Digest = nullptr; +#else base64EncodedSha1Digest = NULL; +#endif } } @@ -3314,7 +3630,11 @@ fprintf(stderr, "\t(final-between-chromosome) creating placeholder md record at chromosome: %s (compressedFn: %s) (signature: %s)\n", chromosome, compressedFn, base64EncodedSha1Digest); #endif if (recIdx == 0) { +#ifdef __cplusplus + *md = nullptr; +#else *md = NULL; +#endif *md = STARCH_createMetadata(chromosome, compressedFn, 0, @@ -3323,7 +3643,11 @@ 0UL, STARCH_DEFAULT_DUPLICATE_ELEMENT_FLAG_VALUE, STARCH_DEFAULT_NESTED_ELEMENT_FLAG_VALUE, +#ifdef __cplusplus + nullptr, +#else NULL, +#endif STARCH_DEFAULT_LINE_STRING_LENGTH); if (!*md) { fprintf(stderr, "ERROR: Not enough memory is available\n"); @@ -3341,18 +3665,26 @@ 0UL, STARCH_DEFAULT_DUPLICATE_ELEMENT_FLAG_VALUE, STARCH_DEFAULT_DUPLICATE_ELEMENT_FLAG_VALUE, +#ifdef __cplusplus + nullptr, +#else NULL, +#endif STARCH_DEFAULT_LINE_STRING_LENGTH); } /* make previous chromosome the current chromosome */ - if (prevChromosome != NULL) { +#ifdef __cplusplus + if (prevChromosome != nullptr) { free(prevChromosome); - prevChromosome = NULL; + prevChromosome = nullptr; } -#ifdef __cplusplus prevChromosome = static_cast( malloc(strlen(chromosome) + 1) ); #else + if (prevChromosome != NULL) { + free(prevChromosome); + prevChromosome = NULL; + } prevChromosome = malloc(strlen(chromosome) + 1); #endif if (!prevChromosome) { @@ -3367,7 +3699,7 @@ /* reset flag, lastPosition and lcDiff, increment record index */ #ifdef DEBUG - fprintf(stderr, "\t(final-between-chromosome) resetting per-chromosome stream transformation parameters...\n"); + fprintf(stderr, "\t(final-between-chromosome B) resetting per-chromosome stream transformation parameters...\n"); #endif withinChr = kStarchFalse; lastPosition = 0; @@ -3375,7 +3707,11 @@ pStop = -1; if (pRemainder) { free(pRemainder); +#ifdef __cplusplus + pRemainder = nullptr; +#else pRemainder = NULL; +#endif } previousStop = 0; lcDiff = 0; @@ -3397,7 +3733,7 @@ if (stop > start) coordDiff = stop - start; else { - fprintf(stderr, "ERROR: BED data is corrupt at line %lu (stop: %" PRId64 ", start: %" PRId64 ")\n", lineIdx, stop, start); + fprintf(stderr, "ERROR: (E) BED data is corrupt at line %lu (stop: %" PRId64 ", start: %" PRId64 ")\n", lineIdx, stop, start); return STARCH_FATAL_ERROR; } if (coordDiff != lcDiff) { @@ -3594,6 +3930,23 @@ /* set pElement values */ pStart = start; pStop = stop; +#ifdef __cplusplus + if (pRemainder) { + free(pRemainder); + pRemainder = nullptr; + } + if (remainder) + pRemainder = STARCH_strndup(remainder, strlen(remainder)); + + if (withinChr == kStarchTrue) { + free(chromosome); + chromosome = nullptr; + } + if (remainder) { + free(remainder); + remainder = nullptr; + } +#else if (pRemainder) { free(pRemainder); pRemainder = NULL; @@ -3609,6 +3962,7 @@ free(remainder); remainder = NULL; } +#endif cIdx = 0; } else { @@ -3643,7 +3997,7 @@ if (stop > start) coordDiff = stop - start; else { - fprintf(stderr, "ERROR: BED data is corrupt at line %lu (stop: %" PRId64 ", start: %" PRId64 ")\n", lineIdx, stop, start); + fprintf(stderr, "ERROR: (F) BED data is corrupt at line %lu (stop: %" PRId64 ", start: %" PRId64 ")\n", lineIdx, stop, start); return STARCH_FATAL_ERROR; } if (coordDiff != lcDiff) { @@ -3742,11 +4096,15 @@ return STARCH_FATAL_ERROR; } free(pRemainder); +#ifdef __cplusplus + pRemainder = nullptr; +#else pRemainder = NULL; +#endif } } else { - fprintf(stderr, "ERROR: BED data is corrupt at line %lu\n", lineIdx); + fprintf(stderr, "ERROR: (G) BED data is corrupt at line %lu\n", lineIdx); return STARCH_FATAL_ERROR; } } @@ -3840,7 +4198,11 @@ } } } +#ifdef __cplusplus + bzBytesWritten = static_cast( bzBytesWrittenHi32 ) << 32 | bzBytesWrittenLo32; +#else bzBytesWritten = (size_t) bzBytesWrittenHi32 << 32 | bzBytesWrittenLo32; +#endif cumulativeRecSize += bzBytesWritten; currentRecSize += bzBytesWritten; #ifdef DEBUG @@ -3925,7 +4287,11 @@ be NULL, as will the char pointer prevChromosome. So we put in a stub metadata record. */ lineIdx = 0; +#ifdef __cplusplus + *md = nullptr; +#else *md = NULL; +#endif *md = STARCH_createMetadata(nullChr, nullCompressedFn, currentRecSize, @@ -3946,7 +4312,11 @@ /* clean up per-chromosome hash digest */ if (base64EncodedSha1Digest) { free(base64EncodedSha1Digest); +#ifdef __cplusplus + base64EncodedSha1Digest = nullptr; +#else base64EncodedSha1Digest = NULL; +#endif } /* reset metadata pointer */ @@ -4022,6 +4392,24 @@ fprintf(stdout, "%s", footerBuffer); fflush(stdout); +#ifdef __cplusplus + if (json) { + free(json); + json = nullptr; + } + if (compressedFn) { + free(compressedFn); + compressedFn = nullptr; + } + if (prevChromosome) { + free(prevChromosome); + prevChromosome = nullptr; + } + if (base64EncodedSha1Digest) { + free(base64EncodedSha1Digest); + base64EncodedSha1Digest = nullptr; + } +#else if (json) { free(json); json = NULL; @@ -4038,6 +4426,7 @@ free(base64EncodedSha1Digest); base64EncodedSha1Digest = NULL; } +#endif return STARCH_EXIT_SUCCESS; } diff -Nru bedops-2.4.35+dfsg/interfaces/src/data/starch/starchMetadataHelpers.c bedops-2.4.36+dfsg/interfaces/src/data/starch/starchMetadataHelpers.c --- bedops-2.4.35+dfsg/interfaces/src/data/starch/starchMetadataHelpers.c 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/interfaces/src/data/starch/starchMetadataHelpers.c 2019-05-23 20:06:31.000000000 +0000 @@ -70,7 +70,11 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCH_createMetadata() ---\n"); #endif +#ifdef __cplusplus + Metadata *newMetadata = nullptr; +#else Metadata *newMetadata = NULL; +#endif size_t fnLength = 0; size_t chrLength = 0; size_t signatureLength = 0; @@ -88,11 +92,13 @@ newMetadata = malloc(sizeof(Metadata)); #endif - if ((newMetadata != NULL) && (chr != NULL) && (fn != NULL)) { - newMetadata->chromosome = NULL; #ifdef __cplusplus + if ((newMetadata != nullptr) && (chr != nullptr) && (fn != nullptr)) { + newMetadata->chromosome = nullptr; newMetadata->chromosome = static_cast( malloc(chrLength + 1) ); #else + if ((newMetadata != NULL) && (chr != NULL) && (fn != NULL)) { + newMetadata->chromosome = NULL; newMetadata->chromosome = malloc(chrLength + 1); #endif if (!newMetadata->chromosome) { @@ -101,10 +107,11 @@ } strncpy(newMetadata->chromosome, chr, chrLength + 1); - newMetadata->filename = NULL; #ifdef __cplusplus + newMetadata->filename = nullptr; newMetadata->filename = static_cast( malloc(fnLength + 1) ); #else + newMetadata->filename = NULL; newMetadata->filename = malloc(fnLength + 1); #endif if (!newMetadata->filename) { @@ -114,11 +121,13 @@ strncpy(newMetadata->filename, fn, fnLength + 1); /* we allow a NULL signature for placeholder purposes */ - newMetadata->signature = NULL; - if (signature) { #ifdef __cplusplus + newMetadata->signature = nullptr; + if (signature) { newMetadata->signature = static_cast( malloc(signatureLength + 1) ); #else + newMetadata->signature = NULL; + if (signature) { newMetadata->signature = malloc(signatureLength + 1); #endif if (!newMetadata->signature) { @@ -135,7 +144,11 @@ newMetadata->totalUniqueBases = totalUniqueBases; newMetadata->duplicateElementExists = duplicateElementExists; newMetadata->nestedElementExists = nestedElementExists; +#ifdef __cplusplus + newMetadata->next = nullptr; +#else newMetadata->next = NULL; +#endif } else { fprintf(stderr, "ERROR: Could not allocate memory for metadata!\n"); @@ -174,8 +187,11 @@ nestedElementExists, signature, lineMaxStringLength); - +#ifdef __cplusplus + if ((newMd != nullptr) && (md->next == nullptr)) +#else if ((newMd != NULL) && (md->next == NULL)) +#endif md->next = newMd; else { fprintf(stderr, "ERROR: Could not allocate memory for metadata!\n"); @@ -191,9 +207,15 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCH_copyMetadata() ---\n"); #endif +#ifdef __cplusplus + Metadata *copy = nullptr; + Metadata *firstRec = nullptr; + const Metadata *iter = nullptr; +#else Metadata *copy = NULL; Metadata *firstRec = NULL; const Metadata *iter = NULL; +#endif /* copy first record */ copy = STARCH_createMetadata(md->chromosome, @@ -210,7 +232,11 @@ md = md->next; /* copy remainder */ +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif copy = STARCH_addMetadata(copy, iter->chromosome, iter->filename, @@ -263,20 +289,23 @@ if (! *md) return STARCH_NONFATAL_ERROR; - for (iter = *md; iter != NULL; iter = iter->next) { #ifdef __cplusplus + for (iter = *md; iter != nullptr; iter = iter->next) { if (strcmp(reinterpret_cast( iter->chromosome ), chr) == 0) { #else + for (iter = *md; iter != NULL; iter = iter->next) { if (strcmp((const char *)iter->chromosome, chr) == 0) { #endif #ifdef DEBUG fprintf(stderr, "\tupdating record for chr: %s\n", iter->chromosome); #endif - free(iter->filename); - iter->filename = NULL; + free(iter->filename); + #ifdef __cplusplus + iter->filename = nullptr; iter->filename = static_cast( malloc(strlen(fn) + 1) ); #else + iter->filename = NULL; iter->filename = malloc(strlen(fn) + 1); #endif strncpy(iter->filename, fn, strlen(fn) + 1); @@ -286,7 +315,11 @@ } if (iter->signature) { free(iter->signature); +#ifdef __cplusplus + iter->signature = nullptr; +#else iter->signature = NULL; +#endif } if (signature) { #ifdef __cplusplus @@ -334,10 +367,11 @@ if (strcmp("all", chr) == 0) chrFound = kStarchTrue; else { - for (iter = md; iter != NULL; iter = iter->next) { #ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { if (strcmp(reinterpret_cast( iter->chromosome ), chr) == 0) { #else + for (iter = md; iter != NULL; iter = iter->next) { if (strcmp((const char *)iter->chromosome, chr) == 0) { #endif chrFound = kStarchTrue; @@ -359,10 +393,11 @@ "duplicateElementExists", "nestedElementExists", "signature"); - for (iter = md; iter != NULL; iter = iter->next) { #ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { if ( (strcmp(reinterpret_cast( iter->chromosome ), chr) == 0) || (strcmp("all", chr) == 0) ) #else + for (iter = md; iter != NULL; iter = iter->next) { if ( (strcmp((const char *)iter->chromosome, chr) == 0) || (strcmp("all", chr) == 0) ) #endif fprintf(stdout, @@ -395,8 +430,11 @@ fprintf(stderr, "ERROR: Could not list chromosomes (metadata structure is empty)\n"); return STARCH_EXIT_FAILURE; } - +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) +#else for (iter = md; iter != NULL; iter = iter->next) +#endif if (strcmp(kStarchNullChromosome, iter->chromosome) != 0) fprintf(stdout, "%s\n", iter->chromosome); @@ -416,8 +454,11 @@ fprintf(stderr, "ERROR: Could not list chromosome (metadata structure is empty)\n"); return STARCH_EXIT_FAILURE; } - +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif if (strcmp(iter->chromosome, chr) == 0) { if (strcmp(kStarchNullChromosome, iter->chromosome) != 0) fprintf(stdout, "%s\n", iter->chromosome); @@ -435,6 +476,30 @@ fprintf(stderr, "\n--- STARCH_freeMetadata() ---\n"); #endif Metadata *iter; +#ifdef __cplusplus + Metadata *prev = nullptr; + + if (! *md) + return; + + for (iter = *md; iter != nullptr; iter = iter->next) { + if (iter->chromosome != nullptr) + free(iter->chromosome); + if (iter->filename != nullptr) + free(iter->filename); + if (iter->signature != nullptr) + free(iter->signature); + if (prev != nullptr) + free(prev); + + prev = iter; + } + + if (prev != nullptr) { + free(prev); + prev = nullptr; + } +#else Metadata *prev = NULL; if (! *md) @@ -457,6 +522,7 @@ free(prev); prev = NULL; } +#endif } int @@ -472,7 +538,11 @@ return STARCH_EXIT_FAILURE; } +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif if (remove(iter->filename) != 0) { fprintf(stderr, "ERROR: Could not delete per-chromosome compressed file %s. Is your BED input not sorted lexographically? Does it contain custom UCSC headers (see --header)?\n", iter->filename); return STARCH_EXIT_FAILURE; @@ -493,13 +563,53 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCH_generateJSONMetadata() ---\n"); #endif - const Metadata *iter = NULL; - json_t *metadataJSON = NULL; #ifdef __cplusplus + const Metadata *iter = nullptr; + json_t *metadataJSON = nullptr; json_t *compressionFormat = json_integer(static_cast(type)); + json_t *streams = json_array(); + json_t *stream = nullptr; + json_t *streamChromosome = nullptr; + json_t *streamFilename = nullptr; + json_t *streamSize = nullptr; + json_t *streamLineCount = nullptr; + json_t *streamLineMaxStringLength = nullptr; + json_t *streamTotalNonUniqueBases = nullptr; + json_t *streamTotalUniqueBases = nullptr; + json_t *streamCustomHeaderFlag = nullptr; + json_t *streamDuplicateElementExistsFlag = nullptr; + json_t *streamNestedElementExistsFlag = nullptr; + json_t *streamSignature = nullptr; + json_t *streamArchive = nullptr; + json_t *streamArchiveType = nullptr; + json_t *streamArchiveNote = nullptr; + json_t *streamArchiveCreationTimestamp = nullptr; + json_t *streamArchiveVersion = nullptr; + json_t *streamArchiveVersionMajor = nullptr; + json_t *streamArchiveVersionMinor = nullptr; + json_t *streamArchiveVersionRevision = nullptr; + char *recordFilenameCopy = nullptr; + char *recordChromosome = nullptr; + char *recordSignature = nullptr; + char *recordToken = nullptr; + char *recordSize = nullptr; + char *creationTimestamp = nullptr; + char *jsonString = nullptr; + size_t creationTimestampLength = STARCH_CREATION_TIMESTAMP_LENGTH; + uint64_t filenameSize = 0; + LineCountType filenameLineCount = 0; + LineLengthType filenameLineMaxStringLength = 0UL; + BaseCountType totalNonUniqueBases = 0; + BaseCountType totalUniqueBases = 0; + time_t creationTime; + struct tm *creationTimeInformation = nullptr; + + if (!md) + return nullptr; #else + const Metadata *iter = NULL; + json_t *metadataJSON = NULL; json_t *compressionFormat = json_integer((json_int_t)type); -#endif json_t *streams = json_array(); json_t *stream = NULL; json_t *streamChromosome = NULL; @@ -539,32 +649,49 @@ if (!md) return NULL; +#endif /* cf. http://www.digip.org/jansson/doc/2.3/apiref.html */ metadataJSON = json_object(); if (!metadataJSON) { fprintf(stderr, "ERROR: Could not instantiate metadata root object\n"); - return NULL; +#ifdef __cplusplus + return nullptr; +#else + return NULL; +#endif } streamArchive = json_object(); if (!streamArchive) { fprintf(stderr, "ERROR: Could not instantiate stream archive object\n"); +#ifdef __cplusplus + return nullptr; +#else return NULL; +#endif } streamArchiveType = json_string(STARCH_METADATA_STREAM_ARCHIVE_TYPE_VALUE); if (!streamArchiveType) { fprintf(stderr, "ERROR: Could not instantiate stream archive type object\n"); +#ifdef __cplusplus + return nullptr; +#else return NULL; +#endif } json_object_set_new(streamArchive, STARCH_METADATA_STREAM_ARCHIVE_TYPE_KEY, streamArchiveType); streamCustomHeaderFlag = json_boolean(headerFlag == kStarchTrue); /* returns json_true() if true, else json_false() */ if (!streamCustomHeaderFlag) { fprintf(stderr, "ERROR: Could not instantiate stream header flag object\n"); +#ifdef __cplusplus + return nullptr; +#else return NULL; +#endif } json_object_set_new(streamArchive, STARCH_METADATA_STREAM_HEADER_BED_TYPE_KEY, streamCustomHeaderFlag); @@ -583,7 +710,11 @@ } if ((!streamArchiveVersionMajor) || (!streamArchiveVersionMinor) || (!streamArchiveVersionRevision)) { fprintf(stderr, "ERROR: Could not instantiate stream archive version objects\n"); +#ifdef __cplusplus + return nullptr; +#else return NULL; +#endif } /* 1.5+ archive */ @@ -596,9 +727,20 @@ creationTimeInformation = localtime(&creationTime); #ifdef __cplusplus creationTimestamp = static_cast( malloc(creationTimestampLength) ); + if (!creationTimestamp) { + fprintf(stderr, "ERROR: Could not instantiate stream archive creation timestamp string\n"); + return nullptr; + } + strftime(creationTimestamp, creationTimestampLength, "%Y-%m-%dT%H:%M:%S%z", creationTimeInformation); + streamArchiveCreationTimestamp = json_string(creationTimestamp); + free(creationTimestamp); + creationTimestamp = nullptr; + if (!streamArchiveCreationTimestamp) { + fprintf(stderr, "ERROR: Could not instantiate stream archive creation timestamp JSON object\n"); + return nullptr; + } #else creationTimestamp = malloc(creationTimestampLength); -#endif if (!creationTimestamp) { fprintf(stderr, "ERROR: Could not instantiate stream archive creation timestamp string\n"); return NULL; @@ -611,6 +753,7 @@ fprintf(stderr, "ERROR: Could not instantiate stream archive creation timestamp JSON object\n"); return NULL; } +#endif } else { /* unstarch - read from archive */ @@ -623,7 +766,11 @@ streamArchiveNote = json_string(note); if (!streamArchiveNote) { fprintf(stderr, "ERROR: Could not instantiate stream archive note object\n"); +#ifdef __cplusplus + return nullptr; +#else return NULL; +#endif } json_object_set_new(streamArchive, STARCH_METADATA_STREAM_ARCHIVE_NOTE_KEY, streamArchiveNote); } @@ -636,7 +783,11 @@ json_object_set_new(streamArchive, STARCH_METADATA_STREAM_COMPRESSION_FORMAT_KEY, compressionFormat); json_object_set_new(metadataJSON, STARCH_METADATA_STREAM_ARCHIVE_KEY, streamArchive); +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif stream = json_object(); recordFilenameCopy = STARCH_strndup(iter->filename, strlen(iter->filename) + 1); @@ -706,14 +857,22 @@ streamDuplicateElementExistsFlag = json_boolean(iter->duplicateElementExists == kStarchTrue); if (!streamDuplicateElementExistsFlag) { fprintf(stderr, "ERROR: Could not instantiate stream duplicate-element-exists flag object\n"); +#ifdef __cplusplus + return nullptr; +#else return NULL; +#endif } json_object_set_new(stream, STARCH_METADATA_STREAM_DUPLICATEELEMENTEXISTS_KEY, streamDuplicateElementExistsFlag); streamNestedElementExistsFlag = json_boolean(iter->nestedElementExists == kStarchTrue); if (!streamNestedElementExistsFlag) { fprintf(stderr, "ERROR: Could not instantiate stream duplicate-element-exists flag object\n"); +#ifdef __cplusplus + return nullptr; +#else return NULL; +#endif } json_object_set_new(stream, STARCH_METADATA_STREAM_NESTEDELEMENTEXISTS_KEY, streamNestedElementExistsFlag); } @@ -770,7 +929,11 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCH_listJSONMetadata() ---\n"); #endif +#ifdef __cplusplus + char *jsonString = nullptr; +#else char *jsonString = NULL; +#endif if (!out) out = stdout; @@ -803,11 +966,19 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCH_writeJSONMetadata() ---\n"); #endif +#ifdef __cplusplus + char *jsonString = nullptr; + size_t jsonLength; + + /* archive version and creation timestamp are NULL, in order to write default values */ + jsonString = STARCH_generateJSONMetadata(md, *type, nullptr, nullptr, note, headerFlag); +#else char *jsonString = NULL; size_t jsonLength; /* archive version and creation timestamp are NULL, in order to write default values */ jsonString = STARCH_generateJSONMetadata(md, *type, NULL, NULL, note, headerFlag); +#endif if (!jsonString) { fprintf(stderr, "ERROR: Could not write JSON-formatted metadata to buffer (JSON string is empty)\n"); @@ -817,18 +988,25 @@ jsonLength = strlen(jsonString) + 1; /* dynamic buffer */ - if (! *buf) #ifdef __cplusplus + if (! *buf) { *buf = static_cast( malloc(jsonLength + 2) ); + } + if (*buf != nullptr) { + memcpy(*buf, jsonString, jsonLength); + free(jsonString); + jsonString = nullptr; + } #else + if (! *buf) { *buf = malloc(jsonLength + 2); -#endif - + } if (*buf != NULL) { memcpy(*buf, jsonString, jsonLength); free(jsonString); jsonString = NULL; } +#endif else { fprintf(stderr, "ERROR: Could not allocate space for JSON-formatted metadata buffer\n"); return STARCH_EXIT_FAILURE; @@ -864,6 +1042,67 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCH_readJSONMetadata() ---\n"); #endif +#ifdef __cplusplus + int charCnt = 0; + char *dynamicBuffer = nullptr; + char *dynamicBufferCopy = nullptr; + char legacyBuffer[STARCH_LEGACY_METADATA_SIZE]; + char testMagicBuffer[STARCH_TEST_BYTE_COUNT] = {0}; + char footerBuffer[STARCH2_MD_FOOTER_LENGTH + 1] = {0}; + char currC = '\0'; + char prevC = '\0'; + uint64_t testMagicOffset = 0; + uint64_t mdOffsetIndex = 0; + Metadata *firstRec = nullptr; + json_t *streamArchive; + json_t *streamArchiveVersion = nullptr; + json_t *streamArchiveCreationTimestamp = nullptr; + json_t *streamArchiveNote = nullptr; + json_t *streams = nullptr; + json_t *stream = nullptr; + json_t *streamChromosome = nullptr; + json_t *streamFilename = nullptr; + json_t *streamSignature = nullptr; + json_t *streamSize = nullptr; + json_t *streamLineCount = nullptr; + json_t *streamLineMaxStringLength = nullptr; + json_t *streamTotalNonUniqueBases = nullptr; + json_t *streamTotalUniqueBases = nullptr; + json_t *streamDuplicateElementExistsFlag = nullptr; + json_t *streamNestedElementExistsFlag = nullptr; + json_t *streamsCompressionType = nullptr; + size_t streamIdx; + char *streamChr = nullptr; + char *streamFn = nullptr; + char *streamCTime = nullptr; + char *streamNote = nullptr; + char *streamSig = nullptr; + uint64_t streamSizeValue = 0; + char *testMagicPrecursor = nullptr; + json_error_t jsonParseError; + const char *jsonObjKey = nullptr; + json_t *jsonObjValue = nullptr; + const char *jsonObjAvKey = nullptr; + json_t *jsonObjAvValue = nullptr; + LineCountType streamLineCountValue = STARCH_DEFAULT_LINE_COUNT; + LineLengthType streamLineMaxStringLengthValue = STARCH_DEFAULT_LINE_STRING_LENGTH; + BaseCountType streamTotalNonUniqueBasesValue = STARCH_DEFAULT_NON_UNIQUE_BASE_COUNT; + BaseCountType streamTotalUniqueBasesValue = STARCH_DEFAULT_UNIQUE_BASE_COUNT; + Boolean streamDuplicateElementExistsValue = STARCH_DEFAULT_DUPLICATE_ELEMENT_FLAG_VALUE; + Boolean streamNestedElementExistsValue = STARCH_DEFAULT_NESTED_ELEMENT_FLAG_VALUE; + json_t *mdJSON = nullptr; + size_t mdHashIndex; + char offsetBuffer[STARCH2_MD_FOOTER_CUMULATIVE_RECORD_SIZE_LENGTH + 1] = {0}; + unsigned char mdHashBuffer[STARCH2_MD_FOOTER_BASE64_ENCODED_SHA1_LENGTH] = {0}; + char *testMdHashBuffer = nullptr; + unsigned char testMdHashSha1Buffer[STARCH2_MD_FOOTER_SHA1_LENGTH]; + off_t fSize; + off_t currentMdOffset; + size_t mdLength; + Boolean starchRevision2Flag = kStarchFalse; + unsigned char starchRevision2HeaderTestBytes[sizeof(starchRevision2HeaderBytes)] = {0}; + size_t nReadBytes; +#else int charCnt = 0; char *dynamicBuffer = NULL; char *dynamicBufferCopy = NULL; @@ -923,6 +1162,7 @@ Boolean starchRevision2Flag = kStarchFalse; unsigned char starchRevision2HeaderTestBytes[sizeof(starchRevision2HeaderBytes)] = {0}; size_t nReadBytes; +#endif if (! *version) { #ifdef __cplusplus @@ -1048,7 +1288,11 @@ /* release pre-magic-byte terminator check */ free(testMagicPrecursor); +#ifdef __cplusplus + testMagicPrecursor = nullptr; +#else testMagicPrecursor = NULL; +#endif /* set metadata offset */ *mdOffset = testMagicOffset; @@ -1133,7 +1377,7 @@ } offsetBuffer[mdOffsetIndex] = '\0'; #ifdef __cplusplus - currentMdOffset = static_cast( strtoull(reinterpret_cast( offsetBuffer ), NULL, STARCH_RADIX) ); + currentMdOffset = static_cast( strtoull(reinterpret_cast( offsetBuffer ), nullptr, STARCH_RADIX) ); *mdOffset = static_cast( currentMdOffset ); #else currentMdOffset = (off_t) strtoull((const char *)offsetBuffer, NULL, STARCH_RADIX); @@ -1467,7 +1711,7 @@ return STARCH_EXIT_FAILURE; } #ifdef __cplusplus - streamSizeValue = static_cast( strtoull(json_string_value(streamSize), NULL, STARCH_RADIX) ); + streamSizeValue = static_cast( strtoull(json_string_value(streamSize), nullptr, STARCH_RADIX) ); #else streamSizeValue = (uint64_t) strtoull(json_string_value(streamSize), NULL, STARCH_RADIX); #endif @@ -1659,10 +1903,17 @@ free(streamFn); if (streamSig) free(streamSig); +#ifdef __cplusplus + if ((mdJSON != nullptr) && (preserveJSONRef == kStarchFalse)) { + json_decref(mdJSON); + mdJSON = nullptr; + } +#else if ((mdJSON != NULL) && (preserveJSONRef == kStarchFalse)) { - json_decref(mdJSON); + json_decref(mdJSON); mdJSON = NULL; - } + } +#endif } else { /* version error */ @@ -1681,6 +1932,34 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCH_mergeMetadataWithCompressedFiles() ---\n"); #endif +#ifdef __cplusplus + const Metadata *iter = nullptr; + FILE *outPtr = nullptr; + FILE *chrFnPtr = nullptr; + int c; + + if ((outPtr = freopen(nullptr, "wb", stdout)) != nullptr) { + fwrite(mdHeader, strlen(mdHeader), 1, outPtr); + for (iter = md; iter != nullptr; iter = iter->next) { + chrFnPtr = fopen(iter->filename, "rb"); + if (!chrFnPtr) { + fprintf(stderr, "ERROR: Could not open per-chromosome data file %s\n", iter->filename); + return STARCH_EXIT_FAILURE; + } + while ((c = fgetc(chrFnPtr)) != EOF) { + if (fputc(c, outPtr) == EOF) { + fprintf(stderr, "ERROR: Could not write to standard output stream\n"); + } + } + fclose(chrFnPtr); + } + fclose(outPtr); + } + else { + fprintf(stderr, "ERROR: Could not open standard output stream\n"); + return STARCH_EXIT_FAILURE; + } +#else const Metadata *iter = NULL; FILE *outPtr = NULL; FILE *chrFnPtr = NULL; @@ -1707,6 +1986,7 @@ fprintf(stderr, "ERROR: Could not open standard output stream\n"); return STARCH_EXIT_FAILURE; } +#endif return STARCH_EXIT_SUCCESS; } @@ -1733,10 +2013,11 @@ #ifdef DEBUG fprintf(stderr, "\n--- STARCH_copyArchiveVersion() ---\n"); #endif - ArchiveVersion *av = NULL; #ifdef __cplusplus + ArchiveVersion *av = nullptr; av = static_cast( malloc (sizeof(ArchiveVersion)) ); #else + ArchiveVersion *av = NULL; av = malloc (sizeof(ArchiveVersion)); #endif if (av) { @@ -1782,10 +2063,19 @@ offset. We leave out post-v1.2 features (line count, etc.). */ +#ifdef __cplusplus + char *token = nullptr; + char *tokenCheck = nullptr; + char *recChromosome = nullptr; + char *recFilename = nullptr; + Metadata *firstRec = nullptr; +#else char *token = NULL; char *tokenCheck = NULL; char *recChromosome = NULL; char *recFilename = NULL; + Metadata *firstRec = NULL; +#endif unsigned long recFileSize = 0UL; LineCountType recLineCountValue = STARCH_DEFAULT_LINE_COUNT; BaseCountType recNonUniqueBaseCountValue = STARCH_DEFAULT_NON_UNIQUE_BASE_COUNT; @@ -1797,7 +2087,6 @@ size_t bufIdx, tokBufIdx, recTokBufIdx; int tokenCount; int recIdx = 0; - Metadata *firstRec = NULL; for (bufIdx = 0, tokBufIdx = 0; bufIdx < STARCH_LEGACY_METADATA_SIZE; bufIdx++, tokBufIdx++) { if (buf[bufIdx] == '\n') { @@ -1805,7 +2094,11 @@ recIdx++; tokBuf[tokBufIdx] = '\0'; token = strtok(tokBuf, "\t"); +#ifdef __cplusplus + for (tokenCount = 0; token != nullptr; tokenCount++) { +#else for (tokenCount = 0; token != NULL; tokenCount++) { +#endif switch (tokenCount) { case 0: { #ifdef __cplusplus @@ -1875,15 +2168,61 @@ } case 1: { /* read file size */ +#ifdef __cplusplus + recFileSize = strtoul(token, nullptr, STARCH_RADIX); +#else recFileSize = strtoul(token, NULL, STARCH_RADIX); +#endif break; } } +#ifdef __cplusplus + token = strtok(nullptr, "\t"); +#else token = strtok(NULL, "\t"); +#endif } /* if tokBufIdx is zero, then we are at the end of the metadata content */ if (tokBufIdx != 0) { +#ifdef __cplusplus + /* put record into metadata */ + if (recIdx == 1) { + *rec = STARCH_createMetadata(recChromosome, + recFilename, + recFileSize, + recLineCountValue, + recNonUniqueBaseCountValue, + recUniqueBaseCountValue, + recDuplicateElementExistsFlagValue, + recNestedElementExistsFlagValue, + nullptr, + STARCH_DEFAULT_LINE_STRING_LENGTH); + firstRec = *rec; + } + else + *rec = STARCH_addMetadata(*rec, + recChromosome, + recFilename, + recFileSize, + recLineCountValue, + recNonUniqueBaseCountValue, + recUniqueBaseCountValue, + recDuplicateElementExistsFlagValue, + recNestedElementExistsFlagValue, + nullptr, + STARCH_DEFAULT_LINE_STRING_LENGTH); + + /* cleanup */ + if (recFilename) { + free(recFilename); + recFilename = nullptr; + } + if (recChromosome) { + free(recChromosome); + recChromosome = nullptr; + } +#else /* put record into metadata */ if (recIdx == 1) { *rec = STARCH_createMetadata(recChromosome, @@ -1920,6 +2259,7 @@ free(recChromosome); recChromosome = NULL; } +#endif } else break; @@ -1974,12 +2314,18 @@ pLen = haystackLen; #ifdef __cplusplus - for (p = const_cast( haystack ); p != NULL; p = static_cast( memchr(p + 1, *needle, pLen-1) )) { + for (p = const_cast( haystack ); p != nullptr; p = static_cast( memchr(p + 1, *needle, pLen-1) )) { pLen = haystackLen - static_cast( p - haystack ); + if (pLen < len) + return nullptr; + if (strncmp(p, needle, len) == 0) + return p; + } + + return nullptr; #else for (p = (char *) haystack; p != NULL; p = (char *) memchr(p + 1, *needle, pLen-1)) { pLen = haystackLen - (size_t) (p - haystack); -#endif if (pLen < len) return NULL; if (strncmp(p, needle, len) == 0) @@ -1987,6 +2333,7 @@ } return NULL; +#endif } int @@ -2002,7 +2349,11 @@ return STARCH_EXIT_FAILURE; } +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) +#else for (iter = md; iter != NULL; iter = iter->next) +#endif if (strcmp(chr, iter->chromosome) == 0) return STARCH_EXIT_SUCCESS; @@ -2022,7 +2373,11 @@ return STARCH_EXIT_FAILURE; } +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) +#else for (iter = md; iter != NULL; iter = iter->next) +#endif if (strcmp(chr, iter->chromosome) < 0) return STARCH_EXIT_SUCCESS; diff -Nru bedops-2.4.35+dfsg/interfaces/src/data/starch/unstarchHelpers.c bedops-2.4.36+dfsg/interfaces/src/data/starch/unstarchHelpers.c --- bedops-2.4.35+dfsg/interfaces/src/data/starch/unstarchHelpers.c 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/interfaces/src/data/starch/unstarchHelpers.c 2019-05-23 20:06:31.000000000 +0000 @@ -59,14 +59,19 @@ #ifdef DEBUG_VERBOSE fprintf(stderr, "\n--- UNSTARCH_extractDataWithGzip() ---\n"); #endif +#ifdef __cplusplus + char* firstInputToken = nullptr; + char* secondInputToken = nullptr; +#else + char* firstInputToken = NULL; + char* secondInputToken = NULL; +#endif const Metadata* iter; char* chromosome; uint64_t size; uint64_t cumulativeSize = 0; SignedCoordType start, pLength, lastEnd; char const* all = "all"; - char* firstInputToken = NULL; - char* secondInputToken = NULL; unsigned char zInBuf[STARCH_Z_CHUNK]; unsigned char zOutBuf[STARCH_Z_CHUNK]; unsigned char zLineBuf[STARCH_Z_CHUNK]; @@ -106,7 +111,11 @@ } secondInputToken[0] = '\0'; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif chromosome = iter->chromosome; size = iter->size; start = 0; @@ -129,11 +138,18 @@ chrFound = kStarchTrue; /* initialized and open gzip stream */ +#ifdef __cplusplus + zStream.zalloc = nullptr; + zStream.zfree = nullptr; + zStream.opaque = nullptr; + zStream.next_in = nullptr; +#else zStream.zalloc = Z_NULL; zStream.zfree = Z_NULL; zStream.opaque = Z_NULL; - zStream.avail_in = 0; zStream.next_in = Z_NULL; +#endif + zStream.avail_in = 0; zError = inflateInit2(&zStream, (15+32)); /* cf. http://www.zlib.net/manual.html */ if (zError != Z_OK) { @@ -271,7 +287,11 @@ if (zRemainderBuf) { free(zRemainderBuf); +#ifdef __cplusplus + zRemainderBuf = nullptr; +#else zRemainderBuf = NULL; +#endif } if (!chrFound) { @@ -281,12 +301,20 @@ if (firstInputToken) { free(firstInputToken); +#ifdef __cplusplus + firstInputToken = nullptr; +#else firstInputToken = NULL; +#endif } if (secondInputToken) { free(secondInputToken); +#ifdef __cplusplus + secondInputToken = nullptr; +#else secondInputToken = NULL; +#endif } return 0; @@ -298,14 +326,19 @@ #ifdef DEBUG fprintf(stderr, "\n--- UNSTARCH_extractDataWithBzip2() ---\n"); #endif +#ifdef __cplusplus + char* firstInputToken = nullptr; + char* secondInputToken = nullptr; +#else + char* firstInputToken = NULL; + char* secondInputToken = NULL; +#endif const Metadata* iter; char* chromosome; uint64_t size; uint64_t cumulativeSize = 0; SignedCoordType start, pLength, lastEnd; char const* all = "all"; - char* firstInputToken = NULL; - char* secondInputToken = NULL; BZFILE *bzFp; int bzError; unsigned char *bzOutput; @@ -337,8 +370,11 @@ } secondInputToken[0] = '\0'; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { - +#endif chromosome = iter->chromosome; size = iter->size; start = 0; @@ -358,8 +394,11 @@ if ((strcmp(whichChr, all) == 0) || (strcmp(whichChr, chromosome) == 0)) { /* chrFound = UNSTARCH_TRUE; */ - +#ifdef __cplusplus + bzFp = BZ2_bzReadOpen( &bzError, *inFp, 0, 0, nullptr, 0 ); /* http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html#bzcompress-init */ +#else bzFp = BZ2_bzReadOpen( &bzError, *inFp, 0, 0, NULL, 0 ); /* http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html#bzcompress-init */ +#endif if (bzError != BZ_OK) { BZ2_bzReadClose( &bzError, bzFp ); fprintf(stderr, "ERROR: Bzip2 data stream could not be opened\n"); @@ -381,7 +420,11 @@ firstInputToken[0] = '\0'; secondInputToken[0] = '\0'; } +#ifdef __cplusplus + } while (bzOutput != nullptr); +#else } while (bzOutput != NULL); +#endif free(bzOutput); BZ2_bzReadClose(&bzError, bzFp); @@ -402,12 +445,20 @@ if (firstInputToken) { free(firstInputToken); +#ifdef __cplusplus + firstInputToken = nullptr; +#else firstInputToken = NULL; +#endif } if (secondInputToken) { free(secondInputToken); +#ifdef __cplusplus + secondInputToken = nullptr; +#else secondInputToken = NULL; +#endif } return 0; @@ -419,10 +470,14 @@ #ifdef DEBUG fprintf(stderr, "\n--- UNSTARCH_bzReadLine() ---\n"); #endif +#ifdef __cplusplus + unsigned char *outputCopy = nullptr; +#else + unsigned char *outputCopy = NULL; +#endif size_t offset = 0; size_t len = UNSTARCH_COMPRESSED_BUFFER_MAX_LENGTH; int bzError; - unsigned char *outputCopy = NULL; Boolean runFlag = kStarchFalse; if ((!input) || (!*output)) { @@ -469,7 +524,11 @@ fprintf(stderr, "\trunFlag is false\n"); #endif free(*output); +#ifdef __cplusplus + *output = nullptr; +#else *output = NULL; +#endif } } @@ -479,7 +538,11 @@ #ifdef DEBUG fprintf(stderr, "\n--- UNSTARCH_reverseTransformInput() ---\n"); #endif +#ifdef __cplusplus + char *pTest = nullptr; +#else char *pTest = NULL; +#endif char *pTestChars; const char *pTestParam = "p"; @@ -517,7 +580,7 @@ if (elemTok2[0] != '\0') { if (*lastEnd > 0) { #ifdef __cplusplus - *start = *lastEnd + static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ); + *start = *lastEnd + static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ); *lastEnd = *start + *pLength; fprintf(outFp, "%s\t%" PRId64 "\t%" PRId64 "\t%s\n", chr, static_cast( *start ), static_cast( *lastEnd ), elemTok2); #else @@ -528,8 +591,8 @@ } else { #ifdef __cplusplus - *lastEnd = static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ) + *pLength; - fprintf(outFp, "%s\t%" PRId64 "\t%" PRId64 "\t%s\n", chr, static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ), static_cast( *lastEnd ), elemTok2); + *lastEnd = static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ) + *pLength; + fprintf(outFp, "%s\t%" PRId64 "\t%" PRId64 "\t%s\n", chr, static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ), static_cast( *lastEnd ), elemTok2); #else *lastEnd = (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX) + *pLength; fprintf(outFp, "%s\t%" PRId64 "\t%" PRId64 "\t%s\n", chr, (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX), (SignedCoordType) *lastEnd, elemTok2); @@ -537,33 +600,37 @@ } } else { - pTest = NULL; #ifdef __cplusplus + pTest = nullptr; pTest = UNSTARCH_strnstr(reinterpret_cast( elemTok1 ), pTestParam, 1); #else + pTest = NULL; pTest = UNSTARCH_strnstr((const char *)elemTok1, pTestParam, 1); #endif if (pTest) { - pTestChars = NULL; #ifdef __cplusplus + pTestChars = nullptr; pTestChars = static_cast( malloc(strlen(elemTok1)) ); #else + pTestChars = NULL; pTestChars = malloc(strlen(elemTok1)); #endif strncpy(pTestChars, elemTok1 + 1, strlen(elemTok1)); if (!pTestChars) return UNSTARCH_FATAL_ERROR; #ifdef __cplusplus - *pLength = static_cast( strtoull(pTestChars, NULL, UNSTARCH_RADIX) ); + *pLength = static_cast( strtoull(pTestChars, nullptr, UNSTARCH_RADIX) ); + free(pTestChars); + pTestChars = nullptr; #else *pLength = (SignedCoordType) strtoull(pTestChars, NULL, UNSTARCH_RADIX); -#endif free(pTestChars); pTestChars = NULL; +#endif } else { #ifdef __cplusplus - *start = *lastEnd + static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ); + *start = *lastEnd + static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ); #else *start = *lastEnd + (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX); #endif @@ -586,10 +653,15 @@ #ifdef DEBUG fprintf(stderr, "\n--- UNSTARCH_sReverseTransformInput() ---\n"); #endif +#ifdef __cplusplus + char *pTest = nullptr; + char *currentRemainderCopy = nullptr; +#else char *pTest = NULL; + char *currentRemainderCopy = NULL; +#endif char *pTestChars; const char *pTestParam = "p"; - char *currentRemainderCopy = NULL; /* if *str begins with a reserved header name, then we shortcut and print the line without transformation */ @@ -631,7 +703,7 @@ if (elemTok2[0] != '\0') { if (*lastEnd > 0) { #ifdef __cplusplus - *start = *lastEnd + static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ); + *start = *lastEnd + static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ); #else *start = *lastEnd + (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX); #endif @@ -690,7 +762,7 @@ } else { #ifdef __cplusplus - *lastEnd = static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ) + *pLength; + *lastEnd = static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ) + *pLength; #else *lastEnd = (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX) + *pLength; #endif @@ -712,7 +784,7 @@ return UNSTARCH_FATAL_ERROR; } #ifdef __cplusplus - *currentStart = static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ); + *currentStart = static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ); #else *currentStart = (int64_t) strtoull(elemTok1, NULL, UNSTARCH_RADIX); #endif @@ -746,33 +818,37 @@ } } else { - pTest = NULL; #ifdef __cplusplus + pTest = nullptr; pTest = UNSTARCH_strnstr(reinterpret_cast( elemTok1 ), pTestParam, 1); #else + pTest = NULL; pTest = UNSTARCH_strnstr((const char *)elemTok1, pTestParam, 1); #endif if (pTest) { - pTestChars = NULL; #ifdef __cplusplus + pTestChars = nullptr; pTestChars = static_cast( malloc(strlen(elemTok1)) ); #else + pTestChars = NULL; pTestChars = malloc(strlen(elemTok1)); #endif strncpy(pTestChars, elemTok1 + 1, strlen(elemTok1)); if (!pTestChars) return UNSTARCH_FATAL_ERROR; #ifdef __cplusplus - *pLength = static_cast( strtoull(pTestChars, NULL, UNSTARCH_RADIX) ); + *pLength = static_cast( strtoull(pTestChars, nullptr, UNSTARCH_RADIX) ); + free(pTestChars); + pTestChars = nullptr; #else *pLength = (SignedCoordType) strtoull(pTestChars, NULL, UNSTARCH_RADIX); -#endif free(pTestChars); pTestChars = NULL; +#endif } else { #ifdef __cplusplus - *start = *lastEnd + static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ); + *start = *lastEnd + static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ); #else *start = *lastEnd + (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX); #endif @@ -813,7 +889,11 @@ #ifdef DEBUG fprintf(stderr, "\n--- UNSTARCH_reverseTransformIgnoringHeaderedInput() ---\n"); #endif +#ifdef __cplusplus + char *pTest = nullptr; +#else char *pTest = NULL; +#endif char *pTestChars; const char *pTestParam = "p"; @@ -851,7 +931,7 @@ if (elemTok2[0] != '\0') { if (*lastEnd > 0) { #ifdef __cplusplus - *start = *lastEnd + static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ); + *start = *lastEnd + static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ); #else *start = *lastEnd + (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX); #endif @@ -860,8 +940,8 @@ } else { #ifdef __cplusplus - *lastEnd = static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ) + *pLength; - fprintf(outFp, "%s\t%" PRId64 "\t%" PRId64 "\t%s\n", chr, static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ), *lastEnd, elemTok2); + *lastEnd = static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ) + *pLength; + fprintf(outFp, "%s\t%" PRId64 "\t%" PRId64 "\t%s\n", chr, static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ), *lastEnd, elemTok2); #else *lastEnd = (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX) + *pLength; fprintf(outFp, "%s\t%" PRId64 "\t%" PRId64 "\t%s\n", chr, (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX), *lastEnd, elemTok2); @@ -869,33 +949,37 @@ } } else { - pTest = NULL; #ifdef __cplusplus + pTest = nullptr; pTest = UNSTARCH_strnstr(reinterpret_cast(elemTok1), pTestParam, 1); #else + pTest = NULL; pTest = UNSTARCH_strnstr((const char *)elemTok1, pTestParam, 1); #endif if (pTest) { - pTestChars = NULL; #ifdef __cplusplus + pTestChars = nullptr; pTestChars = static_cast( malloc(strlen(elemTok1)) ); #else + pTestChars = NULL; pTestChars = malloc(strlen(elemTok1)); #endif strncpy(pTestChars, elemTok1 + 1, strlen(elemTok1)); if (!pTestChars) return UNSTARCH_FATAL_ERROR; #ifdef __cplusplus - *pLength = static_cast( strtoull(pTestChars, NULL, UNSTARCH_RADIX) ); + *pLength = static_cast( strtoull(pTestChars, nullptr, UNSTARCH_RADIX) ); + free(pTestChars); + pTestChars = nullptr; #else *pLength = (SignedCoordType) strtoull(pTestChars, NULL, UNSTARCH_RADIX); -#endif free(pTestChars); pTestChars = NULL; +#endif } else { #ifdef __cplusplus - *start = *lastEnd + static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ); + *start = *lastEnd + static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ); #else *start = *lastEnd + (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX); #endif @@ -934,8 +1018,12 @@ fprintf(stderr, "\tcurrentRemainderLen -> [%zu]\n", *currentRemainderLen); */ #endif - char pTestChars[MAX_DEC_INTEGERS] = {0}; +#ifdef __cplusplus + char *currentRemainderCopy = nullptr; +#else char *currentRemainderCopy = NULL; +#endif + char pTestChars[MAX_DEC_INTEGERS] = {0}; /* if *str begins with a reserved header name, then we shortcut */ @@ -969,7 +1057,7 @@ if (elemTok2[0] != '\0') { if (*lastEnd > 0) { #ifdef __cplusplus - *start = *lastEnd + static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ); + *start = *lastEnd + static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ); #else *start = *lastEnd + (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX); #endif @@ -1038,13 +1126,17 @@ } else { #ifdef __cplusplus - *lastEnd = static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ) + *pLength; + *lastEnd = static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ) + *pLength; #else *lastEnd = (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX) + *pLength; #endif #ifdef DEBUG +#ifdef __cplusplus + fprintf(stderr, "B: %s\t%" PRId64 "\t%" PRId64 "\t%s\n", chr, (int64_t) strtoull(elemTok1, nullptr, UNSTARCH_RADIX), *lastEnd, elemTok2); +#else fprintf(stderr, "B: %s\t%" PRId64 "\t%" PRId64 "\t%s\n", chr, (int64_t) strtoull(elemTok1, NULL, UNSTARCH_RADIX), *lastEnd, elemTok2); #endif +#endif if (! *currentChr) { #ifdef __cplusplus *currentChr = static_cast( malloc(TOKEN_CHR_MAX_LENGTH) ); @@ -1063,7 +1155,7 @@ return UNSTARCH_FATAL_ERROR; } #ifdef __cplusplus - *currentStart = static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ); + *currentStart = static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ); #else *currentStart = (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX); #endif @@ -1118,14 +1210,14 @@ if (elemTok1[0] == 'p') { strncpy(pTestChars, elemTok1 + 1, strlen(elemTok1)); #ifdef __cplusplus - *pLength = static_cast( strtoull(pTestChars, NULL, UNSTARCH_RADIX) ); + *pLength = static_cast( strtoull(pTestChars, nullptr, UNSTARCH_RADIX) ); #else *pLength = (SignedCoordType) strtoull(pTestChars, NULL, UNSTARCH_RADIX); #endif } else { #ifdef __cplusplus - *start = *lastEnd + static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ); + *start = *lastEnd + static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ); #else *start = *lastEnd + (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX); #endif @@ -1163,7 +1255,11 @@ fprintf(stderr, "\n--- elemTok1 : [%s]\n", elemTok1); fprintf(stderr, "\n--- elemTok2 : [%s]\n", elemTok2); #endif +#ifdef __cplusplus + char *pTest = nullptr; +#else char *pTest = NULL; +#endif char *pTestChars; const char *pTestParam = "p"; @@ -1172,7 +1268,7 @@ if (elemTok2[0] != '\0') { if (*lastEnd > 0) { #ifdef __cplusplus - *start = *lastEnd + static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ); + *start = *lastEnd + static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ); #else *start = *lastEnd + (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX); #endif @@ -1181,8 +1277,8 @@ } else { #ifdef __cplusplus - *lastEnd = static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ) + *pLength; - fprintf(outFp, "%s\t%" PRId64 "\t%" PRId64 "\t%s\n", chr, static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ), *lastEnd, elemTok2); + *lastEnd = static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ) + *pLength; + fprintf(outFp, "%s\t%" PRId64 "\t%" PRId64 "\t%s\n", chr, static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ), *lastEnd, elemTok2); #else *lastEnd = (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX) + *pLength; fprintf(outFp, "%s\t%" PRId64 "\t%" PRId64 "\t%s\n", chr, (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX), *lastEnd, elemTok2); @@ -1190,33 +1286,37 @@ } } else { - pTest = NULL; #ifdef __cplusplus + pTest = nullptr; pTest = UNSTARCH_strnstr(reinterpret_cast( elemTok1 ), pTestParam, 1); #else + pTest = NULL; pTest = UNSTARCH_strnstr((const char *)elemTok1, pTestParam, 1); #endif if (pTest) { - pTestChars = NULL; #ifdef __cplusplus + pTestChars = nullptr; pTestChars = static_cast( malloc(strlen(elemTok1)) ); #else + pTestChars = NULL; pTestChars = malloc(strlen(elemTok1)); #endif strncpy(pTestChars, elemTok1 + 1, strlen(elemTok1)); if (!pTestChars) return UNSTARCH_FATAL_ERROR; #ifdef __cplusplus - *pLength = static_cast( strtoull(pTestChars, NULL, UNSTARCH_RADIX) ); + *pLength = static_cast( strtoull(pTestChars, nullptr, UNSTARCH_RADIX) ); + free(pTestChars); + pTestChars = nullptr; #else *pLength = (SignedCoordType) strtoull(pTestChars, NULL, UNSTARCH_RADIX); -#endif free(pTestChars); pTestChars = NULL; +#endif } else { #ifdef __cplusplus - *start = *lastEnd + static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ); + *start = *lastEnd + static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ); #else *start = *lastEnd + (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX); #endif @@ -1319,17 +1419,22 @@ #ifdef DEBUG fprintf(stderr, "\n--- UNSTARCH_sReverseTransformHeaderlessInput() ---\n"); #endif +#ifdef __cplusplus + char *pTest = nullptr; + char *currentRemainderCopy = nullptr; +#else char *pTest = NULL; + char *currentRemainderCopy = NULL; +#endif char *pTestChars; const char *pTestParam = "p"; - char *currentRemainderCopy = NULL; if (UNSTARCH_createInverseTransformTokens(str, delim, elemTok1, elemTok2) == 0) { if (elemTok2[0] != '\0') { if (*lastEnd > 0) { #ifdef __cplusplus - *start = *lastEnd + static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ); + *start = *lastEnd + static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ); #else *start = *lastEnd + (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX); #endif @@ -1387,7 +1492,7 @@ } else { #ifdef __cplusplus - *lastEnd = static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ) + *pLength; + *lastEnd = static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ) + *pLength; #else *lastEnd = (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX) + *pLength; #endif @@ -1414,7 +1519,7 @@ return UNSTARCH_FATAL_ERROR; } #ifdef __cplusplus - *currentStart = static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ); + *currentStart = static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ); #else *currentStart = (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX); #endif @@ -1448,33 +1553,37 @@ } } else { - pTest = NULL; #ifdef __cplusplus + pTest = nullptr; pTest = UNSTARCH_strnstr(reinterpret_cast( elemTok1 ), pTestParam, 1); #else + pTest = NULL; pTest = UNSTARCH_strnstr((const char *)elemTok1, pTestParam, 1); #endif if (pTest) { - pTestChars = NULL; #ifdef __cplusplus + pTestChars = nullptr; pTestChars = static_cast( malloc(strlen(elemTok1)) ); #else + pTestChars = NULL; pTestChars = malloc(strlen(elemTok1)); #endif strncpy(pTestChars, elemTok1 + 1, strlen(elemTok1)); if (!pTestChars) return UNSTARCH_FATAL_ERROR; #ifdef __cplusplus - *pLength = static_cast( strtoull(pTestChars, NULL, UNSTARCH_RADIX) ); + *pLength = static_cast( strtoull(pTestChars, nullptr, UNSTARCH_RADIX) ); + free(pTestChars); + pTestChars = nullptr; #else *pLength = (SignedCoordType) strtoull(pTestChars, NULL, UNSTARCH_RADIX); -#endif free(pTestChars); pTestChars = NULL; +#endif } else { #ifdef __cplusplus - *start = *lastEnd + static_cast( strtoull(elemTok1, NULL, UNSTARCH_RADIX) ); + *start = *lastEnd + static_cast( strtoull(elemTok1, nullptr, UNSTARCH_RADIX) ); #else *start = *lastEnd + (SignedCoordType) strtoull(elemTok1, NULL, UNSTARCH_RADIX); #endif @@ -1600,15 +1709,18 @@ pLen = haystackLen; #ifdef __cplusplus - for (p = const_cast( haystack ); p != NULL; p = static_cast( memchr(p + 1, *needle, pLen-1) )) { -#else - for (p = (char *) haystack; p != NULL; p = (char *) memchr(p + 1, *needle, pLen-1)) { -#endif -#ifdef __cplusplus + for (p = const_cast( haystack ); p != nullptr; p = static_cast( memchr(p + 1, *needle, pLen-1) )) { pLen = haystackLen - static_cast( p - const_cast( haystack ) ); + if (pLen < len) + return nullptr; + if (strncmp(p, needle, len) == 0) + return p; + } + + return nullptr; #else + for (p = (char *) haystack; p != NULL; p = (char *) memchr(p + 1, *needle, pLen-1)) { pLen = haystackLen - (size_t) (p - haystack); -#endif if (pLen < len) return NULL; if (strncmp(p, needle, len) == 0) @@ -1616,6 +1728,7 @@ } return NULL; +#endif } char * @@ -1632,12 +1745,15 @@ #ifdef __cplusplus result = static_cast( malloc(len + 1) ); + + if (!result) + return nullptr; #else result = malloc(len + 1); -#endif if (!result) - return 0; + return NULL; +#endif result[len] = '\0'; @@ -1656,7 +1772,11 @@ #endif const Metadata *iter; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif if (strcmp(chr, iter->chromosome) == 0) { return iter->lineCount; } @@ -1691,7 +1811,11 @@ const Metadata *iter; LineCountType totalLineCount = 0; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) +#else for (iter = md; iter != NULL; iter = iter->next) +#endif totalLineCount += iter->lineCount; fprintf(stdout, "%" PRIu64 "\n", totalLineCount); @@ -1705,7 +1829,11 @@ #endif const Metadata *iter; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif if (strcmp(chr, iter->chromosome) == 0) { return iter->lineMaxStringLength; } @@ -1740,7 +1868,11 @@ const Metadata *iter; LineLengthType lineMaxStringLength = STARCH_DEFAULT_LINE_STRING_LENGTH; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) +#else for (iter = md; iter != NULL; iter = iter->next) +#endif lineMaxStringLength = (lineMaxStringLength >= iter->lineMaxStringLength) ? lineMaxStringLength : iter->lineMaxStringLength; fprintf(stdout, "%lu\n", lineMaxStringLength); @@ -1754,7 +1886,11 @@ #endif const Metadata *iter; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif if (strcmp(chr, iter->chromosome) == 0) { return iter->totalNonUniqueBases; } @@ -1789,7 +1925,11 @@ const Metadata *iter; BaseCountType totalBaseCount = 0; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) +#else for (iter = md; iter != NULL; iter = iter->next) +#endif totalBaseCount += iter->totalNonUniqueBases; fprintf(stdout, "%" PRIu64 "\n", totalBaseCount); @@ -1803,7 +1943,11 @@ #endif const Metadata *iter; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif if (strcmp(chr, iter->chromosome) == 0) return iter->totalUniqueBases; } @@ -1837,7 +1981,11 @@ const Metadata *iter; BaseCountType totalBaseCount = 0; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) +#else for (iter = md; iter != NULL; iter = iter->next) +#endif totalBaseCount += iter->totalUniqueBases; fprintf(stdout, "%" PRIu64 "\n", totalBaseCount); @@ -1851,7 +1999,11 @@ #endif const Metadata *iter; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif if (strcmp(chr, iter->chromosome) == 0) return iter->duplicateElementExists; } @@ -1884,7 +2036,11 @@ #endif const Metadata *iter; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif if (UNSTARCH_duplicateElementExistsForChromosome(md, iter->chromosome) == kStarchTrue) { fprintf(stdout, "%s\n", UNSTARCH_booleanToString(kStarchTrue)); return; @@ -1922,20 +2078,23 @@ #endif const Metadata *iter; - for (iter = md; iter != NULL; iter = iter->next) { - if (UNSTARCH_duplicateElementExistsForChromosome(md, iter->chromosome) == kStarchTrue) { #ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { + if (UNSTARCH_duplicateElementExistsForChromosome(md, iter->chromosome) == kStarchTrue) { fprintf(stdout, "%d\n", static_cast( kStarchTrue )); -#else - fprintf(stdout, "%d\n", (int) kStarchTrue); -#endif return; } } -#ifdef __cplusplus fprintf(stdout, "%d\n", static_cast( kStarchFalse )); #else + for (iter = md; iter != NULL; iter = iter->next) { + if (UNSTARCH_duplicateElementExistsForChromosome(md, iter->chromosome) == kStarchTrue) { + fprintf(stdout, "%d\n", (int) kStarchTrue); + return; + } + } + fprintf(stdout, "%d\n", (int) kStarchFalse); #endif } @@ -1947,8 +2106,12 @@ fprintf(stderr, "\n--- UNSTARCH_nestedElementExistsForChromosome() ---\n"); #endif const Metadata *iter; - + +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif if (strcmp(chr, iter->chromosome) == 0) return iter->nestedElementExists; } @@ -1980,7 +2143,11 @@ #endif const Metadata *iter; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif if (UNSTARCH_nestedElementExistsForChromosome(md, iter->chromosome) == kStarchTrue) { fprintf(stdout, "%s\n", UNSTARCH_booleanToString(kStarchTrue)); return; @@ -2018,20 +2185,23 @@ #endif const Metadata *iter; - for (iter = md; iter != NULL; iter = iter->next) { - if (UNSTARCH_nestedElementExistsForChromosome(md, iter->chromosome) == kStarchTrue) { #ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { + if (UNSTARCH_nestedElementExistsForChromosome(md, iter->chromosome) == kStarchTrue) { fprintf(stdout, "%d\n", static_cast( kStarchTrue )); -#else - fprintf(stdout, "%d\n", (int) kStarchTrue); -#endif return; } } -#ifdef __cplusplus fprintf(stdout, "%d\n", static_cast( kStarchFalse )); #else + for (iter = md; iter != NULL; iter = iter->next) { + if (UNSTARCH_nestedElementExistsForChromosome(md, iter->chromosome) == kStarchTrue) { + fprintf(stdout, "%d\n", (int) kStarchTrue); + return; + } + } + fprintf(stdout, "%d\n", (int) kStarchFalse); #endif } @@ -2042,7 +2212,11 @@ #ifdef DEBUG fprintf(stderr, "\n--- UNSTARCH_printSignature() ---\n"); #endif +#ifdef __cplusplus + char *signature = nullptr; +#else char *signature = NULL; +#endif if (strcmp(chr, "all") == 0) { UNSTARCH_printAllSignatures(md, mdSha1Buffer); @@ -2062,12 +2236,19 @@ #endif const Metadata *iter; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { + if ((strcmp(chr, iter->chromosome) == 0) && (iter->signature) && (strlen(iter->signature) > 0)) + return iter->signature; + } + return nullptr; +#else for (iter = md; iter != NULL; iter = iter->next) { if ((strcmp(chr, iter->chromosome) == 0) && (iter->signature) && (strlen(iter->signature) > 0)) return iter->signature; } - return NULL; +#endif } void @@ -2087,19 +2268,29 @@ fprintf(stderr, "\n--- UNSTARCH_printMetadataSignature() ---\n"); #endif size_t mdSha1BufferLength = STARCH2_MD_FOOTER_SHA1_LENGTH; - char *jsonBase64String = NULL; #ifdef __cplusplus + char *jsonBase64String = nullptr; + STARCH_encodeBase64(&jsonBase64String, static_cast( STARCH2_MD_FOOTER_BASE64_ENCODED_SHA1_LENGTH ), const_cast( mdSha1Buffer ), static_cast( mdSha1BufferLength )); + + if (!jsonBase64String) { + fprintf(stderr, "ERROR: Could not allocate space for Base64-encoded metadata string representation\n"); + exit(-1); + } + fprintf(stdout, "metadata\t%s\n", jsonBase64String); + free(jsonBase64String); + jsonBase64String = nullptr; #else + char *jsonBase64String = NULL; + STARCH_encodeBase64(&jsonBase64String, (const size_t) STARCH2_MD_FOOTER_BASE64_ENCODED_SHA1_LENGTH, (const unsigned char *) mdSha1Buffer, (const size_t) mdSha1BufferLength); -#endif if (!jsonBase64String) { fprintf(stderr, "ERROR: Could not allocate space for Base64-encoded metadata string representation\n"); @@ -2108,6 +2299,7 @@ fprintf(stdout, "metadata\t%s\n", jsonBase64String); free(jsonBase64String); jsonBase64String = NULL; +#endif } void @@ -2118,7 +2310,11 @@ #endif const Metadata *iter; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif fprintf(stdout, "%s\t%s\n", iter->chromosome, strlen(iter->signature) > 0 ? iter->signature : "NA"); } } @@ -2129,8 +2325,13 @@ #ifdef DEBUG fprintf(stderr, "\n--- UNSTARCH_verifySignature() ---\n"); #endif +#ifdef __cplusplus + char *expectedSignature = nullptr; + char *observedSignature = nullptr; +#else char *expectedSignature = NULL; char *observedSignature = NULL; +#endif Boolean signaturesVerifiedFlag = kStarchFalse; if (strcmp(chr, "all") == 0) { @@ -2161,7 +2362,11 @@ } if (observedSignature) { free(observedSignature); - observedSignature = NULL; +#ifdef __cplusplus + observedSignature = nullptr; +#else + observedSignature = NULL; +#endif } return signaturesVerifiedFlag; } @@ -2180,22 +2385,31 @@ 4) Return Base64 encoding of SHA-1 signature */ +#ifdef __cplusplus + const Metadata *iter = nullptr; + char *currentChromosome = nullptr; + char *base64EncodedSha1Digest = nullptr; +#else const Metadata *iter = NULL; char *currentChromosome = NULL; + char *base64EncodedSha1Digest = NULL; +#endif uint64_t size = 0; uint64_t cumulativeSize = 0; - unsigned char sha1Digest[STARCH2_MD_FOOTER_SHA1_LENGTH] = {0}; - char *base64EncodedSha1Digest = NULL; struct sha1_ctx perChromosomeHashCtx; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif currentChromosome = iter->chromosome; size = iter->size; #ifdef __cplusplus if (STARCH_fseeko(*inFp, static_cast( cumulativeSize + mdOffset ), SEEK_SET) != 0) { fprintf(stderr, "ERROR: Could not seek data in archive\n"); - return NULL; + return nullptr; } #else if (STARCH_fseeko(*inFp, (off_t) (cumulativeSize + mdOffset), SEEK_SET) != 0) { @@ -2216,19 +2430,27 @@ switch (compType) { case kBzip2: { - BZFILE *bzFp = NULL; int bzError = 0; - unsigned char *bzOutput = NULL; size_t bzOutputLength = UNSTARCH_COMPRESSED_BUFFER_MAX_LENGTH; - bzFp = BZ2_bzReadOpen( &bzError, *inFp, 0, 0, NULL, 0 ); /* http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html#bzcompress-init */ +#ifdef __cplusplus + BZFILE *bzFp = nullptr; + unsigned char *bzOutput = nullptr; + bzFp = BZ2_bzReadOpen( &bzError, *inFp, 0, 0, nullptr, 0 ); /* http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html#bzcompress-init */ if (bzError != BZ_OK) { BZ2_bzReadClose( &bzError, bzFp ); fprintf(stderr, "ERROR: Bzip2 data stream could not be opened\n"); - return NULL; + return nullptr; } -#ifdef __cplusplus bzOutput = static_cast( malloc(bzOutputLength) ); #else + BZFILE *bzFp = NULL; + unsigned char *bzOutput = NULL; + bzFp = BZ2_bzReadOpen( &bzError, *inFp, 0, 0, NULL, 0 ); /* http://www.bzip.org/1.0.5/bzip2-manual-1.0.5.html#bzcompress-init */ + if (bzError != BZ_OK) { + BZ2_bzReadClose( &bzError, bzFp ); + fprintf(stderr, "ERROR: Bzip2 data stream could not be opened\n"); + return NULL; + } bzOutput = malloc(bzOutputLength); #endif do { @@ -2254,7 +2476,11 @@ bzOutput[++len] = '\0'; sha1_process_bytes( bzOutput, len, &perChromosomeHashCtx ); } +#ifdef __cplusplus + } while (bzOutput != nullptr); +#else } while (bzOutput != NULL); +#endif /* cleanup */ if (bzOutput) free(bzOutput); @@ -2266,21 +2492,32 @@ unsigned int zHave, zOutBufIdx; size_t zBufIdx, zBufOffset; int zError; - unsigned char *zRemainderBuf = NULL; unsigned char zInBuf[STARCH_Z_CHUNK]; unsigned char zOutBuf[STARCH_Z_CHUNK]; unsigned char zLineBuf[STARCH_Z_CHUNK]; - +#ifdef __cplusplus + unsigned char *zRemainderBuf = nullptr; + zStream.zalloc = nullptr; + zStream.zfree = nullptr; + zStream.opaque = nullptr; + zStream.next_in = nullptr; +#else + unsigned char *zRemainderBuf = NULL; zStream.zalloc = Z_NULL; zStream.zfree = Z_NULL; zStream.opaque = Z_NULL; - zStream.avail_in = 0; zStream.next_in = Z_NULL; +#endif + zStream.avail_in = 0; zError = inflateInit2(&zStream, (15+32)); /* cf. http://www.zlib.net/manual.html */ if (zError != Z_OK) { fprintf(stderr, "ERROR: Could not initialize z-stream\n"); +#ifdef __cplusplus + return nullptr; +#else return NULL; +#endif } #ifdef __cplusplus @@ -2304,9 +2541,15 @@ zStream.next_out = zOutBuf; zError = inflate(&zStream, Z_NO_FLUSH); switch (zError) { +#ifdef __cplusplus + case Z_NEED_DICT: { fprintf(stderr, "ERROR: Z-stream needs dictionary\n"); return nullptr; } + case Z_DATA_ERROR: { fprintf(stderr, "ERROR: Z-stream suffered data error\n"); return nullptr; } + case Z_MEM_ERROR: { fprintf(stderr, "ERROR: Z-stream suffered memory error\n"); return nullptr; } +#else case Z_NEED_DICT: { fprintf(stderr, "ERROR: Z-stream needs dictionary\n"); return NULL; } case Z_DATA_ERROR: { fprintf(stderr, "ERROR: Z-stream suffered data error\n"); return NULL; } case Z_MEM_ERROR: { fprintf(stderr, "ERROR: Z-stream suffered memory error\n"); return NULL; } +#endif }; zHave = STARCH_Z_CHUNK - zStream.avail_out; zOutBuf[zHave] = '\0'; @@ -2363,19 +2606,31 @@ /* cleanup */ if (zRemainderBuf) { free(zRemainderBuf); +#ifdef __cplusplus + zRemainderBuf = nullptr; +#else zRemainderBuf = NULL; +#endif } /* close gzip stream */ zError = inflateEnd(&zStream); if (zError != Z_OK) { fprintf(stderr, "ERROR: Could not close z-stream (%d)\n", zError); +#ifdef __cplusplus + return nullptr; +#else return NULL; +#endif } break; } case kUndefined: { fprintf(stderr, "ERROR: Archive compression type is undefined\n"); +#ifdef __cplusplus + return nullptr; +#else return NULL; +#endif } } @@ -2395,7 +2650,11 @@ } } fprintf(stderr, "ERROR: Leaving UNSTARCH_observedSignatureForChromosome() without having processed chromosome [%s]\n", chr); +#ifdef __cplusplus + return nullptr; +#else return NULL; +#endif } Boolean @@ -2405,11 +2664,19 @@ fprintf(stderr, "\n--- UNSTARCH_verifyAllSignatures() ---\n"); #endif +#ifdef __cplusplus + const Metadata *iter = nullptr; +#else const Metadata *iter = NULL; +#endif Boolean perChromosomeSignatureVerifiedFlag = kStarchFalse; Boolean allSignaturesVerifiedFlag = kStarchTrue; +#ifdef __cplusplus + for (iter = md; iter != nullptr; iter = iter->next) { +#else for (iter = md; iter != NULL; iter = iter->next) { +#endif perChromosomeSignatureVerifiedFlag = UNSTARCH_verifySignature(inFp, md, mdOffset, iter->chromosome, compType); if (!perChromosomeSignatureVerifiedFlag) { allSignaturesVerifiedFlag = kStarchFalse; diff -Nru bedops-2.4.35+dfsg/Makefile bedops-2.4.36+dfsg/Makefile --- bedops-2.4.35+dfsg/Makefile 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/Makefile 2019-05-23 20:06:31.000000000 +0000 @@ -22,7 +22,7 @@ CWD := $(shell pwd) BINDIR = bin BINDIR_MODULE = modules - +export DESTBINDIR = . default: ifeq ($(KERNEL), Darwin) @@ -45,7 +45,7 @@ $(MAKE) megarow -f ${SELF} $(MAKE) float128 -f ${SELF} $(MAKE) install_all -f ${SELF} - $(MAKE) symlink_typical -f ${SELF} + $(MAKE) symlink_post_install_all -f ${SELF} module_all: $(MAKE) support -f ${SELF} @@ -64,6 +64,9 @@ typical: $(MAKE) BINARY_TYPE=$(TYPICAL) -f ${SELF} +symlink_post_install_all: + cd ${BINDIR} && ./switch-BEDOPS-binary-type --typical . && cd ${CWD} + symlink_typical: $(eval SRCNAMES=`find $(BINDIR)/ -maxdepth 1 -mindepth 1 -type f -name '*$(TYPICAL)' -print0 | xargs -L1 -0 -I{} sh -c 'basename {}'`) for SRCNAME in ${SRCNAMES}; do \ @@ -242,7 +245,7 @@ install_conversion_scripts: prep_c cp $(WRAPPERS) ${BINDIR} -.PHONY: $(WRAPPERS) +.PHONY: $(WRAPPERS) tests install_conversion_scripts_all: $(WRAPPERS) @@ -396,6 +399,9 @@ find . -exec sed -i "s/"$$OLD_CPD"/"$$NEW_CPD"/g" {} \; endif +####################### +# packaging + docker: packaging/docker/Dockerfile docker build -t bedops -f packaging/docker/Dockerfile . @@ -404,3 +410,9 @@ deb: packaging/deb/Dockerfile docker build -t bedops:deb -f packaging/deb/Dockerfile . + +####################### +# tests + +tests: + $(MAKE) all -f tests/Makefile diff -Nru bedops-2.4.35+dfsg/packaging/deb/control bedops-2.4.36+dfsg/packaging/deb/control --- bedops-2.4.35+dfsg/packaging/deb/control 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/packaging/deb/control 2019-05-23 20:06:31.000000000 +0000 @@ -1,5 +1,5 @@ Package: bedops -Version: 2.4.35 +Version: 2.4.36 Section: base Priority: optional Architecture: amd64 diff -Nru bedops-2.4.35+dfsg/packaging/deb/Dockerfile bedops-2.4.36+dfsg/packaging/deb/Dockerfile --- bedops-2.4.35+dfsg/packaging/deb/Dockerfile 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/packaging/deb/Dockerfile 2019-05-23 20:06:31.000000000 +0000 @@ -10,16 +10,16 @@ ADD . /bedops # populate base debian package tree -RUN mkdir /bedops_2.4.35 -WORKDIR /bedops_2.4.35 +RUN mkdir /bedops_2.4.36 +WORKDIR /bedops_2.4.36 RUN mkdir -p DEBIAN usr/bin usr/share/doc/bedops RUN cp /bedops/LICENSE /bedops/README.md usr/share/doc/bedops RUN cp /bedops/packaging/deb/control DEBIAN # build and install bedops into debian package tree WORKDIR /bedops -RUN make -j `nproc` && make install BINDIR=/bedops_2.4.35/usr/bin +RUN make -j `nproc` && make install BINDIR=/bedops_2.4.36/usr/bin WORKDIR / -RUN dpkg-deb --build bedops_2.4.35 +RUN dpkg-deb --build bedops_2.4.36 # deb file should now be located in / directory diff -Nru bedops-2.4.35+dfsg/packaging/os_x/BEDOPS.pkgproj bedops-2.4.36+dfsg/packaging/os_x/BEDOPS.pkgproj --- bedops-2.4.35+dfsg/packaging/os_x/BEDOPS.pkgproj 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/packaging/os_x/BEDOPS.pkgproj 2019-05-23 20:06:31.000000000 +0000 @@ -239,7 +239,7 @@ PATH_TYPE 0 PERMISSIONS - 493 + 1005 TYPE 1 UID @@ -341,6 +341,38 @@ UID 0 + + CHILDREN + + GID + 0 + PATH + Automator + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Extensions + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + GID 0 @@ -944,7 +976,7 @@ TREAT_MISSING_FILES_AS_WARNING VERSION - 2 + 5 PACKAGE_SCRIPTS @@ -974,6 +1006,8 @@ PAYLOAD_SIZE -1 + REFERENCE_PATH + RELOCATABLE USE_HFS+_COMPRESSION @@ -1221,7 +1255,7 @@ PATH_TYPE 0 PERMISSIONS - 493 + 1005 TYPE 1 UID @@ -1323,6 +1357,38 @@ UID 0 + + CHILDREN + + GID + 0 + PATH + Automator + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Extensions + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + GID 0 @@ -1558,7 +1624,7 @@ TREAT_MISSING_FILES_AS_WARNING VERSION - 2 + 5 PACKAGE_SCRIPTS @@ -1588,6 +1654,8 @@ PAYLOAD_SIZE -1 + REFERENCE_PATH + RELOCATABLE USE_HFS+_COMPRESSION @@ -1835,7 +1903,7 @@ PATH_TYPE 0 PERMISSIONS - 493 + 1005 TYPE 1 UID @@ -1937,6 +2005,38 @@ UID 0 + + CHILDREN + + GID + 0 + PATH + Automator + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Extensions + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + GID 0 @@ -2172,7 +2272,7 @@ TREAT_MISSING_FILES_AS_WARNING VERSION - 2 + 5 PACKAGE_SCRIPTS @@ -2202,6 +2302,8 @@ PAYLOAD_SIZE -1 + REFERENCE_PATH + RELOCATABLE USE_HFS+_COMPRESSION @@ -2449,7 +2551,7 @@ PATH_TYPE 0 PERMISSIONS - 493 + 1005 TYPE 1 UID @@ -2551,6 +2653,38 @@ UID 0 + + CHILDREN + + GID + 0 + PATH + Automator + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Extensions + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + GID 0 @@ -2786,7 +2920,7 @@ TREAT_MISSING_FILES_AS_WARNING VERSION - 2 + 5 PACKAGE_SCRIPTS @@ -2816,6 +2950,8 @@ PAYLOAD_SIZE -1 + REFERENCE_PATH + RELOCATABLE USE_HFS+_COMPRESSION @@ -3063,7 +3199,7 @@ PATH_TYPE 0 PERMISSIONS - 493 + 1005 TYPE 1 UID @@ -3165,6 +3301,38 @@ UID 0 + + CHILDREN + + GID + 0 + PATH + Automator + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Extensions + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + GID 0 @@ -3400,7 +3568,7 @@ TREAT_MISSING_FILES_AS_WARNING VERSION - 2 + 5 PACKAGE_SCRIPTS @@ -3430,6 +3598,8 @@ PAYLOAD_SIZE -1 + REFERENCE_PATH + RELOCATABLE USE_HFS+_COMPRESSION @@ -3677,7 +3847,7 @@ PATH_TYPE 0 PERMISSIONS - 493 + 1005 TYPE 1 UID @@ -3779,6 +3949,38 @@ UID 0 + + CHILDREN + + GID + 0 + PATH + Automator + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Extensions + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + GID 0 @@ -4206,7 +4408,7 @@ TREAT_MISSING_FILES_AS_WARNING VERSION - 2 + 5 PACKAGE_SCRIPTS @@ -4236,6 +4438,8 @@ PAYLOAD_SIZE -1 + REFERENCE_PATH + RELOCATABLE USE_HFS+_COMPRESSION @@ -4483,7 +4687,7 @@ PATH_TYPE 0 PERMISSIONS - 493 + 1005 TYPE 1 UID @@ -4585,6 +4789,38 @@ UID 0 + + CHILDREN + + GID + 0 + PATH + Automator + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Extensions + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + GID 0 @@ -5076,7 +5312,7 @@ TREAT_MISSING_FILES_AS_WARNING VERSION - 2 + 5 PACKAGE_SCRIPTS @@ -5106,6 +5342,8 @@ PAYLOAD_SIZE -1 + REFERENCE_PATH + RELOCATABLE USE_HFS+_COMPRESSION @@ -5353,7 +5591,7 @@ PATH_TYPE 0 PERMISSIONS - 493 + 1005 TYPE 1 UID @@ -5455,6 +5693,38 @@ UID 0 + + CHILDREN + + GID + 0 + PATH + Automator + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Extensions + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + GID 0 @@ -5818,7 +6088,7 @@ TREAT_MISSING_FILES_AS_WARNING VERSION - 2 + 5 PACKAGE_SCRIPTS @@ -5853,6 +6123,8 @@ PAYLOAD_SIZE -1 + REFERENCE_PATH + RELOCATABLE USE_HFS+_COMPRESSION @@ -6115,7 +6387,7 @@ PATH_TYPE 0 PERMISSIONS - 493 + 1005 TYPE 1 UID @@ -6354,7 +6626,7 @@ TREAT_MISSING_FILES_AS_WARNING VERSION - 4 + 5 PACKAGE_SCRIPTS @@ -6379,6 +6651,8 @@ PAYLOAD_SIZE -1 + REFERENCE_PATH + RELOCATABLE USE_HFS+_COMPRESSION @@ -6891,7 +7165,7 @@ LANGUAGE English VALUE - BEDOPS 2.4.35 + BEDOPS 2.4.36 @@ -7116,7 +7390,7 @@ NAME - BEDOPS 2.4.35 + BEDOPS 2.4.36 PAYLOAD_ONLY TREAT_MISSING_PRESENTATION_DOCUMENTS_AS_WARNING diff -Nru bedops-2.4.35+dfsg/packaging/rpm/bedops.spec bedops-2.4.36+dfsg/packaging/rpm/bedops.spec --- bedops-2.4.35+dfsg/packaging/rpm/bedops.spec 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/packaging/rpm/bedops.spec 2019-05-23 20:06:31.000000000 +0000 @@ -1,5 +1,5 @@ Name: bedops -Version: 2.4.35 +Version: 2.4.36 Release: 1 Summary: A suite of tools to address common questions raised in genomic studies. Group: Applications/Productivity diff -Nru bedops-2.4.35+dfsg/packaging/rpm/Dockerfile bedops-2.4.36+dfsg/packaging/rpm/Dockerfile --- bedops-2.4.35+dfsg/packaging/rpm/Dockerfile 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/packaging/rpm/Dockerfile 2019-05-23 20:06:31.000000000 +0000 @@ -11,9 +11,9 @@ # copy the source context into the local image & build/install # note: make sure .dockerignore is up to date -RUN mkdir /bedops-2.4.35 -ADD . /bedops-2.4.35 -RUN tar zcf /bedops-2.4.35.tar.gz bedops-2.4.35 -RUN rm -rf /bedops-2.4.35 -RUN rpmbuild -ta bedops-2.4.35.tar.gz -RUN rm /bedops-2.4.35.tar.gz +RUN mkdir /bedops-2.4.36 +ADD . /bedops-2.4.36 +RUN tar zcf /bedops-2.4.36.tar.gz bedops-2.4.36 +RUN rm -rf /bedops-2.4.36 +RUN rpmbuild -ta bedops-2.4.36.tar.gz +RUN rm /bedops-2.4.36.tar.gz diff -Nru bedops-2.4.35+dfsg/README.md bedops-2.4.36+dfsg/README.md --- bedops-2.4.35+dfsg/README.md 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/README.md 2019-05-23 20:06:31.000000000 +0000 @@ -1,4 +1,4 @@ -## BEDOPS v2.4.35: high-performance genomic feature operations ## +## BEDOPS v2.4.36: high-performance genomic feature operations ## [![Build Status](https://travis-ci.org/bedops/bedops.svg?branch=master)](https://travis-ci.org/bedops/bedops) [![GitHub stars](https://img.shields.io/github/stars/bedops/bedops.svg)](https://github.com/bedops/bedops/stargazers) [![Project license](https://img.shields.io/badge/license-GPLv2-blue.svg)](https://github.com/bedops/bedops/blob/master/LICENSE) [![Documentation Status](https://readthedocs.org/projects/bedops/badge/?version=latest)](https://readthedocs.org/projects/bedops/?badge=latest) @@ -6,9 +6,9 @@ ### About ### -**BEDOPS v2.4.35** is a suite of tools to address common questions raised in genomic studies — mostly with regard to overlap and proximity relationships between data sets. It aims to be scalable and flexible, facilitating the efficient and accurate analysis and management of large-scale genomic data. +**BEDOPS v2.4.36** is a suite of tools to address common questions raised in genomic studies — mostly with regard to overlap and proximity relationships between data sets. It aims to be scalable and flexible, facilitating the efficient and accurate analysis and management of large-scale genomic data. -The overview section of the **BEDOPS v2.4.35** documentation summarizes the toolkit, functionality and performance enhancements. The reference table offers documentation for all applications and scripts. +The overview section of the **BEDOPS v2.4.36** documentation summarizes the toolkit, functionality and performance enhancements. The reference table offers documentation for all applications and scripts. ### Downloads ### @@ -28,20 +28,20 @@ @@ -50,11 +50,11 @@ ### Documentation ### -Complete documentation for **BEDOPS v2.4.35** tools is available at: https://bedops.readthedocs.io/ +Complete documentation for **BEDOPS v2.4.36** tools is available at: https://bedops.readthedocs.io/ ### Citation ### -If you use **BEDOPS v2.4.35** in your research, please cite the following manuscript: +If you use **BEDOPS v2.4.36** in your research, please cite the following manuscript: > Shane Neph, M. Scott Kuehn, Alex P. Reynolds, et al. > [**BEDOPS: high-performance genomic feature operations** @@ -62,7 +62,7 @@ ### Copyright ### -> Copyright (C) 2011-2018 Shane J. Neph, M. Scott Kuehn and Alex P. Reynolds +> Copyright (C) 2011-2019 Shane J. Neph, M. Scott Kuehn and Alex P. Reynolds > > Source code, documentation and media assets released under GNU Public License Version 2 (GPL v2). diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.chop.001a.test bedops-2.4.36+dfsg/tests/bedops/data/001.chop.001a.test --- bedops-2.4.35+dfsg/tests/bedops/data/001.chop.001a.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.chop.001a.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr1 10 100 id-1 +chr1 50 125 +chr1 2000 2500 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.chop.001b.test bedops-2.4.36+dfsg/tests/bedops/data/001.chop.001b.test --- bedops-2.4.35+dfsg/tests/bedops/data/001.chop.001b.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.chop.001b.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr1 250 400 +chr1 2100 2125 ok 2.7818 +chr21 500 1000 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.chop.001.expected bedops-2.4.36+dfsg/tests/bedops/data/001.chop.001.expected --- bedops-2.4.35+dfsg/tests/bedops/data/001.chop.001.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.chop.001.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,14 @@ +chr1 10 110 +chr1 110 125 +chr1 250 350 +chr1 350 400 +chr1 2000 2100 +chr1 2100 2200 +chr1 2200 2300 +chr1 2300 2400 +chr1 2400 2500 +chr21 500 600 +chr21 600 700 +chr21 700 800 +chr21 800 900 +chr21 900 1000 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.chrom.001.expected bedops-2.4.36+dfsg/tests/bedops/data/001.chrom.001.expected --- bedops-2.4.35+dfsg/tests/bedops/data/001.chrom.001.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.chrom.001.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,2 @@ +chr6 11 16 +chr6 118 119 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.complement.001.expected bedops-2.4.36+dfsg/tests/bedops/data/001.complement.001.expected --- bedops-2.4.35+dfsg/tests/bedops/data/001.complement.001.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.complement.001.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,2 @@ +chr7 102 105 +chr7 116 117 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.difference.001.expected bedops-2.4.36+dfsg/tests/bedops/data/001.difference.001.expected --- bedops-2.4.35+dfsg/tests/bedops/data/001.difference.001.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.difference.001.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr1 0 1 +chr4 19 101 +chr7 7 11 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.ec.001a.test bedops-2.4.36+dfsg/tests/bedops/data/001.ec.001a.test --- bedops-2.4.35+dfsg/tests/bedops/data/001.ec.001a.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.ec.001a.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,2 @@ +chr2 0 1000 +chr1 55 65 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.element-of.001.expected bedops-2.4.36+dfsg/tests/bedops/data/001.element-of.001.expected --- bedops-2.4.35+dfsg/tests/bedops/data/001.element-of.001.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.element-of.001.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,6 @@ +chr4 51 56 +chr4 58 59 +chr4 99 100 +chr4 102 103 +chr5 25 27 +chr7 21 23 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.intersection.001a.test bedops-2.4.36+dfsg/tests/bedops/data/001.intersection.001a.test --- bedops-2.4.35+dfsg/tests/bedops/data/001.intersection.001a.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.intersection.001a.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chr7 100 201 +chr7 200 301 +chr7 302 401 +chr7 402 501 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.intersection.001b.test bedops-2.4.36+dfsg/tests/bedops/data/001.intersection.001b.test --- bedops-2.4.35+dfsg/tests/bedops/data/001.intersection.001b.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.intersection.001b.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,8 @@ +chr7 100 101 +chr7 200 201 +chr7 300 301 +chr7 301 302 +chr7 302 303 +chr7 352 356 +chr7 390 411 +chr7 502 506 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.intersection.001.expected bedops-2.4.36+dfsg/tests/bedops/data/001.intersection.001.expected --- bedops-2.4.35+dfsg/tests/bedops/data/001.intersection.001.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.intersection.001.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,7 @@ +chr7 100 101 +chr7 200 201 +chr7 300 301 +chr7 302 303 +chr7 352 356 +chr7 390 401 +chr7 402 411 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.merge.001.expected bedops-2.4.36+dfsg/tests/bedops/data/001.merge.001.expected --- bedops-2.4.35+dfsg/tests/bedops/data/001.merge.001.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.merge.001.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr7 2 102 +chr7 105 116 +chr7 117 151 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.merge.001.test bedops-2.4.36+dfsg/tests/bedops/data/001.merge.001.test --- bedops-2.4.35+dfsg/tests/bedops/data/001.merge.001.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.merge.001.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,9 @@ +chr7 2 101 +chr7 3 58 +chr7 58 102 +chr7 105 111 +chr7 105 112 +chr7 111 114 +chr7 112 115 +chr7 115 116 +chr7 117 151 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.named-pipe.001.expected bedops-2.4.36+dfsg/tests/bedops/data/001.named-pipe.001.expected --- bedops-2.4.35+dfsg/tests/bedops/data/001.named-pipe.001.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.named-pipe.001.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,26 @@ +chr1 10 110 +chr1 63 125 +chr1 116 125 +chr1 250 350 +chr1 303 400 +chr1 356 400 +chr1 2000 2100 +chr1 2053 2153 +chr1 2106 2206 +chr1 2159 2259 +chr1 2212 2312 +chr1 2265 2365 +chr1 2318 2418 +chr1 2371 2471 +chr1 2424 2500 +chr1 2477 2500 +chr21 500 600 +chr21 553 653 +chr21 606 706 +chr21 659 759 +chr21 712 812 +chr21 765 865 +chr21 818 918 +chr21 871 971 +chr21 924 1000 +chr21 977 1000 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.partition.001a.test bedops-2.4.36+dfsg/tests/bedops/data/001.partition.001a.test --- bedops-2.4.35+dfsg/tests/bedops/data/001.partition.001a.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.partition.001a.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr1 10 100 +chr1 50 125 +chr1 2000 2500 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.partition.001b.test bedops-2.4.36+dfsg/tests/bedops/data/001.partition.001b.test --- bedops-2.4.35+dfsg/tests/bedops/data/001.partition.001b.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.partition.001b.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chr0 250 400 +chr1 250 400 +chr1 2100 2125 +chr21 500 1000 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.partition.001c.test bedops-2.4.36+dfsg/tests/bedops/data/001.partition.001c.test --- bedops-2.4.35+dfsg/tests/bedops/data/001.partition.001c.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.partition.001c.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr0 100 300 +chr1 50 125 +chr1 2000 2500 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.partition.001.expected bedops-2.4.36+dfsg/tests/bedops/data/001.partition.001.expected --- bedops-2.4.35+dfsg/tests/bedops/data/001.partition.001.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.partition.001.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,11 @@ +chr0 100 250 +chr0 250 300 +chr0 300 400 +chr1 10 50 +chr1 50 100 +chr1 100 125 +chr1 250 400 +chr1 2000 2100 +chr1 2100 2125 +chr1 2125 2500 +chr21 500 1000 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.stdin.001.expected bedops-2.4.36+dfsg/tests/bedops/data/001.stdin.001.expected --- bedops-2.4.35+dfsg/tests/bedops/data/001.stdin.001.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.stdin.001.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,18 @@ +chr1 10 110 +chr1 250 350 +chr1 2000 2100 +chr1 2053 2153 +chr1 2106 2206 +chr1 2159 2259 +chr1 2212 2312 +chr1 2265 2365 +chr1 2318 2418 +chr1 2371 2471 +chr21 500 600 +chr21 553 653 +chr21 606 706 +chr21 659 759 +chr21 712 812 +chr21 765 865 +chr21 818 918 +chr21 871 971 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.symdiff.001.expected bedops-2.4.36+dfsg/tests/bedops/data/001.symdiff.001.expected --- bedops-2.4.35+dfsg/tests/bedops/data/001.symdiff.001.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.symdiff.001.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,11 @@ +chr1 0 5 +chr1 11 15 +chr11 80 105 +chr11 106 126 +chr13 0 200 +chr13 201 301 +chr15 5 10 +chr15 11 101 +chr4 19 101 +chr5 16 18 +chr7 7 11 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.union.001.expected bedops-2.4.36+dfsg/tests/bedops/data/001.union.001.expected --- bedops-2.4.35+dfsg/tests/bedops/data/001.union.001.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.union.001.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,11 @@ +chr1 0 108 +chr1 0 110 +chr10 400 700 +chr11 0 700 +chr12 0 104 +chr12 1 278 +chr13 0 102 +chr14 0 178 +chr15 400 799 +chr16 0 105 +chr17 0 177 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/001.union.001.test bedops-2.4.36+dfsg/tests/bedops/data/001.union.001.test --- bedops-2.4.35+dfsg/tests/bedops/data/001.union.001.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/001.union.001.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,11 @@ +chr1 1 10 +chr1 2 8 +chr10 500 600 +chr11 4 600 +chr12 3 4 +chr12 101 178 +chr13 1 2 +chr14 59 78 +chr15 500 699 +chr16 4 5 +chr17 5 77 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.chop.002.expected bedops-2.4.36+dfsg/tests/bedops/data/002.chop.002.expected --- bedops-2.4.35+dfsg/tests/bedops/data/002.chop.002.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.chop.002.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,12 @@ +chr1 10 110 +chr1 250 350 +chr1 2000 2100 +chr1 2100 2200 +chr1 2200 2300 +chr1 2300 2400 +chr1 2400 2500 +chr21 500 600 +chr21 600 700 +chr21 700 800 +chr21 800 900 +chr21 900 1000 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.chrom.002.expected bedops-2.4.36+dfsg/tests/bedops/data/002.chrom.002.expected --- bedops-2.4.35+dfsg/tests/bedops/data/002.chrom.002.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.chrom.002.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,2 @@ +chr4 0 5 +chr4 11 16 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.difference.002a.test bedops-2.4.36+dfsg/tests/bedops/data/002.difference.002a.test --- bedops-2.4.35+dfsg/tests/bedops/data/002.difference.002a.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.difference.002a.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,125 @@ +chr1 148009248 148029247 +chr1 148352248 148370247 +chr10 55153881 55652880 +chr11 1704342 1716341 +chr11 1944342 2299341 +chr11 4731318 5571317 +chr11 5702318 5718317 +chr11 63995061 64214060 +chr11 115962356 116099355 +chr11 116190356 116201355 +chr11 116249356 116275355 +chr11 130604863 131007862 +chr11 131041863 131103862 +chr12 38627234 38758233 +chr12 38810234 38844233 +chr12 38932234 39125233 +chr13 29418172 29560171 +chr13 112338065 112371064 +chr13 112504065 112549064 +chr13 112612065 112630064 +chr13 112674065 112834064 +chr14 52947539 53073538 +chr14 53179539 53216538 +chr14 53252539 53395538 +chr14 98458982 98726981 +chr14 98846982 98922981 +chr15 41520526 41532525 +chr15 41613526 41644525 +chr15 41944526 42017525 +chr16 93144 119143 +chr16 265144 282143 +chr16 25780472 26277471 +chr16 60834367 61332366 +chr18 23719565 24213564 +chr18 59412369 59637368 +chr18 59866369 59907368 +chr19 59190792 59264791 +chr19 59928792 60022791 +chr2 51577376 52068375 +chr2 118011510 118269509 +chr2 118311510 118466509 +chr2 220105565 220163564 +chr2 220315565 220350564 +chr2 220388565 220601564 +chr2 234299983 234517982 +chr2 234572983 234772982 +chr20 33365433 33435432 +chr21 32713497 32845496 +chr21 32937497 32987496 +chr21 33098497 33211496 +chr21 33238497 33356496 +chr21 33384497 33484496 +chr21 34033497 34189496 +chr21 34350497 34363496 +chr21 39244494 39449493 +chr21 39506494 39537493 +chr21 39696494 39714493 +chr22 30129340 30178339 +chr22 30411340 30433339 +chr22 30507340 30623339 +chr22 30704340 31104339 +chr22 31157340 31176339 +chr22 31225340 31826339 +chr4 118604259 119102258 +chr5 55871562 55910561 +chr5 55932562 55983561 +chr5 56039562 56117561 +chr5 56184562 56210561 +chr5 56313562 56342561 +chr5 131285468 131354467 +chr5 131409468 131435467 +chr5 141880431 142107430 +chr5 142154431 142329430 +chr6 41462953 41483952 +chr6 41657953 41676952 +chr6 41730953 41754952 +chr6 41887953 41895952 +chr6 73790092 73926091 +chr6 73957092 74005091 +chr6 74105092 74133091 +chr6 74177092 74192091 +chr6 108410516 108501515 +chr6 108624516 108653515 +chr6 108804516 108870515 +chr6 132220684 132711683 +chr7 26730869 26808868 +chr7 26855869 26873868 +chr7 27032869 27228868 +chr7 89733489 89835488 +chr7 90088489 90106488 +chr7 90225489 90514488 +chr7 113527996 113629995 +chr7 113668996 113839995 +chr7 113903996 113950995 +chr7 113979996 114044995 +chr7 114099996 114122995 +chr7 114320996 114525995 +chr7 115404552 115415551 +chr7 115486552 115517551 +chr7 115575552 115712551 +chr7 115843552 116070551 +chr7 116127552 116156551 +chr7 116371552 116447551 +chr7 116506552 116532551 +chr7 116595552 116622551 +chr7 116675552 116991551 +chr7 117045552 117280551 +chr7 125702889 125893888 +chr7 125960889 126462888 +chr7 126512889 126592888 +chr7 126672889 126728888 +chr7 126762889 126789888 +chr8 118882346 118959345 +chr8 119129346 119148345 +chr8 119223346 119333345 +chr9 128817231 128848230 +chr9 129247231 129263230 +chrX 122513817 122565816 +chrX 122754817 122790816 +chrX 122879817 122994816 +chrX 152635277 152648276 +chrX 152834277 152848276 +chrX 152915277 153048276 +chrX 153357277 153471276 +chrX 153891277 153958276 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.difference.002b.test bedops-2.4.36+dfsg/tests/bedops/data/002.difference.002b.test --- bedops-2.4.35+dfsg/tests/bedops/data/002.difference.002b.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.difference.002b.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,121 @@ +chr1 148324497 148381196 +chr10 55154212 55653761 +chr11 1700195 1805844 +chr11 1858695 2299444 +chr11 4731161 5560910 +chr11 5704161 5732510 +chr11 63943030 64249029 +chr11 115962329 116094278 +chr11 130604811 131104460 +chr12 38627136 38796085 +chr12 38992836 39126385 +chr13 29418029 29559428 +chr13 112338078 112483527 +chr13 112520428 112525227 +chr13 112624578 112628727 +chr13 112671478 112834777 +chr14 52947469 53067518 +chr14 53179869 53445318 +chr14 98458731 98939630 +chr15 41612706 41647605 +chr15 41943256 42018955 +chr16 63608 93057 +chr16 154108 191707 +chr16 260308 337657 +chr16 411108 499907 +chr16 25782417 26279766 +chr16 60834343 61333692 +chr18 23719245 24213544 +chr18 59412352 59624151 +chr18 59822052 59912251 +chr19 59070324 59235073 +chr19 59252574 59272223 +chr19 59444274 59505073 +chr19 59768724 59808473 +chr19 59878074 60024073 +chr2 51577171 52070270 +chr2 118011463 118260212 +chr2 118319513 118469162 +chr2 220105486 220164985 +chr2 220211686 220252585 +chr2 220324186 220602785 +chr2 234274978 234773827 +chr20 33304942 33337441 +chr20 33367142 33455641 +chr20 33547842 33648241 +chr20 33719592 33741791 +chr21 32669086 33011135 +chr21 33088136 33429135 +chr21 33448236 33468585 +chr21 33770636 33776835 +chr21 33986136 34147135 +chr21 34187236 34192935 +chr21 39244480 39443129 +chr21 39518080 39577279 +chr21 39710980 39744379 +chr22 30139169 30162868 +chr22 30267469 30295368 +chr22 30306819 30325968 +chr22 30428969 30457418 +chr22 30518569 30641468 +chr22 30691769 31109568 +chr22 31233969 31828418 +chr4 118605412 119104211 +chr5 55871514 55974213 +chr5 56049964 56108463 +chr5 56295064 56312663 +chr5 131285239 131348288 +chr5 131508839 131615988 +chr5 131664139 131723988 +chr5 132163339 132207638 +chr5 132252289 132274838 +chr5 141880430 142238379 +chr5 142266580 142281579 +chr5 142316030 142320129 +chr6 41428258 41520157 +chr6 41671858 41744107 +chr6 73789966 74172215 +chr6 108415700 108655299 +chr6 108803650 108870849 +chr6 132218553 132635602 +chr6 132654353 132711702 +chr7 26730774 26934423 +chr7 27002574 27229823 +chr7 89544453 89577352 +chr7 89720203 89826252 +chr7 90246353 90525602 +chr7 113527971 113613220 +chr7 113686671 113748970 +chr7 113836821 113857470 +chr7 113900871 114009870 +chr7 114086871 114108620 +chr7 114220471 114262670 +chr7 114309121 114527020 +chr7 115497585 115530034 +chr7 115579385 115763184 +chr7 115868585 116122834 +chr7 116299385 116328884 +chr7 116394035 116441684 +chr7 116511235 116606234 +chr7 116709135 116784484 +chr7 116858785 116956034 +chr7 117061585 117262884 +chr7 125710958 125781757 +chr7 125813958 125866307 +chr7 125981658 126582957 +chr7 126667158 126818457 +chr8 118882234 119035133 +chr8 119104034 119148683 +chr8 119225934 119329033 +chr9 128810361 128867310 +chr9 129025011 129077310 +chr9 129147561 129264760 +chrX 122514171 122576870 +chrX 122752371 122773320 +chrX 122873171 122995070 +chrX 152635348 152671997 +chrX 152809248 153077847 +chrX 153193448 153278597 +chrX 153338498 153518997 +chrX 153572798 153785397 +chrX 153880448 153967197 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.difference.002.expected bedops-2.4.36+dfsg/tests/bedops/data/002.difference.002.expected --- bedops-2.4.35+dfsg/tests/bedops/data/002.difference.002.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.difference.002.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,89 @@ +chr1 148009248 148029247 +chr10 55153881 55154212 +chr11 5560910 5571317 +chr11 5702318 5704161 +chr11 116094278 116099355 +chr11 116190356 116201355 +chr11 116249356 116275355 +chr12 38810234 38844233 +chr12 38932234 38992836 +chr13 29559428 29560171 +chr13 112338065 112338078 +chr13 112504065 112520428 +chr13 112525227 112549064 +chr13 112612065 112624578 +chr13 112628727 112630064 +chr14 53067518 53073538 +chr14 53179539 53179869 +chr15 41520526 41532525 +chr16 93144 119143 +chr16 25780472 25782417 +chr18 24213544 24213564 +chr18 59624151 59637368 +chr19 59235073 59252574 +chr2 118260212 118269509 +chr2 118311510 118319513 +chr2 220315565 220324186 +chr20 33365433 33367142 +chr21 33429135 33448236 +chr21 33468585 33484496 +chr21 34147135 34187236 +chr21 34350497 34363496 +chr21 39443129 39449493 +chr21 39506494 39518080 +chr21 39696494 39710980 +chr22 30129340 30139169 +chr22 30162868 30178339 +chr22 30411340 30428969 +chr22 30507340 30518569 +chr22 31157340 31176339 +chr22 31225340 31233969 +chr4 118604259 118605412 +chr5 55974213 55983561 +chr5 56039562 56049964 +chr5 56108463 56117561 +chr5 56184562 56210561 +chr5 56313562 56342561 +chr5 131348288 131354467 +chr5 131409468 131435467 +chr5 142238379 142266580 +chr5 142281579 142316030 +chr5 142320129 142329430 +chr6 41657953 41671858 +chr6 41744107 41754952 +chr6 41887953 41895952 +chr6 74177092 74192091 +chr6 108410516 108415700 +chr6 132635602 132654353 +chr7 89826252 89835488 +chr7 90088489 90106488 +chr7 90225489 90246353 +chr7 113613220 113629995 +chr7 113668996 113686671 +chr7 113748970 113836821 +chr7 114009870 114044995 +chr7 114108620 114122995 +chr7 115404552 115415551 +chr7 115486552 115497585 +chr7 115575552 115579385 +chr7 115843552 115868585 +chr7 116127552 116156551 +chr7 116371552 116394035 +chr7 116441684 116447551 +chr7 116506552 116511235 +chr7 116606234 116622551 +chr7 116675552 116709135 +chr7 116784484 116858785 +chr7 116956034 116991551 +chr7 117045552 117061585 +chr7 117262884 117280551 +chr7 125702889 125710958 +chr7 125781757 125813958 +chr7 125866307 125893888 +chr7 125960889 125981658 +chr7 126582957 126592888 +chr8 119223346 119225934 +chr8 119329033 119333345 +chrX 122513817 122514171 +chrX 122773320 122790816 +chrX 152635277 152635348 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.element-of.002.expected bedops-2.4.36+dfsg/tests/bedops/data/002.element-of.002.expected --- bedops-2.4.35+dfsg/tests/bedops/data/002.element-of.002.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.element-of.002.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,2 @@ +chr1 1 9 +chr1 7 8 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.intersection.002.expected bedops-2.4.36+dfsg/tests/bedops/data/002.intersection.002.expected --- bedops-2.4.35+dfsg/tests/bedops/data/002.intersection.002.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.intersection.002.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1 @@ +chr7 390 391 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.intersection.002.test bedops-2.4.36+dfsg/tests/bedops/data/002.intersection.002.test --- bedops-2.4.35+dfsg/tests/bedops/data/002.intersection.002.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.intersection.002.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,2 @@ +chr7 356 381 +chr7 380 391 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.merge.002.expected bedops-2.4.36+dfsg/tests/bedops/data/002.merge.002.expected --- bedops-2.4.35+dfsg/tests/bedops/data/002.merge.002.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.merge.002.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1 @@ +chr7 2 151 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.not-element-of.002.expected bedops-2.4.36+dfsg/tests/bedops/data/002.not-element-of.002.expected --- bedops-2.4.35+dfsg/tests/bedops/data/002.not-element-of.002.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.not-element-of.002.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1 @@ +chr1 16 19 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.partition.002a.test bedops-2.4.36+dfsg/tests/bedops/data/002.partition.002a.test --- bedops-2.4.35+dfsg/tests/bedops/data/002.partition.002a.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.partition.002a.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chr1 10 100 +chr1 50 125 +chr1 2000 2500 +chr3 1 2 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.partition.002b.test bedops-2.4.36+dfsg/tests/bedops/data/002.partition.002b.test --- bedops-2.4.35+dfsg/tests/bedops/data/002.partition.002b.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.partition.002b.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chr0 100 300 +chr1 50 125 +chr1 2000 2500 +chr2 5 7 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.partition.002c.test bedops-2.4.36+dfsg/tests/bedops/data/002.partition.002c.test --- bedops-2.4.35+dfsg/tests/bedops/data/002.partition.002c.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.partition.002c.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,9 @@ +chr1 10 100 +chr1 50 125 +chr1 50 125 +chr1 2000 2500 +chr2 1 10 +chr2 1 10 +chr2 1 10 +chr2 1 10 +chr2 2 10 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.partition.002d.test bedops-2.4.36+dfsg/tests/bedops/data/002.partition.002d.test --- bedops-2.4.35+dfsg/tests/bedops/data/002.partition.002d.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.partition.002d.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chr1 1 10 +chr1 3 6 +chr1 9 10 +chr2 1 10 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.partition.002e.test bedops-2.4.36+dfsg/tests/bedops/data/002.partition.002e.test --- bedops-2.4.35+dfsg/tests/bedops/data/002.partition.002e.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.partition.002e.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,12 @@ +chr1 5 20 +chr1 10 20 +chr1 11 21 +chr1 12 22 +chr1 13 23 +chr1 14 24 +chr1 15 25 +chr1 16 26 +chr1 17 27 +chr1 18 28 +chr1 19 29 +chr1 20 30 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.partition.002.expected bedops-2.4.36+dfsg/tests/bedops/data/002.partition.002.expected --- bedops-2.4.35+dfsg/tests/bedops/data/002.partition.002.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.partition.002.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,35 @@ +chr0 100 300 +chr1 1 3 +chr1 3 5 +chr1 5 6 +chr1 6 9 +chr1 9 10 +chr1 10 11 +chr1 11 12 +chr1 12 13 +chr1 13 14 +chr1 14 15 +chr1 15 16 +chr1 16 17 +chr1 17 18 +chr1 18 19 +chr1 19 20 +chr1 20 21 +chr1 21 22 +chr1 22 23 +chr1 23 24 +chr1 24 25 +chr1 25 26 +chr1 26 27 +chr1 27 28 +chr1 28 29 +chr1 29 30 +chr1 30 50 +chr1 50 100 +chr1 100 125 +chr1 2000 2500 +chr2 1 2 +chr2 2 5 +chr2 5 7 +chr2 7 10 +chr3 1 2 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.symdiff.002.expected bedops-2.4.36+dfsg/tests/bedops/data/002.symdiff.002.expected --- bedops-2.4.35+dfsg/tests/bedops/data/002.symdiff.002.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.symdiff.002.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,10 @@ +chr1 0 5 +chr1 11 15 +chr11 80 100 +chr11 126 1001 +chr13 201 301 +chr15 0 5 +chr15 21 101 +chr4 19 101 +chr5 16 18 +chr7 7 11 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/002.union.002.expected bedops-2.4.36+dfsg/tests/bedops/data/002.union.002.expected --- bedops-2.4.35+dfsg/tests/bedops/data/002.union.002.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/002.union.002.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chr10 500 600 +chr11 100 600 +chr12 101 178 +chr15 500 699 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.chop.003.expected bedops-2.4.36+dfsg/tests/bedops/data/003.chop.003.expected --- bedops-2.4.35+dfsg/tests/bedops/data/003.chop.003.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.chop.003.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,26 @@ +chr1 10 110 +chr1 63 125 +chr1 116 125 +chr1 250 350 +chr1 303 400 +chr1 356 400 +chr1 2000 2100 +chr1 2053 2153 +chr1 2106 2206 +chr1 2159 2259 +chr1 2212 2312 +chr1 2265 2365 +chr1 2318 2418 +chr1 2371 2471 +chr1 2424 2500 +chr1 2477 2500 +chr21 500 600 +chr21 553 653 +chr21 606 706 +chr21 659 759 +chr21 712 812 +chr21 765 865 +chr21 818 918 +chr21 871 971 +chr21 924 1000 +chr21 977 1000 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.chrom.003.expected bedops-2.4.36+dfsg/tests/bedops/data/003.chrom.003.expected --- bedops-2.4.35+dfsg/tests/bedops/data/003.chrom.003.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.chrom.003.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,2 @@ +chr7 2 102 +chr7 105 116 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.complement.003.expected bedops-2.4.36+dfsg/tests/bedops/data/003.complement.003.expected --- bedops-2.4.35+dfsg/tests/bedops/data/003.complement.003.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.complement.003.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,5 @@ +chr4 11 16 +chr6 11 16 +chr6 118 119 +chr7 102 105 +chr7 116 117 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.difference.003.expected bedops-2.4.36+dfsg/tests/bedops/data/003.difference.003.expected --- bedops-2.4.35+dfsg/tests/bedops/data/003.difference.003.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.difference.003.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,157 @@ +chr1 148324497 148352248 +chr1 148370247 148381196 +chr10 55652880 55653761 +chr11 1700195 1704342 +chr11 1716341 1805844 +chr11 1858695 1944342 +chr11 2299341 2299444 +chr11 4731161 4731318 +chr11 5718317 5732510 +chr11 63943030 63995061 +chr11 64214060 64249029 +chr11 115962329 115962356 +chr11 130604811 130604863 +chr11 131007862 131041863 +chr11 131103862 131104460 +chr12 38627136 38627234 +chr12 38758233 38796085 +chr12 39125233 39126385 +chr13 29418029 29418172 +chr13 112371064 112483527 +chr13 112671478 112674065 +chr13 112834064 112834777 +chr14 52947469 52947539 +chr14 53216538 53252539 +chr14 53395538 53445318 +chr14 98458731 98458982 +chr14 98726981 98846982 +chr14 98922981 98939630 +chr15 41612706 41613526 +chr15 41644525 41647605 +chr15 41943256 41944526 +chr15 42017525 42018955 +chr16 63608 93057 +chr16 154108 191707 +chr16 260308 265144 +chr16 282143 337657 +chr16 411108 499907 +chr16 26277471 26279766 +chr16 60834343 60834367 +chr16 61332366 61333692 +chr18 23719245 23719565 +chr18 59412352 59412369 +chr18 59822052 59866369 +chr18 59907368 59912251 +chr19 59070324 59190792 +chr19 59264791 59272223 +chr19 59444274 59505073 +chr19 59768724 59808473 +chr19 59878074 59928792 +chr19 60022791 60024073 +chr2 51577171 51577376 +chr2 52068375 52070270 +chr2 118011463 118011510 +chr2 118466509 118469162 +chr2 220105486 220105565 +chr2 220163564 220164985 +chr2 220211686 220252585 +chr2 220350564 220388565 +chr2 220601564 220602785 +chr2 234274978 234299983 +chr2 234517982 234572983 +chr2 234772982 234773827 +chr20 33304942 33337441 +chr20 33435432 33455641 +chr20 33547842 33648241 +chr20 33719592 33741791 +chr21 32669086 32713497 +chr21 32845496 32937497 +chr21 32987496 33011135 +chr21 33088136 33098497 +chr21 33211496 33238497 +chr21 33356496 33384497 +chr21 33770636 33776835 +chr21 33986136 34033497 +chr21 34189496 34192935 +chr21 39244480 39244494 +chr21 39537493 39577279 +chr21 39714493 39744379 +chr22 30267469 30295368 +chr22 30306819 30325968 +chr22 30433339 30457418 +chr22 30623339 30641468 +chr22 30691769 30704340 +chr22 31104339 31109568 +chr22 31826339 31828418 +chr4 119102258 119104211 +chr5 55871514 55871562 +chr5 55910561 55932562 +chr5 56295064 56312663 +chr5 131285239 131285468 +chr5 131508839 131615988 +chr5 131664139 131723988 +chr5 132163339 132207638 +chr5 132252289 132274838 +chr5 141880430 141880431 +chr5 142107430 142154431 +chr6 41428258 41462953 +chr6 41483952 41520157 +chr6 41676952 41730953 +chr6 73789966 73790092 +chr6 73926091 73957092 +chr6 74005091 74105092 +chr6 74133091 74172215 +chr6 108501515 108624516 +chr6 108653515 108655299 +chr6 108803650 108804516 +chr6 108870515 108870849 +chr6 132218553 132220684 +chr6 132711683 132711702 +chr7 26730774 26730869 +chr7 26808868 26855869 +chr7 26873868 26934423 +chr7 27002574 27032869 +chr7 27228868 27229823 +chr7 89544453 89577352 +chr7 89720203 89733489 +chr7 90514488 90525602 +chr7 113527971 113527996 +chr7 113839995 113857470 +chr7 113900871 113903996 +chr7 113950995 113979996 +chr7 114086871 114099996 +chr7 114220471 114262670 +chr7 114309121 114320996 +chr7 114525995 114527020 +chr7 115517551 115530034 +chr7 115712551 115763184 +chr7 116070551 116122834 +chr7 116299385 116328884 +chr7 116532551 116595552 +chr7 126462888 126512889 +chr7 126667158 126672889 +chr7 126728888 126762889 +chr7 126789888 126818457 +chr8 118882234 118882346 +chr8 118959345 119035133 +chr8 119104034 119129346 +chr8 119148345 119148683 +chr9 128810361 128817231 +chr9 128848230 128867310 +chr9 129025011 129077310 +chr9 129147561 129247231 +chr9 129263230 129264760 +chrX 122565816 122576870 +chrX 122752371 122754817 +chrX 122873171 122879817 +chrX 122994816 122995070 +chrX 152648276 152671997 +chrX 152809248 152834277 +chrX 152848276 152915277 +chrX 153048276 153077847 +chrX 153193448 153278597 +chrX 153338498 153357277 +chrX 153471276 153518997 +chrX 153572798 153785397 +chrX 153880448 153891277 +chrX 153958276 153967197 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.element-of.003.expected bedops-2.4.36+dfsg/tests/bedops/data/003.element-of.003.expected --- bedops-2.4.35+dfsg/tests/bedops/data/003.element-of.003.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.element-of.003.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,2 @@ +chr1 1149020 1149450 +chr1 1149320 1149470 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.merge.003.expected bedops-2.4.36+dfsg/tests/bedops/data/003.merge.003.expected --- bedops-2.4.35+dfsg/tests/bedops/data/003.merge.003.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.merge.003.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr6 5 11 +chr6 16 118 +chr6 119 121 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.merge.003.test bedops-2.4.36+dfsg/tests/bedops/data/003.merge.003.test --- bedops-2.4.35+dfsg/tests/bedops/data/003.merge.003.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.merge.003.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chr6 5 11 +chr6 16 17 +chr6 17 118 +chr6 119 121 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.not-element-of.003a.test bedops-2.4.36+dfsg/tests/bedops/data/003.not-element-of.003a.test --- bedops-2.4.35+dfsg/tests/bedops/data/003.not-element-of.003a.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.not-element-of.003a.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr1 1149020 1149450 +chr1 1149120 1149270 +chr1 1149320 1149470 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.not-element-of.003b.test bedops-2.4.36+dfsg/tests/bedops/data/003.not-element-of.003b.test --- bedops-2.4.35+dfsg/tests/bedops/data/003.not-element-of.003b.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.not-element-of.003b.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,2 @@ +chr1 1149320 1149470 +chr1 1155860 1156010 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.not-element-of.003.expected bedops-2.4.36+dfsg/tests/bedops/data/003.not-element-of.003.expected --- bedops-2.4.35+dfsg/tests/bedops/data/003.not-element-of.003.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.not-element-of.003.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1 @@ +chr1 1149120 1149270 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.partition.003.expected bedops-2.4.36+dfsg/tests/bedops/data/003.partition.003.expected --- bedops-2.4.35+dfsg/tests/bedops/data/003.partition.003.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.partition.003.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,9 @@ +chr1 33657 33666 +chr1 33666 33670 +chr1 33670 33672 +chr1 33672 33682 +chr1 33682 33686 +chr1 33686 33687 +chr1 33687 33690 +chr1 34375 34377 +chr1 34377 34390 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.partition.003.test bedops-2.4.36+dfsg/tests/bedops/data/003.partition.003.test --- bedops-2.4.35+dfsg/tests/bedops/data/003.partition.003.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.partition.003.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,6 @@ +chr1 33657 33687 +MA0068.1-Pax4 8.67655e-06 + TAATGCTATCCCTCCCCCAGCCCCCCACCC +chr1 33666 33686 +MA0073.1-RREB1 1.97929e-06 + CCCTCCCCCAGCCCCCCACC +chr1 33670 33690 +MA0073.1-RREB1 1.0924e-06 + CCCCCAGCCCCCCACCCACT +chr1 33672 33682 +MA0079.2-SP1 5.66765e-06 + CCCAGCCCCC +chr1 34375 34390 +MA0065.2-PPARG::RXRA 7.21085e-07 + GGTGGGCAAAGGGCA +chr1 34377 34390 +MA0114.1-HNF4A 5.44281e-06 + TGGGCAAAGGGCA diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.symdiff.003a.test bedops-2.4.36+dfsg/tests/bedops/data/003.symdiff.003a.test --- bedops-2.4.35+dfsg/tests/bedops/data/003.symdiff.003a.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.symdiff.003a.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,2 @@ +chr1 1 9 +chr1 7 8 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.symdiff.003b.test bedops-2.4.36+dfsg/tests/bedops/data/003.symdiff.003b.test --- bedops-2.4.35+dfsg/tests/bedops/data/003.symdiff.003b.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.symdiff.003b.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr1 1 5 +chr1 7 9 +chr1 16 19 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.symdiff.003c.test bedops-2.4.36+dfsg/tests/bedops/data/003.symdiff.003c.test --- bedops-2.4.35+dfsg/tests/bedops/data/003.symdiff.003c.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.symdiff.003c.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1 @@ +chr1 3 9 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.symdiff.003d.test bedops-2.4.36+dfsg/tests/bedops/data/003.symdiff.003d.test --- bedops-2.4.35+dfsg/tests/bedops/data/003.symdiff.003d.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.symdiff.003d.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1 @@ +chr1 11 15 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.symdiff.003.expected bedops-2.4.36+dfsg/tests/bedops/data/003.symdiff.003.expected --- bedops-2.4.35+dfsg/tests/bedops/data/003.symdiff.003.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.symdiff.003.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,2 @@ +chr1 11 15 +chr1 16 19 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.union.003.expected bedops-2.4.36+dfsg/tests/bedops/data/003.union.003.expected --- bedops-2.4.35+dfsg/tests/bedops/data/003.union.003.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.union.003.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,10 @@ +chr9 141127305 141128332 chr9:141127805-141127832,+,1 1 + +chrM 0 564 chrM:6-64,+,5 5 + +chrM 0 564 chrM:13-64,+,13 6 + +chrM 0 653 chrM:69-153,+,16 7 + +chrM 0 713 chrM:67-213,+,103 9 + +chrM 0 713 chrM:183-213,+,14 6 + +chrM 0 755 chrM:34-255,+,53 7 + +chrM 0 919 chrM:9-419,-,14117 17 - +chrM 0 922 chrM:11-422,-,3100 14 - +chrM 0 1059 chrM:12-559,-,25584 17 - diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/003.union.003.test bedops-2.4.36+dfsg/tests/bedops/data/003.union.003.test --- bedops-2.4.35+dfsg/tests/bedops/data/003.union.003.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/003.union.003.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,10 @@ +chr9 141127805 141127832 chr9:141127805-141127832,+,1 1 + +chrM 6 64 chrM:6-64,+,5 5 + +chrM 9 419 chrM:9-419,-,14117 17 - +chrM 11 422 chrM:11-422,-,3100 14 - +chrM 12 559 chrM:12-559,-,25584 17 - +chrM 13 64 chrM:13-64,+,13 6 + +chrM 34 255 chrM:34-255,+,53 7 + +chrM 67 213 chrM:67-213,+,103 9 + +chrM 69 153 chrM:69-153,+,16 7 + +chrM 183 213 chrM:183-213,+,14 6 + diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.chop.004.expected bedops-2.4.36+dfsg/tests/bedops/data/004.chop.004.expected --- bedops-2.4.35+dfsg/tests/bedops/data/004.chop.004.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.chop.004.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,18 @@ +chr1 10 110 +chr1 250 350 +chr1 2000 2100 +chr1 2053 2153 +chr1 2106 2206 +chr1 2159 2259 +chr1 2212 2312 +chr1 2265 2365 +chr1 2318 2418 +chr1 2371 2471 +chr21 500 600 +chr21 553 653 +chr21 606 706 +chr21 659 759 +chr21 712 812 +chr21 765 865 +chr21 818 918 +chr21 871 971 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.chrom.004.expected bedops-2.4.36+dfsg/tests/bedops/data/004.chrom.004.expected --- bedops-2.4.35+dfsg/tests/bedops/data/004.chrom.004.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.chrom.004.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,2 @@ +chr7 2 102 +chr7 105 116 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.complement.004a.test bedops-2.4.36+dfsg/tests/bedops/data/004.complement.004a.test --- bedops-2.4.35+dfsg/tests/bedops/data/004.complement.004a.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.complement.004a.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chr1 0 1 +chr1 14 22 +chr11 3000 4001 +chr7 6 14 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.complement.004b.test bedops-2.4.36+dfsg/tests/bedops/data/004.complement.004b.test --- bedops-2.4.35+dfsg/tests/bedops/data/004.complement.004b.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.complement.004b.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,10 @@ +chr1 1 2 +chr1 14 15 +chr11 3100 4501 +chr11 4600 4714 +chr4 100 201 +chr4 201 203 +chr7 89 92 +chr7 101 120 +chr8 1000 1112 +chr8 1112 1115 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.complement.004c.test bedops-2.4.36+dfsg/tests/bedops/data/004.complement.004c.test --- bedops-2.4.35+dfsg/tests/bedops/data/004.complement.004c.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.complement.004c.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,8 @@ +chr1 17 30 +chr1 58 66 +chr11 5000 5006 +chr13 14 18 +chr13 19 101 +chr4 13 14 +chr4 73 80 +chr5 1 4 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.complement.004.expected bedops-2.4.36+dfsg/tests/bedops/data/004.complement.004.expected --- bedops-2.4.35+dfsg/tests/bedops/data/004.complement.004.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.complement.004.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,9 @@ +chr1 2 14 +chr1 30 58 +chr11 4501 4600 +chr11 4714 5000 +chr13 18 19 +chr4 14 73 +chr4 80 100 +chr7 14 89 +chr7 92 101 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.difference.004a.test bedops-2.4.36+dfsg/tests/bedops/data/004.difference.004a.test --- bedops-2.4.35+dfsg/tests/bedops/data/004.difference.004a.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.difference.004a.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chrY 3 5 +chrY 7 12 +chrY 16 25 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.difference.004b.test bedops-2.4.36+dfsg/tests/bedops/data/004.difference.004b.test --- bedops-2.4.35+dfsg/tests/bedops/data/004.difference.004b.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.difference.004b.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chrY 5 8 +chrY 11 15 +chrY 27 31 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.difference.004.expected bedops-2.4.36+dfsg/tests/bedops/data/004.difference.004.expected --- bedops-2.4.35+dfsg/tests/bedops/data/004.difference.004.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.difference.004.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chrY 3 5 +chrY 8 11 +chrY 16 25 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.element-of.004a.test bedops-2.4.36+dfsg/tests/bedops/data/004.element-of.004a.test --- bedops-2.4.35+dfsg/tests/bedops/data/004.element-of.004a.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.element-of.004a.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chrY 59021595 59021609 +chrY 59021595 59021611 +chrY 59021598 59021611 +chrY 59021604 59021620 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.element-of.004b.test bedops-2.4.36+dfsg/tests/bedops/data/004.element-of.004b.test --- bedops-2.4.35+dfsg/tests/bedops/data/004.element-of.004b.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.element-of.004b.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1 @@ +chrY 59002033 59002045 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.intersection.004a.test bedops-2.4.36+dfsg/tests/bedops/data/004.intersection.004a.test --- bedops-2.4.35+dfsg/tests/bedops/data/004.intersection.004a.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.intersection.004a.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,9 @@ +chr1 0 1 +chr1 5 11 +chr11 105 106 +chr13 100 201 +chr15 5 11 +chr4 19 101 +chr4 29 39 +chr5 19 201 +chr7 7 11 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.intersection.004b.test bedops-2.4.36+dfsg/tests/bedops/data/004.intersection.004b.test --- bedops-2.4.35+dfsg/tests/bedops/data/004.intersection.004b.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.intersection.004b.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,7 @@ +chr1 1 15 +chr11 80 126 +chr13 0 100 +chr13 200 301 +chr15 10 101 +chr5 16 18 +chr5 19 201 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.intersection.004c.test bedops-2.4.36+dfsg/tests/bedops/data/004.intersection.004c.test --- bedops-2.4.35+dfsg/tests/bedops/data/004.intersection.004c.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.intersection.004c.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chr1 7 8 +chr11 100 1001 +chr13 0 201 +chr15 0 21 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.intersection.004.expected bedops-2.4.36+dfsg/tests/bedops/data/004.intersection.004.expected --- bedops-2.4.35+dfsg/tests/bedops/data/004.intersection.004.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.intersection.004.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chr1 7 8 +chr11 105 106 +chr13 200 201 +chr15 10 11 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.merge.004.expected bedops-2.4.36+dfsg/tests/bedops/data/004.merge.004.expected --- bedops-2.4.35+dfsg/tests/bedops/data/004.merge.004.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.merge.004.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,6 @@ +chr6 5 11 +chr6 16 118 +chr6 119 121 +chr7 2 102 +chr7 105 116 +chr7 117 151 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.partition.004.expected bedops-2.4.36+dfsg/tests/bedops/data/004.partition.004.expected --- bedops-2.4.35+dfsg/tests/bedops/data/004.partition.004.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.partition.004.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,9 @@ +chr1 279 280 +chr1 280 281 +chr1 281 282 +chr1 310 311 +chr1 311 312 +chr1 312 313 +chr1 313 314 +chr1 314 318 +chr1 318 320 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.partition.004.test bedops-2.4.36+dfsg/tests/bedops/data/004.partition.004.test --- bedops-2.4.35+dfsg/tests/bedops/data/004.partition.004.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.partition.004.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,9 @@ +chr1 279 280 +chr1 280 281 +chr1 281 282 +chr1 310 311 +chr1 310 320 +chr1 311 312 +chr1 312 313 +chr1 312 318 +chr1 313 314 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.symdiff.004.expected bedops-2.4.36+dfsg/tests/bedops/data/004.symdiff.004.expected --- bedops-2.4.35+dfsg/tests/bedops/data/004.symdiff.004.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.symdiff.004.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,5 @@ +chrY 3 7 +chrY 8 11 +chrY 12 15 +chrY 16 25 +chrY 27 31 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.union.004.expected bedops-2.4.36+dfsg/tests/bedops/data/004.union.004.expected --- bedops-2.4.35+dfsg/tests/bedops/data/004.union.004.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.union.004.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,2 @@ +chr1 15 92 +chr1 25 42 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/004.union.004.test bedops-2.4.36+dfsg/tests/bedops/data/004.union.004.test --- bedops-2.4.35+dfsg/tests/bedops/data/004.union.004.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/004.union.004.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr1 20 100 +chr1 30 50 +chr2 5 8 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/005.chop.005.expected bedops-2.4.36+dfsg/tests/bedops/data/005.chop.005.expected --- bedops-2.4.35+dfsg/tests/bedops/data/005.chop.005.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/005.chop.005.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,35 @@ +chr1 10 11 +chr1 11 12 +chr1 12 13 +chr1 13 14 +chr1 14 15 +chr2 10 11 +chr2 11 12 +chr2 12 13 +chr2 13 14 +chr2 14 15 +chr3 10 11 +chr3 11 12 +chr3 12 13 +chr3 13 14 +chr3 14 15 +chr9 10 11 +chr9 11 12 +chr9 12 13 +chr9 13 14 +chr9 14 15 +chrM 10 11 +chrM 11 12 +chrM 12 13 +chrM 13 14 +chrM 14 15 +chrX 10 11 +chrX 11 12 +chrX 12 13 +chrX 13 14 +chrX 14 15 +chrY 10 11 +chrY 11 12 +chrY 12 13 +chrY 13 14 +chrY 14 15 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/005.chop.005.test bedops-2.4.36+dfsg/tests/bedops/data/005.chop.005.test --- bedops-2.4.35+dfsg/tests/bedops/data/005.chop.005.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/005.chop.005.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,7 @@ +chr1 10 15 id-1 +chr2 10 15 +chr3 10 15 +chr9 10 15 +chrM 10 15 +chrX 10 15 +chrY 10 15 id-2 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/005.complement.005.expected bedops-2.4.36+dfsg/tests/bedops/data/005.complement.005.expected --- bedops-2.4.35+dfsg/tests/bedops/data/005.complement.005.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/005.complement.005.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,2 @@ +chr1 1 4 +chr10 1 20 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/005.complement.005.test bedops-2.4.36+dfsg/tests/bedops/data/005.complement.005.test --- bedops-2.4.35+dfsg/tests/bedops/data/005.complement.005.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/005.complement.005.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chr1 0 1 +chr1 4 5 +chr10 0 1 +chr10 20 30 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/005.difference.005.expected bedops-2.4.36+dfsg/tests/bedops/data/005.difference.005.expected --- bedops-2.4.35+dfsg/tests/bedops/data/005.difference.005.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/005.difference.005.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chrY 5 7 +chrY 12 15 +chrY 27 31 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/005.merge.005.expected bedops-2.4.36+dfsg/tests/bedops/data/005.merge.005.expected --- bedops-2.4.35+dfsg/tests/bedops/data/005.merge.005.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/005.merge.005.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,8 @@ +chr4 5 11 +chr4 16 17 +chr6 0 11 +chr6 16 118 +chr6 119 121 +chr7 2 102 +chr7 105 116 +chr7 117 151 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/005.merge.005.test bedops-2.4.36+dfsg/tests/bedops/data/005.merge.005.test --- bedops-2.4.35+dfsg/tests/bedops/data/005.merge.005.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/005.merge.005.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chr4 5 11 +chr4 16 17 +chr6 0 5 +chr6 120 121 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/005.union.005.expected bedops-2.4.36+dfsg/tests/bedops/data/005.union.005.expected --- bedops-2.4.35+dfsg/tests/bedops/data/005.union.005.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/005.union.005.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1 @@ +chr1 20 21 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/006.complement.006.expected bedops-2.4.36+dfsg/tests/bedops/data/006.complement.006.expected --- bedops-2.4.35+dfsg/tests/bedops/data/006.complement.006.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/006.complement.006.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr7 0 2 +chr7 102 105 +chr7 116 117 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/006.merge.006a.test bedops-2.4.36+dfsg/tests/bedops/data/006.merge.006a.test --- bedops-2.4.35+dfsg/tests/bedops/data/006.merge.006a.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/006.merge.006a.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chr1 0 1 +chr1 0 3 +chr1 1 31 +chr7 5 8 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/006.merge.006b.test bedops-2.4.36+dfsg/tests/bedops/data/006.merge.006b.test --- bedops-2.4.35+dfsg/tests/bedops/data/006.merge.006b.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/006.merge.006b.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr1 29 31 +chr1 32 40 +chr4 100 201 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/006.merge.006c.test bedops-2.4.36+dfsg/tests/bedops/data/006.merge.006c.test --- bedops-2.4.35+dfsg/tests/bedops/data/006.merge.006c.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/006.merge.006c.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr1 31 32 +chr1 40 47 +chr5 1 4 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/006.merge.006.expected bedops-2.4.36+dfsg/tests/bedops/data/006.merge.006.expected --- bedops-2.4.35+dfsg/tests/bedops/data/006.merge.006.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/006.merge.006.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chr1 0 47 +chr4 100 201 +chr5 1 4 +chr7 5 8 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/007.complement.007.expected bedops-2.4.36+dfsg/tests/bedops/data/007.complement.007.expected --- bedops-2.4.35+dfsg/tests/bedops/data/007.complement.007.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/007.complement.007.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1 @@ +chr7 0 2 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/007.merge.007a.test bedops-2.4.36+dfsg/tests/bedops/data/007.merge.007a.test --- bedops-2.4.35+dfsg/tests/bedops/data/007.merge.007a.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/007.merge.007a.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,5 @@ +chr1 1 51 +chr4 51 52 +chr4 56 59 +chr4 100 102 +chr5 23 26 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/007.merge.007b.test bedops-2.4.36+dfsg/tests/bedops/data/007.merge.007b.test --- bedops-2.4.35+dfsg/tests/bedops/data/007.merge.007b.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/007.merge.007b.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,6 @@ +chr4 51 56 +chr4 58 59 +chr4 99 100 +chr4 102 103 +chr5 25 27 +chr7 21 23 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/007.merge.007.expected bedops-2.4.36+dfsg/tests/bedops/data/007.merge.007.expected --- bedops-2.4.35+dfsg/tests/bedops/data/007.merge.007.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/007.merge.007.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,5 @@ +chr1 1 51 +chr4 51 59 +chr4 99 103 +chr5 23 27 +chr7 21 23 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/007.union.007.expected bedops-2.4.36+dfsg/tests/bedops/data/007.union.007.expected --- bedops-2.4.35+dfsg/tests/bedops/data/007.union.007.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/007.union.007.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr1 15 105 +chr1 25 55 +chr2 0 13 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/008.complement.008.expected bedops-2.4.36+dfsg/tests/bedops/data/008.complement.008.expected --- bedops-2.4.35+dfsg/tests/bedops/data/008.complement.008.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/008.complement.008.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,7 @@ +chr4 0 5 +chr4 11 16 +chr6 11 16 +chr6 118 119 +chr7 0 2 +chr7 102 105 +chr7 116 117 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/008.merge.008.expected bedops-2.4.36+dfsg/tests/bedops/data/008.merge.008.expected --- bedops-2.4.35+dfsg/tests/bedops/data/008.merge.008.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/008.merge.008.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,16 @@ +chr1 0 2 +chr1 14 30 +chr1 58 66 +chr11 3000 4501 +chr11 4600 4714 +chr11 5000 5006 +chr13 14 18 +chr13 19 101 +chr4 13 14 +chr4 73 80 +chr4 100 203 +chr5 1 4 +chr7 6 14 +chr7 89 92 +chr7 101 120 +chr8 1000 1115 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/008.union.008.expected bedops-2.4.36+dfsg/tests/bedops/data/008.union.008.expected --- bedops-2.4.35+dfsg/tests/bedops/data/008.union.008.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/008.union.008.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr1 15 105 +chr1 25 55 +chr2 0 13 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/009.complement.009.expected bedops-2.4.36+dfsg/tests/bedops/data/009.complement.009.expected --- bedops-2.4.35+dfsg/tests/bedops/data/009.complement.009.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/009.complement.009.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,15 @@ +chr1 2 14 +chr1 30 58 +chr11 0 3000 +chr11 4501 4600 +chr11 4714 5000 +chr13 0 14 +chr13 18 19 +chr4 0 13 +chr4 14 73 +chr4 80 100 +chr5 0 1 +chr7 0 6 +chr7 14 89 +chr7 92 101 +chr8 0 1000 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/009.merge.009.expected bedops-2.4.36+dfsg/tests/bedops/data/009.merge.009.expected --- bedops-2.4.35+dfsg/tests/bedops/data/009.merge.009.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/009.merge.009.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,5 @@ +chrY 3 7 +chrY 8 11 +chrY 12 15 +chrY 16 25 +chrY 27 31 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/009.union.009.expected bedops-2.4.36+dfsg/tests/bedops/data/009.union.009.expected --- bedops-2.4.35+dfsg/tests/bedops/data/009.union.009.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/009.union.009.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +chr1 15 92 +chr1 25 42 +chr2 45 72 diff -Nru bedops-2.4.35+dfsg/tests/bedops/data/009.union.009.test bedops-2.4.36+dfsg/tests/bedops/data/009.union.009.test --- bedops-2.4.35+dfsg/tests/bedops/data/009.union.009.test 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/data/009.union.009.test 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,4 @@ +chr1 20 100 +chr1 30 50 +chr2 5 8 +chr2 50 80 diff -Nru bedops-2.4.35+dfsg/tests/bedops/Makefile bedops-2.4.36+dfsg/tests/bedops/Makefile --- bedops-2.4.35+dfsg/tests/bedops/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/bedops/Makefile 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,386 @@ +APP = bedops +CWD := $(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))) +BIN = $(CWD)/../../bin/bedops +TMP := $(shell mktemp -d) +DATA = $(CWD)/data +SHELL := /bin/bash + +all: + @echo "Testing binary [$(APP)] and build type [$(BUILDTYPE)]" + @$(MAKE) tests + +tests: bedops_prep merge complement intersection difference symdiff element-of not-element-of union partition chrom chop stdin named-pipe ec + @echo "Removing [$(TMP)]" + @rm -rf $(TMP) + +bedops_prep: + @[ -f $(BIN) ] || echo "Missing binary [$(APP)] for build type [$(BUILDTYPE)]" + @echo "Writing to [$(TMP)]" + $(BIN) --version + +merge: +# Test 001 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 001]" + @$(BIN) -m $(DATA)/001.merge.001.test > $(TMP)/001.merge.001.observed + @diff $(TMP)/001.merge.001.observed $(DATA)/001.merge.001.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 002 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 002]" + @$(BIN) -m $(DATA)/001.merge.001.test $(DATA)/001.complement.001.expected > $(TMP)/002.merge.002.observed + @diff $(TMP)/002.merge.002.observed $(DATA)/002.merge.002.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 003 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 003]" + @$(BIN) -m $(DATA)/003.merge.003.test > $(TMP)/003.merge.003.observed + @diff $(TMP)/003.merge.003.observed $(DATA)/003.merge.003.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 004 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 004]" + @$(BIN) -m $(DATA)/001.merge.001.test $(DATA)/003.merge.003.test > $(TMP)/004.merge.004.observed + @diff $(TMP)/004.merge.004.observed $(DATA)/004.merge.004.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 005 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 005]" + @$(BIN) -m $(DATA)/005.merge.005.test $(DATA)/004.merge.004.expected > $(TMP)/005.merge.005.observed + @diff $(TMP)/005.merge.005.observed $(DATA)/005.merge.005.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 006 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 006]" + @$(BIN) -m $(DATA)/006.merge.006a.test $(DATA)/006.merge.006b.test $(DATA)/006.merge.006c.test > $(TMP)/006.merge.006.observed + @diff $(TMP)/006.merge.006.observed $(DATA)/006.merge.006.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 007 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 007]" + @$(BIN) -m $(DATA)/007.merge.007a.test $(DATA)/007.merge.007b.test > $(TMP)/007.merge.007.observed + @diff $(TMP)/007.merge.007.observed $(DATA)/007.merge.007.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 008 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 008]" + @$(BIN) -m $(DATA)/004.complement.004a.test $(DATA)/004.complement.004b.test $(DATA)/004.complement.004c.test > $(TMP)/008.merge.008.observed + @diff $(TMP)/008.merge.008.observed $(DATA)/008.merge.008.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 009 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 009]" + @$(BIN) -m $(DATA)/004.difference.004.expected $(DATA)/005.difference.005.expected > $(TMP)/009.merge.009.observed + @diff $(TMP)/009.merge.009.observed $(DATA)/009.merge.009.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +complement: +# Test 001 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 001]" + @$(BIN) -c $(DATA)/001.merge.001.test > $(TMP)/001.complement.001.observed + @diff $(TMP)/001.complement.001.observed $(DATA)/001.complement.001.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 002 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 002]" + @$(BIN) -c $(DATA)/002.merge.002.expected > $(TMP)/002.complement.002.observed + @diff $(TMP)/002.complement.002.observed $(DATA)/002.complement.002.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 003 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 003]" + @$(BIN) -c $(DATA)/005.merge.005.expected > $(TMP)/003.complement.003.observed + @diff $(TMP)/003.complement.003.observed $(DATA)/003.complement.003.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 004 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 004]" + @$(BIN) -c $(DATA)/004.complement.004a.test $(DATA)/004.complement.004b.test $(DATA)/004.complement.004c.test > $(TMP)/004.complement.004.observed + @diff $(TMP)/004.complement.004.observed $(DATA)/004.complement.004.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 005 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 005]" + @$(BIN) -c $(DATA)/005.complement.005.test > $(TMP)/005.complement.005.observed + @diff $(TMP)/005.complement.005.observed $(DATA)/005.complement.005.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 006 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 006]" + @$(BIN) -c -L $(DATA)/001.merge.001.test > $(TMP)/006.complement.006.observed + @diff $(TMP)/006.complement.006.observed $(DATA)/006.complement.006.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 007 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 007]" + @$(BIN) -c -L $(DATA)/002.merge.002.expected > $(TMP)/007.complement.007.observed + @diff $(TMP)/007.complement.007.observed $(DATA)/007.complement.007.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 008 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 008]" + @$(BIN) -c -L $(DATA)/005.merge.005.expected > $(TMP)/008.complement.008.observed + @diff $(TMP)/008.complement.008.observed $(DATA)/008.complement.008.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 009 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 009]" + @$(BIN) -c -L $(DATA)/004.complement.004a.test $(DATA)/004.complement.004b.test $(DATA)/004.complement.004c.test > $(TMP)/009.complement.009.observed + @diff $(TMP)/009.complement.009.observed $(DATA)/009.complement.009.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +intersection: +# Test 001 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 001]" + @$(BIN) -i $(DATA)/001.intersection.001a.test $(DATA)/001.intersection.001b.test > $(TMP)/001.intersection.001.observed + @diff $(TMP)/001.intersection.001.observed $(DATA)/001.intersection.001.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 002 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 002]" + @$(BIN) -i $(DATA)/001.intersection.001a.test $(DATA)/001.intersection.001b.test $(DATA)/002.intersection.002.test > $(TMP)/002.intersection.002.observed + @diff $(TMP)/002.intersection.002.observed $(DATA)/002.intersection.002.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 003 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 003]" + @$(BIN) -i $(DATA)/008.merge.008.expected $(DATA)/004.complement.004.expected > $(TMP)/003.intersection.003.observed + @diff $(TMP)/003.intersection.003.observed $(DATA)/003.intersection.003.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 004 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 004]" + @$(BIN) -i $(DATA)/004.intersection.004a.test $(DATA)/004.intersection.004b.test $(DATA)/004.intersection.004c.test > $(TMP)/004.intersection.004.observed + @diff $(TMP)/004.intersection.004.observed $(DATA)/004.intersection.004.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +difference: +# Test 001 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 001]" + @$(BIN) -d $(DATA)/004.intersection.004a.test $(DATA)/004.intersection.004b.test $(DATA)/004.intersection.004c.test > $(TMP)/001.difference.001.observed + @diff $(TMP)/001.difference.001.observed $(DATA)/001.difference.001.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 002 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 002]" + @$(BIN) -d $(DATA)/002.difference.002a.test $(DATA)/002.difference.002b.test > $(TMP)/002.difference.002.observed + @diff $(TMP)/002.difference.002.observed $(DATA)/002.difference.002.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 003 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 003]" + @$(BIN) -d $(DATA)/002.difference.002b.test $(DATA)/002.difference.002a.test > $(TMP)/003.difference.003.observed + @diff $(TMP)/003.difference.003.observed $(DATA)/003.difference.003.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 004 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 004]" + @$(BIN) -d $(DATA)/004.difference.004a.test $(DATA)/004.difference.004b.test > $(TMP)/004.difference.004.observed + @diff $(TMP)/004.difference.004.observed $(DATA)/004.difference.004.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 005 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 005]" + @$(BIN) -d $(DATA)/004.difference.004b.test $(DATA)/004.difference.004a.test > $(TMP)/005.difference.005.observed + @diff $(TMP)/005.difference.005.observed $(DATA)/005.difference.005.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 006 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 006]" + @$(BIN) -d $(DATA)/004.symdiff.004.expected $(DATA)/009.merge.009.expected > $(TMP)/006.difference.006.observed + @diff $(TMP)/006.difference.006.observed $(DATA)/006.difference.006.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 007 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 007]" + @$(BIN) -d $(DATA)/009.merge.009.expected $(DATA)/004.symdiff.004.expected > $(TMP)/007.difference.007.observed + @diff $(TMP)/007.difference.007.observed $(DATA)/007.difference.007.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +symdiff: +# Test 001 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 001]" + @$(BIN) -s $(DATA)/004.intersection.004a.test $(DATA)/004.intersection.004b.test > $(TMP)/001.symdiff.001.observed + @diff $(TMP)/001.symdiff.001.observed $(DATA)/001.symdiff.001.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 002 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 002]" + @$(BIN) -s $(DATA)/004.intersection.004a.test $(DATA)/004.intersection.004b.test $(DATA)/004.intersection.004c.test > $(TMP)/002.symdiff.002.observed + @diff $(TMP)/002.symdiff.002.observed $(DATA)/002.symdiff.002.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 003 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 003]" + @$(BIN) -s $(DATA)/003.symdiff.003a.test $(DATA)/003.symdiff.003b.test $(DATA)/003.symdiff.003c.test $(DATA)/003.symdiff.003d.test > $(TMP)/003.symdiff.003.observed + @diff $(TMP)/003.symdiff.003.observed $(DATA)/003.symdiff.003.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 004 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 004]" + @$(BIN) -s $(DATA)/004.difference.004a.test $(DATA)/004.difference.004b.test > $(TMP)/004.symdiff.004.observed + @diff $(TMP)/004.symdiff.004.observed $(DATA)/004.symdiff.004.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 005 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 005]" + @$(BIN) -s $(DATA)/009.merge.009.expected $(DATA)/004.symdiff.004.expected > $(TMP)/005.symdiff.005.observed + @diff $(TMP)/005.symdiff.005.observed $(DATA)/005.symdiff.005.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +element-of: +# Test 001 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 001]" + @$(BIN) -e $(DATA)/007.merge.007b.test $(DATA)/007.merge.007b.test > $(TMP)/001.element-of.001.observed + @diff $(TMP)/001.element-of.001.observed $(DATA)/001.element-of.001.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 002 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 002]" + @$(BIN) -e 0 $(DATA)/003.symdiff.003a.test $(DATA)/003.symdiff.003b.test > $(TMP)/002.element-of.002.observed + @diff $(TMP)/002.element-of.002.observed $(DATA)/002.element-of.002.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 003 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 003]" + @$(BIN) -e 1 $(DATA)/003.not-element-of.003a.test $(DATA)/003.not-element-of.003b.test > $(TMP)/003.element-of.003.observed + @diff $(TMP)/003.element-of.003.observed $(DATA)/003.element-of.003.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 004 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 004]" + @$(BIN) -e $(DATA)/004.element-of.004a.test $(DATA)/004.element-of.004b.test > $(TMP)/004.element-of.004.observed + @diff $(TMP)/004.element-of.004.observed $(DATA)/004.element-of.004.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +not-element-of: +# Test 001 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 001]" + @$(BIN) -n $(DATA)/007.merge.007b.test $(DATA)/007.merge.007b.test > $(TMP)/001.not-element-of.001.observed + @diff $(TMP)/001.not-element-of.001.observed $(DATA)/001.not-element-of.001.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 002 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 002]" + @$(BIN) -n 0 $(DATA)/003.symdiff.003b.test $(DATA)/003.symdiff.003a.test > $(TMP)/002.not-element-of.002.observed + @diff $(TMP)/002.not-element-of.002.observed $(DATA)/002.not-element-of.002.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 003 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 003]" + @$(BIN) -n 1 $(DATA)/003.not-element-of.003a.test $(DATA)/003.not-element-of.003b.test > $(TMP)/003.not-element-of.003.observed + @diff $(TMP)/003.not-element-of.003.observed $(DATA)/003.not-element-of.003.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +union: +# Test 001 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 001]" + @$(BIN) -u --range 100 $(DATA)/001.union.001.test > $(TMP)/001.union.001.observed + @diff $(TMP)/001.union.001.observed $(DATA)/001.union.001.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 002 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 002]" + @$(BIN) -u --range -100 $(DATA)/001.union.001.expected > $(TMP)/002.union.002.observed + @diff $(TMP)/002.union.002.observed $(DATA)/002.union.002.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 003 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 003]" + @$(BIN) -u --range 500 $(DATA)/003.union.003.test > $(TMP)/003.union.003.observed + @diff $(TMP)/003.union.003.observed $(DATA)/003.union.003.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 004 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 004]" + @$(BIN) -u --range -5:-8 $(DATA)/004.union.004.test > $(TMP)/004.union.004.observed + @diff $(TMP)/004.union.004.observed $(DATA)/004.union.004.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 005 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 005]" + @$(BIN) -u --range 0:-79 $(DATA)/004.union.004.test > $(TMP)/005.union.005.observed + @diff $(TMP)/005.union.005.observed $(DATA)/005.union.005.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 006 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 006]" + @$(BIN) -u --range 0:-80 $(DATA)/004.union.004.test > $(TMP)/006.union.006.observed + @diff $(TMP)/006.union.006.observed $(DATA)/006.union.006.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 007 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 007]" + @$(BIN) -u --range -5:5 $(DATA)/004.union.004.test > $(TMP)/007.union.007.observed + @diff $(TMP)/007.union.007.observed $(DATA)/007.union.007.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 008 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 008]" + @$(BIN) -u --range 5 $(DATA)/004.union.004.test > $(TMP)/008.union.008.observed + @diff $(TMP)/008.union.008.observed $(DATA)/008.union.008.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 009 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 009]" + @$(BIN) -u --range -5:-8 $(DATA)/009.union.009.test > $(TMP)/009.union.009.observed + @diff $(TMP)/009.union.009.observed $(DATA)/009.union.009.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +partition: +# Test 001 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 001]" + @$(BIN) -p $(DATA)/001.partition.001a.test $(DATA)/001.partition.001b.test $(DATA)/001.partition.001c.test > $(TMP)/001.partition.001.observed + @diff $(TMP)/001.partition.001.observed $(DATA)/001.partition.001.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 002 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 002]" + @$(BIN) -p $(DATA)/002.partition.002a.test $(DATA)/002.partition.002b.test $(DATA)/002.partition.002c.test $(DATA)/002.partition.002d.test $(DATA)/002.partition.002e.test > $(TMP)/002.partition.002.observed + @diff $(TMP)/002.partition.002.observed $(DATA)/002.partition.002.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 003 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 003]" + @$(BIN) -p $(DATA)/003.partition.003.test > $(TMP)/003.partition.003.observed + @diff $(TMP)/003.partition.003.observed $(DATA)/003.partition.003.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 004 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 004]" + @$(BIN) -p $(DATA)/004.partition.004.test > $(TMP)/004.partition.004.observed + @diff $(TMP)/004.partition.004.observed $(DATA)/004.partition.004.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 005 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 005]" + @$(BIN) -p $(DATA)/004.partition.004.test > $(TMP)/004.partition.004.observed + @diff $(TMP)/004.partition.004.observed $(DATA)/004.partition.004.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +chrom: +# Test 001 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 001]" + @$(BIN) --chrom chr6 -u $(DATA)/008.complement.008.expected > $(TMP)/001.chrom.001.observed + @diff $(TMP)/001.chrom.001.observed $(DATA)/001.chrom.001.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 002 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 002]" + @$(BIN) --chrom chr4 -m $(DATA)/008.complement.008.expected > $(TMP)/002.chrom.002.observed + @diff $(TMP)/002.chrom.002.observed $(DATA)/002.chrom.002.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 003 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 003]" + @$(BIN) --chrom chr7 -c $(DATA)/008.complement.008.expected > $(TMP)/003.chrom.003.observed + @diff $(TMP)/003.chrom.003.observed $(DATA)/003.chrom.003.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 004 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 004]" + @$(BIN) --ec --chrom chr7 -c -L $(DATA)/008.complement.008.expected > $(TMP)/004.chrom.004.observed + @diff $(TMP)/004.chrom.004.observed $(DATA)/004.chrom.004.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +chop: +# Test 001 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 001]" + @$(BIN) --chop 100 $(DATA)/001.chop.001a.test $(DATA)/001.chop.001b.test > $(TMP)/001.chop.001.observed + @diff $(TMP)/001.chop.001.observed $(DATA)/001.chop.001.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 002 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 002]" + @$(BIN) --chop 100 -x $(DATA)/001.chop.001a.test $(DATA)/001.chop.001b.test > $(TMP)/002.chop.002.observed + @diff $(TMP)/002.chop.002.observed $(DATA)/002.chop.002.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 003 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 003]" + @$(BIN) --chop 100 --stagger 53 $(DATA)/001.chop.001a.test $(DATA)/001.chop.001b.test > $(TMP)/003.chop.003.observed + @diff $(TMP)/003.chop.003.observed $(DATA)/003.chop.003.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 004 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 004]" + @$(BIN) --chop 100 --stagger 53 -x $(DATA)/001.chop.001a.test $(DATA)/001.chop.001b.test > $(TMP)/004.chop.004.observed + @diff $(TMP)/004.chop.004.observed $(DATA)/004.chop.004.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 005 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 005]" + @$(BIN) --chop $(DATA)/005.chop.005.test > $(TMP)/005.chop.005.observed + @diff $(TMP)/005.chop.005.observed $(DATA)/005.chop.005.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +stdin: +# Test 001 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 001]" + @$(BIN) -u $(DATA)/001.chop.001a.test $(DATA)/001.chop.001b.test | $(BIN) --chop 100 --stagger 53 -x - > $(TMP)/001.stdin.001.observed + @diff $(TMP)/001.stdin.001.observed $(DATA)/001.stdin.001.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +named-pipe: +# Test 001 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 001]" + @$(BIN) --chop 100 --stagger 53 <($(BIN) -u $(DATA)/001.chop.001a.test $(DATA)/001.chop.001b.test) > $(TMP)/001.named-pipe.001.observed + @diff $(TMP)/001.named-pipe.001.observed $(DATA)/001.named-pipe.001.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +ec: +# Test 001 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 001]" + @if $(BIN) --ec --chop 20 --chrom chr1 $(DATA)/001.ec.001a.test 2> /dev/null; then printf " ...passed! (not expected to pass)\n"; exit 1; else printf " ...failed! (but expected to fail)\n"; exit 0; fi +# Test 002 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 002]" + @if $(BIN) --ec --chop 20 --chrom chr2 $(DATA)/001.ec.001a.test 2> /dev/null; then printf " ...passed! (not expected to pass)\n"; exit 1; else printf " ...failed! (but expected to fail)\n"; exit 0; fi +# Test 003 + @printf "[$(APP)-$(BUILDTYPE) --$@] - [Test 003]" + @if $(BIN) --ec --chop 20 --chrom chr1 <(sort-bed $(DATA)/001.ec.001a.test) > /dev/null 2>&1; then printf " ...passed!\n"; exit 0; else printf " ...failed!\n"; exit 1; fi diff -Nru bedops-2.4.35+dfsg/tests/Makefile bedops-2.4.36+dfsg/tests/Makefile --- bedops-2.4.35+dfsg/tests/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/Makefile 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,28 @@ +CWD := $(shell pwd) +SWITCH = $(CWD)/../bin/switch-BEDOPS-binary-type +ALL_BINARY_TYPES = typical megarow float128 +SHELL := /bin/bash + +all: tests + +.PHONY: tests bedops starch + +tests: + $(MAKE) bedops -C $(CWD)/tests + $(MAKE) starch -C $(CWD)/tests + $(MAKE) clean -C $(CWD)/tests + +bedops: + for btype in ${ALL_BINARY_TYPES}; do \ + (cd $(CWD)/../bin && $(SWITCH) --$$btype . && cd $(CWD)) || exit $$?; \ + $(MAKE) all -C $(CWD)/bedops BUILDTYPE=$$btype; \ + done + +starch: + for btype in ${ALL_BINARY_TYPES}; do \ + (cd $(CWD)/../bin && $(SWITCH) --$$btype . && cd $(CWD)) || exit $$?; \ + $(MAKE) all -C $(CWD)/starch BUILDTYPE=$$btype; \ + done + +clean: + (cd $(CWD)/../bin && $(SWITCH) --typical . && cd $(CWD)) || exit $$? diff -Nru bedops-2.4.35+dfsg/tests/starch/data/001.unstarch.signature.001.expected bedops-2.4.36+dfsg/tests/starch/data/001.unstarch.signature.001.expected --- bedops-2.4.35+dfsg/tests/starch/data/001.unstarch.signature.001.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/starch/data/001.unstarch.signature.001.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,22 @@ +metadata oCfHBXB6cYgEeJfQcdQFytfKwQ4= +chr1 iRgfAiTq83xaM55tnzZtnAmuDts= +chr10 LXUincBCeVkNgfDshQZyN/zY8Ik= +chr11 UMS/t9+OBW8obVnvLNPjrvruyr0= +chr12 YAkFXHqbE7LcHDkqEiCCHCHr8Xg= +chr13 vI1SOJJz15la0MKyD7vjY3VMly0= +chr14 swcTSP5BR8YaqCKCdg/FWdf6sCg= +chr15 uAdnpV+JvQteyUxBEI2vZCbO2No= +chr16 4hcz15zk4PWmG0uyVvIE+qTYS8A= +chr18 OUymlsfv+IX1E2gm/vGd1bEaNeM= +chr19 thhoHnth0tbSKNcT30tJloGx8bk= +chr2 oTLxElPFT0gBAf/gBR6A8u70X0E= +chr20 AbuHkhc1htrlwvmVGW7Zq0Q/FOk= +chr21 /gGpI8Gj7skKzSzuzjDLTB41RMM= +chr22 xrl3xTQe2L6TSmf3MnSJymbgBYE= +chr4 ewLzPHyyw256VFScof62ERyU+dU= +chr5 OdfERhpAjEZ5UtWYNtALpZOa/HI= +chr6 1yGdfw0mQMZgY+5bwLd3HnHt4vg= +chr7 FxmzUL+IrQcMlAPObuz7xwYj8JA= +chr8 DZqAdjNvHrwui7K9NA1axa8f2kA= +chr9 HPcwTXOrzZoLGL7NJUnjFwSGTRU= +chrX LiTRZtyf8pe79UrTdqQEJYpqupk= Binary files /tmp/tmpoKXfx9/7qAvWUwIFn/bedops-2.4.35+dfsg/tests/starch/data/001.unstarch.signature.001.test and /tmp/tmpoKXfx9/_2d1zXmLKf/bedops-2.4.36+dfsg/tests/starch/data/001.unstarch.signature.001.test differ diff -Nru bedops-2.4.35+dfsg/tests/starch/data/002.unstarch.signature.001.expected bedops-2.4.36+dfsg/tests/starch/data/002.unstarch.signature.001.expected --- bedops-2.4.35+dfsg/tests/starch/data/002.unstarch.signature.001.expected 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/starch/data/002.unstarch.signature.001.expected 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,22 @@ +metadata x+75RW6mRmOSzMjnPvxt4igtLtY= +chr1 NA +chr10 NA +chr11 NA +chr12 NA +chr13 NA +chr14 NA +chr15 NA +chr16 NA +chr18 NA +chr19 NA +chr2 NA +chr20 NA +chr21 NA +chr22 NA +chr4 NA +chr5 NA +chr6 NA +chr7 NA +chr8 NA +chr9 NA +chrX NA Binary files /tmp/tmpoKXfx9/7qAvWUwIFn/bedops-2.4.35+dfsg/tests/starch/data/002.unstarch.signature.001.test and /tmp/tmpoKXfx9/_2d1zXmLKf/bedops-2.4.36+dfsg/tests/starch/data/002.unstarch.signature.001.test differ diff -Nru bedops-2.4.35+dfsg/tests/starch/data/hg38.bed bedops-2.4.36+dfsg/tests/starch/data/hg38.bed --- bedops-2.4.35+dfsg/tests/starch/data/hg38.bed 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/starch/data/hg38.bed 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,25 @@ +chr1 0 248956422 +chr10 0 133797422 +chr11 0 135086622 +chr12 0 133275309 +chr13 0 114364328 +chr14 0 107043718 +chr15 0 101991189 +chr16 0 90338345 +chr17 0 83257441 +chr18 0 80373285 +chr19 0 58617616 +chr2 0 242193529 +chr20 0 64444167 +chr21 0 46709983 +chr22 0 50818468 +chr3 0 198295559 +chr4 0 190214555 +chr5 0 181538259 +chr6 0 170805979 +chr7 0 159345973 +chr8 0 145138636 +chr9 0 138394717 +chrM 0 16569 +chrX 0 156040895 +chrY 0 57227415 diff -Nru bedops-2.4.35+dfsg/tests/starch/data/README bedops-2.4.36+dfsg/tests/starch/data/README --- bedops-2.4.35+dfsg/tests/starch/data/README 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/starch/data/README 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,3 @@ +To generate hg38 BED file: + +$ fetchChromSizes hg38 | awk -vOFS="\t" '($1!~/_/){print $1,"0",$2}' | sort-bed - \ No newline at end of file diff -Nru bedops-2.4.35+dfsg/tests/starch/generate_random_intervals.sh bedops-2.4.36+dfsg/tests/starch/generate_random_intervals.sh --- bedops-2.4.35+dfsg/tests/starch/generate_random_intervals.sh 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/starch/generate_random_intervals.sh 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,20 @@ +#!/bin/bash -e + +boundsFn=$1 +samples=$2 +maxLength=$3 + +# rand=$(od -N 4 -t uL -An /dev/urandom | tr -d " ") && rand=$(($rand % 1234)) + +while IFS='' read -r line || [[ -n "$line" ]]; do + chr=`printf "$line" | awk '{ print $1 }'` + chrN=`printf "$chr" | awk '{ sub(/chr/, "", $1); print $1; }'` + bound=`printf "$line" | awk '{ print $3 }'` + adjustedBound=$((${bound} - ${maxLength} - 1)) + for sample in `seq 1 ${samples}`; do + start=$(od -N 4 -t uL -An /dev/urandom | tr -d " ") && start=$(($start % $adjustedBound)) + length=$(od -N 4 -t uL -An /dev/urandom | tr -d " ") && length=$(($length % $maxLength)) + stop=$(($start + $length + 1)) + echo -e "$chr\t$start\t$stop\tid-$chrN-$sample" + done +done < "${boundsFn}" \ No newline at end of file diff -Nru bedops-2.4.35+dfsg/tests/starch/Makefile bedops-2.4.36+dfsg/tests/starch/Makefile --- bedops-2.4.35+dfsg/tests/starch/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ bedops-2.4.36+dfsg/tests/starch/Makefile 2019-05-23 20:06:31.000000000 +0000 @@ -0,0 +1,87 @@ +APPGROUP = starch +CWD := $(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))) +STARCH = $(CWD)/../../bin/starch +STARCHBIN = starch +UNSTARCH = $(CWD)/../../bin/unstarch +UNSTARCHBIN = unstarch +STARCHCAT = $(CWD)/../../bin/starchcat +STARCHCATBIN = starchcat +STARCHSTRIP = $(CWD)/../../bin/starchstrip +STARCHSTRIPBIN = starchstrip +SORTBED = $(CWD)/../../bin/sort-bed +TMP := $(shell mktemp -d) +DATA = $(CWD)/data +SHELL := /bin/bash +SAMPLES = 100 +MAXLENGTH = 10000 +RANDOMINTERVALS = $(TMP)/random_intervals.bed + +all: + @echo "Testing binary group [$(APPGROUP)] and build type [$(BUILDTYPE)]" + @$(MAKE) tests + +tests: unstarch starch + @echo "Removing [$(TMP)]" + @rm -rf $(TMP) + +unstarch: unstarch_prep signature + +unstarch_prep: + @[ -f $(UNSTARCH) ] || echo "Missing binary [$(UNSTARCH)] for build type [$(BUILDTYPE)]" + @echo "Writing to [$(TMP)]" + $(UNSTARCH) --version + +signature: +# Test 001 +# starch tests/bedops/data/002.difference.002a.test > tests/starch/data/001.unstarch.signature.001.test + @printf "[$(APPGROUP)-$(UNSTARCHBIN)-$(BUILDTYPE) --$@] - [Test 001]" + @$(UNSTARCH) --signature $(DATA)/001.unstarch.signature.001.test > $(TMP)/001.unstarch.signature.001.observed + @diff $(TMP)/001.unstarch.signature.001.observed $(DATA)/001.unstarch.signature.001.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" +# Test 002 +# starch tests/bedops/data/002.difference.002a.test > tests/starch/data/002.unstarch.signature.001.test + @printf "[$(APPGROUP)-$(UNSTARCHBIN)-$(BUILDTYPE) --$@] - [Test 002]" + @$(UNSTARCH) --signature $(DATA)/002.unstarch.signature.001.test > $(TMP)/002.unstarch.signature.001.observed + @diff $(TMP)/002.unstarch.signature.001.observed $(DATA)/002.unstarch.signature.001.expected || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +starch: starch_prep deflate_and_inflate + +starch_prep: + @[ -f $(STARCH) ] || echo "Missing binary [$(STARCH)] for build type [$(BUILDTYPE)]" + @echo "Writing to [$(TMP)]" + $(STARCH) --version + @echo "Generating random intervals..." + ./generate_random_intervals.sh $(DATA)/hg38.bed $(SAMPLES) $(MAXLENGTH) | $(SORTBED) - > $(RANDOMINTERVALS) + +deflate_and_inflate: deflate_and_inflate_bzip2 deflate_and_inflate_gz + +deflate_and_inflate_bzip2: +# Test 001 + @printf "[$(APPGROUP)-$(STARCHBIN)-$(BUILDTYPE) --$@] - [Test 001]" + @$(STARCH) --bzip2 $(RANDOMINTERVALS) > $(TMP)/001.starch.deflate_and_inflate.bzip2.starch + @$(UNSTARCH) $(TMP)/001.starch.deflate_and_inflate.bzip2.starch > $(TMP)/001.starch.deflate_and_inflate.bzip2.bed + @diff $(TMP)/001.starch.deflate_and_inflate.bzip2.bed $(RANDOMINTERVALS) || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +deflate_and_inflate_gz: +# Test 001 + @printf "[$(APPGROUP)-$(STARCHBIN)-$(BUILDTYPE) --$@] - [Test 001]" + @$(STARCH) --gzip $(RANDOMINTERVALS) > $(TMP)/001.starch.deflate_and_inflate.gz.starch + @$(UNSTARCH) $(TMP)/001.starch.deflate_and_inflate.gz.starch > $(TMP)/001.starch.deflate_and_inflate.gz.bed + @diff $(TMP)/001.starch.deflate_and_inflate.gz.bed $(RANDOMINTERVALS) || (printf " ...failed!\n" && exit 1) + @printf " ...passed!\n" + +starchcat: starchcat_prep + +starchcat_prep: + @[ -f $(STARCHCAT) ] || echo "Missing binary [$(STARCHCAT)] for build type [$(BUILDTYPE)]" + @echo "Writing to [$(TMP)]" + $(STARCHCAT) --version + +starchstrip: starchstrip_prep + +starchstrip_prep: + @[ -f $(STARCHSTRIP) ] || echo "Missing binary [$(STARCHSTRIP)] for build type [$(BUILDTYPE)]" + @echo "Writing to [$(TMP)]" + $(STARCHSTRIP) --version \ No newline at end of file diff -Nru bedops-2.4.35+dfsg/.travis.yml bedops-2.4.36+dfsg/.travis.yml --- bedops-2.4.35+dfsg/.travis.yml 2018-05-02 21:43:25.000000000 +0000 +++ bedops-2.4.36+dfsg/.travis.yml 2019-05-23 20:06:31.000000000 +0000 @@ -15,5 +15,5 @@ - if [[ "$CXX" == "g++" ]]; then if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -qq g++-4.8; fi; fi - if [[ "$CXX" == "g++" ]]; then if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50; fi; fi script: - - if [[ "$CC" == "gcc" ]]; then if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then make all; fi; fi - - if [[ "$CC" == "clang" ]]; then if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make all; fi; fi \ No newline at end of file + - if [[ "$CC" == "gcc" ]]; then if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then make all; make install_all; fi; fi + - if [[ "$CC" == "clang" ]]; then if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make all; make install_all; fi; fi