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

Properly paired tag #36

Merged
merged 3 commits into from
Mar 4, 2021
Merged
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
14 changes: 14 additions & 0 deletions src/alignment_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,14 @@ gafkluge::GafRecord alignment_to_gaf(function<size_t(nid_t)> node_to_length, fun
gaf.opt_fields["fp"] = make_pair("Z", aln.fragment_prev().name());
}
}

if (aln.has_annotation()) {
auto& annotation = aln.annotation();
if (annotation.fields().count("proper_pair")) {
bool is_properly_paired = (annotation.fields().at("proper_pair")).bool_value();
gaf.opt_fields["pd"] = make_pair("b", is_properly_paired ? "1" : "0");
}
}
}

return gaf;
Expand Down Expand Up @@ -515,6 +523,12 @@ void gaf_to_alignment(function<size_t(nid_t)> node_to_length, function<string(ni
} else if (opt_it.first == "fn") {
// get the fragment_next field
aln.mutable_fragment_next()->set_name(opt_it.second.second);
} else if (opt_it.first == "pd") {
//Is this read properly paired
auto* annotation = aln.mutable_annotation();
google::protobuf::Value is_properly_paired;
is_properly_paired.set_bool_value(opt_it.second.second == "1");
(*annotation->mutable_fields())["proper_pair"] = is_properly_paired;
}
}
}
Expand Down