1 /* $Id: splice.h 222797 2020-06-03 21:05:08Z twu $ */
2 #ifndef SPLICE_INCLUDED
3 #define SPLICE_INCLUDED
4 
5 #include "bool.h"
6 #include "types.h"	/* For Splicetype_T */
7 #include "list.h"
8 #include "method.h"
9 #include "chrnum.h"
10 #include "genomicpos.h"
11 #include "compress.h"
12 #include "genome.h"
13 
14 
15 typedef struct Spliceinfo_T *Spliceinfo_T;
16 struct Spliceinfo_T {
17   int *int_memory;
18 
19   int *donor_positions_alloc;
20   int *donor_knowni_alloc;
21   int *acceptor_positions_alloc;
22   int *acceptor_knowni_alloc;
23 
24   int *segmenti_donor_knownpos;
25   int *segmentj_acceptor_knownpos;
26   int *segmentj_antidonor_knownpos;
27   int *segmenti_antiacceptor_knownpos;
28 
29   int *segmenti_donor_knowni;
30   int *segmentj_acceptor_knowni;
31   int *segmentj_antidonor_knowni;
32   int *segmenti_antiacceptor_knowni;
33 
34   int segmenti_donor_nknown;
35   int segmentj_acceptor_nknown;
36   int segmentj_antidonor_nknown;
37   int segmenti_antiacceptor_nknown;
38 
39   double *double_memory;
40 
41   double *donor_probs_alloc;
42   double *acceptor_probs_alloc;
43 };
44 
45 
46 extern void
47 Splice_setup (Genome_T genomebits_in, Genome_T genomebits_alt_in, int min_shortend_in);
48 
49 extern void
50 Spliceinfo_free (Spliceinfo_T *old);
51 
52 extern Spliceinfo_T
53 Spliceinfo_new (int querylength);
54 
55 extern int
56 Splice_resolve_sense (int *best_nindels, int *best_indel_pos, int *best_knowni_i, int *best_knowni_j,
57 		      int *best_nmismatches_i, int *best_nmismatches_j, int *best_nmismatches_indel,
58 		      int *best_ref_nmismatches_i, int *best_ref_nmismatches_j,
59 		      int *best_ref_nmismatches_indel, double *best_prob_i, double *best_prob_j,
60 
61 		      Univcoord_T segmenti_left, Univcoord_T segmentj_left,
62 		      Univcoord_T segmenti_chroffset, Univcoord_T segmentj_chroffset,
63 
64 		      int pos5, int pos3, int querylength, Compress_T query_compress,
65 		      Spliceinfo_T spliceinfo, int max_mismatches_allowed,
66 		      bool plusp, int genestrand, int max_deletionlen, int max_insertionlen,
67 		      bool allow_indel_p);
68 
69 extern int
70 Splice_resolve_antisense (int *best_nindels, int *best_indel_pos, int *best_knowni_i, int *best_knowni_j,
71 			  int *best_nmismatches_i, int *best_nmismatches_j, int *best_nmismatches_indel,
72 			  int *best_ref_nmismatches_i, int *best_ref_nmismatches_j,
73 			  int *best_ref_nmismatches_indel, double *best_prob_i, double *best_prob_j,
74 
75 			  Univcoord_T segmenti_left, Univcoord_T segmentj_left,
76 			  Univcoord_T segmenti_chroffset, Univcoord_T segmentj_chroffset,
77 
78 			  int pos5, int pos3, int querylength, Compress_T query_compress,
79 			  Spliceinfo_T spliceinfo, int max_mismatches_allowed,
80 			  bool plusp, int genestrand, int max_deletionlen, int max_insertionlen,
81 			  bool allow_indel_p);
82 
83 extern int
84 Splice_resolve_distant (int *best_nmismatches_i, int *best_nmismatches_j,
85 			double *best_prob_i, double *best_prob_j, int *sensedir_distant_guess,
86 
87 			int *mismatch_positions_i, int segmenti_nmismatches,
88 			int *mismatch_positions_j, int segmentj_nmismatches,
89 
90 			Univcoord_T segmenti_left, Univcoord_T segmentj_left,
91 			Univcoord_T segmenti_chroffset, Univcoord_T segmentj_chroffset,
92 
93 			int pos5, int pos3, int splice_pos_start, int splice_pos_end, int querylength,
94 			bool plusp_i, bool plusp_j);
95 
96 extern int
97 Splice_trim_novel_spliceends_5 (Splicetype_T *splicetype, int **ambig_qends, double **ambig_probs_3,
98 				Univcoord_T left, int qstart, int qend,
99 				int *mismatch_positions, int nmismatches,
100 				Univcoord_T chroffset, double end_splicesite_prob_match,
101 				int max_nconsecutive, bool plusp, int sensedir);
102 
103 extern int
104 Splice_trim_novel_spliceends_3 (Splicetype_T *splicetype, int **ambig_qends, double **ambig_probs_3,
105 				Univcoord_T left, int qstart, int qend, int querylength,
106 				int *mismatch_positions, int nmismatches,
107 				Univcoord_T chroffset, double end_splicesite_prob_match,
108 				int max_nconsecutive, bool plusp, int sensedir);
109 
110 #endif
111 
112