Skip to content

Commit

Permalink
use ints instead of strings to index read group count tables
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrapnell committed May 6, 2014
1 parent 893420e commit 7cdf107
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/bundles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2053,8 +2053,13 @@ bool PrecomputedExpressionBundleFactory::next_bundle(HitBundle& bundle, bool cac
boost::shared_ptr<const AbundanceGroup> ab = _hit_fac->next_locus(bundle.id(), cache_bundle);
if (ab)
{
double compatible_mass = _hit_fac->get_compat_mass(bundle.id());
double total_mass = _hit_fac->get_total_mass(bundle.id());

/*
double compatible_mass = _hit_fac->get_compat_mass(bundle_label_buf);
double total_mass = _hit_fac->get_total_mass(bundle_label_buf);
*/

bundle.finalize();
bundle.add_raw_mass(total_mass);
Expand Down
8 changes: 6 additions & 2 deletions src/hits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1128,14 +1128,18 @@ void PrecomputedExpressionHitFactory::load_count_tables(const string& expression
// populate the cached count tables so we can make convincing fake bundles later on.
ReadGroupProperties rg_props = **(ab->rg_props().begin());

int i = 0;
BOOST_FOREACH(const LocusCount& c, rg_props.raw_compatible_counts())
{
compat_mass[c.locus_desc] = c.count;
compat_mass[i++] = c.count;
//compat_mass[c.locus_desc] = c.count;
}

i = 0;
BOOST_FOREACH(const LocusCount& c, rg_props.raw_total_counts())
{
total_mass[c.locus_desc] = c.count;
total_mass[i++] = c.count;
//total_mass[c.locus_desc] = c.count;
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/hits.h
Original file line number Diff line number Diff line change
Expand Up @@ -888,9 +888,9 @@ class PrecomputedExpressionHitFactory : public HitFactory
boost::shared_ptr<const AbundanceGroup> get_abundance_for_locus(int locus_id);
void clear_abundance_for_locus(int locus_id);

double get_compat_mass(const string& locus_id)
double get_compat_mass(int locus_id)
{
map<string, double >::iterator i = compat_mass.find(locus_id);
map<int, double >::iterator i = compat_mass.find(locus_id);
if (i != compat_mass.end())
{
return i->second;
Expand All @@ -901,9 +901,9 @@ class PrecomputedExpressionHitFactory : public HitFactory
}
}

double get_total_mass(const string& locus_id)
double get_total_mass(int locus_id)
{
map<string, double >::iterator i = total_mass.find(locus_id);
map<int, double >::iterator i = total_mass.find(locus_id);
if (i != total_mass.end())
{
return i->second;
Expand All @@ -927,8 +927,8 @@ class PrecomputedExpressionHitFactory : public HitFactory
std::ifstream _ifs;
string _expression_file_name;
boost::shared_ptr<boost::archive::binary_iarchive> _ia;
map<string, double> compat_mass;
map<string, double> total_mass;
map<int, double> compat_mass;
map<int, double> total_mass;
map<int, boost::shared_ptr<const AbundanceGroup> > _curr_ab_groups;


Expand Down

0 comments on commit 7cdf107

Please sign in to comment.