Skip to content

Commit

Permalink
update storage type for tag slices
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Patro committed Oct 9, 2020
1 parent 19d66ca commit e01a7c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
9 changes: 5 additions & 4 deletions include/SingleCellProtocols.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@

#include "AlevinOpts.hpp"
#include "AlevinTypes.hpp"
#include "pufferfish/chobo/small_vector.hpp"
#include "pufferfish/chobo/static_vector.hpp"

namespace alevin{
namespace protocols {

static constexpr size_t num_tag_pieces{16};
struct TagGeometry {
uint32_t read_num{0};
std::vector<std::pair<uint32_t, uint32_t>> substr_locs{};
chobo::static_vector<std::pair<uint32_t, uint32_t>, num_tag_pieces> substr_locs{};
// chobo::static_vector<std::pair<uint32_t,uint8_t>, 16> bc_locs;
// std::vector<std::pair<uint32_t, uint32_t>> substr_locs{};
uint32_t length{0};
uint32_t largest_index{0};

Expand Down Expand Up @@ -119,8 +122,6 @@ namespace alevin{
// vector of offset, length pairs
TagGeometry umi_geo;
TagGeometry bc_geo;
//chobo::static_vector<std::pair<uint32_t,uint8_t>, 16> umi_locs;
//chobo::static_vector<std::pair<uint32_t,uint8_t>, 16> bc_locs;

void set_umi_geo(TagGeometry& g) { umi_geo = g; umiLength = umi_geo.length; };
void set_bc_geo(TagGeometry& g) { bc_geo = g; barcodeLength = bc_geo.length; };
Expand Down
13 changes: 10 additions & 3 deletions src/AlevinUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,9 @@ namespace alevin {
d.clear();
if ( parser.parse(geo_string.c_str()) ) {
if (d.size() > 1) {
//aopt.jointLog->error("Though supported in the syntax, the current implementation \n"
// "of custom tag geometry does not support having a tag \n"
// "split over more than one read.");
log->error("Though supported in the syntax, the current implementation \n"
"of custom tag geometry does not support having a tag \n"
"split over more than one read.");
return false;
}

Expand All @@ -545,6 +545,13 @@ namespace alevin {
if (stop < start) { return false; }
int len = (stop - start) + 1;
tlen += len;
if (tg.substr_locs.size() >= alevin::protocols::num_tag_pieces) {
log->error("Currently, alevin does not support the tag (barcode / umi) being "
"split into more than {} pieces. If the current bound is a "
"problem for your protocol, please reach out on GitHub.",
alevin::protocols::num_tag_pieces);
return false;
}
tg.substr_locs.push_back(std::make_pair(static_cast<uint32_t>(start), static_cast<uint32_t>(len)));
}
tg.length = tlen;
Expand Down

0 comments on commit e01a7c2

Please sign in to comment.