1 /* $Id: iit-read-univ.h 222581 2020-05-13 02:40:52Z twu $ */
2 #ifndef IIT_READ_UNIV_INCLUDED
3 #define IIT_READ_UNIV_INCLUDED
4 
5 typedef struct Univ_IIT_T *Univ_IIT_T;
6 
7 #ifdef USE_MPI
8 #include <mpi.h>
9 #endif
10 
11 #include <stdio.h>
12 #include "bool.h"
13 #include "uintlist.h"
14 #include "list.h"
15 #include "univinterval.h"
16 #include "types.h"
17 #include "genomicpos.h"
18 #include "iit-read.h"		/* For IIT_divint */
19 #include "chrnum.h"		/* For Chrnum_T and Trnum_T */
20 
21 #define T Univ_IIT_T
22 
23 extern bool
24 Univ_IIT_coord_values_8p (T this);
25 extern int
26 Univ_IIT_total_nintervals (T this);
27 extern int
28 Univ_IIT_ntypes (T this);
29 extern Univcoord_T
30 Univ_IIT_length (T this, int index);
31 extern Univcoord_T
32 Univ_IIT_genomelength (T chromosome_iit, bool with_circular_alias_p);
33 extern bool *
34 Univ_IIT_circularp (bool *any_circular_p, T chromosome_iit);
35 extern bool *
36 Univ_IIT_altlocp (Univcoord_T **alias_starts, Univcoord_T **alias_ends, T chromosome_iit, T altscaffold_iit);
37 extern Univinterval_T
38 Univ_IIT_interval (T this, int index);
39 extern Univcoord_T
40 Univ_IIT_interval_low (T this, int index);
41 extern Univcoord_T
42 Univ_IIT_interval_high (T this, int index);
43 extern Univcoord_T
44 Univ_IIT_interval_length (T this, int index);
45 extern int
46 Univ_IIT_interval_type (T this, int index);
47 extern Univcoord_T
48 Univ_IIT_next_chrbound (T this, int index, int circular_typeint);
49 extern void
50 Univ_IIT_interval_bounds (Univcoord_T *low, Univcoord_T *high, Chrpos_T *length, T this,
51 			  int index, int circular_typeint);
52 extern void
53 Univ_IIT_intervals_setup (Univcoord_T **chroffsets, Univcoord_T **chrhighs, Chrpos_T **chrlengths,
54 			  T this, int nchromosomes, int circular_typeint);
55 extern int *
56 Univ_IIT_divint_crosstable (T chromosome_iit, IIT_T iit);
57 extern int *
58 Univ_IIT_chrnum_crosstable (T chromosome_iit, IIT_T iit);
59 
60 extern char *
61 Univ_IIT_typestring (T this, int type);
62 extern int
63 Univ_IIT_typeint (T this, char *typestring);
64 extern char *
65 Univ_IIT_label (T this, int index, bool *allocp);
66 extern char *
67 Univ_IIT_annotation (char **restofheader, T this, int index, bool *alloc_header_p);
68 extern void
69 Univ_IIT_dump_typestrings (FILE *fp, T this);
70 extern void
71 Univ_IIT_dump_labels (FILE *fp, T this);
72 extern void
73 Univ_IIT_dump (T this);
74 extern void
75 Univ_IIT_dump_table (T this, bool zerobasedp);
76 extern void
77 Univ_IIT_dump_fai (T this);
78 
79 extern void
80 Univ_IIT_dump_sam (
81 #ifdef USE_MPI
82 		   MPI_File fp,
83 #else
84 		   FILE *fp,
85 #endif
86 		   T this, char *sam_read_group_id, char *sam_read_group_name,
87 		   char *sam_read_group_library, char *sam_read_group_platform);
88 
89 #ifdef USE_MPI
90 extern int
91 Univ_IIT_reserve_sam (T this, char *sam_read_group_id, char *sam_read_group_name,
92 		      char *sam_read_group_library, char *sam_read_group_platform);
93 #endif
94 
95 extern Chrpos_T *
96 Univ_IIT_chrlengths (T this);
97 extern void
98 Univ_IIT_dump_labels (FILE *fp, T this);
99 extern char
100 Univ_IIT_annotation_firstchar (T this, int index);
101 extern void
102 Univ_IIT_dump_contigs (T this, T chromosome_iit, bool directionalp);
103 extern void
104 Univ_IIT_free (T *old);
105 extern T
106 Univ_IIT_read (char *filename, bool readonlyp, bool add_iit_p);
107 extern void
108 Univ_IIT_debug (char *filename);
109 extern int *
110 Univ_IIT_find (int *nmatches, T this, char *label);
111 extern int
112 Univ_IIT_find_linear (T this, char *label);
113 extern int
114 Univ_IIT_find_one (T this, char *label);
115 extern int *
116 Univ_IIT_get (int *nmatches, T this, Univcoord_T x, Univcoord_T y);
117 extern int
118 Univ_IIT_get_one (T this, Univcoord_T x, Univcoord_T y);
119 extern Univcoord_T
120 Univ_IIT_update_chrnum (Chrnum_T *chrnum, Univcoord_T *chroffset, Univcoord_T chrhigh, Chrpos_T *chrlength,
121 			T this, Univcoord_T low, Univcoord_T high, int circular_typeint);
122 extern Chrnum_T
123 Univ_IIT_get_chrnum (Univcoord_T *chroffset, Univcoord_T *chrhigh, Chrpos_T *chrlength,
124 		     T this, Univcoord_T low, Univcoord_T high, int circular_typeint);
125 extern Trnum_T
126 Univ_IIT_get_trnum (Trcoord_T *troffset, Trcoord_T *trhigh, Trcoord_T *trlength,
127 		    T this, Trcoord_T low, Trcoord_T high);
128 extern char *
129 Univ_IIT_string_from_position (Chrpos_T *chrpos, Univcoord_T position, T chromosome_iit);
130 
131 #undef T
132 #endif
133 
134