Skip to content

Commit

Permalink
BayesTyper (v1.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Andreas Sibbesen committed Aug 16, 2017
1 parent 3372b1e commit 1e34c12
Show file tree
Hide file tree
Showing 138 changed files with 1,383 additions and 1,570 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)

SET(CMAKE_CXX_FLAGS "--std=c++11 -g -Wall -O3 -DBT_VERSION='\"${GIT_BRANCH} ${GIT_LAST_COMMIT_HASH}\"' -lpthread")
SET(CMAKE_CXX_FLAGS "--std=c++11 -g -Wall -O3 -DBT_VERSION='\"v1.1 ${GIT_LAST_COMMIT_HASH}\"' -lpthread")

FIND_PACKAGE(Boost COMPONENTS program_options system filesystem iostreams REQUIRED)
message(STATUS ${Boost_LIBRARIES})
Expand Down
2 changes: 1 addition & 1 deletion include/bayesTyper/BitsetCompare.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
BitsetCompare.hpp - This file is part of BayesTyper (v0.9)
BitsetCompare.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down
2 changes: 1 addition & 1 deletion include/bayesTyper/ChromosomePloidy.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
ChromosomePloidy.hpp - This file is part of BayesTyper (v0.9)
ChromosomePloidy.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down
2 changes: 1 addition & 1 deletion include/bayesTyper/Combinator.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
Combinator.hpp - This file is part of BayesTyper (v0.9)
Combinator.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down
2 changes: 1 addition & 1 deletion include/bayesTyper/CountAllocation.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
CountAllocation.hpp - This file is part of BayesTyper (v0.9)
CountAllocation.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down
2 changes: 1 addition & 1 deletion include/bayesTyper/CountDistribution.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
CountDistribution.hpp - This file is part of BayesTyper (v0.9)
CountDistribution.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down
2 changes: 1 addition & 1 deletion include/bayesTyper/DiscreteSampler.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
DiscreteSampler.hpp - This file is part of BayesTyper (v0.9)
DiscreteSampler.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down
2 changes: 1 addition & 1 deletion include/bayesTyper/FrequencyDistribution.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
FrequencyDistribution.hpp - This file is part of BayesTyper (v0.9)
FrequencyDistribution.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down
4 changes: 2 additions & 2 deletions include/bayesTyper/GenotypeWriter.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
GenotypeWriter.hpp - This file is part of BayesTyper (v0.9)
GenotypeWriter.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down Expand Up @@ -74,7 +74,7 @@ class GenotypeWriter {
void writeVariantStats(ofstream *, const Genotypes::VariantStats &, const VariantInfo &);
void writeAlleleCover(ofstream *, vector<ushort> *, VariantInfo *);
void writeSamples(ofstream *, const vector<Genotypes::SampleStats> &, const VariantInfo &);
void writeAlleleKmerStats(ofstream *, const vector<FixedKmerStats> &);
void writeAlleleKmerStats(ofstream *, const AlleleKmerStats &);

void addAlleleKmerEstimates(const vector<Genotypes::SampleStats> &);

Expand Down
8 changes: 3 additions & 5 deletions include/bayesTyper/Genotypes.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
Genotypes.hpp - This file is part of BayesTyper (v0.9)
Genotypes.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down Expand Up @@ -57,7 +57,7 @@ class Genotypes {
ushort variant_cluster_size;
uint variant_cluster_group_size;

uchar has_complex_region : 1, has_redundant_sequence : 1;
bool has_redundant_sequence;

VariantInfo variant_info;
vector<ushort> non_covered_alleles;
Expand All @@ -82,7 +82,7 @@ class Genotypes {
vector<float> genotype_posteriors;

vector<float> allele_posteriors;
vector<FixedKmerStats> allele_kmer_stats;
AlleleKmerStats allele_kmer_stats;

bool is_allele_kmer_estimate_variant;

Expand All @@ -94,8 +94,6 @@ class Genotypes {
SampleStats(const ushort num_alleles, const uint num_genotypes) : genotype_posteriors(num_genotypes, 0), allele_posteriors(num_alleles, 0) {

genotype_estimate.reserve(2);
allele_kmer_stats.reserve(num_alleles);

is_allele_kmer_estimate_variant = false;
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/bayesTyper/HaplotypeFrequencyDistribution.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
HaplotypeFrequencyDistribution.hpp - This file is part of BayesTyper (v0.9)
HaplotypeFrequencyDistribution.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down
2 changes: 1 addition & 1 deletion include/bayesTyper/HybridHash.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
HybridHash.hpp - This file is part of BayesTyper (v0.9)
HybridHash.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down
29 changes: 29 additions & 0 deletions include/bayesTyper/HybridHash.tpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@

/*
HybridHash.tpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Copyright (c) 2016 Jonas Andreas Sibbesen and Lasse Maretty
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/


#include <iostream>
#include <math.h>
#include <assert.h>
Expand Down
5 changes: 3 additions & 2 deletions include/bayesTyper/InferenceEngine.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
InferenceEngine.hpp - This file is part of BayesTyper (v0.9)
InferenceEngine.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down Expand Up @@ -68,11 +68,12 @@ class InferenceEngine {

const uint prng_seed;
const ushort num_threads;
const ushort num_haplotype_candidates_per_sample;
const ushort max_sample_haplotype_candidates;
const uchar num_genomic_rate_gc_bias_bins;
const ushort gibbs_burn;
const ushort gibbs_samples;
const ushort num_gibbs_chains;
const float kmer_subsampling_rate;
const uint max_haplotype_variant_kmers;
const ushort num_parameter_estimation_samples;
const uint num_parameter_estimation_snvs;
Expand Down
2 changes: 1 addition & 1 deletion include/bayesTyper/Kmer.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
Kmer.hpp - This file is part of BayesTyper (v0.9)
Kmer.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down
27 changes: 27 additions & 0 deletions include/bayesTyper/Kmer.tpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@

/*
Kmer.tpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Copyright (c) 2016 Jonas Andreas Sibbesen and Lasse Maretty
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/


template<uchar size>
const bitset<size*2> & Kmer<size>::getKmer() {
Expand Down
6 changes: 3 additions & 3 deletions include/bayesTyper/KmerCounter.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
KmerCounter.hpp - This file is part of BayesTyper (v0.9)
KmerCounter.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down Expand Up @@ -53,7 +53,7 @@ class KmerCounter {

KmerCounter(KmerHash * const, Utils::SmallmerSet * const, const ushort);

ulong countVariantClusterSmallmers(vector<VariantClusterGroup *> *);
ulong countVariantClusterSmallmers(vector<VariantClusterGraph *> *);
ulong countInterclusterKmers(const vector<VariantFileParser::InterClusterRegion> &);
ulong countSampleKmers(const vector<Sample> &);
void countVariantClusterKmers(vector<VariantClusterGroup *> *, const uint, const ushort, const ushort);
Expand All @@ -79,7 +79,7 @@ class KmerCounter {

uchar min_sample_kmer_count;

void countVariantClusterSmallmersCallback(vector<VariantClusterGroup *> *, const ushort, mutex *, ulong *);
void countVariantClusterSmallmersCallback(vector<VariantClusterGraph *> *, const ushort, mutex *, ulong *);
void countInterclusterKmersCallback(const vector<VariantFileParser::InterClusterRegion> &, const ushort, mutex *, ulong *);
void countSampleKmersCallBack(ProducerConsumerQueue<KmerBatchInfo *> *, ProducerConsumerQueue<KmerBatchInfo *> *, mutex *, ulong *);
void countVariantClusterKmersCallback(vector<VariantClusterGroup *> *, const uint, const ushort, const ushort, const ushort);
Expand Down
2 changes: 1 addition & 1 deletion include/bayesTyper/KmerCounts.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
KmerCounts.hpp - This file is part of BayesTyper (v0.9)
KmerCounts.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down
5 changes: 3 additions & 2 deletions include/bayesTyper/KmerFactory.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
KmerFactory.hpp - This file is part of BayesTyper (v0.9)
KmerFactory.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down Expand Up @@ -55,11 +55,12 @@ class KmerFactory {
const uint prng_seed;
const string vcf_file;
const string genome_file;
const string output_prefix;
const string decoy_file;
const ushort num_threads;
const uint max_allele_length;
const double copy_number_variant_threshold;
const ushort num_haplotype_candidates_per_sample;
const ushort max_sample_haplotype_candidates;
const uchar num_genomic_rate_gc_bias_bins;

ulong number_of_variants;
Expand Down
2 changes: 1 addition & 1 deletion include/bayesTyper/KmerHash.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
KmerHash.hpp - This file is part of BayesTyper (v0.9)
KmerHash.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down
79 changes: 12 additions & 67 deletions include/bayesTyper/KmerStats.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
KmerStats.hpp - This file is part of BayesTyper (v0.9)
KmerStats.hpp - This file is part of BayesTyper (v1.1)
The MIT License (MIT)
Expand Down Expand Up @@ -45,86 +45,31 @@ class KmerStats {
KmerStats();

void reset();
void addKmer(KmerCounts * const, const ushort, const float);
void addValue(const pair<float, bool> &);

float getCount() const;
uint getCount() const;
pair<float, bool> getFraction() const;
pair<float, bool> getMean() const;

protected:

float count;
float fraction;
float mean;
};

class FixedKmerStats {

public:

FixedKmerStats();
FixedKmerStats(const float, const float, const float);

float getCount() const;
float getFraction() const;
float getMean() const;
private:

float count;
uint count;
float fraction;
float mean;
};

class MedianKmerStats {

public:

MedianKmerStats();

void addKmerStats(const KmerStats &);

pair<float, bool> getMedianCount();
pair<float, bool> getMedianFraction();
pair<float, bool> getMedianMean();

private:

struct floatLess {

bool operator() (const float & first, const float & second) const {

if (Utils::floatCompare(first, second)) {

return false;

} else {

return first < second;
}
}
};

pair<float, bool> median(SortedLinearMap<float, uint, floatLess> &, const uint);

SortedLinearMap<float, uint, floatLess> count_values;
uint num_count_values;

SortedLinearMap<float, uint, floatLess> fraction_values;
uint num_fraction_values;

SortedLinearMap<float, uint, floatLess> mean_values;
uint num_mean_values;
};

class VariantKmerStats {
class AlleleKmerStats {

public:

vector<vector<MedianKmerStats> > allele_kmer_stats;
vector<KmerStats> count_stats;
vector<KmerStats> fraction_stats;
vector<KmerStats> mean_stats;

VariantKmerStats();
VariantKmerStats(const ushort, const ushort);
AlleleKmerStats() {};
AlleleKmerStats(const ushort);

void addAlleleKmerStats(const KmerStats &, const ushort, const ushort);
void addKmerStats(const KmerStats &, const ushort);
};

#endif
Loading

0 comments on commit 1e34c12

Please sign in to comment.