#include "ISNode.hh" void ISNode::detectARNodeIDs(){ detectARNodeIDs5(); detectARNodeIDs3(); } void ISNode::detectARNodeIDs5(){ map nodeID2flag; for( uint i=0 ; igetLastNodeID(); nodeID2flag.insert( map::value_type(nodeID, true) ); } for( map::const_iterator it=nodeID2flag.begin() ; it!=nodeID2flag.end() ; ++it ){ IDnum nodeID = it->first; arNodeIDs5.push_back( nodeID ); } } void ISNode::detectARNodeIDs3(){ map nodeID2flag; for( uint i=0 ; igetLastNodeID(); nodeID2flag.insert( map::value_type(nodeID, true) ); } for( map::const_iterator it=nodeID2flag.begin() ; it!=nodeID2flag.end() ; ++it ){ IDnum nodeID = it->first; arNodeIDs3.push_back( nodeID ); } } string ISNode::getARNodeColumn5() const { string col; for( uint i=0 ; i ISNodeIO::load( const string& filename ){ ifstream ifs; Utils::fileopen( ifs, filename, "[ISNodeIO] " ); return load(ifs); } vector ISNodeIO::load( ifstream& ifs ){ vector isNodes; string line; while( getline(ifs, line) ) if( isValidLine(line) ) isNodes.push_back( parseLine(line) ); ifs.close(); return isNodes; } bool ISNodeIO::isValidLine( const string& line ){ return ( Utils::split(line, IS_NODE_IO_DELIMITER).size() == IS_NODE_IO_NUM_COLUMNS ); } ISNode* ISNodeIO::parseLine( const string& line ){ vector cols = Utils::split( line, IS_NODE_IO_DELIMITER ); IDnum id = atoi( cols.at(0).c_str() ); string name = cols.at(1); long offset5 = atoi( cols.at(2).c_str() ); long expand5 = atoi( cols.at(3).c_str() ); long offset3 = atoi( cols.at(4).c_str() ); long expand3 = atoi( cols.at(5).c_str() ); long length = atoi( cols.at(6).c_str() ); return new ISNode( id, name, offset5, expand5, offset3, expand3, length ); } void ISNodeIO::saveARNodes( const string& filename, const vector& isNodes ){ ofstream ofs; Utils::fileopen( ofs, filename, "[ISNodeIO] " ); return saveARNodes( ofs, isNodes ); } void ISNodeIO::saveARNodes( ofstream& ofs, const vector& isNodes ){ for( uint i=0 ; igetNodeID() << "\t" << isNode->getISName() << "\t" << isNode->getARNodeColumn5() << "\t" << isNode->getARNodeColumn3() << endl; } }