#ifndef COLLAPSED_CELL_OPTIMIZER_HPP #define COLLAPSED_CELL_OPTIMIZER_HPP #include #include #include #include #include #include "ReadExperiment.hpp" #include "SalmonOpts.hpp" #include "GZipWriter.hpp" #include "EquivalenceClassBuilder.hpp" #include "AlevinOpts.hpp" #include "SingleCellProtocols.hpp" #include "WhiteList.hpp" #include "DedupUMI.hpp" #include "TranscriptGroup.hpp" #include "cuckoohash_map.hh" #include "Eigen/Dense" #include "concurrentqueue.h" #include #include namespace bfs = boost::filesystem; using JqueueT = moodycamel::ConcurrentQueue; using eqMapT = libcuckoo::cuckoohash_map; using tgrouplabelt = std::vector; using tgroupweightvec = std::vector; using SCExpT = ReadExperiment>; using EqMapT = libcuckoo::cuckoohash_map; constexpr double digammaMin = 1e-10; struct CellState { bool inActive; }; class CollapsedCellOptimizer { public: using VecType = std::vector>; using SerialVecType = std::vector; CollapsedCellOptimizer(); template bool optimize(EqMapT& freqMap, spp::sparse_hash_map& txpToGeneMap, spp::sparse_hash_map& geneIdxMap, AlevinOpts& aopt, GZipWriter& gzw, std::vector& trueBarcodes, std::vector& umiCount, CFreqMapT& freqCounter, size_t numLowConfidentBarcode); }; bool runPerCellEM(double& totalNumFrags, size_t numGenes, CollapsedCellOptimizer::SerialVecType& alphas, const CollapsedCellOptimizer::SerialVecType& priorAlphas, std::vector& salmonEqclasses, std::shared_ptr& jointlog, bool initUniform, bool useVBEM); void optimizeCell(std::vector& trueBarcodes, const std::vector>& priorAlphas, std::atomic& barcode, size_t totalCells, uint32_t umiEditDistance, eqMapT& eqMap, std::deque>& orderedTgroup, std::shared_ptr& jointlog, std::vector& umiCount, std::vector& skippedCB, bool verbose, GZipWriter& gzw, bool noEM, bool useVBEM, bool quiet, std::atomic& totalDedupCounts, std::atomic& totalExpGeneCounts, double priorWeight, spp::sparse_hash_map& txpToGeneMap, uint32_t numGenes, uint32_t umiLength, uint32_t numBootstraps, uint32_t numGibbsSamples, bool naiveEqclass, bool dumpUmiGraph, bool dumpCellEq, bool useAllBootstraps, bool initUniform, CFreqMapT& freqCounter, bool dumpArboFragCounts, spp::sparse_hash_set& mRnaGenes, spp::sparse_hash_set& rRnaGenes, std::atomic& totalUniEdgesCounts, std::atomic& totalBiEdgesCounts); using VecT = CollapsedCellOptimizer::SerialVecType; #endif // COLLAPSED_CELL_OPTIMIZER_HPP