Skip to content

Commit

Permalink
Fix lib_format_counts.json
Browse files Browse the repository at this point in the history
Don't write any entries for format encodings that
don't correspond to a valid library type (e.g.
single end with SF, SR, etc.).  There are only 12
possible valid library types, and there should
be only 12 entires corresponding to counts:

U
SF
SR
IU
OU
MU
ISR
OSR
MSR
ISF
OSF
MSF

This commit fixes #82.

Note: We should write out lib_format_counts.json in
alignment-based mode.
  • Loading branch information
rob-p committed Aug 31, 2016
1 parent fd4a3c6 commit a944f7d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
21 changes: 8 additions & 13 deletions include/LibraryFormat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,17 @@ class LibraryFormat {
if (type == ReadType::SINGLE_END) {
if (orientation != ReadOrientation::NONE) {
return desc;
} else if (strandedness == ReadStrandedness::SA or
strandedness == ReadStrandedness::AS ) {
return desc;
}
}
if (type == ReadType::PAIRED_END) {
if (orientation == ReadOrientation::NONE) {
return desc;
} else if (strandedness == ReadStrandedness::S or
strandedness == ReadStrandedness::A ) {
return desc;
}
}

Expand Down Expand Up @@ -131,26 +137,15 @@ class LibraryFormat {
desc += "SR";
break;
case ReadStrandedness::S:
desc += "F";
desc += "SF";
break;
case ReadStrandedness::A:
desc += "R";
desc += "SR";
break;
case ReadStrandedness::U:
desc += "U";
break;
}
/*
if (type == ReadType::PAIRED_END) {
if (desc == "SF" or
desc == "SR" or
desc == "F" or
desc == "R" or
desc == "U" ) {
desc.clear();
}
}
*/
return desc;
}

Expand Down
7 changes: 7 additions & 0 deletions include/ReadExperiment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,13 +600,20 @@ class ReadExperiment {
}

//ofile << "---- counts for each format type ---\n";
//std::unordered_map<std::string, uint64_t> descMap;
for (size_t i = 0; i < counts.size(); ++i) {
//ofile << LibraryFormat::formatFromID(i) << " : " << counts[i] << "\n";
std::string desc = LibraryFormat::formatFromID(i).toString();
if (!desc.empty()) {
oa(cereal::make_nvp(desc, counts[i].load()));
//descMap[desc] += counts[i].load();
}
}
/*
for (auto& kv : descMap) {
oa(cereal::make_nvp(kv.first, kv.second));
}
*/
//ofile << "------------------------------------\n\n";
}
//ofile.close();
Expand Down

0 comments on commit a944f7d

Please sign in to comment.