1 /* $Id: genome.h 222905 2020-06-22 17:52:45Z twu $ */
2 #ifndef GENOME_INCLUDED
3 #define GENOME_INCLUDED
4 
5 #include "bool.h"
6 #include "access.h"
7 #include "types.h"
8 #include "genomicpos.h"
9 #include "iit-read-univ.h"
10 #include "chrnum.h"
11 #include "mode.h"
12 #include "univcoord.h"
13 
14 #ifndef GSNAP
15 #include "sequence.h"
16 #endif
17 
18 #define OUTOFBOUNDS '*'
19 
20 typedef enum {GENOME_OLIGOS, GENOME_BITS} Genometype_T;
21 
22 #define T Genome_T
23 typedef struct T *T;
24 
25 extern void
26 Genome_free (T *old);
27 extern Genomecomp_T *
28 Genome_blocks (T this);
29 extern Univcoord_T
30 Genome_totallength (T this);
31 #if 0
32 extern void
33 Genome_shmem_remove (char *genomesubdir, char *fileroot, char *snps_root, Genometype_T genometype,
34 		     bool genome_lc_p);
35 #endif
36 extern T
37 Genome_new (char *genomesubdir, char *fileroot, char *snps_root,
38 	    Genometype_T genometype, bool genome_lc_p, Access_mode_T access, bool sharedp);
39 
40 extern void
41 Genome_setup (T genome_in, T genomealt_in, Univcoord_T genomelength_in,
42 	      Mode_T mode_in, int circular_typeint_in);
43 extern void
44 Genome_user_setup (Genomecomp_T *genome_blocks_in, Univcoord_T genomelength_in);
45 
46 extern void
47 Genome_uncompress_mmap (char *gbuffer1, Genomecomp_T *blocks, Univcoord_T startpos,
48 			Univcoord_T endpos);
49 extern void
50 Genome_uncompress_memory (char *gbuffer1, Genomecomp_T *blocks, Univcoord_T startpos,
51 			  Univcoord_T endpos);
52 extern bool
53 Genome_fill_buffer (Chrnum_T *chrnum, int *nunknowns, T this, Univcoord_T left, Chrpos_T length, char *gbuffer1,
54 		    Univ_IIT_T chromosome_iit);
55 extern void
56 Genome_fill_buffer_simple (T this, Univcoord_T left, Chrpos_T length, char *gbuffer1);
57 extern void
58 Genome_fill_buffer_convert_fwd (Univcoord_T left, Chrpos_T length, char *gbuffer1);
59 extern void
60 Genome_fill_buffer_convert_rev (Univcoord_T left, Chrpos_T length, char *gbuffer1);
61 extern void
62 Genome_fill_buffer_blocks (Univcoord_T left, Chrpos_T length, char *gbuffer1);
63 extern void
64 Genome_fill_buffer_ref (Univcoord_T left, int pos5, int pos3, char *gbuffer1);
65 extern void
66 Genome_fill_buffer_blocks_noterm (Univcoord_T left, Chrpos_T length, char *gbuffer1, char *gbuffer2);
67 extern void
68 Genome_fill_buffer_simple_alt (T genome, T genomealt, Univcoord_T left, Chrpos_T length, char *gbuffer1);
69 extern void
70 Genome_fill_buffer_nucleotides (T this, Univcoord_T left, Chrpos_T length, unsigned char *gbuffer);
71 extern void
72 Genome_fill_buffer_int_string (T this, Univcoord_T left, Chrpos_T length, unsigned char *gbuffer,
73 			       unsigned char *conversion);
74 extern char
75 Genome_get_char (T this, Univcoord_T left);
76 extern char
77 Genome_get_char_blocks (char *charalt, Univcoord_T left);
78 extern void
79 Genome_get_segment_blocks_right (char *segment, char *segmentalt, Univcoord_T left, Chrpos_T length, Univcoord_T chrhigh,
80 				 bool revcomp);
81 extern void
82 Genome_get_segment_blocks_left (char *segment, char *segmentalt, Univcoord_T left, Chrpos_T length, Univcoord_T chroffset,
83 				bool revcomp);
84 #ifndef GSNAP
85 extern Sequence_T
86 Genome_get_segment (T this, Univcoord_T left, Chrpos_T length, Univ_IIT_T chromosome_iit,
87 		    bool revcomp);
88 extern Sequence_T
89 Genome_get_segment_alt (T this, Univcoord_T left, Chrpos_T length, Univ_IIT_T chromosome_iit,
90 			bool revcomp);
91 extern Sequence_T
92 Genome_get_segment_snp (T this, Univcoord_T left, Chrpos_T length, Univ_IIT_T chromosome_iit,
93 			bool revcomp);
94 #endif
95 
96 extern int
97 Genome_next_char (T this);
98 extern Univcoord_T
99 Genome_ntcounts (Univcoord_T *na, Univcoord_T *nc, Univcoord_T *ng, Univcoord_T *nt,
100 		 T this, Univcoord_T left, Univcoord_T length);
101 
102 #undef T
103 #endif
104