1 #ifndef ALGO_SEQ__CONSENSUS_SPLICE__HPP
2 #define ALGO_SEQ__CONSENSUS_SPLICE__HPP
3 
4 /*  $Id: consensus_splice.hpp 405345 2013-07-02 18:56:07Z astashya $
5  * ===========================================================================
6  *
7  *                            PUBLIC DOMAIN NOTICE
8  *               National Center for Biotechnology Information
9  *
10  *  This software/database is a "United States Government Work" under the
11  *  terms of the United States Copyright Act.  It was written as part of
12  *  the author's official duties as a United States Government employee and
13  *  thus cannot be copyrighted.  This software/database is freely available
14  *  to the public for use. The National Library of Medicine and the U.S.
15  *  Government have not placed any restriction on its use or reproduction.
16  *
17  *  Although all reasonable efforts have been taken to ensure the accuracy
18  *  and reliability of the software and data, the NLM and the U.S.
19  *  Government do not and cannot warrant the performance or results that
20  *  may be obtained by using this software or data. The NLM and the U.S.
21  *  Government disclaim all warranties, express or implied, including
22  *  warranties of performance, merchantability or fitness for any particular
23  *  purpose.
24  *
25  *  Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors:  Josh Cherry
30  *
31  * File Description: Simple functions for determining whether a pair of
32  *    dinucleotides form a consensus splice sequence
33  *
34  */
35 
36 #include <corelib/ncbistd.hpp>
37 
38 BEGIN_NCBI_SCOPE
39 
40 
41 /// Consensus splice is GY..AG or AT..AC
IsConsensusSplice(const string & splice5,const string & splice3)42 inline bool IsConsensusSplice(const string& splice5,
43                               const string& splice3)
44 {
45     return (NStr::EqualNocase(splice3, "AG") &&
46             (NStr::EqualNocase(splice5, "GT") ||
47              NStr::EqualNocase(splice5, "GC")))  ||
48            (NStr::EqualNocase(splice5, "AT") &&
49             NStr::EqualNocase(splice3, "AC"));
50 }
51 
52 
53 /// Strict consensus splice is GT..AG
IsStrictConsensusSplice(const string & splice5,const string & splice3)54 inline bool IsStrictConsensusSplice(const string& splice5,
55                                     const string& splice3)
56 {
57     return NStr::EqualNocase(splice5, "GT")  &&
58            NStr::EqualNocase(splice3, "AG");
59 }
60 
61 /// GT-{TG,GG,AT,AA} or {GA,TT,AT,GG}-AG or AT-{AT,AA}
IsKnownNonConsensusSplice(const string & splice5,const string & splice3)62 inline bool IsKnownNonConsensusSplice(const string& splice5,
63                                       const string& splice3)
64 {
65     return (splice5.size() == 2 && NStr::FindNoCase("GA TT AT GG", splice5) != NPOS && NStr::EqualNocase(splice3, "AG"))
66         || (NStr::EqualNocase(splice5, "GT") && splice3.size() == 2 && NStr::FindNoCase("TG GG AT AA", splice3) != NPOS)
67         || (NStr::EqualNocase(splice5, "AT") && splice3.size() == 2 && NStr::FindNoCase("AT AA", splice3) != NPOS) ;
68 }
69 
70 END_NCBI_SCOPE
71 
72 #endif  // ALGO_SEQ__CONSENSUS_SPLICE__HPP
73