Mercurial > repos > chrisd > testshed
view snp_caller/src/FastaRecord.cpp @ 0:0fd352f62446 draft default tip
planemo upload for repository https://github.com/ChrisD11/Duplicon commit 3ee0594c692faac542ffa58f4339d79b9b8aefbd-dirty
author | chrisd |
---|---|
date | Sun, 21 Feb 2016 06:05:24 -0500 |
parents | |
children |
line wrap: on
line source
#include <algorithm> #include "FastaRecord.h" FastaRecord::FastaRecord(std::string gene_id, std::string gene) : _gene_id(gene_id), _gene(gene) {} int FastaRecord::find_gene(const std::vector<FastaRecord> & records, const std::string &gene_id, const std::string seq) { int gene_index; std::vector<FastaRecord>::const_iterator low; low = std::lower_bound(records.begin(), records.end(), FastaRecord(gene_id, seq), [](const FastaRecord &a, const FastaRecord &b) { return a.gene_id() < b.gene_id(); }); gene_index = (low - records.begin()); return gene_index; } void FastaRecord::sort_by_gene_id(std::vector<FastaRecord> &records) { sort(records.begin(), records.end(), [](const FastaRecord &a, const FastaRecord &b) { return a.gene_id() < b.gene_id(); }); }