1 /* $Id: best_placement.hpp 593765 2019-09-24 16:30:55Z ucko $ 2 * =========================================================================== 3 * 4 * PUBLIC DOMAIN NOTICE 5 * National Center for Biotechnology Information 6 * 7 * This software/database is a "United States Government Work" under the 8 * terms of the United States Copyright Act. It was written as part of 9 * the author's official duties as a United States Government employee and 10 * thus cannot be copyrighted. This software/database is freely available 11 * to the public for use. The National Library of Medicine and the U.S. 12 * Government have not placed any restriction on its use or reproduction. 13 * 14 * Although all reasonable efforts have been taken to ensure the accuracy 15 * and reliability of the software and data, the NLM and the U.S. 16 * Government do not and cannot warrant the performance or results that 17 * may be obtained by using this software or data. The NLM and the U.S. 18 * Government disclaim all warranties, express or implied, including 19 * warranties of performance, merchantability or fitness for any particular 20 * purpose. 21 * 22 * Please cite the author in any work or product based on this material. 23 * 24 * =========================================================================== 25 * 26 * Authors: Alex Astashyn 27 * 28 * File Description: 29 * 30 */ 31 32 #pragma once 33 #include <objects/seqalign/Seq_align_set.hpp> 34 #include <objects/seqalign/Seq_align.hpp> 35 36 #include <functional> 37 38 BEGIN_NCBI_SCOPE 39 40 class NCBI_XALGOALIGN_EXPORT NBestPlacement 41 { 42 public: 43 NBestPlacement() = delete; 44 ~NBestPlacement() = delete; 45 46 using score_fn_t = std::function<int(const objects::CSeq_align&)>; 47 48 /// Adds the following scores: 49 /// `best_placement_score` as computed by score_fn 50 /// `rank` - all top scoring alignments will have rank=1 51 /// `rank1_index`, `rank1_count` if more than one top-scoring alignment. 52 /// 53 /// Input seq-align-set shall contain alignments for the same query 54 static void Rank( 55 objects::CSeq_align_set& sas, 56 score_fn_t score_fn = &NBestPlacement::GetScore); 57 58 static int GetScore(const objects::CSeq_align& aln); 59 }; 60 61 END_NCBI_SCOPE 62