-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
15,875 additions
and
1,882 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.DS_Store | ||
.idea | ||
cmake-build-debug | ||
test-example | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
set(GTEST_DIR "../../software/googletest/" CACHE PATH "Google Test path.") | ||
cmake_minimum_required(VERSION 2.8.2) | ||
|
||
add_subdirectory(${GTEST_DIR} ${CMAKE_BINARY_DIR}/gtest) | ||
include_directories(SYSTEM ${GTEST_DIR}/googlemock/include/ ${GTEST_DIR}/googletest/include/) | ||
project(googletest-download NONE) | ||
|
||
function(add_google_test target) | ||
add_executable(${target} ${ARGN}) | ||
target_link_libraries(${target} gmock_main) | ||
add_test(${target} ${target}) | ||
endfunction() | ||
include(ExternalProject) | ||
ExternalProject_Add(googletest | ||
GIT_REPOSITORY https://github.com/google/googletest.git | ||
GIT_TAG master | ||
SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src" | ||
BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build" | ||
CONFIGURE_COMMAND "" | ||
BUILD_COMMAND "" | ||
INSTALL_COMMAND "" | ||
TEST_COMMAND "" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
file(GLOB sources *.cc) | ||
add_library(common ${sources}) | ||
target_link_libraries(common ${Boost_LIBRARIES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// | ||
// Expansion Hunter | ||
// Copyright (c) 2016 Illumina, Inc. | ||
// | ||
// Author: Egor Dolzhenko <[email protected]>, | ||
// Mitch Bekritsky <[email protected]>, Richard Shaw | ||
// Concept: Michael Eberle <[email protected]> | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
#pragma once | ||
|
||
#include <map> | ||
#include <ostream> | ||
#include <string> | ||
|
||
enum class ReadType { kSpanning, kFlanking, kInrepeat, kOther }; | ||
const std::map<ReadType, std::string> kReadTypeToString = { | ||
{ReadType::kInrepeat, "INREPEAT"}, | ||
{ReadType::kSpanning, "SPANNING"}, | ||
{ReadType::kFlanking, "FLANKING"}, | ||
{ReadType::kOther, "OTHER"}}; | ||
|
||
struct Read { | ||
std::string name; | ||
std::string bases; | ||
std::string quals; | ||
}; | ||
|
||
class AlleleSupport { | ||
public: | ||
AlleleSupport() : num_spanning_(0), num_flanking_(0), num_inrepeat_(0) {} | ||
AlleleSupport(int num_spanning, int num_flanking, int num_inrepeat) | ||
: num_spanning_(num_spanning), num_flanking_(num_flanking), | ||
num_inrepeat_(num_inrepeat) {} | ||
|
||
int num_spanning() const { return num_spanning_; } | ||
int num_flanking() const { return num_flanking_; } | ||
int num_inrepeat() const { return num_inrepeat_; } | ||
|
||
void set_num_spanning(int num_spanning) { num_spanning_ = num_spanning; } | ||
void set_num_flanking(int num_flanking) { num_flanking_ = num_flanking; } | ||
void set_num_inrepeat(int num_inrepeat) { num_inrepeat_ = num_inrepeat; } | ||
|
||
std::string ToString() const { | ||
return std::to_string(num_spanning_) + "-" + std::to_string(num_flanking_) + | ||
"-" + std::to_string(num_inrepeat_); | ||
} | ||
|
||
bool operator==(const AlleleSupport &rhs) const { | ||
return num_spanning_ == rhs.num_spanning_ && | ||
num_flanking_ == rhs.num_flanking_ && | ||
num_inrepeat_ == rhs.num_inrepeat_; | ||
} | ||
|
||
private: | ||
int num_spanning_; | ||
int num_flanking_; | ||
int num_inrepeat_; | ||
}; | ||
|
||
struct Interval { | ||
Interval() : lower_bound_(-1), upper_bound_(-1) {} | ||
int lower_bound_; | ||
int upper_bound_; | ||
bool operator==(const Interval &rhs) const { | ||
return lower_bound_ == rhs.lower_bound_ && upper_bound_ == rhs.upper_bound_; | ||
} | ||
std::string ToString() const { | ||
return std::to_string(lower_bound_) + "-" + std::to_string(upper_bound_); | ||
} | ||
}; | ||
|
||
struct RepeatAllele { | ||
RepeatAllele(int size, int num_supporting_reads, ReadType type) | ||
: size_(size), num_supporting_reads_(num_supporting_reads), type_(type) {} | ||
RepeatAllele(int size, ReadType type, AlleleSupport support) | ||
: size_(size), type_(type), num_supporting_reads_(-1), support_(support) {} | ||
bool operator==(const RepeatAllele &rhs) const { | ||
return size_ == rhs.size_ && ci_ == rhs.ci_ && support_ == rhs.support_ && | ||
type_ == rhs.type_ && | ||
num_supporting_reads_ == rhs.num_supporting_reads_; | ||
} | ||
int size_; | ||
Interval ci_; | ||
AlleleSupport support_; // TODO: Rename to "consistent". | ||
int num_supporting_reads_; | ||
ReadType type_; | ||
}; | ||
|
||
typedef std::vector<RepeatAllele> RepeatGenotype; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// | ||
// Expansion Hunter | ||
// Copyright (c) 2016 Illumina, Inc. | ||
// | ||
// Author: Egor Dolzhenko <[email protected]>, | ||
// Mitch Bekritsky <[email protected]>, Richard Shaw | ||
// Concept: Michael Eberle <[email protected]> | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
#pragma once | ||
|
||
#include <iostream> | ||
#include <string> | ||
|
||
class Region { | ||
public: | ||
friend std::istream &operator>>(std::istream &istrm, Region ®ion); | ||
friend std::ostream &operator<<(std::ostream &ostrm, const Region ®ion); | ||
|
||
Region(); | ||
Region(const std::string &chrom, int64_t start, int64_t end, | ||
const std::string &labelStr = std::string()); | ||
Region(const std::string &rangeStr, | ||
const std::string &labelStr = std::string()); | ||
|
||
bool is_set() const { return (chrom_ != "chr0"); } | ||
bool operator<(const Region &other_region) const; | ||
|
||
bool Overlaps(const Region &other_region) const; | ||
|
||
Region Extend(int extension_len) const; | ||
|
||
const std::string &chrom() const { return chrom_; } | ||
const int64_t start() const { return start_; } | ||
const int64_t end() const { return end_; } | ||
const std::string &label() const { return label_; } | ||
|
||
void set_start(int64_t start) { start_ = start; } | ||
void set_end(int64_t end) { end_ = end; } | ||
void set_label(const std::string &label) { label_ = label; } | ||
|
||
const std::string ToString() const; | ||
|
||
private: | ||
std::string chrom_; | ||
int64_t start_; | ||
int64_t end_; | ||
std::string label_; | ||
}; | ||
|
||
std::istream &operator>>(std::istream &istrm, Region ®ion); | ||
std::ostream &operator<<(std::ostream &ostrm, const Region ®ion); |
Oops, something went wrong.