1 /*===========================================================================
2 *
3 *                            PUBLIC DOMAIN NOTICE
4 *               National Center for Biotechnology Information
5 *
6 *  This software/database is a "United States Government Work" under the
7 *  terms of the United States Copyright Act.  It was written as part of
8 *  the author's official duties as a United States Government employee and
9 *  thus cannot be copyrighted.  This software/database is freely available
10 *  to the public for use. The National Library of Medicine and the U.S.
11 *  Government have not placed any restriction on its use or reproduction.
12 *
13 *  Although all reasonable efforts have been taken to ensure the accuracy
14 *  and reliability of the software and data, the NLM and the U.S.
15 *  Government do not and cannot warrant the performance or results that
16 *  may be obtained by using this software or data. The NLM and the U.S.
17 *  Government disclaim all warranties, express or implied, including
18 *  warranties of performance, merchantability or fitness for any particular
19 *  purpose.
20 *
21 *  Please cite the author in any work or product based on this material.
22 *
23 * ===========================================================================
24 *
25 */
26 
27 #ifndef _sra_tools_hpp_ngs_pileup_
28 #define _sra_tools_hpp_ngs_pileup_
29 
30 #include <klib/defs.h>
31 
32 #include <string>
33 #include <vector>
34 
35 namespace ngs
36 {
37     class Reference;
38 }
39 
40 class NGS_Pileup
41 {
42 public:
43     struct Settings
44     {
45         struct ReferenceSlice
46         {
ReferenceSliceNGS_Pileup::Settings::ReferenceSlice47             ReferenceSlice( const std::string& p_name ) /* entire reference */
48             :   m_name ( p_name ),
49                 m_firstPos ( 0 ),
50                 m_lastPos ( 0 ),
51                 m_full ( true )
52             {
53             }
ReferenceSliceNGS_Pileup::Settings::ReferenceSlice54             ReferenceSlice( const std::string& p_name,
55                             int64_t p_firstPos,
56                             int64_t p_lastPos )
57             :   m_name ( p_name ),
58                 m_firstPos ( p_firstPos ),
59                 m_lastPos ( p_lastPos ),
60                 m_full ( false )
61             {
62             }
63 
64             std::string m_name;
65             int64_t     m_firstPos;
66             int64_t     m_lastPos;
67             bool        m_full;
68         };
69 
AddInputNGS_Pileup::Settings70         void AddInput ( const std::string& accession ) { inputs . push_back ( accession ); }
71         void AddReference ( const std::string& commonOrCanonicalName );
72         void AddReferenceSlice ( const std::string& commonOrCanonicalName,
73                                  int64_t firstPos,
74                                  int64_t lastPos );
75 
76 
77         typedef std::vector < std::string > Inputs;
78         typedef std::vector < ReferenceSlice > References;
79 
80         Inputs inputs;
81         std::ostream* output;
82         References references;
83     };
84 
85 public:
86     NGS_Pileup ( const Settings& p_settings );
87 
88     void Run () const;
89 
90 private:
91     struct TargetReference;
92     class TargetReferences;
93 
94     Settings            m_settings;
95 };
96 
97 #endif
98