src/c++/lib/common/Fragment.cpp
/**
 * Extract fragments from reads
 * @param coordinates graph coordinates structure for length calculation
 * @param reads read buffer
 * @param output_list output list for fragments
 */
Extract fragments from reads
@param coordinates graph coordinates structure for length calculation
@param reads read buffer
@param output_list output list for fragments
Extract fragments from reads @param coordinates graph coordinates structure for length calculation @param reads read buffer @param output_list output list for fragments
void readsToFragments(
    graphtools::GraphCoordinates const& coordinates, common::ReadBuffer const& reads,
    std::list<std::unique_ptr<Fragment>>& output_list)
{
    std::unordered_map<std::string, Fragment*> fragment_map;
    for (auto& read : reads)
    {
        const std::string fragment_id = read->fragment_id();
        auto frag_it = fragment_map.find(fragment_id);
        if (frag_it == fragment_map.end())
        {
            auto fragment = output_list.emplace(output_list.end(), new Fragment());
            frag_it = fragment_map.insert(std::make_pair(fragment_id, fragment->get())).first;
        }
        frag_it->second->addRead(coordinates, *read);
    }
}
void readsToFragments ( graphtools :: GraphCoordinates const & coordinates , common :: ReadBuffer const & reads , std :: list < std :: unique_ptr < Fragment > > & output_list ) { std :: unordered_map < std :: string , Fragment * > fragment_map ; for ( auto & read : reads ) { const std :: string fragment_id = read -> fragment_id ( ) ; auto frag_it = fragment_map . find ( fragment_id ) ; if ( frag_it == fragment_map . end ( ) ) { auto fragment = output_list . emplace ( output_list . end ( ) , new Fragment ( ) ) ; frag_it = fragment_map . insert ( std :: make_pair ( fragment_id , fragment -> get ( ) ) ) . first ; } frag_it -> second -> addRead ( coordinates , * read ) ; } }
Extract fragments from reads
 @param coordinates graph coordinates structure for length calculation
 @param reads read buffer
 @param output_list output list for fragments
Extract fragments from reads @param coordinates graph coordinates structure for length calculation @param reads read buffer @param output_list output list for fragments