1 /*  seg.h
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  * File Name:  seg.h
27  *
28  * Author:  Scott Federhen
29  *
30  * Version Creation Date: 4/24/98
31  *
32  * $Revision: 6.8 $
33  *
34  * File Description:  low-complexity filter 'seg'
35  *
36  * Modifications:
37  * --------------------------------------------------------------------------
38  * Date     Name        Description of modification
39  * -------  ----------  -----------------------------------------------------
40  *
41  *
42  * ==========================================================================
43  */
44 
45 #ifndef __SEGSTR__
46 #define __SEGSTR__
47 
48 #include <stdio.h>
49 #include <fcntl.h>
50 #include <ctype.h>
51 #include <math.h>
52 
53 #include <ncbierr.h>
54 #include <ncbibs.h>
55 #include <sequtil.h>
56 #include <seqport.h>
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 
63 /*-----------------------------------------------------(alphabet defines)---*/
64 
65 #define NA4     1
66 #define AA20    2
67 
68 #define LN20    2.9957322735539909
69 #define LN4     1.3862943611198906
70 
71 #define CHAR_SET 128
72 
73 /*--------------------------------------------------------------(structs)---*/
74 
75 typedef struct segm
76   {
77    int begin;
78    int end;
79    struct segm *next;
80   } Seg, PNTR SegPtr;
81 
82 typedef struct alpha
83   {
84    Int4 alphabet;
85    Int4 alphasize;
86    FloatHi lnalphasize;
87    Int4Ptr alphaindex;
88    BytePtr alphaflag;
89    CharPtr alphachar;
90   } Alpha, PNTR AlphaPtr;
91 
92 typedef struct segparams
93   {
94    Int4 window;
95    FloatHi locut;
96    FloatHi hicut;
97    Int4 period;
98    Int4 hilenmin;
99    Boolean overlaps;	/* merge overlapping pieces if TRUE. */
100    Int4 maxtrim;
101    Int4 maxbogus;
102    AlphaPtr palpha;
103   } SegParams, PNTR SegParamsPtr;
104 
105 typedef struct sequence
106   {
107    struct sequence PNTR parent;
108    CharPtr seq;
109    AlphaPtr palpha;
110    Int4 start;
111    Int4 length;
112    Int4 bogus;
113    Boolean punctuation;
114    Int4 PNTR composition;
115    Int4 PNTR state;
116    FloatHi entropy;
117   } Sequence, PNTR SequencePtr;
118 
119 /*---------------------------------------------------------------(protos)---*/
120 
121 SeqLocPtr BioseqSeg (BioseqPtr bsp, SegParamsPtr sparamsp);
122 SeqLocPtr BioseqSegNa (BioseqPtr bsp, SegParamsPtr sparamsp);
123 SeqLocPtr BioseqSegAa (BioseqPtr bsp, SegParamsPtr sparamsp);
124 SeqLocPtr SeqlocSegNa (SeqLocPtr slp, SegParamsPtr sparamsp);
125 SeqLocPtr SeqlocSegAa (SeqLocPtr slp, SegParamsPtr sparamsp);
126 SegParamsPtr SegParamsNewAa(void);
127 SegParamsPtr SegParamsNewNa(void);
128 void SegParamsCheck (SegParamsPtr sparamsp);
129 
130 void SegSeq(SequencePtr seq, SegParamsPtr sparamsp, SegPtr *segs,
131             Int4 offset);
132 SequencePtr SeqNew(void);
133 void SeqFree(SequencePtr seq);
134 void SegFree(SegPtr segs);
135 
136 void SegParamsFree(SegParamsPtr sparamsp);
137 
138 extern void lower(CharPtr string, size_t len);
139 extern void upper(CharPtr string, size_t len);
140 
141 /*--------------------------------------------------------------------------*/
142 
143 #ifdef __cplusplus
144 }
145 #endif
146 #endif
147