diff --git a/DESCRIPTION b/DESCRIPTION index a9ab663..926e07e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: cytolib Type: Package Title: C++ infrastructure for representing and interacting with the gated cytometry data -Version: 2.1.18 +Version: 2.1.19 Date: 2017-08-07 Author: Mike Jiang Maintainer: Mike Jiang , Jake Wagner diff --git a/inst/include/cytolib/MemCytoFrame.hpp b/inst/include/cytolib/MemCytoFrame.hpp index b1414d6..e61de40 100644 --- a/inst/include/cytolib/MemCytoFrame.hpp +++ b/inst/include/cytolib/MemCytoFrame.hpp @@ -10,6 +10,7 @@ #ifndef INST_INCLUDE_CYTOLIB_MEMCYTOFRAME_HPP_ #define INST_INCLUDE_CYTOLIB_MEMCYTOFRAME_HPP_ #include "CytoFrame.hpp" +#include "trans_group.hpp" #include "readFCSdata.hpp" namespace cytolib @@ -186,6 +187,7 @@ class MemCytoFrame: public CytoFrame{ void append_data_columns(const EVENT_DATA_VEC & new_cols); + void transform_data(const trans_local & trans); }; diff --git a/src/GatingHierarchy.cpp b/src/GatingHierarchy.cpp index 7f1a9e3..41a5f76 100644 --- a/src/GatingHierarchy.cpp +++ b/src/GatingHierarchy.cpp @@ -173,7 +173,7 @@ namespace cytolib curTrans->transforming(¶m_range.second, 1); } - + cytoframe.set_keyword("transformation", "custom"); cytoframe.set_range(curChannel, ColType::channel, param_range); } diff --git a/src/MemCytoFrame.cpp b/src/MemCytoFrame.cpp index 507747e..493ec4a 100644 --- a/src/MemCytoFrame.cpp +++ b/src/MemCytoFrame.cpp @@ -937,6 +937,9 @@ namespace cytolib else params[i-1].max = boost::lexical_cast(it->second); + if(range_str == "flowCore_$P" + pid + "Rmax") + params[i-1].max += 1; + params[i-1].PnB = stoi(keys_["$P" + pid + "B"]); @@ -1061,6 +1064,45 @@ namespace cytolib return data_.colptr(idx); } + void MemCytoFrame::transform_data(const trans_local & trans) { + if(g_loglevel>=GATING_HIERARCHY_LEVEL) + PRINT("start transforming cytoframe data \n"); + if(n_rows()==0) + throw(domain_error("data is not loaded yet!")); + + vector channels=get_channels(); + int nEvents = n_rows(); + /* + * transforming each marker + */ + for(vector::iterator it1=channels.begin();it1!=channels.end();it1++) + { + + string curChannel=*it1; + auto param_range = get_range(curChannel, ColType::channel, RangeType::instrument); + TransPtr curTrans=trans.getTran(curChannel); + + if(curTrans) + { + if(curTrans->gateOnly()) + continue; + + EVENT_DATA_TYPE * x = get_data_memptr(curChannel, ColType::channel); + if(g_loglevel>=GATING_HIERARCHY_LEVEL) + { + string type; + curTrans->getType(type); + PRINT("transforming "+curChannel+" with func:"+type+"\n"); + } + curTrans->transforming(x,nEvents); + curTrans->transforming(¶m_range.first, 1); + curTrans->transforming(¶m_range.second, 1); + } + + set_keyword("transformation", "custom"); + set_range(curChannel, ColType::channel, param_range); + } + } };