Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Old interval tree #23

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ scriptToBin: $(BINS)

GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always)

CXXFLAGS = -O3 -D_FILE_OFFSET_BITS=64 -std=c++0x
CXXFLAGS = -O3 -D_FILE_OFFSET_BITS=64 -std=c++11 -ggdb
#CXXFLAGS = -O2
#CXXFLAGS = -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual

Expand Down
2 changes: 1 addition & 1 deletion intervaltree
13 changes: 7 additions & 6 deletions src/Variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ bool Variant::canonicalizable(){

if (svtype.empty()){
// We have no SV type, so we can't interpret things.
cerr << "No SV type information. Variant cannot be canonicalized: " << *this << endl;
return false;
}

Expand Down Expand Up @@ -388,10 +389,10 @@ bool Variant::canonicalize(FastaReference& fasta_reference, vector<FastaReferenc
bool has_end = this->info.count("END") && !this->info.at("END").empty();

// Where is the end, or where should it be?
long info_end = 0;
int64_t info_end = 0;
if (has_end) {
// Get the END from the tag
info_end = stol(this->info.at("END")[0]);
info_end = stoull(this->info.at("END")[0]);
}
else if(ref_valid && !place_seq) {
// Get the END from the reference sequence, which is ready.
Expand Down Expand Up @@ -421,13 +422,13 @@ bool Variant::canonicalize(FastaReference& fasta_reference, vector<FastaReferenc

// What is the variant length change?
// We store it as absolute value
long info_len = 0;
int64_t info_len = 0;
if (has_len){
// Get the SVLEN from the tag
info_len = abs(stol(this->info.at("SVLEN")[0]));
info_len = abs(stoll(this->info.at("SVLEN")[0]));
}
else if ((svtype == "INS" || svtype == "DEL") && has_span){
info_len = abs(stol(this->info.at("SPAN")[0]));
info_len = abs(stoll(this->info.at("SPAN")[0]));
}
else if (svtype == "DEL"){
// We always have the end by now
Expand Down Expand Up @@ -462,7 +463,7 @@ bool Variant::canonicalize(FastaReference& fasta_reference, vector<FastaReferenc
has_len = true;

// We also compute a span
long info_span = 0;
int64_t info_span = 0;
if (has_span){
// Use the specified span
info_span = abs(stol(this->info.at("SVLEN")[0]));
Expand Down
5 changes: 4 additions & 1 deletion src/vcfnormalizesvs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ int main(int argc, char** argv) {

Variant var;
while (variantFile.getNextVariant(var)) {
bool valid = var.canonicalize(ref, insertions, replace_sequences, min_size);
bool valid = false;
if (var.canonicalizable()){
valid = var.canonicalize(ref, insertions, replace_sequences, min_size);
}
if (!valid){
cerr << "Variant could not be normalized" << var << endl;
}
Expand Down