16#include <unordered_map>
19#include <shared_mutex>
29 std::vector<uint32_t>
pos;
30 std::vector<double>
pfb;
31 std::vector<double>
baf;
50 std::shared_mutex& shared_mutex;
52 void updateSNPData(
SNPData& snp_data, uint32_t pos,
double pfb,
double baf,
double log2_cov,
bool is_snp);
54 void runViterbi(
const CHMM& hmm,
SNPData& snp_data, std::pair<std::vector<int>,
double>& prediction)
const;
57 void querySNPRegion(std::string chr, uint32_t start_pos, uint32_t end_pos,
const std::vector<uint32_t>& pos_depth_map,
double mean_chr_cov,
SNPData& snp_data,
const InputData& input_data)
const;
60 std::vector<std::string> splitRegionIntoChunks(std::string chr, uint32_t start_pos, uint32_t end_pos,
int chunk_count)
const;
63 CNVCaller(std::shared_mutex& shared_mutex) : shared_mutex(shared_mutex) {}
77 {0, Genotype::UNKNOWN},
78 {1, Genotype::HOMOZYGOUS_ALT},
79 {2, Genotype::HETEROZYGOUS},
80 {3, Genotype::HOMOZYGOUS_REF},
81 {4, Genotype::HOMOZYGOUS_ALT},
82 {5, Genotype::HETEROZYGOUS},
83 {6, Genotype::HOMOZYGOUS_ALT}
91 }
catch (
const std::out_of_range& e) {
92 printError(
"ERROR: Invalid CN state: " + std::to_string(cn_state));
93 return Genotype::UNKNOWN;
99 std::tuple<double, SVType, Genotype, int>
runCopyNumberPrediction(std::string chr,
const CHMM& hmm, uint32_t start_pos, uint32_t end_pos,
double mean_chr_cov,
const std::vector<uint32_t>& pos_depth_map,
const InputData& input_data)
const;
102 void runCIGARCopyNumberPrediction(std::string chr, std::vector<SVCall>& sv_candidates,
const CHMM& hmm,
double mean_chr_cov,
const std::vector<uint32_t>& pos_depth_map,
const InputData& input_data)
const;
104 void calculateMeanChromosomeCoverage(
const std::vector<std::string>& chromosomes, std::unordered_map<std::string, std::vector<uint32_t>>& chr_pos_depth_map, std::unordered_map<std::string, double>& chr_mean_cov_map,
const std::string& bam_filepath,
int thread_count)
const;
106 void readSNPAlleleFrequencies(std::string chr, uint32_t start_pos, uint32_t end_pos, std::vector<uint32_t>& snp_pos, std::unordered_map<uint32_t, double>& snp_baf, std::unordered_map<uint32_t, double>& snp_pfb,
const InputData& input_data)
const;
109 void saveSVCopyNumberToTSV(
SNPData& snp_data, std::string filepath, std::string chr, uint32_t start, uint32_t end, std::string sv_type,
double likelihood)
const;
Definition cnv_caller.h:48
Genotype getGenotypeFromCNState(int cn_state) const
Definition cnv_caller.h:87
void saveSVCopyNumberToTSV(SNPData &snp_data, std::string filepath, std::string chr, uint32_t start, uint32_t end, std::string sv_type, double likelihood) const
Definition cnv_caller.cpp:820
void saveSVCopyNumberToJSON(SNPData &before_sv, SNPData &after_sv, SNPData &snp_data, std::string chr, uint32_t start, uint32_t end, std::string sv_type, double likelihood, const std::string &filepath) const
Definition cnv_caller.cpp:902
void readSNPAlleleFrequencies(std::string chr, uint32_t start_pos, uint32_t end_pos, std::vector< uint32_t > &snp_pos, std::unordered_map< uint32_t, double > &snp_baf, std::unordered_map< uint32_t, double > &snp_pfb, const InputData &input_data) const
Definition cnv_caller.cpp:567
void calculateMeanChromosomeCoverage(const std::vector< std::string > &chromosomes, std::unordered_map< std::string, std::vector< uint32_t > > &chr_pos_depth_map, std::unordered_map< std::string, double > &chr_mean_cov_map, const std::string &bam_filepath, int thread_count) const
Definition cnv_caller.cpp:424
std::tuple< double, SVType, Genotype, int > runCopyNumberPrediction(std::string chr, const CHMM &hmm, uint32_t start_pos, uint32_t end_pos, double mean_chr_cov, const std::vector< uint32_t > &pos_depth_map, const InputData &input_data) const
Definition cnv_caller.cpp:166
CNVCaller(std::shared_mutex &shared_mutex)
Definition cnv_caller.h:63
void runCIGARCopyNumberPrediction(std::string chr, std::vector< SVCall > &sv_candidates, const CHMM &hmm, double mean_chr_cov, const std::vector< uint32_t > &pos_depth_map, const InputData &input_data) const
Definition cnv_caller.cpp:299
const std::unordered_map< int, Genotype > StateGenotypeMap
Definition cnv_caller.h:76
Genotype
Definition sv_types.h:50
Definition cnv_caller.h:28
SNPData()
Definition cnv_caller.h:37
std::vector< double > log2_cov
Definition cnv_caller.h:32
std::vector< bool > is_snp
Definition cnv_caller.h:34
std::vector< uint32_t > pos
Definition cnv_caller.h:29
double mean_chr_cov
Definition cnv_caller.h:35
std::vector< double > pfb
Definition cnv_caller.h:30
std::vector< double > baf
Definition cnv_caller.h:31
std::vector< int > state_sequence
Definition cnv_caller.h:33
void printError(std::string message)
Definition utils.cpp:88